Skip to content

v0.25.0 — Celo CIP-64 fee abstraction + Mento corridor + Agent Visa

Latest

Choose a tag to compare

@phamdat721101 phamdat721101 released this 10 Jun 17:31
· 2 commits to main since this release

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. writeContract and transferWithAuthorization with feeCurrency injection. USDC → fee adapter 0x2F25…602B (mainnet) / 0x4822…1dC0 (sepolia); USDT → 0x0e2A…6f72 (mainnet only); USDm → token addr (CIP-66, self-fee-currency).
  • CeloFeeAbstractedAdapterPaymentAdapter impl. Buyer flow delegates to canonical X402Adapter (off-chain EIP-3009 signing — zero gas needed). Merchant flow verifyAndSettle() broadcasts on-chain with the facilitator wallet ALSO paying gas in USDC. Wire-compatible with thirdweb x402 facilitator.
  • Mento corridorselectMentoCorridor pure-fn + MentoBrokerClient viem-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). Pluggable AgentVisaStorage interface; MemoryAgentVisaStorage + JsonFileAgentVisaStorage ship 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.ts buyer+merchant, celo-mento-demo.ts cKES→USDC)
  • 1 skill (skills/pay-celo-x402.sh)
  • ~840 net source LOC

Verification

  • tsup build 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
```