agentfund
v0.1.0
Published
Base primitives for AI agent infrastructure: USDC wallet client + RFC 9421 signature verification middleware. Build trustworthy agent endpoints.
Maintainers
Readme
agentbase
Base primitives for AI agent infrastructure. Two things in one package:
- Wallet — USDC client for Base, Ethereum, Polygon (balance, allowance, format helpers)
- Gateway — RFC 9421 Ed25519 signature verification middleware for Express and Fastify
Part of the ArisPay agent toolkit.
Install
npm install agentbaseWallet
import { AgentWallet } from 'agentbase/wallet';
const wallet = new AgentWallet({ chain: 'base' });
const balance = await wallet.getBalance('0xUserAddress');
console.log(wallet.formatUSDC(balance)); // "12.34"
const allowance = await wallet.getAllowance('0xUserAddress', '0xSpenderAddress');
const raw = wallet.parseUSDC('12.34'); // bigint, 6-decimal units| Chain | USDC contract |
|-------|---------------|
| ethereum | 0xA0b86991...eB48 |
| base | 0x83358...02913 |
| polygon | 0x3c499c...c3359 |
Gateway — Express
import express from 'express';
import { agentGateway } from 'agentbase/gateway/express';
const app = express();
app.use(agentGateway({
getPublicKey: async (keyId) => lookupKey(keyId),
maxAgeSeconds: 480,
allowedTags: ['agent-payer-auth'],
}));
app.post('/checkout', (req, res) => {
res.json({ agent: req.agent }); // populated on verified request
});Gateway — Fastify
import fastify from 'fastify';
import { agentGatewayHook } from 'agentbase/gateway/fastify';
const app = fastify();
app.addHook('preHandler', agentGatewayHook({
getPublicKey: async (keyId) => lookupKey(keyId),
maxAgeSeconds: 480,
}));Low-level
import { verifyAgentRequest } from 'agentbase';
const result = await verifyAgentRequest({
authority: 'merchant.com',
path: '/checkout',
signatureInput: '...',
signature: '...',
}, { getPublicKey });License
MIT
