Skip to content

fix: show and wire up "swap again" for Solana / non-EVM swaps cp-8.2.0#32741

Merged
vinnyhoward merged 2 commits into
mainfrom
fix-tmcu-993-swaps-again-button-missing-in-non-evm
Jul 3, 2026
Merged

fix: show and wire up "swap again" for Solana / non-EVM swaps cp-8.2.0#32741
vinnyhoward merged 2 commits into
mainfrom
fix-tmcu-993-swaps-again-button-missing-in-non-evm

Conversation

@vinnyhoward

@vinnyhoward vinnyhoward commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Description

On a Solana (and other non-EVM) swap's activity detail screen, the "Swap again" button was missing. EVM swaps showed it; non-EVM swaps did not.

Root cause: the button is gated on toBridgeToken(...) returning a token, and that helper bailed on decimals === undefined. Non-EVM activity rows never carry decimals (the keyring adapter's getToken only sets amount/symbol/assetId), so the helper returned undefined → the gate hid the button. It would also have no-opped even if shown, because the non-EVM skeleton was keyed by the bare reference or the EVM 0x0 sentinel, but the user's held non-EVM tokens are keyed by their full CAIP-19 asset id as address (selectMultichainTokenListForAccountsAnyChain stores address: assetId), so hydration could never match.

Fix (localized to toBridgeToken):

  • Only require decimals for EVM rows. For non-EVM, keep a 0 placeholder and let useActivityDetailsDoItAgain hydrate the real value from the user's held tokens (right after a swap the user holds both legs).
  • Key the non-EVM skeleton by its full asset id as address, so isSameBridgeToken matches the held token and fills in the real decimals, correct Solana address, icon, and balance.
  • EVM behavior is unchanged (still requires decimals, still uses the contract address / normalized native sentinel).

This mirrors the extension's "gate on the asset id, resolve the full token" approach, adapted to mobile's held-token hydration. No changes were needed in SwapDetails / BridgeDetails — they already consume the gate + hook.

Changelog

CHANGELOG entry: Fixed the "Swap again" button not appearing on Solana and other non-EVM swap activity details.

Related issues

Fixes: https://consensyssoftware.atlassian.net/browse/TMCU-993

Manual testing steps

Feature: "Swap again" on non-EVM (Solana) swap activity details

  Scenario: Button shows for a Solana swap
    Given the activity redesign flag is on
    And I have performed a swap on Solana (e.g. SOL -> USDC)
    When I open that swap from the Activity list
    Then I see the "Swap again" button

  Scenario: Button opens the swap prefilled with the same tokens
    Given I am on a Solana swap's activity detail with the "Swap again" button
    When I tap "Swap again"
    Then the Bridge opens in Swap mode
    And the source and destination tokens are prefilled with the correct
      Solana tokens (real icons, balances) and an empty amount

  Scenario: EVM swaps are unaffected
    Given the activity redesign flag is on
    And I have performed an EVM swap
    When I open that swap and tap "Swap again"
    Then it behaves exactly as before

Screenshots/Recordings

Simulator.Screen.Recording.-.iPhone.17.-.2026-07-02.at.16.21.41.mov

Before

Simulator.Screen.Recording.-.iPhone.17.-.2026-07-02.at.16.21.30.mov

After

Simulator.Screen.Recording.-.iPhone.17.-.2026-07-02.at.16.21.41.mov

Pre-merge author checklist

Performance checks (if applicable)

  • I've tested on Android
    • Ideally on a mid-range device; emulator is acceptable
  • I've tested with a power user scenario
    • Use these power-user SRPs to import wallets with many accounts and tokens
  • I've instrumented key operations with Sentry traces for production performance metrics

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.

Note

Low Risk
Scoped change to activity-to-bridge token mapping with EVM behavior preserved and solid unit/hook coverage; no auth or transaction signing changes.

Overview
Swap again on activity details was hidden for Solana and other non-EVM swaps because toBridgeToken required decimals, which those activity rows never include.

toBridgeToken now only enforces decimals on EVM chains; for non-EVM it builds a bridge token with decimals: 0 and uses the full CAIP-19 assetId as address so held-token hydration in useActivityDetailsDoItAgain can match wallet tokens and fill real decimals, icons, and balances. EVM mapping is unchanged (still needs decimals and normalized contract/native addresses).

Tests cover EVM rows missing decimals, Solana SPL/native skeleton tokens, hydration from held tokens on repeat swap, and the visibility gate for symbol-only Solana legs.

Reviewed by Cursor Bugbot for commit 779f1a3. Bugbot is set up for automated code reviews on this repo. Configure here.

Non-EVM activity rows (e.g. Solana) never carry token decimals, so
toBridgeToken bailed and the "swap again" button was hidden — and would
have no-opped even if shown, because the skeleton's chain id and address
never matched the user's held tokens.

Only require decimals for EVM rows now; for non-EVM keep a 0 placeholder
and let useActivityDetailsDoItAgain hydrate the real value from held
tokens. Key the non-EVM skeleton by its full CAIP-19 asset id (the same
key selectMultichainTokenListForAccountsAnyChain stores as the token
address) so hydration matches and fills in the real decimals, the correct
Solana address, icon, and balance. EVM behavior is unchanged.

Fixes: TMCU-993
@github-actions

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

@mm-token-exchange-service mm-token-exchange-service Bot added the team-mobile-ux Mobile UX team label Jul 2, 2026
@mm-token-exchange-service

mm-token-exchange-service Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

PR template — items to address before "Ready for review"

Warnings — informational, address before merging:

  • Pre-merge author checklist has unchecked items (e.g. "I've applied the right labels on the PR (see labeling guidelines). Not required for external contributors."). Every box must be consciously checked — see docs/readme/ready-for-review.md.

See docs/readme/ready-for-review.md for the full Definition of Ready for Review.

@github-actions github-actions Bot added the size-M label Jul 2, 2026
@vinnyhoward vinnyhoward marked this pull request as ready for review July 2, 2026 22:29
@github-actions github-actions Bot added the risk:low AI analysis: low risk label Jul 2, 2026
@vinnyhoward vinnyhoward enabled auto-merge July 3, 2026 16:19
@github-actions

github-actions Bot commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

🔍 Smart E2E Test Selection

  • Selected E2E tags: SmokeSwap, SmokeConfirmations, SmokeNetworkExpansion, SmokeWalletPlatform
  • Selected Performance tags: None (no tests recommended)
  • Risk Level: medium
  • AI Confidence: 82%
click to see 🤖 AI reasoning details

E2E Test Selection:
The PR modifies activityDetailsDoItAgainUtils.ts to support non-EVM (Solana) tokens in the "Do It Again" / "Swap Again" feature within ActivityDetails (transaction history). The key change is in toBridgeToken(): for non-EVM chains, it now skips the decimals === undefined guard (using 0 as a placeholder) and uses the full assetId as the token address instead of extracting a contract address. The other two changed files are unit tests adding coverage for this new behavior.

SmokeSwap: The "Do It Again" button navigates to Routes.BRIDGE.ROOT (the Bridge/Swap flow). This change directly affects how source/destination tokens are constructed and passed to that flow for Solana tokens. Any regression could break the swap-again flow.

SmokeConfirmations: Required per SmokeSwap tag description — swap flows involve transaction confirmations.

SmokeNetworkExpansion: The change specifically adds Solana (non-EVM) token support. The fix enables Solana SPL tokens and native SOL to be correctly mapped to BridgeToken objects for the swap-again flow. This is directly in scope for SmokeNetworkExpansion which covers Solana Wallet Standard compliance and non-EVM blockchain support.

SmokeWalletPlatform: ActivityDetails is part of the transaction history view, which is covered by SmokeWalletPlatform (transaction history: displaying incoming/outgoing transactions, token transfer details). The "Do It Again" button lives in this view.

The change is well-scoped with good unit test coverage. Risk is medium because it touches the swap/bridge navigation path for Solana tokens, which is a user-facing flow.

Performance Test Selection:
The changes are limited to utility functions for constructing BridgeToken objects from activity rows and their unit tests. There is no impact on app launch, asset loading, swap execution timing, or any other performance-sensitive flow. No performance tests are warranted.

View GitHub Actions results

@sonarqubecloud

sonarqubecloud Bot commented Jul 3, 2026

Copy link
Copy Markdown

@vinnyhoward vinnyhoward added this pull request to the merge queue Jul 3, 2026
Merged via the queue into main with commit bbcab80 Jul 3, 2026
124 of 126 checks passed
@vinnyhoward vinnyhoward deleted the fix-tmcu-993-swaps-again-button-missing-in-non-evm branch July 3, 2026 17:16
@github-actions github-actions Bot locked and limited conversation to collaborators Jul 3, 2026
@mm-token-exchange-service mm-token-exchange-service Bot added the release-8.3.0 Issue or pull request that will be included in release 8.3.0 label Jul 3, 2026
@vinnyhoward vinnyhoward changed the title fix: show and wire up "swap again" for Solana / non-EVM swaps fix: show and wire up "swap again" for Solana / non-EVM swaps cp-8.2.0 Jul 6, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

release-8.3.0 Issue or pull request that will be included in release 8.3.0 risk:low AI analysis: low risk size-M team-mobile-ux Mobile UX team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants