First agentic SDK with native fee abstraction. Adds Celo Mainnet (42220) and Celo Sepolia (11142220) where the agent pays for an API in USDC and pays gas in the same USDC via CIP-64 — one balance, one tx, sub-cent fees, ~1s finality, agent never holds CELO.
Three primitives ship together
CeloFeeAbstractedTransactor— CIP-64 wrapper.writeContractandtransferWithAuthorizationwithfeeCurrencyinjection. USDC → fee adapter0x2F25…602B(mainnet) /0x4822…1dC0(sepolia); USDT →0x0e2A…6f72(mainnet only); USDm → token addr (CIP-66, self-fee-currency).CeloFeeAbstractedAdapter—PaymentAdapterimpl. Buyer flow delegates to canonicalX402Adapter(off-chain EIP-3009 signing — zero gas needed). Merchant flowverifyAndSettle()broadcasts on-chain with the facilitator wallet ALSO paying gas in USDC. Wire-compatible with thirdweb x402 facilitator.- Mento corridor —
selectMentoCorridorpure-fn +MentoBrokerClientviem-backed quotes/swaps for USDm/cKES/cREAL → USDC, both legs CIP-64 wrapped. CeloAgentVisaTracker— Tourist (1+ tx) → Work (1000+ tx OR $5K vol & Self ID) → Citizenship (10000+ tx OR $15K vol). PluggableAgentVisaStorageinterface;MemoryAgentVisaStorage+JsonFileAgentVisaStorageship in v0.25. Per-key mutex prevents lost updates.
Quickstart
```typescript
import { createPaymentClient } from 'n-payment';
const client = createPaymentClient({
chains: ['celo-mainnet'],
ows: { wallet: 'my-agent', privateKey: process.env.CELO_PRIVATE_KEY as `0x${string}` },
celo: {
payAsset: 'USDC', // pay both gas and API in USDC
agentVisa: { selfAgentIdProvided: true }, // unlock Work tier at 1K tx / $5K volume
},
});
// 0 CELO needed. Gas paid in USDC via fee-currency adapter.
await client.fetchWithPayment('https://api.example.com/celo-paid-mcp');
// Read your visa progress.
const visa = await client.getCeloVisaStatus();
console.log(visa?.tier, visa?.txCount, visa?.volumeUsd);
```
Footprint
- 8 new src files (
src/celo/{index,fee-abstraction,mento,mento-broker,agent-visa}.ts,src/adapters/celo-fee-abstracted.ts) - 3 test files — 88 new Celo tests (fee abstraction × 18, mento × 14, agent visa × 17 + tier math × 7)
- 2 examples (
celo-x402-demo.tsbuyer+merchant,celo-mento-demo.tscKES→USDC) - 1 skill (
skills/pay-celo-x402.sh) - ~840 net source LOC
Verification
tsupbuild green (CJS + ESM + DTS)- 88 new Celo tests + 39 core tests green
- End-to-end smoke test against fresh npm install: 15/15 public-surface checks pass
Backward compatibility
100% backward compatible. v0.24 callers see identical behavior — config.celo is opt-in. All 28 prior chains untouched.
Install
```bash
npm install n-payment@0.25.0
```