agentwallet-sdk 6.0.2 → 6.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -255
- package/dist/bridge/__tests__/solana.test.js +1 -1
- package/dist/bridge/__tests__/solana.test.js.map +1 -1
- package/dist/convenience.d.ts +104 -0
- package/dist/convenience.d.ts.map +1 -0
- package/dist/convenience.js +264 -0
- package/dist/convenience.js.map +1 -0
- package/dist/escrow/MutualStakeEscrow.d.ts.map +1 -1
- package/dist/escrow/MutualStakeEscrow.js +5 -3
- package/dist/escrow/MutualStakeEscrow.js.map +1 -1
- package/dist/index.d.ts +254 -49
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -14
- package/dist/index.js.map +1 -1
- package/dist/plugins/elizaos.d.ts +52 -0
- package/dist/plugins/elizaos.d.ts.map +1 -0
- package/dist/plugins/elizaos.js +89 -0
- package/dist/plugins/elizaos.js.map +1 -0
- package/dist/policy/SpendingPolicy.test.js.map +1 -1
- package/dist/swap/SwapModule.d.ts.map +1 -1
- package/dist/swap/SwapModule.js +3 -3
- package/dist/swap/SwapModule.js.map +1 -1
- package/dist/swap/index.d.ts +1 -1
- package/dist/swap/index.d.ts.map +1 -1
- package/dist/swap/index.js +1 -1
- package/dist/swap/index.js.map +1 -1
- package/dist/swap/types.d.ts +2 -0
- package/dist/swap/types.d.ts.map +1 -1
- package/dist/swap/types.js +2 -0
- package/dist/swap/types.js.map +1 -1
- package/dist/x402/__tests__/client.test.js +1 -1
- package/dist/x402/__tests__/client.test.js.map +1 -1
- package/dist/x402/chains/abstract/index.d.ts.map +1 -1
- package/dist/x402/chains/abstract/index.js.map +1 -1
- package/dist/x402/chains/stellar/index.d.ts.map +1 -1
- package/dist/x402/chains/stellar/index.js +0 -2
- package/dist/x402/chains/stellar/index.js.map +1 -1
- package/dist/x402/client.d.ts +1 -7
- package/dist/x402/client.d.ts.map +1 -1
- package/dist/x402/client.js +25 -25
- package/dist/x402/client.js.map +1 -1
- package/dist/x402/index.d.ts +0 -1
- package/dist/x402/index.d.ts.map +1 -1
- package/dist/x402/index.js +0 -2
- package/dist/x402/index.js.map +1 -1
- package/dist/x402/middleware.d.ts.map +1 -1
- package/dist/x402/middleware.js +3 -0
- package/dist/x402/middleware.js.map +1 -1
- package/package.json +6 -13
- package/dist/tokens/__tests__/decimals.test.d.ts +0 -2
- package/dist/tokens/__tests__/decimals.test.d.ts.map +0 -1
- package/dist/tokens/__tests__/decimals.test.js +0 -107
- package/dist/tokens/__tests__/decimals.test.js.map +0 -1
- package/dist/tokens/__tests__/registry.test.d.ts +0 -2
- package/dist/tokens/__tests__/registry.test.d.ts.map +0 -1
- package/dist/tokens/__tests__/registry.test.js +0 -191
- package/dist/tokens/__tests__/registry.test.js.map +0 -1
- package/dist/tokens/__tests__/transfers.test.d.ts +0 -2
- package/dist/tokens/__tests__/transfers.test.d.ts.map +0 -1
- package/dist/tokens/__tests__/transfers.test.js +0 -103
- package/dist/tokens/__tests__/transfers.test.js.map +0 -1
- package/dist/tokens/decimals.d.ts +0 -65
- package/dist/tokens/decimals.d.ts.map +0 -1
- package/dist/tokens/decimals.js +0 -112
- package/dist/tokens/decimals.js.map +0 -1
- package/dist/tokens/index.d.ts +0 -14
- package/dist/tokens/index.d.ts.map +0 -1
- package/dist/tokens/index.js +0 -14
- package/dist/tokens/index.js.map +0 -1
- package/dist/tokens/registry.d.ts +0 -82
- package/dist/tokens/registry.d.ts.map +0 -1
- package/dist/tokens/registry.js +0 -293
- package/dist/tokens/registry.js.map +0 -1
- package/dist/tokens/solana.d.ts +0 -108
- package/dist/tokens/solana.d.ts.map +0 -1
- package/dist/tokens/solana.js +0 -306
- package/dist/tokens/solana.js.map +0 -1
- package/dist/tokens/transfers.d.ts +0 -95
- package/dist/tokens/transfers.d.ts.map +0 -1
- package/dist/tokens/transfers.js +0 -196
- package/dist/tokens/transfers.js.map +0 -1
- package/dist/x402/multi-asset.d.ts +0 -54
- package/dist/x402/multi-asset.d.ts.map +0 -1
- package/dist/x402/multi-asset.js +0 -123
- package/dist/x402/multi-asset.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
# AgentWallet SDK
|
|
2
2
|
|
|
3
|
-
>
|
|
4
|
-
>
|
|
5
|
-
> **Patent Pending** — Non-Custodial Multi-Chain Financial Infrastructure System for Autonomous AI Agents (USPTO Provisional, filed March 2026)
|
|
3
|
+
> **⭐ Star us during GTC Week (Mar 15-20) — NVIDIA's NemoClaw launches Monday with no payment primitive. agent-wallet-sdk is the open-source answer. Help us reach record stars during the biggest AI week of 2026.**
|
|
6
4
|
|
|
7
5
|
Non-custodial AI agent wallet with ERC-8004 on-chain identity, ERC-6551 token-bound accounts, x402 payments, mutual stake escrow, and programmable spending guardrails.
|
|
8
6
|
|
|
@@ -70,137 +68,6 @@ const result = await agentExecute(wallet, {
|
|
|
70
68
|
console.log(result.executed ? 'Sent!' : 'Queued for approval');
|
|
71
69
|
```
|
|
72
70
|
|
|
73
|
-
## Token Registry (v6.0.0)
|
|
74
|
-
|
|
75
|
-
The `TokenRegistry` ships with 80+ verified token addresses across 11 EVM chains + Solana. No more hard-coding contract addresses.
|
|
76
|
-
|
|
77
|
-
```typescript
|
|
78
|
-
import { getGlobalRegistry, BASE_REGISTRY, ETHEREUM_REGISTRY } from 'agentwallet-sdk';
|
|
79
|
-
|
|
80
|
-
// Global registry — all chains loaded
|
|
81
|
-
const registry = getGlobalRegistry();
|
|
82
|
-
|
|
83
|
-
// Look up a token by symbol + chain
|
|
84
|
-
const usdc = registry.getToken('USDC', 8453); // Base chain ID
|
|
85
|
-
console.log(usdc?.address); // 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913
|
|
86
|
-
|
|
87
|
-
// List all tokens on a chain
|
|
88
|
-
const baseTokens = registry.listTokens(8453);
|
|
89
|
-
console.log(baseTokens.map(t => t.symbol));
|
|
90
|
-
// ['USDC', 'USDT', 'DAI', 'WETH', 'WBTC', 'LINK', 'UNI', 'AAVE', 'LDO', ...]
|
|
91
|
-
|
|
92
|
-
// Add a custom token
|
|
93
|
-
registry.addToken({
|
|
94
|
-
symbol: 'MYTOKEN',
|
|
95
|
-
name: 'My Custom Token',
|
|
96
|
-
chainId: 8453,
|
|
97
|
-
address: '0xYourTokenAddress',
|
|
98
|
-
decimals: 18,
|
|
99
|
-
});
|
|
100
|
-
|
|
101
|
-
// Native gas token (ETH, POL, AVAX, S) — isNative: true, no ERC-20 transfer needed
|
|
102
|
-
const eth = registry.getToken('ETH', 1);
|
|
103
|
-
console.log(eth?.isNative); // true
|
|
104
|
-
|
|
105
|
-
// Per-chain convenience exports (global registry, filtered by chain)
|
|
106
|
-
import { BASE_REGISTRY, ARBITRUM_REGISTRY, ETHEREUM_REGISTRY } from 'agentwallet-sdk';
|
|
107
|
-
const arbUsdc = ARBITRUM_REGISTRY.getToken('USDC', 42161);
|
|
108
|
-
```
|
|
109
|
-
|
|
110
|
-
## Multi-Token EVM Transfers (v6.0.0)
|
|
111
|
-
|
|
112
|
-
Send any ERC-20 token or native gas to any address with automatic decimal handling.
|
|
113
|
-
|
|
114
|
-
```typescript
|
|
115
|
-
import { createWallet, sendToken, sendNative, getTokenBalance, getNativeBalance, getBalances } from 'agentwallet-sdk';
|
|
116
|
-
|
|
117
|
-
const wallet = createWallet({ accountAddress: '0x...', chain: 'base', walletClient });
|
|
118
|
-
|
|
119
|
-
// Send 100 USDC (human-readable amount — no manual decimal math)
|
|
120
|
-
const txHash = await sendToken(wallet, {
|
|
121
|
-
symbol: 'USDC',
|
|
122
|
-
to: '0xRecipient',
|
|
123
|
-
amount: '100', // 100 USDC → internally converted to 100_000_000 (6 decimals)
|
|
124
|
-
});
|
|
125
|
-
|
|
126
|
-
// Send 0.5 ETH (native gas)
|
|
127
|
-
const nativeTxHash = await sendNative(wallet, '0xRecipient', '0.5');
|
|
128
|
-
|
|
129
|
-
// Check a single token balance (returns human-readable string)
|
|
130
|
-
const usdcBalance = await getTokenBalance(wallet, 'USDC');
|
|
131
|
-
console.log(usdcBalance); // "250.00"
|
|
132
|
-
|
|
133
|
-
// Check native balance
|
|
134
|
-
const ethBalance = await getNativeBalance(wallet);
|
|
135
|
-
console.log(ethBalance); // "1.234567890123456789"
|
|
136
|
-
|
|
137
|
-
// Check all registered token balances at once
|
|
138
|
-
const balances = await getBalances(wallet);
|
|
139
|
-
// [{ symbol: 'USDC', balance: '250.00', raw: 250000000n }, { symbol: 'WETH', ... }, ...]
|
|
140
|
-
```
|
|
141
|
-
|
|
142
|
-
## Decimal Helpers (v6.0.0)
|
|
143
|
-
|
|
144
|
-
Convert between on-chain raw amounts and human-readable values without hunting for decimal counts.
|
|
145
|
-
|
|
146
|
-
```typescript
|
|
147
|
-
import { toRaw, toHuman, formatBalance } from 'agentwallet-sdk';
|
|
148
|
-
|
|
149
|
-
// Human → raw (for contract calls)
|
|
150
|
-
const raw = toRaw('100.50', 6); // → 100_500_000n (USDC 6 decimals)
|
|
151
|
-
const rawEth = toRaw('1.5', 18); // → 1_500_000_000_000_000_000n
|
|
152
|
-
|
|
153
|
-
// Raw → human-readable string
|
|
154
|
-
const human = toHuman(100_500_000n, 6); // → "100.5"
|
|
155
|
-
const humanEth = toHuman(1_500_000_000_000_000_000n, 18); // → "1.5"
|
|
156
|
-
|
|
157
|
-
// Format with rounding and symbol
|
|
158
|
-
const display = formatBalance(100_500_000n, 6, 'USDC', 2); // → "100.50 USDC"
|
|
159
|
-
const ethDisplay = formatBalance(1_500_000_000_000_000_000n, 18, 'ETH', 4); // → "1.5000 ETH"
|
|
160
|
-
```
|
|
161
|
-
|
|
162
|
-
## Solana SPL Token Support (v6.0.0)
|
|
163
|
-
|
|
164
|
-
`SolanaWallet` wraps `@solana/web3.js` as an optional peer dependency — install only if you need Solana.
|
|
165
|
-
|
|
166
|
-
```bash
|
|
167
|
-
npm install @solana/web3.js @solana/spl-token
|
|
168
|
-
```
|
|
169
|
-
|
|
170
|
-
```typescript
|
|
171
|
-
import { SolanaWallet } from 'agentwallet-sdk/tokens/solana';
|
|
172
|
-
|
|
173
|
-
const solWallet = new SolanaWallet({
|
|
174
|
-
privateKeyBase58: process.env.SOLANA_PRIVATE_KEY!,
|
|
175
|
-
rpcUrl: 'https://api.mainnet-beta.solana.com', // optional, defaults to mainnet
|
|
176
|
-
});
|
|
177
|
-
|
|
178
|
-
// Get native SOL balance
|
|
179
|
-
const { sol, lamports } = await solWallet.getSolBalance();
|
|
180
|
-
console.log(`Balance: ${sol} SOL`);
|
|
181
|
-
|
|
182
|
-
// Send SOL
|
|
183
|
-
const sig = await solWallet.sendSol('RecipientBase58Address', 0.1); // 0.1 SOL
|
|
184
|
-
console.log('Tx:', sig);
|
|
185
|
-
|
|
186
|
-
// Get SPL token balance (e.g., USDC on Solana)
|
|
187
|
-
const usdcMint = 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v'; // Solana USDC
|
|
188
|
-
const { amount, decimals } = await solWallet.getSplTokenBalance(usdcMint);
|
|
189
|
-
console.log(`USDC: ${Number(amount) / 10 ** decimals}`);
|
|
190
|
-
|
|
191
|
-
// Send SPL token
|
|
192
|
-
const splSig = await solWallet.sendSplToken(
|
|
193
|
-
usdcMint,
|
|
194
|
-
'RecipientBase58Address',
|
|
195
|
-
5_000_000n, // 5 USDC (6 decimals)
|
|
196
|
-
);
|
|
197
|
-
console.log('SPL tx:', splSig);
|
|
198
|
-
|
|
199
|
-
// List all SPL token accounts
|
|
200
|
-
const accounts = await solWallet.listSplTokenAccounts();
|
|
201
|
-
// [{ mint: '...', amount: 5000000n, decimals: 6 }, ...]
|
|
202
|
-
```
|
|
203
|
-
|
|
204
71
|
## Multi-Chain x402 Payments
|
|
205
72
|
|
|
206
73
|
Pay any x402-gated API from any supported chain. The client automatically selects
|
|
@@ -455,10 +322,6 @@ await escrow.verify(escrowId);
|
|
|
455
322
|
|
|
456
323
|
| Feature | Status | Description |
|
|
457
324
|
|---------|--------|-------------|
|
|
458
|
-
| TokenRegistry | ✅ Live | 80+ verified token addresses across 11 EVM chains + Solana |
|
|
459
|
-
| Multi-Token Transfers | ✅ Live | sendToken, sendNative, getBalances — any ERC-20 or native gas |
|
|
460
|
-
| Solana SPL Tokens | ✅ Live | SolanaWallet with getSolBalance, sendSol, sendSplToken (optional dep) |
|
|
461
|
-
| Decimal Helpers | ✅ Live | toRaw, toHuman, formatBalance — no manual decimal math |
|
|
462
325
|
| Agent Identity | ✅ Live | ERC-8004 Identity Registry — on-chain ERC-721 agent IDs |
|
|
463
326
|
| Agent Reputation | ✅ Live | ERC-8004 Reputation Registry — scored feedback and summaries |
|
|
464
327
|
| Agent Validation | ✅ Live | ERC-8004 Validation Registry — validator request/response |
|
|
@@ -485,7 +348,7 @@ await escrow.verify(escrowId);
|
|
|
485
348
|
| Yield Staking | Aave V3, Compound V3, Morpho Blue strategies |
|
|
486
349
|
| Tax Reporting | Cost basis and gain/loss reporting |
|
|
487
350
|
|
|
488
|
-
Premium access: [github.com/
|
|
351
|
+
Premium access: [github.com/up2itnow/AgentNexus2](https://github.com/up2itnow/AgentNexus2)
|
|
489
352
|
|
|
490
353
|
## x402 Protocol: Supported Chains and Payment Rails
|
|
491
354
|
|
|
@@ -569,7 +432,7 @@ const { txHash } = await bridge.bridge({
|
|
|
569
432
|
|
|
570
433
|
All USDC addresses are native Circle USDC (not bridged variants).
|
|
571
434
|
|
|
572
|
-
## Complete Agent Identity Stack (
|
|
435
|
+
## Complete Agent Identity Stack (v5.1.0)
|
|
573
436
|
|
|
574
437
|
One npm install now gives any AI agent a wallet, email address, on-chain ID, reputation, and signed payment intents.
|
|
575
438
|
|
|
@@ -602,121 +465,6 @@ await resolver.sendWithPayment({
|
|
|
602
465
|
});
|
|
603
466
|
```
|
|
604
467
|
|
|
605
|
-
## Enterprise Deployment Guide
|
|
606
|
-
|
|
607
|
-
### Architecture Overview
|
|
608
|
-
|
|
609
|
-
agent-wallet-sdk is designed for enterprise environments where AI agents need autonomous spending power with hard compliance boundaries. The SDK runs in your infrastructure - no third-party custody, no shared key management service, no data leaving your network.
|
|
610
|
-
|
|
611
|
-
**Deployment options:**
|
|
612
|
-
|
|
613
|
-
- **Self-hosted node service:** Run the SDK as a microservice behind your API gateway. Each agent gets its own ERC-6551 wallet with organization-wide SpendingPolicy enforcement.
|
|
614
|
-
- **Embedded in agent runtime:** Import directly into your agent's Node.js/TypeScript process. Wallet keys stay in your process memory, never transmitted.
|
|
615
|
-
- **Containerized (Docker/K8s):** Production-ready with environment variable configuration. Secrets via mounted volumes or your existing secrets manager (Vault, AWS Secrets Manager, GCP Secret Manager).
|
|
616
|
-
|
|
617
|
-
```bash
|
|
618
|
-
# Docker deployment
|
|
619
|
-
docker run -e WALLET_PRIVATE_KEY_FILE=/secrets/key \
|
|
620
|
-
-e RPC_URL=https://mainnet.base.org \
|
|
621
|
-
-v /path/to/secrets:/secrets:ro \
|
|
622
|
-
agentwallet-sdk:latest
|
|
623
|
-
```
|
|
624
|
-
|
|
625
|
-
### Network Requirements
|
|
626
|
-
|
|
627
|
-
- Outbound HTTPS to your chosen RPC provider (Base, Ethereum, Arbitrum, etc.)
|
|
628
|
-
- No inbound ports required
|
|
629
|
-
- Compatible with corporate proxies (standard HTTPS_PROXY env var)
|
|
630
|
-
- Air-gapped deployment supported for key generation; RPC access needed only for transaction broadcast
|
|
631
|
-
|
|
632
|
-
### High Availability
|
|
633
|
-
|
|
634
|
-
- Stateless design: wallet state lives on-chain, not in application memory
|
|
635
|
-
- Multiple SDK instances can share the same wallet address safely (nonce management handled)
|
|
636
|
-
- Recommended: run behind a load balancer with health checks on the `/health` endpoint
|
|
637
|
-
|
|
638
|
-
## Compliance Checklist
|
|
639
|
-
|
|
640
|
-
Use this checklist when evaluating agent-wallet-sdk for regulated environments.
|
|
641
|
-
|
|
642
|
-
### Data Residency
|
|
643
|
-
- [x] All wallet keys generated and stored locally - no external key management service
|
|
644
|
-
- [x] No telemetry, analytics, or usage data transmitted to any third party
|
|
645
|
-
- [x] Transaction data stays on public blockchain (Base, Ethereum, etc.) - no proprietary data store
|
|
646
|
-
- [x] SDK source code is open source (MIT) - full audit capability
|
|
647
|
-
|
|
648
|
-
### Access Control
|
|
649
|
-
- [x] SpendingPolicy enforces per-transaction limits, daily caps, and token-specific restrictions on-chain
|
|
650
|
-
- [x] Transactions exceeding policy limits are queued for human approval - never auto-executed
|
|
651
|
-
- [x] Wallet access revocation via NFT transfer (ERC-6551) - instant, cryptographic, no admin API
|
|
652
|
-
- [x] Role-based access: owner (human) sets policy, agent executes within policy bounds
|
|
653
|
-
|
|
654
|
-
### Audit Trail
|
|
655
|
-
- [x] Every transaction recorded on-chain with block number, timestamp, and gas cost
|
|
656
|
-
- [x] SpendingPolicy changes are on-chain events - immutable audit log
|
|
657
|
-
- [x] ERC-8004 reputation feedback is on-chain - tamper-proof performance history
|
|
658
|
-
- [x] No off-chain state that could be modified without detection
|
|
659
|
-
|
|
660
|
-
### Key Management
|
|
661
|
-
- [x] Non-custodial: the organization holds all private keys
|
|
662
|
-
- [x] Compatible with HSMs via standard Ethereum signing interfaces (EIP-712)
|
|
663
|
-
- [x] Key rotation: deploy new ERC-6551 wallet, transfer NFT, old keys become inert
|
|
664
|
-
- [x] No shared secrets between SDK instances or between organization and vendor
|
|
665
|
-
|
|
666
|
-
## Procurement FAQ
|
|
667
|
-
|
|
668
|
-
**Q: Is agent-wallet-sdk a SaaS product?**
|
|
669
|
-
No. It's an open-source SDK (MIT license) that you install and run in your infrastructure. There's no hosted service, no subscription, no vendor lock-in. You own the deployment.
|
|
670
|
-
|
|
671
|
-
**Q: What are the costs?**
|
|
672
|
-
The SDK itself is free. Costs are blockchain gas fees for transactions (typically $0.001-0.01 on Base L2) and your chosen RPC provider. No per-seat, per-agent, or per-transaction licensing fees.
|
|
673
|
-
|
|
674
|
-
**Q: How does licensing work?**
|
|
675
|
-
MIT license. Use it in commercial products, modify it, distribute it. No copyleft restrictions. No license changes planned - the license is in the git history.
|
|
676
|
-
|
|
677
|
-
**Q: Who maintains it?**
|
|
678
|
-
AI Agent Economy (https://github.com/up2itnow0822/agent-wallet-sdk). Active development since 2025. Community contributions welcome.
|
|
679
|
-
|
|
680
|
-
**Q: Can we get a support agreement?**
|
|
681
|
-
Enterprise support packages are available. Contact bill@ai-agent-economy.com for SLA terms.
|
|
682
|
-
|
|
683
|
-
**Q: Is there vendor lock-in risk?**
|
|
684
|
-
No. The SDK uses standard Ethereum tooling (viem, ERC-6551, ERC-8004). If you stop using the SDK, your wallets, keys, and on-chain identity continue to work with any Ethereum-compatible tool.
|
|
685
|
-
|
|
686
|
-
**Q: Does it work with our existing agent framework?**
|
|
687
|
-
Yes. The SDK is framework-agnostic. It works with OpenClaw, NanoClaw, LangChain, CrewAI, AutoGPT, Anthropic Claude tool-use, OpenAI Assistants, or any Node.js/TypeScript environment. agentpay-mcp adds MCP protocol support for Claude and other MCP-compatible clients.
|
|
688
|
-
|
|
689
|
-
**Q: What chains are supported?**
|
|
690
|
-
17 chains via CCTP bridging. Primary: Base (recommended for low gas costs), Ethereum, Arbitrum, Polygon, Optimism. See Supported Chains table above.
|
|
691
|
-
|
|
692
|
-
## SOC 2 Readiness Matrix
|
|
693
|
-
|
|
694
|
-
| SOC 2 Criteria | agent-wallet-sdk Coverage | Notes |
|
|
695
|
-
|---|---|---|
|
|
696
|
-
| **CC6.1** Logical access security | SpendingPolicy on-chain enforcement, ERC-6551 NFT-based access control | Access revocation is cryptographic via NFT transfer |
|
|
697
|
-
| **CC6.2** System component access | Non-custodial - no vendor access to keys or wallets | Organization controls all secrets |
|
|
698
|
-
| **CC6.3** Access removal | NFT transfer = instant revocation of all agent permissions | No "forgot to deprovision" risk |
|
|
699
|
-
| **CC7.1** System monitoring | All transactions on-chain with block explorer visibility | Real-time alerting via standard blockchain monitoring tools |
|
|
700
|
-
| **CC7.2** Anomaly detection | SpendingPolicy caps prevent anomalous spend automatically | Over-limit transactions queue for human review |
|
|
701
|
-
| **CC8.1** Change management | Open-source - all changes in public git history | Audit any version, diff any release |
|
|
702
|
-
| **A1.2** Recovery objectives | Stateless SDK + on-chain state = recovery is re-deploy + import keys | No database backups needed |
|
|
703
|
-
| **C1.1** Data confidentiality | No data transmitted to vendor, no telemetry, local-only operation | Private keys never leave your infrastructure |
|
|
704
|
-
| **PI1.1** Processing integrity | Deterministic smart contract execution, on-chain verification | Transaction results are cryptographically verifiable |
|
|
705
|
-
|
|
706
|
-
### What SOC 2 Auditors Will Ask (And Your Answers)
|
|
707
|
-
|
|
708
|
-
**"How do you control what the AI agent can spend?"**
|
|
709
|
-
SpendingPolicy smart contracts enforce per-transaction limits, daily caps, and approved token lists on-chain. The agent cannot bypass these limits - they're enforced by the blockchain, not by application code.
|
|
710
|
-
|
|
711
|
-
**"What happens if an agent is compromised?"**
|
|
712
|
-
The agent can only spend up to its SpendingPolicy limits. Worst case: one day's approved budget. Transfer the NFT to revoke all access immediately. No waiting for key rotation, no certificate revocation lists.
|
|
713
|
-
|
|
714
|
-
**"Where are the private keys stored?"**
|
|
715
|
-
In your infrastructure. The SDK never transmits keys. Compatible with your existing secrets management (Vault, AWS Secrets Manager, Azure Key Vault, GCP Secret Manager, or local encrypted storage).
|
|
716
|
-
|
|
717
|
-
**"Can the vendor access our wallets?"**
|
|
718
|
-
No. Non-custodial means we never have your keys. There's no "admin backdoor," no support override, no recovery mechanism that bypasses your key ownership.
|
|
719
|
-
|
|
720
468
|
## Links
|
|
721
469
|
|
|
722
470
|
- [ERC-8004 Spec](https://eips.ethereum.org/EIPS/eip-8004)
|
|
@@ -65,7 +65,7 @@ describe('USDC contract addresses', () => {
|
|
|
65
65
|
it('all EVM chains have valid 0x addresses', () => {
|
|
66
66
|
const chains = Object.keys(USDC_CONTRACT);
|
|
67
67
|
expect(chains.length).toBe(10);
|
|
68
|
-
for (const [
|
|
68
|
+
for (const [chain, addr] of Object.entries(USDC_CONTRACT)) {
|
|
69
69
|
expect(addr).toMatch(/^0x[0-9a-fA-F]{40}$/);
|
|
70
70
|
}
|
|
71
71
|
});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AO,CAAC,iEAAiE,CAAC,CAAC;IAC5F,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,6BAA6B,EAAE,GAAG,EAAE;QACrC,MAAM,CAAC,GAAG,EAAE,CAAC,qBAAqB,CAAC,QAAyB,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC;IAC3E,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module convenience
|
|
3
|
+
* Environment-variable-driven wallet bootstrap helpers.
|
|
4
|
+
*
|
|
5
|
+
* Provides three dead-simple factory functions that read all configuration
|
|
6
|
+
* from process environment variables so that any agent can set up a fully
|
|
7
|
+
* functional wallet in 3 lines without touching viem directly:
|
|
8
|
+
*
|
|
9
|
+
* ```typescript
|
|
10
|
+
* import { walletFromEnv, setPolicyFromEnv, x402FromEnv } from 'agentwallet-sdk';
|
|
11
|
+
*
|
|
12
|
+
* const wallet = walletFromEnv();
|
|
13
|
+
* await setPolicyFromEnv(wallet);
|
|
14
|
+
* const client = x402FromEnv(wallet);
|
|
15
|
+
* ```
|
|
16
|
+
*
|
|
17
|
+
* ### Environment variables
|
|
18
|
+
*
|
|
19
|
+
* | Variable | Required | Default | Description |
|
|
20
|
+
* |-----------------------|----------|----------------|--------------------------------------------------|
|
|
21
|
+
* | AGENT_PRIVATE_KEY | ✅ yes | — | EOA private key (0x-prefixed hex, 32 bytes) |
|
|
22
|
+
* | AGENT_WALLET_ADDRESS | ✅ yes | — | AgentAccountV2 smart-wallet address |
|
|
23
|
+
* | CHAIN_NAME | no | base | Chain name (base, mainnet, arbitrum, …) |
|
|
24
|
+
* | CHAIN_ID | no | — | Alternative to CHAIN_NAME — numeric chain id |
|
|
25
|
+
* | RPC_URL | no | chain default | Custom JSON-RPC endpoint |
|
|
26
|
+
* | SPEND_LIMIT_PER_TX | no | — | Per-tx USDC limit (decimal, e.g. "1.00") |
|
|
27
|
+
* | SPEND_LIMIT_DAILY | no | — | Daily USDC limit (decimal, e.g. "10.00") |
|
|
28
|
+
* | SPEND_ALLOWLIST | no | — | Comma-separated recipient addresses |
|
|
29
|
+
* | X402_SUPPORTED_NETWORKS | no | (all mainnet) | Comma-separated "chain:chainId" network strings |
|
|
30
|
+
* | X402_GLOBAL_DAILY_LIMIT | no | — | Global daily x402 USDC limit (decimal) |
|
|
31
|
+
* | X402_PER_REQUEST_MAX | no | — | Per-request max USDC spend (decimal) |
|
|
32
|
+
*/
|
|
33
|
+
import { createWallet, createX402Client } from './index.js';
|
|
34
|
+
/**
|
|
35
|
+
* Create a fully configured AgentWallet from environment variables.
|
|
36
|
+
*
|
|
37
|
+
* Reads:
|
|
38
|
+
* - **AGENT_PRIVATE_KEY** — EOA signing key (required; 0x-prefixed 32-byte hex)
|
|
39
|
+
* - **AGENT_WALLET_ADDRESS** — AgentAccountV2 contract address (required)
|
|
40
|
+
* - **CHAIN_NAME** or **CHAIN_ID** — target chain (optional; defaults to Base mainnet)
|
|
41
|
+
* - **RPC_URL** — custom RPC endpoint (optional; uses chain default if omitted)
|
|
42
|
+
*
|
|
43
|
+
* @param options - Optional overrides for chain and rpcUrl.
|
|
44
|
+
* @param options.chain - Chain name that takes precedence over the env var.
|
|
45
|
+
* @param options.rpcUrl - RPC endpoint that takes precedence over the env var.
|
|
46
|
+
* @returns A fully configured wallet object (same shape as `createWallet()`).
|
|
47
|
+
*
|
|
48
|
+
* @throws {Error} If AGENT_PRIVATE_KEY is missing or not a valid hex key.
|
|
49
|
+
* @throws {Error} If AGENT_WALLET_ADDRESS is missing.
|
|
50
|
+
*
|
|
51
|
+
* @example
|
|
52
|
+
* ```typescript
|
|
53
|
+
* const wallet = walletFromEnv({ chain: 'base-sepolia' });
|
|
54
|
+
* ```
|
|
55
|
+
*/
|
|
56
|
+
export declare function walletFromEnv(options?: {
|
|
57
|
+
chain?: string;
|
|
58
|
+
rpcUrl?: string;
|
|
59
|
+
}): ReturnType<typeof createWallet>;
|
|
60
|
+
/**
|
|
61
|
+
* Apply a spending policy to a wallet from environment variables.
|
|
62
|
+
*
|
|
63
|
+
* Reads:
|
|
64
|
+
* - **SPEND_LIMIT_PER_TX** — maximum USDC per single transaction (e.g. "1.00")
|
|
65
|
+
* - **SPEND_LIMIT_DAILY** — maximum USDC per 24-hour period (e.g. "10.00")
|
|
66
|
+
* - **SPEND_ALLOWLIST** — comma-separated ERC-20 token addresses to restrict
|
|
67
|
+
*
|
|
68
|
+
* If neither limit is set, logs a warning and falls back to queue-for-approval
|
|
69
|
+
* mode (perTxLimit = 0, periodLimit = 0) so all agent transactions must be
|
|
70
|
+
* manually approved. This is the safest default.
|
|
71
|
+
*
|
|
72
|
+
* @param wallet - Wallet returned by `walletFromEnv()` (or `createWallet()`).
|
|
73
|
+
* @returns Promise that resolves to the on-chain tx hash of the policy update.
|
|
74
|
+
*
|
|
75
|
+
* @example
|
|
76
|
+
* ```typescript
|
|
77
|
+
* await setPolicyFromEnv(wallet);
|
|
78
|
+
* ```
|
|
79
|
+
*/
|
|
80
|
+
export declare function setPolicyFromEnv(wallet: ReturnType<typeof createWallet>): Promise<string>;
|
|
81
|
+
/**
|
|
82
|
+
* Create an x402 payment client from environment variables.
|
|
83
|
+
*
|
|
84
|
+
* Reads:
|
|
85
|
+
* - **X402_SUPPORTED_NETWORKS** — comma-separated "chain:chainId" strings
|
|
86
|
+
* (e.g. "base:8453,arbitrum:42161"); defaults to all supported mainnets
|
|
87
|
+
* - **X402_GLOBAL_DAILY_LIMIT** — total daily USDC budget across all x402
|
|
88
|
+
* services (decimal, e.g. "5.00")
|
|
89
|
+
* - **X402_PER_REQUEST_MAX** — per-request USDC ceiling (decimal)
|
|
90
|
+
*
|
|
91
|
+
* Sensible defaults: supports all 10 mainnet x402 chains, unlimited daily spend
|
|
92
|
+
* (rely on the agent's on-chain spend policy as the hard limit), 1 auto-retry.
|
|
93
|
+
*
|
|
94
|
+
* @param wallet - Wallet returned by `walletFromEnv()` (or `createWallet()`).
|
|
95
|
+
* @returns A configured X402Client instance.
|
|
96
|
+
*
|
|
97
|
+
* @example
|
|
98
|
+
* ```typescript
|
|
99
|
+
* const client = x402FromEnv(wallet);
|
|
100
|
+
* const data = await client.fetch('https://api.example.com/premium-endpoint');
|
|
101
|
+
* ```
|
|
102
|
+
*/
|
|
103
|
+
export declare function x402FromEnv(wallet: ReturnType<typeof createWallet>): ReturnType<typeof createX402Client>;
|
|
104
|
+
//# sourceMappingURL=convenience.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"convenience.d.ts","sourceRoot":"","sources":["../src/convenience.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,OAAO,EACL,YAAY,EAEZ,gBAAgB,EAIjB,MAAM,YAAY,CAAC;AA4EpB;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,aAAa,CAAC,OAAO,CAAC,EAAE;IACtC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,GAAG,UAAU,CAAC,OAAO,YAAY,CAAC,CAwDlC;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAsB,gBAAgB,CAAC,MAAM,EAAE,UAAU,CAAC,OAAO,YAAY,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,CAgD/F;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,UAAU,CAAC,OAAO,YAAY,CAAC,GAAG,UAAU,CAAC,OAAO,gBAAgB,CAAC,CAkBxG"}
|