Skip to content

CLI: wallet faucet commands to request test funds, stacked on the swap client - #37

Draft
kylecrawshaw wants to merge 1 commit into
claude/swap-client-sdk-k45xfkfrom
claude/cli-wallet-faucet
Draft

kylecrawshaw wants to merge 1 commit into
claude/swap-client-sdk-k45xfkfrom
claude/cli-wallet-faucet

Conversation

@kylecrawshaw

@kylecrawshaw kylecrawshaw commented Sep 24, 2026 •

Copy link
Copy Markdown
Member

Summary

Adds faucet commands to the wallet subcommand, built on radius-sdk/faucet from #26. Stacked on #27 (swap client) so it sits on top of the current stack; it only touches packages/cli.

  • radius-cli wallet faucet [address] (alias fund; drip is the default subcommand) drips from the configured network's faucet into the local wallet, or into any address. Prints the faucet URL, amount, explorer link, the RUSD gas drip where the faucet does one, and the next allowed drip time.
  • radius-cli wallet faucet status [address] shows rate-limit state, requests left (or "no rate limit"), and drip amounts.
  • Signing only when asked. The drip is unsigned first; if the faucet answers signature_required, the CLI signs its EIP-191 challenge with the deferred local account (same mechanism as wallet x402) and drips again, so the keystore is unlocked only when actually needed. --signature always|never overrides. Dripping into another address therefore only works while the faucet accepts unsigned requests; it exits 2 with a hint to use --private-key otherwise.
  • Options and config. --token <symbol>, --faucet-url <url>; the URL also comes from RADIUS_FAUCET_URL or faucetUrl in ~/.radius/config.json (new ResolvedConfig.faucetUrl). --json prints {faucetUrl, address, token, amount, txHash, explorerUrl, native, nextDripAt} for a drip and {faucetUrl, address, token, rateLimited, retryAfterMs, remainingRequests, dripAmount, nativeDripAmount, unlimited} for status.
  • Errors. FaucetErrors go to stderr as faucet: <code> (HTTP n): message (retry in n s) [request_id]. Exit code 2 when the faucet declined for now (rate_limited, faucet_empty, a signature the CLI cannot provide), 1 for everything else. Reverted or timed-out drips also print the tx_hash the faucet reports.
  • README: new "Faucet (test funds)" section, JSON shape table rows, RADIUS_FAUCET_URL / faucetUrl in Configuration. Changeset: radius-cli minor.

Testing

  • pnpm --filter radius-cli test: 34 tests pass, 9 new in tests/wallet-faucet.test.ts against a fake faucet (unsigned drip and output shape, signed fallback that verifies the produced signature over the challenge, signer_required for a foreign address, rate limit with retry hint and exit codes, status shapes for ready / rate-limited / unlimited, URL and token resolution, --signature validation). The vitest alias now also maps radius-sdk/faucet to source.
  • pnpm typecheck and pnpm build for the CLI pass.
  • Built binary smoke-tested against local stub faucets with a throwaway RADIUS_HOME: default subcommand routing (wallet faucet → drip), status, --json, alias fund, RADIUS_FAUCET_URL, a signature-requiring faucet (keystore signs, stub verifies the signature), the same faucet with a foreign address (exit 2 with hint), a 429 (exit 2 with "retry in 42 s"), and a bad --signature value.

Not run: a drip against the real testnet faucet.

🤖 Generated with Claude Code

…ucet

`radius-cli wallet faucet [address]` (alias `fund`, default subcommand `drip`)
drips from the configured network's faucet through `radius-sdk/faucet`, and
`wallet faucet status [address]` shows its rate-limit state and drip amounts.
Both default to the local wallet and support `--json`.

Drips are unsigned first; only when the faucet answers `signature_required`
does the CLI sign its EIP-191 challenge with the deferred local account and
drip again, so the keystore is unlocked only when needed. `--signature
always|never` overrides that, `--token` picks another symbol, and
`--faucet-url` / `RADIUS_FAUCET_URL` / `faucetUrl` in config.json relocate the
faucet. Faucet errors go to stderr as `faucet: …` with the API's request id;
exit code 2 when the faucet declined for now (rate limited, empty, a signature
the CLI cannot provide for another address), 1 otherwise.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@kylecrawshaw
kylecrawshaw added this pull request to stack #28 September 24, 2026 02:53
@kylecrawshaw kylecrawshaw changed the title Add wallet faucet commands to request test funds from the Radius faucet CLI: wallet faucet commands to request test funds, stacked on the swap client Sep 24, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🦋 Changeset detected

Latest commit: 80618ed

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

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