CLI: wallet faucet commands to request test funds, stacked on the swap client - #37
Draft
kylecrawshaw wants to merge 1 commit into
Draft
kylecrawshaw wants to merge 1 commit into
kylecrawshaw wants to merge 1 commit into
Conversation
…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
added this pull request to stack #28
September 24, 2026 02:53
wallet faucet commands to request test funds from the Radius faucetwallet faucet commands to request test funds, stacked on the swap client
Contributor
🦋 Changeset detectedLatest commit: 80618ed The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
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.
Summary
Adds faucet commands to the
walletsubcommand, built onradius-sdk/faucetfrom #26. Stacked on #27 (swap client) so it sits on top of the current stack; it only touchespackages/cli.radius-cli wallet faucet [address](aliasfund;dripis 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.signature_required, the CLI signs its EIP-191 challenge with the deferred local account (same mechanism aswallet x402) and drips again, so the keystore is unlocked only when actually needed.--signature always|neveroverrides. Dripping into another address therefore only works while the faucet accepts unsigned requests; it exits 2 with a hint to use--private-keyotherwise.--token <symbol>,--faucet-url <url>; the URL also comes fromRADIUS_FAUCET_URLorfaucetUrlin~/.radius/config.json(newResolvedConfig.faucetUrl).--jsonprints{faucetUrl, address, token, amount, txHash, explorerUrl, native, nextDripAt}for a drip and{faucetUrl, address, token, rateLimited, retryAfterMs, remainingRequests, dripAmount, nativeDripAmount, unlimited}for status.FaucetErrors go to stderr asfaucet: <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 thetx_hashthe faucet reports.RADIUS_FAUCET_URL/faucetUrlin Configuration. Changeset:radius-climinor.Testing
pnpm --filter radius-cli test: 34 tests pass, 9 new intests/wallet-faucet.test.tsagainst a fake faucet (unsigned drip and output shape, signed fallback that verifies the produced signature over the challenge,signer_requiredfor a foreign address, rate limit with retry hint and exit codes, status shapes for ready / rate-limited / unlimited, URL and token resolution,--signaturevalidation). The vitest alias now also mapsradius-sdk/faucetto source.pnpm typecheckandpnpm buildfor the CLI pass.RADIUS_HOME: default subcommand routing (wallet faucet→ drip),status,--json, aliasfund,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--signaturevalue.Not run: a drip against the real testnet faucet.
🤖 Generated with Claude Code