fix(swap-widget): restore redirect-only chains in the asset selector - #12588
Conversation
The redirect shipped with its chains filtered out one layer upstream. TokenSelectModal gates on isWidgetSupportedChainId and only narrows to executable chains when the redirect is off, but its input comes from useAssets, which filters through BASE_ASSETS_BY_CHAIN_ID - and that map never gained the six chains REDIRECT_ONLY_CHAIN_IDS added. Zcash, Tron, Sui, TON, NEAR and Starknet were therefore unselectable, leaving the redirect reachable only for the cosmos chains. Add their base assets so the modal's redirect-aware filter sees them. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe swap widget now imports and registers Near, Starknet, Sui, Ton, Tron, and Zcash in its base-asset chain mapping. ChangesSwap Widget Chain Support
Estimated code review effort: 1 (Trivial) | ~5 minutes Mergeability Score: ⚪ Minimal · up to The PR restores asset-selector visibility for six redirect-only chains without changing swap execution or transaction behavior. No actionable merge-blocking risk remains beyond normal checks and review. Possibly related issues
Possibly related PRs
Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Description
The redirect-only chain support added in #12435 shipped with its chains filtered out one layer upstream, so it has never actually been reachable for the six chains it was built for.
TokenSelectModalgates onisWidgetSupportedChainIdand only narrows to executable chains when the redirect is off — that part is correct. But its input comes fromuseAssets, which filters throughBASE_ASSETS_BY_CHAIN_IDinconstants/chains.ts, and that map never gained the chainsREDIRECT_ONLY_CHAIN_IDSintroduced intypes/index.ts. Assets were dropped before the redirect-aware filter ever saw them.Zcash, Tron, Sui, TON, NEAR and Starknet were therefore unselectable, leaving the redirect reachable only for the cosmos chains. This adds their base assets so the modal's existing filter can do its job.
Issue (if applicable)
closes #
Risk
Low.
Purely additive — five new entries in a lookup map plus zcash, and no change to any existing entry, filter, or execution path. Everything downstream of the picker already handled these chains; they just never arrived. No on-chain transaction is introduced or modified: these chains are redirect-only by definition, and selecting one hands off to app.shapeshift.com rather than signing in the widget.
None. No swapper, signing, or broadcast code is touched.
Testing
Engineering
Run the widget and open the asset selector with the redirect enabled — Zcash, Tron, Sui, TON, NEAR and Starknet now appear and are selectable, and selecting one routes to the app redirect rather than the in-widget swap flow. With the redirect disabled they remain hidden, as before.
Verified locally by asserting the invariant directly: every chain in
EVM_CHAIN_IDS,UTXO_CHAIN_IDS,COSMOS_CHAIN_IDS,OTHER_CHAIN_IDSandREDIRECT_ONLY_CHAIN_IDSresolves through bothisSupportedChainIdandgetBaseAsset— 27/27 pass with this change. Reverting the six entries makes 5 of the 6 redirect chains fail on theisSupportedChainIdline specifically, confirming that map is the layer that was eating them.Operations
The redirect itself is already gated. With it on, confirm the six chains are offered in the asset picker and that picking one opens app.shapeshift.com with the swap pre-filled.
Screenshots (if applicable)
n/a
Summary by CodeRabbit