feat(sdk-coin-canton): add runtime registration via registerWithCoinMap - #9503
Merged
Conversation
Adds registerWithCoinMap(sdk, coinMap) so a dynamically-onboarded Canton token from AMS can be registered into a running SDK instance without a statics release, mirroring the SOL registerWithCoinMap pattern. Wires CantonToken.createTokenConstructors into registerCoinConstructors so GlobalCoinFactory resolves canton/tcanton tokens from the coin map at process start. verifyTransaction hardening is left for a follow-up (release-blocking, needs confirmation of wallet-platform's txParams shape for accept/reject/withdraw/wallet-init flows before changing behavior). TICKET: CHALO-1300
Contributor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #9502 (CHALO-1299 — statics keystone).
Summary
sdk-coin-canton/src/register.ts: addedregisterWithCoinMap(sdk, coinMap), mirroringsdk-coin-sol's pattern — resolves Canton tokens (hardcoded + AMS-dynamic) from a coin map and registers them into both the SDK instance andGlobalCoinFactory.bitgo/src/v2/coinFactory.ts: wiredCantonToken.createTokenConstructors([...tokens.bitcoin.canton.tokens, ...tokens.testnet.canton.tokens])intoregisterCoinConstructors(the SOL analog). Note:getTokenConstructor'scanton/tcantoncase already existed — no change needed there.Explicitly out of scope (by design)
verifyTransactionhardening forTransferAccept/TransferReject/TransferAcknowledge/TransferOfferWithdrawn/WalletInitialization— these still returntrueunconditionally. Deferred per discussion: this is flagged release-blocking in the TDD (WCI-820 regression class) and needs confirmation of whattxParamswallet-platform actually sends for these flows before changing behavior. Tracked as follow-up.transferBuilder.tsand friends already treattokenName/contractAddressas opaque strings with nocoins.get()assertion, so dynamically-registered tokens already flow through.Test plan
test/unit/register.ts(mirrorssdk-coin-sol/test/unit/register.ts): register/registerWithCoinMap register base coins + tokens, dynamic tokens reachGlobalCoinFactory, no-op when coin map has no Canton tokenssdk-coin-cantonunit suite passes (329 passing)tsc --noEmitpasses forsdk-coin-canton;bitgotypecheck shows only pre-existing unrelated errors (Sepethexport,pendingApprovaltest) confirmed present without this diffeslintclean on changed filesTICKET: CHALO-1300