agent-x402-payments
Summary: The bridge that lets a depunks agent spend its own money and act on agents4fun — real x402/USDC payments + agent-to-agent settlement signed by the agent’s Turnkey wallet (gasless via EIP-3009), plus a create-whitelist skill that creates an allowlist on agents4.fun as the artist. Shipped 2026-07-24→25.
The idea
Through mid-July the two products were connected only by branding (“Agents 4.Fun, powered by DePunks”). This is the first functional link: a DePunk agent identity can now hold a wallet, pay for things, settle with peers, and create a whitelist on agents4.fun — money and transactions crossing the app boundary, not just a shared story. It also marks depunks’ agent layer graduating from identity + reputation into agents that transact.
How it works (depunks side — f38ec48, e031694, 359b019)
- Two payment rails.
x402_fetchpays an external x402 endpoint and returns what it serves;a2a_callsettles real USDC between two agent wallets (previously always “simulated”).payX402Requestsigns EIP-3009 with the agent’s Turnkey wallet, and the payee’s facilitator broadcasts — so the payer stays gasless on Base mainnet with no facilitator of ours. Handles both x402 v1 terms and the v2 header + CAIP-2 network form. create-whitelistskill (rung P3, Market-floor rep): grantswhitelist_fees(read live setup + entry fee) andcreate_whitelist(sign EIP-712 wallet intent → agents4.fun counter-signs → broadcast from the agent’s wallet). The agent must be the artist (msg.sender == artist), so this is the first path where an agent wallet broadcasts a tx (turnkeySignTransaction) rather than handing off a gasless authorization — it spends real ETH.- Wallet provisioning is implicit. Acquiring any paying skill provisions the agent’s Turnkey wallet via the single
ensureAgentWalletpath (best-effort; a Turnkey failure doesn’t roll back the grant, paid tools refuse cleanly until it retries). The detail page shows the new address so the owner can fund it. - Host allowlist.
X402_ALLOWED_HOSTS(now wildcard-capable) covers*.agents4.fun+*.depunks.club+ the Bazaar discovery host — the depunks.club wildcard lets one agent pay another DePunk agent’s/agents/:slug/x402endpoint.
How it works (agents4fun side — 8519f91)
createWhitelistin@aw/agent-clientexposes the same permissionless create path an agent uses to apply: read chain fees → save metadata byexternalRef→ sign the wallet intent → broadcast from the artist wallet./api/chainspublishesstandardHookAddress(a requiredcreateParamsfield) so an agent outside the repo can build the tx.- Contract-mirrored intent types. The EIP-712 intent types /
paramsHash/ hook-config layout are hand-mirrored from agents4fun’s@aw/intentinto depunks (app/src/app/lib/agents/agents4fun.ts+ the CLI). A drift-guard test in depunks diffs the worker copy against the CLI copy every run, so the two copies can’t silently diverge — the standing risk of this bridge.
Guardrails (the reason it’s safe to let agents spend)
Every paid tool shares one fence set: owner-initiated only (a member ≠ the party whose funds these are), one action per turn, a hard per-call cap + per-turn budget, the live fee checked against a hard ceiling and the wallet balance before anything is signed, and a console_wire audit row for every decision — paid or refused, each carrying its reason (a skipped payment is as auditable as a made one). It refuses rather than guesses: unknown chain, non-USDC asset, malformed amount, over-cap price are all hard stops.
Status / open threads
- SHIPPED to test + prod (outbound payments on,
5556dcc). Real-money mainnet behaviour was validated against measured chain/DB state (see the trait-inscription fixcbcfb0ain depunks, found the same way). - Watch: the two hand-mirrored
@aw/intentcopies — the drift-guard test is the only thing keeping them in sync; a change to the hook-config layout on the agents4fun side must be reflected in depunks or creates fail. - Base is the settlement chain here (gasless EIP-3009). Note this sits beside the older opensea-erc8217 “Base is not a network DePunks uses” thread — payments-on-Base is a wallet/settlement concern, distinct from where the NFTs live; not necessarily a contradiction, but worth a look on the next synthesis pass.
Sources
- depunks — “Agents spend real money” section (
f38ec48→cbcfb0a, 2026-07-24→25):app/src/app/lib/agents/{x402Pay,agents4fun,agentWallet,turnkeyWallet}.ts,app/src/app/lib/console/{tools,skills}.ts, testsapp/src/tests/app/lib/{agent-x402-fetch,agents4fun-create,console-a2a-settlement}.test.ts - agents4fun — “Agents create whitelists via the public API” section (
8519f91, 2026-07-25):packages/agent-client/src/index.ts(createWhitelist),scripts/agent-create.mjs,/api/chainsstandardHookAddress - Related: depunks, agents4fun, agent-rep-trust, opensea-erc8217