Fix multi-step Uniswap swap decoding and transaction display:
1. uniswap.js: In multi-step swaps (e.g. V3 → V4), the output token and
min received amount now come from the LAST swap step instead of the
first. Previously, an intermediate token's amountOutMin (18 decimals)
was formatted with the final token's decimals (6), producing
astronomically wrong 'Min. received' values (~2 trillion USDC).
2. transactions.js: Contract call token transfers (swaps) are now
consolidated into the original transaction entry instead of creating
separate entries per token transfer. This prevents intermediate hop
tokens (e.g. USDS in a USDT→USDS→USDC route) from appearing as the
transaction's Amount. The received token (swap output) is preferred.
3. transactions.js: The original transaction's from/to addresses are
preserved for contract calls, so the user sees their own address
instead of a router or Permit2 contract address.
closes#127
- Add underline + click-to-copy (data-copy) to addresses in toAddressHtml()
so they match the style used everywhere else in the extension
- Fix 'USDT ETH' display: add rawValue to Uniswap decoder Amount details
and extract Token In info for proper symbol resolution in approval.js
- Hide redundant top-level Amount/To when decoded details are present
(they already show the same info inside the decoded section)
- Wrap decoded calldata details in a bordered well for visual separation
The Uniswap Universal Router calldata decoder listed V4_SWAP (0x10) in
command names but never decoded its inner actions to extract token
addresses. This caused all V4 swaps (e.g. USDT→USDC) to display as
'Swap ETH → ETH' because tokenIn/tokenOut defaulted to null, which
tokenInfo() resolved as native ETH.
Added decodeV4Swap() which parses the V4 inner action bytes:
- SETTLE (0x0b) → extracts input token currency address
- TAKE (0x0e) → extracts output token currency address
- SWAP_EXACT_IN/OUT and their SINGLE variants → extracts tokens from
pool keys and paths, plus amounts
These addresses are then resolved against the known token list
(TOKEN_BY_ADDRESS) to display correct symbols like USDT, USDC, etc.
Fixes#59
Replace stub error handlers with full approval flow for personal_sign,
eth_sign, eth_signTypedData_v4, and eth_signTypedData. Uses toolbar
popup only (no fallback window) and keeps sign approvals pending across
popup close/reopen cycles so the user can respond via the toolbar icon.