Skip to content

CLI: ERC-20 wallet commands — approve, allowance, token, transfers, watch (stacked on #35) - #36

Open
kylecrawshaw wants to merge 1 commit into
mainfrom
claude/cli-transfer-events
Open

kylecrawshaw wants to merge 1 commit into
mainfrom
claude/cli-transfer-events

Conversation

@kylecrawshaw

@kylecrawshaw kylecrawshaw commented Sep 23, 2026 •

Copy link
Copy Markdown
Member

Stacked on #35 (CLI on the SDK's ERC-20 actions), itself on #24 and #23. Review only the last commit.

What

Five new wallet commands, thin wrappers over the erc20Actions that #35 wires onto the CLI's clients. Each takes SBC (the default) or any token address as its last argument; symbol and decimals are read on-chain for a bare address.

  • wallet approve <spender> <amount> [token]: ERC-20 approve, max for an unlimited approval, --gas-limit and --no-wait as for wallet send. Output {hash, receipt?}.
  • wallet allowance <spender> [token] [--owner]: owner defaults to the local account.
  • wallet token [token]: name, symbol, decimals, total supply.
  • wallet transfers [token]: decoded Transfer events over a block range through getTransfers. Last 10 000 blocks by default, or --blocks <n>, --from-block <n>, --to-block <n>. One line per transfer; --json wraps the rows with the token and block range.
  • wallet watch [token]: the same streamed through watchTransfers until Ctrl-C, --poll <ms> for the polling interval. With --json, one JSON object per line; the status line goes to stderr so stdout pipes cleanly.

transfers and watch default to transfers sent or received by the local account: two log filters, merged, deduped and ordered by block then log index, since a self-transfer matches both sides. --from / --to pick one side, --address another account, --all every transfer of the token. lib/erc20.ts gains describeToken, transferFilters, sortTransfers, toTransferRow and listTransfers so that logic is testable apart from commander.

Tests

Five tests added in tests/erc20.test.ts: max amounts, describeToken, side-filter expansion, dedupe/ordering, row formatting, and listTransfers against fake eth_getLogs responses that check both filters carry the block range. CLI total 36 passing, pnpm build clean. Not run against a live node.

ENG-2276

🤖 Generated with Claude Code

@kylecrawshaw
kylecrawshaw force-pushed the claude/cli-transfer-events branch from a04c3c8 to e84c493 Compare September 23, 2026 19:27
@kylecrawshaw kylecrawshaw changed the title CLI: wallet transfers and wallet watch on the SDK's Transfer-event actions (stacked on #35) CLI: ERC-20 wallet commands — approve, allowance, token, transfers, watch (stacked on #35) Sep 23, 2026
@kylecrawshaw
kylecrawshaw force-pushed the claude/cli-transfer-events branch from e84c493 to 63eb5c8 Compare September 23, 2026 19:31
@kylecrawshaw
kylecrawshaw added this pull request to stack #32 September 23, 2026 19:32
@kylecrawshaw
kylecrawshaw force-pushed the claude/cli-transfer-events branch from 63eb5c8 to 9b379e6 Compare September 25, 2026 01:54
@github-actions

github-actions Bot commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

🦋 Changeset detected

Latest commit: 597f349

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
radius-cli Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@kylecrawshaw
kylecrawshaw force-pushed the claude/cli-transfer-events branch 2 times, most recently from f7e53ae to cb1b4cd Compare September 30, 2026 20:23
Base automatically changed from claude/cli-erc20-actions to main September 30, 2026 23:08
Thin commands over the SDK's `erc20Actions`, each taking `SBC` (default) or
any token address, with symbol and decimals read on-chain for a bare address:

- `wallet approve <spender> <amount> [token]`, `max` for an unlimited approval,
  `--gas-limit` and `--no-wait` as for `wallet send`
- `wallet allowance <spender> [token] [--owner]`
- `wallet token [token]`: name, symbol, decimals, total supply
- `wallet transfers [token]`: decoded `Transfer` logs over a block range (last
  10 000 blocks by default) through `getTransfers`
- `wallet watch [token]`: the same streamed through `watchTransfers` until
  Ctrl-C, one JSON object per line with --json

`transfers` and `watch` default to transfers sent or received by the local
account: two filters, merged and deduped since a self-transfer matches both
sides. --from / --to pick one side, --address another account, --all every
transfer of the token.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@kylecrawshaw
kylecrawshaw force-pushed the claude/cli-transfer-events branch from cb1b4cd to 597f349 Compare September 30, 2026 23:08
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