feat(swap): add --chain flag for explicit chain selection (Vibe Kanban)#7
Merged
MinaraAgent merged 2 commits intomainfrom Apr 3, 2026
Merged
feat(swap): add --chain flag for explicit chain selection (Vibe Kanban)#7MinaraAgent merged 2 commits intomainfrom
MinaraAgent merged 2 commits intomainfrom
Conversation
…--chain` option. I only need to add it to `swap.ts` and update the chain resolution logic there.
There was a problem hiding this comment.
Code Review
This pull request introduces a --chain flag to the swap command, allowing users to explicitly specify the blockchain. The logic was updated to prioritize this flag over the chain derived from token information. Feedback indicates that the implementation is currently incomplete as it misses the same flag for transfer and withdraw commands mentioned in the PR description. Additionally, the chain resolution logic should be improved to validate user input and prevent silent fallbacks when an invalid chain is provided.
…ibe Kanban) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.
Summary
-c, --chain <chain>option to theswapcommand, allowing users to explicitly specify the blockchain--chainflag before falling back to token-derived chain--chainflag and warns the user if an unsupported chain is provided (instead of silently falling back)transferandwithdrawcommands already had this flag, so this bringsswapto parityWhy
Previously, the swap command had no way to specify the chain explicitly. The chain was always derived from the resolved token, which could fail or be ambiguous when token lookup returned incomplete information. This made it impossible to disambiguate tokens that exist on multiple chains.
Implementation Details
-c, --chain <chain>option to the swap command optionsopts.chainfirst, normalizes it, and uses it if valid--chainvalue, we warn and exit instead of silently falling backtokenInfo.chainif no explicit flag providedchainvariable asChain | undefinedto matchnormalizeChainreturn typeExample Usage
This PR was written using Vibe Kanban