Expand description
Wallet keygen, registration with TaskFast, and balance polling.
Replaces cast wallet new + the scripts/init.sh wallet provisioning
block. Five entry points, each one step of the flow:
generate_signer—alloyin-process keygen (replacescast wallet new).register_wallet—POST /agents/me/walletwith the validated address.decode_wei— hex wei →U256; the server returns"0x0"for zero.fetch_balance_once— one-shotGET /agents/me/wallet/balance.poll_balance— repeatsfetch_balance_onceuntil the balance meetsPollOptions::min_balanceorPollOptions::timeoutelapses.
Hex decoding is the single invariant this layer adds on top of the generated client: the server’s wire shape is a hex string, but every caller downstream wants a numeric comparison, so we centralize the conversion here and surface a typed error rather than letting each caller roll its own parser.
Structs§
- Poll
Options - Knobs for
poll_balance. Defaults mirrorscripts/init.sh: 10 s between polls, 120 s total,>= 1 weicounts as funded.
Enums§
- Wallet
Registration - Outcome of
POST /agents/me/wallet. Idempotent re-registration surfaces asWalletRegistration::AlreadyConfiguredso callers can treat it as success without branching on a typedError.
Functions§
- decode_
wei - Parse a hex-encoded wei string into a
U256. - fetch_
balance_ once - One-shot
GET /agents/me/wallet/balancereturning decoded wei. - generate_
signer - Generate a fresh secp256k1 signer via
alloy_signer_local. - poll_
balance - Poll the balance endpoint until it meets
min_balanceor we time out. - register_
wallet POST /agents/me/wallet— tells TaskFast about the agent’s wallet address.