fix: display swaps and contract calls correctly in tx history (closes #3) #10
Reference in New Issue
Block a user
Delete Branch "fix/swap-display"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Fixes #3: Swap transactions were displaying as "Sent" or "Received" in transaction history instead of showing the actual method name (e.g. "Execute" for Uniswap swaps).
Changes
src/shared/transactions.jsfetchRecentTransactions, preserve contract call metadata (direction,directionLabel,method,isContractCall) from the original parsed txsrc/popup/views/home.jsandsrc/popup/views/addressDetail.jsdirection === "contract"when determining counterparty address for display (show the contract address, not the from address)src/popup/views/transactionDetail.jsdecodeCalldatafrom approval.jssrc/popup/views/approval.jsdecodeCalldatafor reuse in transaction detail viewsrc/popup/index.htmlmake checkoutputReviewed. Changes are clean and well-scoped:
transactions.jscorrectly preserves contract call metadata when token transfers mergedirection === "contract"for counterparty displaydecodeCalldata, falls back to "Unknown contract call" + raw hexOne minor note:
displayDatavariable on line 185 is computed but not used (the fullinputDatais passed tocopyableHtmlinstead). Not a blocker.Assigned to sneak for merge.
Quoting #3:
Addressed the feedback:
execute,swap,multicall,swapExactTokensForTokens, etc.) now display as "Swap" in tx lists instead of the raw method namedisplayDatavariableThe detail page already shows full decoded swap details via
decodeCalldata→uniswap.decode(). Re-assigned to sneak.d883ddadf2to3fd3e30f44Rebased on main (after PR #11 merge), fixed prettier formatting.
make checkpasses. Re-assigned to sneak.The transaction detail page displays the addresses inconsistently. On one it has the color dot next to the address title, and on the other (and everywhere else) it has it next to the address itself. Please be more careful now and in the future when laying things out that you follow existing conventions. Consistency is key.
Pushed
aaeb38d: the transaction detail page now shows "Swap" (or the relevant method label) as both the page heading and a Type field for contract interactions. Previously the detail view just said "Transaction" with no type indicator.Changes:
tx-detail-headingid,tx-detail-type-sectionwith Type label (hidden for regular sends/receives)render()sets heading text and type field based ondirection === "contract"+directionLabelmake checkpasses (14 tests + prettier).Pushed
8824237— reworked the transaction detail calldata display to match the approval view exactly:border border-border border-dashed p-2with "Action" label → bold name → structured detailsThis matches the
approve-tx-decodedwell in the approval view for display consistency per #3.make checkpasses (14 tests + prettier).Found it — in
txAddressHtml(), the color dot is placed next to the title when a title exists:But the convention everywhere else (home, addressDetail, addressToken) is dot next to the address/ENS name, never next to a label.
Fix: remove dot from the title line, ensure it always appears next to the address or ENS name, matching the existing pattern. Pushing fix now.
Fixed — color dot now always appears next to the address/ENS name, never next to the title. Matches the convention in home, addressDetail, and addressToken views.