fix(apps/amm): disable the already-selected token in the swap token p… - #235
Open
0x-r4bbit wants to merge 1 commit into
Open
fix(apps/amm): disable the already-selected token in the swap token p…#2350x-r4bbit wants to merge 1 commit into
0x-r4bbit wants to merge 1 commit into
Conversation
…icker
The token selector let you pick the same token on both sides of a swap.
That drove resolvePool into amm_client_pool_pda with def_a == def_b, which
hits `panic!("Definitions match")` in amm_core (a pool needs two distinct
tokens). Because that panic crosses the `#[no_mangle]` FFI boundary — which
can't unwind — it aborts, taking the whole UI process down.
Guard it at the source: the picker now disables (dims, no hover/click, tags
"Selected") whichever token is already chosen on the opposite side, so the
two sides can never match.
- TokenListItem: add a `disabled` state (opacity, inert MouseArea, tag)
- TokenSelectorModal: add `disabledDefinitionId`; gate both the popular-token
pills and the list rows on it
- SwapPage: on open, set it to the opposite side's selected token
Collaborator
Author
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.

…icker
The token selector let you pick the same token on both sides of a swap. That drove resolvePool into amm_client_pool_pda with def_a == def_b, which hits
panic!("Definitions match")in amm_core (a pool needs two distinct tokens). Because that panic crosses the#[no_mangle]FFI boundary — which can't unwind — it aborts, taking the whole UI process down.Guard it at the source: the picker now disables (dims, no hover/click, tags "Selected") whichever token is already chosen on the opposite side, so the two sides can never match.
disabledstate (opacity, inert MouseArea, tag)disabledDefinitionId; gate both the popular-token pills and the list rows on it