Skip to content

fix: 30730 prevent spurious Sei Ledger swap "Something went wrong" error#31078

Draft
dawnseeker8 wants to merge 1 commit into
mainfrom
fix/30730-sei-network-swap-issue
Draft

fix: 30730 prevent spurious Sei Ledger swap "Something went wrong" error#31078
dawnseeker8 wants to merge 1 commit into
mainfrom
fix/30730-sei-network-swap-issue

Conversation

@dawnseeker8

Copy link
Copy Markdown
Contributor

Description

On Sei, a Ledger swap that requires 2 signatures (token approval + trade) completes successfully on-chain, yet a misleading "Something went wrong" hardware-wallet sheet is still shown to the user.

Root cause: Sei (chainId 1329) is a Cosmos-SDK chain with EVM compatibility. In @metamask/bridge-status-controller's sequential EVM submit flow (submitEvmHandler), the controller waits for the approval tx to reach confirmed status locally and then immediately broadcasts the trade tx. On Sei, the Cosmos account_sequence has not yet propagated through the RPC at that point, so the trade tx is initially rejected with RPC submit: : incorrect account sequence. That rejection is parsed to ErrorCode.Unknown and surfaced via the hardware-wallet error bottom sheet ("Something went wrong"), even though the swap ultimately lands and succeeds.

Fix: Patch @metamask/bridge-status-controller@72.0.0 to pause for 3s only on Sei, after the approval tx confirms and before the trade tx is broadcast — mirroring the existing LINEA/BASE pattern in handleApprovalDelay. This gives the chain time to update its account state, so the trade is accepted on the first broadcast and no spurious error is shown. The delay sits inside the requireApproval && approvalTxId branch, so it only runs on hardware-wallet flows and is invisible to other users.

Implemented as a yarn-berry patch (consistent with the repo's existing dependency-patch convention):

  • .yarn/patches/@metamask-bridge-status-controller-npm-72.0.0-eb8f9d1327.patch — patches both dist/strategy/evm-strategy.cjs and dist/strategy/evm-strategy.mjs
  • package.json — adds the patch resolution (dependency kept at ^72.0.0)
  • yarn.lock — updated accordingly (yarn install --immutable passes)

Changelog

CHANGELOG entry: Fixed a misleading "Something went wrong" error shown to Ledger users after a successful 2-approval swap on the Sei network.

Related issues

Fixes: #30730

Manual testing steps

Feature: Ledger swap on Sei network

  Scenario: User completes a 2-approval swap on Sei with a Ledger
    Given a Ledger account is connected with blind signing enabled
    And the user is on the Sei network

    When the user swaps USDC/Sei to Sei (requiring an approval + trade signature)
    Then both transactions are signed and submitted successfully
    And the swap completes successfully
    And no "Something went wrong" error sheet is shown

Screenshots/Recordings

Before

After

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
  • I've instrumented key operations with Sentry traces for production performance metrics

Note

This change adds an intentional 3s delay on Sei hardware-wallet swaps (only after approval confirmation). It is a timing heuristic and still needs on-device verification with a Ledger on Sei to confirm the spurious error is gone across varying RPC latencies.

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.

Made with Cursor

…elay

Patch @metamask/bridge-status-controller@72.0.0 to pause 3s after the
approval tx confirms on Sei (chainId 1329) before broadcasting the trade
tx. Sei's Cosmos account_sequence lags local confirmation, so the
immediate trade broadcast was rejected with "incorrect account sequence",
surfacing a misleading "Something went wrong" hardware-wallet sheet even
though the swap ultimately succeeded.

Co-authored-by: Cursor <cursoragent@cursor.com>
@github-actions

github-actions Bot commented Jun 4, 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.

@github-actions github-actions Bot added the pr-not-ready-for-e2e Skip E2E and block merging. Remove this label once the PR is ready to run the E2E tests. label Jun 4, 2026
@mm-token-exchange-service mm-token-exchange-service Bot added the team-be-trade BE Trade team label Jun 4, 2026
@github-actions github-actions Bot added the size-S label Jun 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-not-ready-for-e2e Skip E2E and block merging. Remove this label once the PR is ready to run the E2E tests. size-S team-be-trade BE Trade team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: [Ledger] "Something went wrong" is shown even though the 2 approval swap is successful on Sei network

1 participant