简介
pocket-money
原始描述
Give your AI agent crypto wallets on Base. Create purpose-specific wallets, ask your human to fund each one, check balances, and manage budgets. No accounts,...
通过你的 Agent 添加
安装目录:pocket-money/(目录名取自 SKILL.md 的 frontmatter name,不是 URL 里的 slug)。
点「快速安装」复制一段指令贴给你的 Agent:它会先下载到 /tmp、把文件清单和校验值给你看,你确认之后才解压安装。不会一步装完、也不改系统其它位置。
或者手动安装
包是「根级 SKILL.md + 作者附带的文件」,解压到上面的 <slug>/ 目录即可;
目录名不用换,也不要把包直接解压到 skills 根目录。
技能申请的权限由作者决定:装之前先看清单里有没有脚本、它会读写什么。
技能正文
name: pocket-money description: Give your AI agent crypto wallets to pay for any x402-enabled service. Create purpose-specific wallets, ask your human to fund each one, then spend with human approval via the x402 protocol. No accounts, no KYC — just wallet addresses and USDC on Base. metadata: openclaw: requires: bins: - node - npm config: - .auteng/wallets/ install: - kind: node package: "@auteng/agent-utils" bins: [] homepage: https://github.com/operator-auteng-ai/agent-utils
Pocket Money — Fund Your Agent's Wallets
You have a tool that lets you create crypto wallets (USDC on Base) and use them to pay for any service that supports the x402 protocol. Each wallet is a separate keypair with its own balance — create one per purpose or budget.
Package: @auteng/agent-utils — published by AutEng (source on GitHub).
Setup (first time only)
Install the agent utils library:
npm install @auteng/agent-utils
Creating a Wallet
Create a named wallet for each purpose or budget:
import { wallet } from '@auteng/agent-utils';
const w = await wallet.create({ name: "feb-2026" });
console.log(w.address); // 0xABC123...
If a wallet with that name already exists on disk, it loads it. Each wallet is stored at .auteng/wallets/<name>.json.
You can also create a quick default wallet:
const w = await wallet.create();
Requesting Funding
When you need money, ask your human to fund a specific wallet:
I need $12 in USDC for today's tasks.
Please send USDC on **Base** to this address:
`0xABC123...` (wallet: "feb-2026")
You can send from Coinbase, an exchange, or any wallet that supports Base.
Be specific about:
- How much you need and why (e.g., "$5 for API calls", "$20 for a batch processing job")
- Which wallet (by name) so both you and your human can track budgets
- The network: always Base (not Ethereum mainnet, not Arbitrum)
- The token: USDC (not ETH, not other tokens)
Waiting for Funding
After asking, wait for the USDC to arrive:
await w.waitForFunding(12_000000n);
// Polls Base every 10s until >= 12 USDC is available
Tell your human you're waiting — they may need a minute to complete the transfer.
Human Approval Before Spending
IMPORTANT: Before making any payment, you MUST:
- Tell your human exactly what you're about to spend and why
- Show the estimated cost
- Wait for explicit human approval before proceeding
Example:
I'd like to call an x402 API endpoint.
Service: api.example.com/generate
Cost: ~$0.05 per request
Wallet: "feb-2026" ($0.98 remaining)
OK to proceed?
Never batch multiple paid operations without listing them first. If running a loop of paid calls, present the total estimated cost upfront and get approval for the batch.
Paying for Any x402 Service
Use the wallet's fetch() as a drop-in replacement for the standard fetch(). It works with any x402-enabled endpoint:
const res = await w.fetch('https://api.example.com/generate', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ prompt: 'hello' }),
});
When the server returns 402 Payment Required, the library automatically:
- Reads the payment terms from the 402 response (amount, recipient, token)
- Signs an EIP-3009 USDC authorization
- Retries the request with payment headers
No gas needed — payment is settled server-side by the x402 facilitator.
Probing a URL
Check if any URL is x402-enabled and see what it costs — no wallet needed:
import { x402 } from '@auteng/agent-utils';
const info = await x402.probe('https://api.example.com/generate');
if (info.enabled) {
console.log(info.price); // "$0.05 USDC on Base"
console.log(info.paymentRequired.resource); // what you're paying for
console.log(info.paymentRequired.accepts[0]); // full payment details
}
Use x402.probe() to check pricing before asking your human for approval.
Discovering x402 services
Browse the Bazaar registry to find available x402 services:
const { services, total } = await x402.discover({ limit: 10 });
for (const svc of services) {
console.log(`${svc.description} — ${svc.price}`);
console.log(` ${svc.url}`);
}
Formatting prices
Convert raw x402 amounts to human-readable strings:
x402.formatPrice("2000", "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913", "eip155:8453");
// → "$0.002 USDC on Base"
AutEng Compute (convenience)
AutEng provides a sandboxed compute service via x402. The compute module wraps it for convenience:
import { wallet, compute } from '@auteng/agent-utils';
const w = await wallet.create({ name: "compute-budget" });
const result = await compute.run({
code: 'print("hello world")',
stack: 'python', // 'python' | 'node'
size: 'small', // 'small' | 'med' | 'large'
wallet: w,
});
console.log(result.stdout); // "hello world\n"
Pricing
compute.pricing(); // returns full pricing table
| Size | vCPU | RAM | Base price | Per second |
|---|---|---|---|---|
| small | 2 | 1 GB | $0.002 | $0.00005 |
| med | 4 | 4 GB | $0.008 | $0.00012 |
| large | 8 | 16 GB | $0.03 | $0.00025 |
Managing Wallets
// Retrieve an existing wallet by name
const w = wallet.get("feb-2026");
// List all wallets
const all = wallet.list();
for (const w of all) {
const bal = await w.checkBalance();
console.log(`${w.name}: ${w.address} — ${bal} USDC`);
}
// Check balance
const balance = await w.checkBalance();
// Returns USDC in minor units (6 decimals)
// e.g., 12_000000n = $12.00
If running low, ask your human for more funding before expensive operations.
Security & Storage
Private keys: Wallet 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.
Network access: This skill makes outbound HTTPS requests to:
- Base RPC (
mainnet.base.org) — to check USDC balances - x402 service endpoints — any URL you call with
w.fetch()orx402.probe() - Bazaar registry (
api.cdp.coinbase.com) — when usingx402.discover()
Payment signing: When w.fetch() encounters a 402 response, it automatically signs an EIP-3009 USDC authorization using the wallet's private key. This authorizes the x402 facilitator to transfer USDC from the wallet. The signing happens locally — no private key leaves the machine.
Mitigations:
- Always get human approval before any operation that spends funds
- Only fund wallets with small amounts appropriate for the task — treat them as petty cash, not savings
- Create separate wallets for separate budgets so you and your human can track spending
- Your wallets only need USDC on Base — no ETH needed for gas
w.fetch()works with any x402-enabled URL — not just AutEng services
正文来自原始发布页, 版权归作者所有,许可未标注。 权利人认为有不妥,可申请下架。