@auteng/pocket-money
v1.0.0
Published
Crypto wallets for autonomous AI agents — create, store, and manage USDC wallets on Base
Readme
@auteng/pocket-money
Crypto wallets for autonomous AI agents. Create, store, and manage USDC wallets on Base. No accounts, no KYC — just wallet addresses and USDC.
Install
npm install @auteng/pocket-moneyQuick Start
import { wallet } from '@auteng/pocket-money';
const w = await wallet.create({ name: "my-task" });
console.log(w.address); // 0xABC123...
const balance = await w.checkBalance();
console.log(balance); // 0n (unfunded)Creating Wallets
Each wallet is an independent keypair with its own address and balance. Create as many as you need — one per task, one per month, one per budget.
import { wallet } from '@auteng/pocket-money';
const monthly = await wallet.create({ name: "feb-2026" });
const task = await wallet.create({ name: "data-pipeline" });Wallets are persisted at .auteng/wallets/<name>.json. Creating a wallet that already exists loads it from disk.
Network
// Base mainnet (default)
const w = await wallet.create({ name: "prod" });
// Base Sepolia testnet
const w = await wallet.create({ name: "test", network: "base-sepolia" });Check Balance
const balance = await w.checkBalance();
// Returns USDC in minor units (6 decimals)
// 10_000000n = $10.00 USDCWait for Funding
await w.waitForFunding(10_000000n);
// Polls Base every 10s until >= $10 USDC is availableWith timeout:
await w.waitForFunding(10_000000n, { timeout: 60_000 });
// Throws after 60s if balance < $10Retrieve and List Wallets
const w = wallet.get("feb-2026"); // load by name
const all = wallet.list(); // list all wallets
for (const w of all) {
const bal = await w.checkBalance();
console.log(`${w.name}: ${w.address} — ${bal} USDC`);
}Custom Fetch
The Wallet.fetch() method defaults to globalThis.fetch. You can inject a custom fetch function (e.g. an x402 payment-wrapped fetch) via the Wallet constructor:
import { Wallet } from '@auteng/pocket-money';
const w = new Wallet({
name: "custom",
account,
privateKey,
network: "base",
fetchFn: myX402PaymentFetch, // handles 402 responses automatically
});
const res = await w.fetch('https://api.example.com/endpoint');Security & Storage
Private keys are stored as unencrypted JSON at .auteng/wallets/<name>.json with restricted file permissions (0600). These keys can sign USDC payment authorizations. If the file is leaked or the machine is compromised, funds in that wallet can be stolen. Treat wallet files like passwords.
Mitigations:
- Only fund wallets with small amounts appropriate for the task
- Create separate wallets for separate budgets
- Your wallets only need USDC on Base — no ETH needed for gas
Development
npm install # install dependencies
npm run build # build CJS/ESM/DTS to dist/
npm test # run unit + integration tests
npm run test:watch # run tests in watch modeLicense
MIT
