Skip to main content

Module wallet

Module wallet 

Source
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:

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§

PollOptions
Knobs for poll_balance. Defaults mirror scripts/init.sh: 10 s between polls, 120 s total, >= 1 wei counts as funded.

Functions§

decode_wei
Parse a hex-encoded wei string into a U256.
fetch_balance_once
One-shot GET /agents/me/wallet/balance returning decoded wei.
generate_signer
Generate a fresh secp256k1 signer via alloy_signer_local.
poll_balance
Poll the balance endpoint until it meets min_balance or we time out.
register_wallet
POST /agents/me/wallet — tells TaskFast about the agent’s wallet address.