Repository navigation
Add token transfers, contract explainer, transaction decoder and wallet charts - #6
Merged
Merged
Conversation
- prepareTokenTransfer: validates the token, recipient (address or ENS) and amount with the token's decimals, checks the token balance and ETH for gas, and builds transfer(to, amount) calldata. Refuses transfers to the zero address or the token's own contract. - The signing guard now handles token previews: it decodes the calldata itself and only allows transfer(recipient, amount) matching the card, sent to the token contract with zero ETH. - explainContract: verified ABI from the explorer (following EIP-1967 proxies) plus onchain probes for owner, paused, ERC-20/721/1155. Lists functions and flags privileged ones (mint, pause, upgrade, ownership, fees, blocklists). Raw source is never passed to the model and ABI names are filtered to identifiers. - decodeTransaction: decodes the call with the target's verified ABI or standard ABIs, and summarizes events (ERC-20/721 transfers, mints, burns, approvals, ApprovalForAll, WETH wraps), flagging unlimited approvals and reverts. - New result cards, tool labels, agent instructions, landing examples and README docs. Tests for all three features.
- analyzeWalletActivity now returns flowSeries (per-day received − sent − gas, plus a running total) and gasBreakdown (gas per activity, top five plus Other, with shares). - New Charts tab on the wallet activity card: a running net-flow line with a zero line, crosshair and keyboard-navigable readout, a data table, and a note that it is not a balance; and a labeled bar chart of where the gas went. - New --chart-1 color token with its own dark step, validated for lightness, chroma and contrast against both themes.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Adds four features, in two commits:
prepareTokenTransfer): "Send 5 USDC to alice.eth". Validates the token, recipient (address or ENS) and amount against the token's decimals, checks the token balance and ETH for gas, and returns the usual preview card withtransfer(to, amount)calldata. Refuses transfers to the zero address or to the token's own contract.explainContract): verified ABI from the explorer (following EIP-1967 proxies) plus onchain probes for owner, paused and ERC-20/721/1155. Lists functions and flags privileged ones (mint, pause, upgrade, ownership, roles, fees, blocklists, withdrawals).decodeTransaction): decodes the call with the target's verified ABI or standard ABIs, and summarizes events in plain English (token transfers, mints, burns, approvals, ApprovalForAll, NFT moves, WETH wraps), flagging unlimited approvals and reverts.Type of change
How was it tested?
pnpm lint,pnpm typecheck,pnpm test(127 tests, 28 new) andpnpm buildpass locallypnpm dev) on Ethereum Sepolia — not done against the live network: the Sepolia RPC and explorers aren't reachable from the environment this was built in. The charts were rendered with sample data and checked in light mode, dark mode and at 390px wide.src/lib/(token-transfer.test.ts,contracts.test.ts,decode.test.ts,activity.test.ts)Screenshots
The Charts tab was checked visually in both themes with sample data; no live screenshots, since live Sepolia data wasn't reachable.
Safety checklist (if this touches transactions or tools)
This touches
tools.ts,signing-guard.tsandtx-records.ts:Notes:
transfer(recipient, amount)matching the card, sent to the token contract with zero ETH. Tests cover a swapped recipient, a changed amount, anapprovein disguise and garbage calldata.explainContractnever passes raw source code to the model, and contract, function and event names are filtered to plain identifiers, so text planted in a contract can't easily steer the agent. The agent instructions also say to treat these names as data.tx-recordsare unchanged.