fix(sdk-coin-polyx): route v8 token transfers with dropped sender.did to v8 builder#9309
Merged
nvrakesh06 merged 1 commit intoJul 21, 2026
Merged
Conversation
Retry v8 decoding when v7 metadata silently drops sender.did, then route the transaction to V8TokenTransferBuilder. Add regression and signed and unsigned round-trip coverage. TICKET: CECHO-1471 Co-authored-by: Cursor <cursoragent@cursor.com>
nvrakesh06
force-pushed
the
nvrakeshreddy/polyx-v8-token-withdrawal-routing
branch
from
July 21, 2026 11:49
6875967 to
57fd25f
Compare
nayandas190
approved these changes
Jul 21, 2026
nvrakesh06
marked this pull request as ready for review
July 21, 2026 12:17
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.
Description
Fixes token withdrawals (Polymesh
settlement.addAndAffirmWithMediators) failing on the v7/v8 chain migration with:TransactionBuilderFactory.getBuilder()decodes the raw tx against v7 metadata first and only retries against v8 material if that decode throws. v8 wraps legsender/receiverin anAssetHolderenum ({ portfolio: { did, kind } }) instead of the bare v7{ did, kind }, but the call index foraddAndAffirmWithMediatorsis unchanged between v7/v8 — so decoding a v8-encoded token transfer with v7 metadata does not throw, it just silently produces a decoded transaction missinglegs[0].fungible.sender.did. The factory then proceeds with the v7TokenTransferBuilder, whose schema requires that field directly, andvalidateDecodedTransactionrejects the transaction duringwallet-platform's build-time round-trip re-parse of the withdrawal.Native transfers (
transferWithMemo) are unaffected because that call's v7/v8 arg shape didn't change.Fix
On the v7 decode-success path for
AddAndAffirmWithMediators, detect a missinglegs[0].fungible.sender.didand retry via the existingtryGetV8Builder()(which already correctly routes toV8TokenTransferBuilder/V8HexTokenTransferBuilder) before falling through to the v7 builder.Issue Number
TICKET: CECHO-1471
Type of change
How Has This Been Tested?
npx tsc --noEmitinmodules/sdk-coin-polyx— cleannpx mocha test/unit/transactionBuilder/*TokenTransfer*— 31 passingnpx mocha test/unit/transactionBuilder/transactionBuilderFactory.ts— 248 passing, 2 pendingsender.didfailure for aTPOLYX:NVBITGOTwithdrawal on testnet Polymesh v8.Checklist
transactionBuilderFactory.ts's suite covering "v7 decode succeeds but sender.did missing → routes to v8 builder"🤖 Generated with Claude Code