Skip to content

fix(apps/amm): disable the already-selected token in the swap token p… - #235

Open
0x-r4bbit wants to merge 1 commit into
feat/amm-swap-onchainfrom
fix/apps-amm-selected-token-disabled
Open

fix(apps/amm): disable the already-selected token in the swap token p…#235
0x-r4bbit wants to merge 1 commit into
feat/amm-swap-onchainfrom
fix/apps-amm-selected-token-disabled

Conversation

@0x-r4bbit

Copy link
Copy Markdown
Collaborator

…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

…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
@0x-r4bbit
0x-r4bbit requested review from 3esmit and gravityblast July 23, 2026 11:49
@0x-r4bbit

Copy link
Copy Markdown
Collaborator Author
Screenshot 2026-07-23 at 13 49 28

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant