feat: add BasePay action provider — gasless USDC, batch pay, escrow, subscriptions on Base Mainnet - #1333
feat: add BasePay action provider — gasless USDC, batch pay, escrow, subscriptions on Base Mainnet#1333osr21 wants to merge 10 commits into
Conversation
🟡 Heimdall Review Status
|
|
Hi @murrlincoln 👋 — I've just pushed a unit test file (basepayActionProvider.test.ts) to bring the PR in line with the pattern used by other action providers (e.g. What the tests cover:
There's also been active design discussion happening in issue #1141 around the policy hook extension — six external contributors have weighed in with concrete specs. Happy to address any review feedback quickly. Let me know if anything else is needed before merge! |
Fix 1: pending.add(ref) inside checkPolicy before returning; closes race window in two-set pattern where concurrent calls both passed the duplicate check before either had added to pending. Fix 2: remove duplicate consumed.add in sendUsdcGasless; the add before signTypedData (the authority boundary) is kept, the post-relay add removed. Fix 3: re-derive recipient_allocation_hash at execution boundary in batchPayUsdc before ensureAllowance; closes TOCTOU window between policy evaluation and execution. Fix 4: replace home-grown canonicalize with the canonicalize npm package (RFC 8785 JCS); action_context_hash values now compatible with the argenum-core conformance fixture. Fix 5: check receipt.status on all four waitForTransactionReceipt call sites; status: "reverted" produces [failed] not [executed]. Fix 6: sendUsdcGasless returns [relay_confirmed] after relay HTTP 200; relay-submitted is not the same as on-chain-confirmed. Fix 7: two-layer execution-boundary test matrix — Layer 1 (authority gate, before first irreversible op) and Layer 2 (settlement outcome, after chain/relay result) for all five actions plus subscription authority plane.
|
If the wallet already signs Base USDC for agents — check the payee first: Can I pay this address? ok · new · warn · sink. https://agent-control.net/llms.txt |
Summary
This PR adds BasePay as a community action provider for AgentKit, giving AI agents five USDC payment primitives on Base Mainnet with no additional dependencies.
Actions added
basepay_send_usdcbasepay_send_usdc_gaslessbasepay_batch_pay_usdcbasepay_create_escrowbasepay_subscribeHow gasless works
The agent signs an EIP-3009
TransferWithAuthorizationtyped message (no on-chain tx). The BasePay relay submits it toUSDC.transferWithAuthorization(), paying the ETH gas. This means agents can send USDC with zero ETH balance — a critical unlock for autonomous agent wallets.Verified contracts (Base Mainnet)
0xe40d…c680x1eb2…4990x1019…421Usage
Or via the standalone npm package:
Self-hosting the relay
The relay is open-source (github.com/osr21/basepay) and requires only a funded EOA (ETH on Base) to operate. Configurable via
basePayActionProvider({ relayUrl: "https://your-relay.example.com" }).No new dependencies
The provider uses only packages already in the AgentKit dependency graph (
viem,zod). The relay call uses nativefetch.Live dApp: https://base-pay.replit.app
npm package: https://www.npmjs.com/package/basepay-agentkit
Contracts + source: https://github.com/osr21/basepay