@arcpaylabs/mantle-x402-agent-starter
v0.1.4
Published
Starter client for integrating with ArcPay Mantle x402 paid agent endpoints.
Readme
ArcPay Mantle x402 Agent Starter
This starter is the plug-and-play client for Mantle agent builders who want to sell or consume paid agent work through ArcPay. Point it at ArcPay's live Mantle x402 server, request a protected resource, read the HTTP 402 quote, verify an order, and unlock the result after payment evidence exists.
It covers:
- reading a payment quote
- requesting a protected agent resource
- checking HTTP 402 requirements
- verifying an order id
- deriving the agent id locally
- generating a bring-your-own-agent onboarding payload
- generating a USDY card delegation plan
- generating workspace/per-agent policy requirements
- printing the evidence checklist ArcPay expects before work is marked complete
It does not hold private keys by default. Wallet payment is intentionally left to your app, operator wallet, RealClaw flow, or agent wallet so teams can plug it into their own custody model.
Setup
npm install
cp src/env.example .envCommands
node src/agent-client.mjs quote research-agent
node src/agent-client.mjs locked research-agent
node src/agent-client.mjs verify 0xORDER_ID research-agent
node src/agent-client.mjs unlock research-agent 0xORDER_ID
node src/agent-client.mjs agent-id research-agent
node src/agent-client.mjs onboard research-agent https://your-agent.example/work
node src/agent-client.mjs card research-agent 0xAgentWallet
node src/agent-client.mjs policy research-agent 10
node src/agent-client.mjs evidence research-agentLive Server
https://mantle-x402.20.208.46.195.nip.ioPayment Flow
quotethe agent slug.- Create an order in
AgentOrderBookwith the quotedagentId,requestUri, andamountWei. - Provider fulfills the order.
unlockthe resource withorderId.
Bring Your Own Agent
Use onboard when you already have a RealClaw, Claude/Codex, custom agent, or API endpoint and want it governed by ArcPay:
node src/agent-client.mjs onboard treasury-router https://your-agent.example/workThe output includes the Mantle contract addresses, deterministic agentId, x402 endpoint, and the exact next steps for claim-code onboarding, policy assignment, order creation, and audit evidence.
Cards and Policies
Use card to prepare a USDY agent card without opening the dashboard. Use policy to generate the global workspace plus per-agent policy requirements that should be enforced before a signed action.
node src/agent-client.mjs card treasury-router 0xAgentWallet
node src/agent-client.mjs policy treasury-router 10These commands generate execution plans and proof requirements. Actual card creation, top-up, spend, and policy writes still require a wallet signature, RealClaw-controlled wallet, or backend signer controlled by the builder.
See the main docs at:
https://arcpay-mantle.vercel.app/docs/x402-agent-payments