Skip to main content

codespar_wallet

The agent's governed funds. Read the balance and Pix key, read the wallet ledger, or mint a Pix copia-e-cola to top the wallet up. Buy-side companion to codespar_pay.

1 min read
View MarkdownEdit on GitHub
Buy-sideYour agent is the spender: money leaves the wallet it governs, under a signed mandate.

The agent's governed funds: balance, statement, top-up; per-currency slots.

tool codespar_wallet3 actionsmoves no moneyalways required action

This is the wallet the agent spends FROM. Fund it with receive, then spend with codespar_pay. It is distinct from codespar_ledger, the double-entry books.

Actions

actionWhat it doesMoneyNeeds
balance
example below
Read the spendable balance and the Pix key bound to the wallet (the default action)no
statementRead the wallet ledger: funds, holds and debits, newest firstno
receiveMint a Pix copia-e-cola a payer settles to top the wallet up; the credit lands when the inbound webhook confirmsno

Unknown action: refused; nothing is read or minted. Measured 2026-09-09.

Names come from the published tool document (/v1/meta-tools.json, the same list the MCP server answers to tools/list); the one-line summaries and the money class are kept in the docs repository and checked against it on every build.

Example

action: "balance", the default: the spendable funds and the Pix key bound to the wallet.

Call · tools/call
arguments
{
  "name": "codespar_wallet",
  "arguments": {
    "action": "balance",
    "consumer_id": "consumer_0000"
  }
}
Result

Result shape: see runtime. The tool document says balance returns the wallet balance plus its Pix key (the spendable funds), and names no field for either. Call it in the test environment, where the sandbox wallet ships pre-connected, to see the fields; the published document is /v1/meta-tools.json.

When to use

  • Before a spend, to know whether the wallet can cover it: balance.
  • To fund the wallet: receive mints a Pix copia-e-cola (static by default, dynamic with dynamic: true) that a payer settles; the credit lands when the inbound webhook confirms. Show the code to the payer and re-read balance afterwards.
  • To reconcile: statement is the wallet ledger (funds, holds, debits), newest first, up to limit entries.

Every action is scoped to one consumer; consumer_id defaults to the session user and is the same id codespar_shop and codespar_pay use.

Arguments

FieldTypeRequiredDescription
actionstringNobalance | statement | receive. Defaults to balance.
consumer_idstringNoWhose wallet; defaults to the session user
amountnumberNoTop-up amount in minor units (centavos for BRL), for receive
descriptionstringNoCharge description shown to the payer (receive)
dynamicbooleanNoreceive: mint a dynamic copia-e-cola (location URL) instead of a static QR. Default false
limitnumberNoMax ledger entries, 1..100, default 20 (statement)

Errors and what to do

ErrorCauseWhat to do
invalid_argsAn unknown action. Nothing is read or minted.Fix the call against the Arguments table.
A wallet with no funding sourceThe consumer has no payment account yet (in live, an account comes from codespar_kyc onboarding).Onboard the consumer first. In the test environment the sandbox wallet ships pre-connected.

Money and mandate

Nothing on this tool moves money by itself. receive creates an instrument (the copia-e-cola) that a payer settles later; the wallet is credited only when the inbound webhook confirms the payment. Spending out of the wallet happens on codespar_pay, and every spend is mandate-gated server-side (per-currency caps, per-transaction caps, allowlists, expiry). The wallet holds the funds; the mandate holds the permission.

Notes

The multi-slot wallet. A consumer's wallet is one wallet with per-currency slots (for example BRL and USDC) minted from a single mandate signature. There is no FX inside the wallet: each slot has its own cap and settled-spend ledger, and the payee type routes a payment to the matching slot (a URL or 0x address routes to USDC; a Pix key or copia-e-cola routes to BRL). Moving balance between slots is a REST operation, documented in the consumer wallet API.

Fund, check, spend. receive with an amount → the payer settles the copia-e-cola → the webhook credits the wallet → balance shows the funds → codespar_pay spends them under the signed mandate. The settlement's receipt is the Control Record, mandate, payment and delivery bound in one signed document:

Agentic receipt
rcp_8f2a41c9
signed · Ed25519
Mandate — the permission
mandatecm_gWEZO68q
capBRL 500.00 / month
spent after thisBRL 179.90
Payment — the settlement
railpix
amountBRL 179.90
end-to-end refE18236120…7401
Delivery — the proof
evidencestore order #1049-B confirmed
chain a91c…04be 7d2f…c918verifiable offline via did:web
A signed agentic receipt binding the mandate, the settled payment, and the delivery proof, chained into the audit ledger and verifiable offline.
codespar_wallet | CodeSpar