Skip to content

fix(eth): TxidPage missing explorer link for swaps/sends#53

Open
BitHighlander wants to merge 1 commit intodevelopfrom
fix/explorer-tx-link
Open

fix(eth): TxidPage missing explorer link for swaps/sends#53
BitHighlander wants to merge 1 commit intodevelopfrom
fix/explorer-tx-link

Conversation

@BitHighlander
Copy link
Copy Markdown
Collaborator

Symptom

After a successful Uniswap swap (and ETH-side sends in general), the Transaction Complete card in the side panel rendered the txid as plain hex with no link — no inline anchor, no "View on Explorer" button. Reproduced today on a successful LINK swap at `0x6954a533…94b27968a9`.

Root cause

`sendTransaction` reads `currentProvider.explorerTxLink` when broadcasting `transaction_complete` to the side panel. Two `SET_ASSET_CONTEXT` code paths built that provider object without the field:

  1. EIP155_CHAINS fallback at `chrome-extension/src/background/index.ts:996` — copies `chainId`/`caip`/`name`/`providerUrl` but drops `explorerTxLink` (and `networkId`).

When a user picked Ethereum from the side-panel header (which goes through this fallback), the stored provider had no explorer URL → `transaction_complete` fired with `explorerTxLink: undefined` → `TxidPage` got no link to render → bare hex.

`switchToProvider` (the `wallet_switchEthereumChain` path) already handled it correctly by carrying through whatever the dApp passed.

Fix

  • Carry forward in the EIP155_CHAINS fallback so future sends have the link.
  • Safety net in `sendTransaction`: if `currentProvider.explorerTxLink` is still missing at broadcast time, look it up from `EIP155_CHAINS` by `networkId`. Catches any remaining stored state built by older code paths.

`TxidPage` itself was already correctly handling `explorerUrl` — it renders a clickable link + a "View on Explorer" button when present. The bug was upstream.

Test plan

  • Reload the extension, switch to Ethereum from the side-panel header.
  • Send a small amount of ETH (or do another Uniswap swap).
  • Confirm the Transaction Complete card shows a clickable txid + "View on Explorer" button that opens https://etherscan.io/tx/HASH.
  • Repeat for at least one L2 (Arbitrum / Base / Optimism) to confirm the per-chain explorer URL resolves correctly.

🤖 Generated with Claude Code

The transaction_complete message broadcast by sendTransaction reads
explorerTxLink from currentProvider, but two SET_ASSET_CONTEXT code
paths constructed the provider without that field:

  - The fallback path that builds providerData from EIP155_CHAINS when
    blockchainDataStorage has no entry (background/index.ts:996) was
    copying chainId / caip / name / providerUrl but dropping
    explorerTxLink (and networkId, which we also need for fallback
    resolution).

When the user completed a Uniswap swap from this state, TxidPage
received explorerUrl=undefined and rendered the txid as plain text
with no link — confirmed in production today after a successful
LINK swap landed at 0x6954a533…94b27968a9.

Two fixes:
1. Carry explorerTxLink (and networkId) into providerData in the
   EIP155_CHAINS fallback so future sends have the link available.
2. Safety-net in sendTransaction: if currentProvider.explorerTxLink
   is missing, look it up from EIP155_CHAINS by networkId before
   firing transaction_complete. Catches any remaining stored state
   built by older code paths.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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