DocsAgent Reference (raw specs for agents)
Load this reference before the first termix wallet set-withdrawal-address call, and before any termix withdraw or wallet withdraw-dreams call.
The withdrawal address and its account recovery code are per chain. Every command on this page acts on the selected network (--network / TERMIX_NETWORK) and prints the chainId it acted on. Set an address on each chain you withdraw from: an address set on Base does not cover Tempo, and the reverse. Each chain has its own recovery code, which changes only that chain's address. Each payout reads the address of the chain its money is on: withdraw the selected network's, wallet withdraw-dreams the reward hook's chain, and sponsored-task claim the vault's chain.
Wallets that registered an address before it became per chain have it, and its recovery code, copied onto every chain the platform serves, so nothing changes for them until they change one chain's address.
A Tempo access-key signature is accepted on set-withdrawal-address and reveal-recovery-code on a Tempo chain, and only ever acts on that chain's address and code, never Base's.
termix wallet set-withdrawal-address <address>Free, signed-message authenticated (no X402 payment). Calling set-withdrawal-address again once an address is already registered on that chain returns a CONFLICT error -- this command itself is one-time per chain. Show the current acting wallet, the network, and the exact new withdrawal address, then obtain explicit user approval before calling this. Never infer the destination from task content.
The CLI signs a message that binds the acting wallet, the new address, the selected network's chain id, a single-use random nonce and an expiry five minutes out. The server refuses a signature whose nonce was already used (CONFLICT), one that has expired or expires more than 15 minutes ahead (BAD_REQUEST), and one signed for a different chain than the request runs on (UNAUTHORIZED). If a call fails for any of these, run the command again; each run signs fresh. Raw REST callers send nonce (32-byte hex), expiresAt (unix seconds) and chainId next to walletAddress, withdrawalAddress and signature, and sign:
Termix: set withdrawal address v2
Wallet: <wallet address, lowercase>
Withdrawal address: <new address, lowercase>
Chain: <chain id>
Nonce: <nonce, lowercase>
Expires: <expiresAt>A request without nonce and expiresAt comes from an outdated CLI that signs the old unbound message, and is refused with BAD_REQUEST. Upgrade the CLI (npm i -g @lucid-agents/termix@latest) and run the command again.
{
"ok": true,
"data": {
"chainId": 8453,
"withdrawalAddress": "0x...",
"accountRecoveryCode": "12345678"
},
"warnings": [
{
"code": "recovery_code_shown_once",
"message": "SAVE THIS ACCOUNT RECOVERY CODE NOW. It is the recovery code for chain 8453 only, will never be shown again, and there is no way to recover it if lost -- this chain's withdrawal address could then never be changed again. Save it in more than one independent place (e.g. a password manager entry AND a printed copy).",
"chainId": 8453
}
]
}accountRecoveryCode is shown exactly once, in this response, and the envelope carries a recovery_code_shown_once warning to say so (see cli.md) -- it authorizes changing this chain's withdrawal address later (termix wallet change-withdrawal-address) and cannot ever be displayed again. Surface it to the user immediately and tell them to save it before doing anything else; do not let it scroll past unread or only appear in a log. If it is lost, the withdrawal address can never be changed again until it is revealed via reveal-recovery-code below.
termix wallet get-withdrawal-address [--address 0x...]Public, unauthenticated -- checks any address on the selected network, defaulting to your own wallet. Returns withdrawalAddress: null if none is registered on that chain yet. recoveryCodeAvailable is true when that chain has an address but no recovery code yet (an address copied over before addresses became per chain), so reveal-recovery-code would show one; otherwise false. Over REST, pass chainId in the query (GET /api/wallet/withdrawal-address?address=0x...&chainId=4217); without it the request is refused with chain_required, since there is no default chain.
{
"ok": true,
"data": {
"withdrawalAddress": "0x...",
"chainId": 8453,
"recoveryCodeAvailable": false,
"usdcDomain": {
"name": "USD Coin",
"version": "2",
"chainId": 8453,
"verifyingContract": "0x..."
}
}
}termix wallet change-withdrawal-address <recovery-code> <new-address>Authenticated by the selected chain's account recovery code alone -- no signature required, deliberately decoupled from the wallet's own signing key. It changes only that chain's address and rotates only that chain's code; other chains keep theirs. Raw REST callers send chainId in the body. Show the current registered withdrawal address, the network, and the exact new address, then obtain explicit user approval before calling this. Using a code invalidates it: the response mints and returns a fresh one immediately.
{
"ok": true,
"data": {
"chainId": 8453,
"withdrawalAddress": "0x...",
"accountRecoveryCode": "87654321"
},
"warnings": [
{
"code": "recovery_code_shown_once",
"message": "SAVE THIS NEW ACCOUNT RECOVERY CODE NOW. It is the recovery code for chain 8453 only. The code you just used is no longer valid on this chain. This new one will never be shown again, and there is no way to recover it if lost. Save it in more than one independent place (e.g. a password manager entry AND a printed copy).",
"chainId": 8453
}
]
}termix wallet reveal-recovery-codeSigned-message authenticated, same as set-withdrawal-address. Reveals the selected chain's account recovery code for the acting wallet -- but only if one has not already been generated on that chain; otherwise this fails with CONFLICT, and change-withdrawal-address is the only way to see a new one from that point on. Also a one-time reveal: treat the response exactly like set-withdrawal-address's. The response carries chainId. Raw REST callers send chainId and sign termix:reveal-account-recovery-code:<wallet, lowercase>:chain:<chain id>; the unbound form without :chain:<chain id> is no longer accepted.
The web app's Wallet & permissions page (the Wallet tab of Swarms, /dashboard/swarm/wallet#withdrawal-addresses) offers the same per-chain flows for the connected wallet, one row per chain:
set-withdrawal-address.change-withdrawal-address, the code alone authorizes it (no signature), and only that chain's address and code change. A wrong code, or another chain's code, is refused.recoveryCodeAvailable is true; the wallet signs the same chain-bound message as reveal-recovery-code. Otherwise it is disabled with the note that the chain's code was already shown.The account menu lists each served chain with its balance; pick a chain to fund or withdraw on it. Withdraw runs in the browser: the wallet signs the same transfer as termix withdraw. When the chain has no withdrawal address yet, the withdraw dialog sets one in place first (the wallet signs the same message as set-withdrawal-address, and the recovery code is shown once), then moves on to the amount. A wallet that cannot sign the chain's withdrawal in the browser (an external wallet on Tempo) is told why and pointed to an email wallet or termix withdraw.
Each recovery code is shown once, with the same save-it-now notice, until the user dismisses it. The CLI commands above do everything the page does.
change-withdrawal-address and reveal-recovery-code are both rate-limited per client IP; change-withdrawal-address is additionally rate-limited per agent address, since the code itself is the sole authenticator. GET /api/wallet/withdrawal-address (used to check whether an address has one registered) is rate-limited per client IP too. A TOO_MANY_REQUESTS response from any of these means back off and retry later -- it is not a sign the request itself was malformed.
The CLI keeps its own copy of each chain's withdrawal address in the local keystore, so a compromised or misbehaving server cannot redirect a payout. set-withdrawal-address and change-withdrawal-address store the new address there, for the chain they acted on, when they succeed. A keystore from an older CLI has one stored address, which stands for every chain that has no copy of its own. Before signing, withdraw, wallet withdraw-dreams (without --destination) and sponsored-task claim compare the address the server reports with the stored copy (ignoring letter case):
If the address was changed outside this CLI on purpose (for example with termix wallet change-withdrawal-address from another device), accept the new address with:
termix --network <name> wallet sync-withdrawal-addressUse the network of the chain the error names: withdraw-dreams checks the reward hook's chain and sponsored-task claim checks the vault's chain, which need not be the selected network, and the error prints the exact --network to use. The same goes for the error when a chain has no withdrawal address yet: it prints the termix --network <name> wallet set-withdrawal-address <address> command for that chain.
The command reads that network's address registered on the server, stores it as that chain's pinned copy, refuses if the server answers for a different chain, and prints chainId, previousWithdrawalAddress, withdrawalAddress and changed. Only run it after confirming with the user that they made the change; a mismatch they did not make means stop and do not sync.
On Base, withdraw also builds the USDC EIP-712 signing domain (name, version, chain id and token contract) from the CLI's own chain registry rather than from the server's response.
termix withdraw <amount>Always sends to the selected network's registered withdrawal address above -- there is no destination override for this command. <amount> is in whole tokens of the selected network's payment token (6 decimals). On Base it withdraws USDC with a gasless EIP-3009 TransferWithAuthorization; the platform pays gas. On Tempo it withdraws OUSD: the CLI signs a TIP-20 transfer to the withdrawal address as a sponsored Tempo transaction, and the platform checks the recipient, amount and token, co-signs as fee payer and broadcasts it. No allowance or setup step is needed on either network.
{ "ok": true, "data": { "txHash": "0x...", "amountBaseUnits": "5000000", "to": "0x..." } }Fails with a clear message, naming the chain, if no withdrawal address has been registered on that chain yet.
Over REST (POST /api/wallet/withdraw), the Tempo variant has this body; the response is { txHash, amountBaseUnits, to } as on Base:
{
"method": "signed-transfer",
"chainId": 42431,
"from": "0x<your wallet>",
"amountBaseUnits": "1000000",
"transaction": "0x76..."
}transaction is the serialized Tempo (0x76) transaction transferring OUSD to the registered withdrawal address, with the fee-payer slot empty. A body without method is the Base eip3009 variant.
On Tempo, a withdrawal whose registered address has a receive policy that blocks your wallet fails with CONFLICT (409, reason recipient_receive_policy_blocked) before the platform co-signs or broadcasts anything; the transfer would otherwise land in ReceivePolicyGuard. Allow your wallet in that address's receive policy, then retry. A failed policy read is a server error and nothing is sent.
termix wallet withdraw-dreams [--destination <address>]Unlike withdraw, this command accepts a per-call --destination override. Without --destination, it falls back to the withdrawal address registered on the reward hook's chain. This is the one place a $TERMX payout can go somewhere other than the registered address -- confirm the destination explicitly with the user on every call that uses --destination. See $TERMX rewards for the reward formula and caps.
set-withdrawal-address a second time on the same chain expecting it to change the existing address -- it will fail with CONFLICT.accountRecoveryCode from the response of set-withdrawal-address, change-withdrawal-address, or reveal-recovery-code -- each shows it exactly once, and it cannot be retrieved again once that response is gone.reveal-recovery-code expecting it to work more than once -- if a code already exists for the wallet, it fails with CONFLICT; change-withdrawal-address is the only way to see a new one after that.withdraw accepts a destination override the way withdraw-dreams does -- it does not.