agentwallet-sdk 4.0.3 → 4.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 +100 -25
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
# agentwallet-sdk
|
|
2
2
|
|
|
3
|
-
Non-custodial agent wallet SDK. Your agent holds its own keys
|
|
3
|
+
Non-custodial agent wallet SDK. Your agent holds its own keys — no custodian, no KYC, no freeze risk.
|
|
4
4
|
|
|
5
5
|
[](https://www.npmjs.com/package/agentwallet-sdk)
|
|
6
6
|
[](https://discord.gg/958AACqf7Y)
|
|
7
7
|

|
|
8
8
|

|
|
9
|
-

|
|
10
|
+

|
|
10
11
|
|
|
11
12
|
```bash
|
|
12
13
|
npm i agentwallet-sdk
|
|
@@ -14,56 +15,126 @@ npm i agentwallet-sdk
|
|
|
14
15
|
|
|
15
16
|
---
|
|
16
17
|
|
|
17
|
-
## Why
|
|
18
|
+
## Why agentwallet-sdk?
|
|
18
19
|
|
|
19
20
|
Most agent wallet solutions compromise on the thing that matters most: who controls the keys.
|
|
20
21
|
|
|
21
|
-
| |
|
|
22
|
+
| | agentwallet-sdk | Coinbase Agentic Wallets | MoonPay Agents |
|
|
22
23
|
|---|---|---|---|
|
|
23
24
|
| **Key custody** | Agent holds own keys | Coinbase TEE (custodial) | MoonPay managed |
|
|
24
|
-
| **Freeze risk** | None
|
|
25
|
+
| **Freeze risk** | None — on-chain only | Yes — platform can freeze | Yes — KYC-gated |
|
|
25
26
|
| **Cross-chain** | 17 chains via CCTP V2 | Base only | Limited |
|
|
27
|
+
| **Swap fee** | **0.77%** | 0.875% | N/A |
|
|
26
28
|
| **x402 support** | Native (v2.0.1+) | No public x402 client | No |
|
|
27
29
|
| **Spend limits** | On-chain, enforced by contract | Platform-enforced | Platform-enforced |
|
|
30
|
+
| **Agent identity** | DID + Verifiable Credentials | No | No |
|
|
31
|
+
| **Agent staking** | AAVE USDC yield pool | No | No |
|
|
28
32
|
| **KYC required** | No | No | Yes |
|
|
29
33
|
| **MCP compatible** | Yes | No | No |
|
|
30
34
|
|
|
31
|
-
###
|
|
35
|
+
### 0.77% swap fee — 12% cheaper than MetaMask and Coinbase Wallet
|
|
32
36
|
|
|
33
|
-
|
|
37
|
+
Both MetaMask and Coinbase Wallet charge **0.875%** on every swap. We charge **0.77%** — the lowest fee from any major wallet SDK. Built for agents that execute hundreds of swaps autonomously. Every basis point compounds.
|
|
34
38
|
|
|
35
|
-
|
|
39
|
+
```typescript
|
|
40
|
+
import { SwapModule } from 'agentwallet-sdk/swap';
|
|
41
|
+
|
|
42
|
+
const swap = new SwapModule(publicClient, walletClient, accountAddress);
|
|
36
43
|
|
|
37
|
-
|
|
44
|
+
// 0.77% fee — cheaper than MetaMask, cheaper than Coinbase Wallet
|
|
45
|
+
const result = await swap.executeSwap(USDC_ADDRESS, WETH_ADDRESS, 1000_000000n);
|
|
46
|
+
```
|
|
38
47
|
|
|
39
|
-
###
|
|
48
|
+
### True non-custody
|
|
40
49
|
|
|
41
|
-
The wallet is an ERC-6551 token-bound account on-chain. The agent's private key lives in the agent's environment, controlled by whoever runs the agent. Nobody else has it. Spend limits are enforced by the smart contract
|
|
50
|
+
The wallet is an ERC-6551 token-bound account on-chain. The agent's private key lives in the agent's environment, controlled by whoever runs the agent. Nobody else has it. Spend limits are enforced by the smart contract — not by a platform policy that can change overnight.
|
|
42
51
|
|
|
43
52
|
```typescript
|
|
44
53
|
import { createWallet, createX402Fetch, NATIVE_TOKEN } from 'agentwallet-sdk';
|
|
45
54
|
|
|
46
|
-
// Agent holds its own key
|
|
47
55
|
const wallet = createWallet({ accountAddress: '0x...', chain: 'base', walletClient });
|
|
48
56
|
|
|
49
57
|
// x402 payments: agent pays APIs automatically, no human needed
|
|
50
58
|
const fetch = createX402Fetch(wallet, { globalDailyLimit: 10_000_000n });
|
|
51
59
|
const data = await fetch('https://api.example.com/premium');
|
|
52
60
|
// Server returned 402? Payment handled. Original request retried. Human not consulted.
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### Agent identity — permanent DID + Verifiable Credentials
|
|
64
|
+
|
|
65
|
+
Every agent gets a permanent, self-sovereign decentralized identity derived directly from its wallet key. No external registry. No KYC. Just cryptographic proof that this agent is who it claims to be.
|
|
66
|
+
|
|
67
|
+
```typescript
|
|
68
|
+
import { deriveAgentDID, issueCredential, verifyCredential } from 'agentwallet-sdk/identity';
|
|
69
|
+
|
|
70
|
+
// Permanent DID — same key always produces the same DID
|
|
71
|
+
const did = deriveAgentDID(privateKey);
|
|
72
|
+
// → "did:key:z6MkhaXgBZDvotDkL5257faiztiGiC2QtKLGpbnnEGta2doK"
|
|
73
|
+
|
|
74
|
+
// Issue a signed Verifiable Credential
|
|
75
|
+
const vc = issueCredential(did, privateKey, {
|
|
76
|
+
agentName: 'TradingAgent-01',
|
|
77
|
+
capabilities: ['swap', 'bridge', 'pay'],
|
|
78
|
+
owner: '0xff86...',
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
// Any counterparty can verify without phoning home
|
|
82
|
+
console.log(verifyCredential(vc)); // true
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### Agent staking — earn yield on idle USDC
|
|
53
86
|
|
|
54
|
-
|
|
87
|
+
Agents can deposit USDC into an AAVE V3-backed staking pool and earn yield on earnings instead of holding cash in a wallet. **Agent participants only** — verified by DID at deposit time. No human participants.
|
|
88
|
+
|
|
89
|
+
```typescript
|
|
90
|
+
import { AgentStakingPool } from 'agentwallet-sdk/staking';
|
|
91
|
+
|
|
92
|
+
const pool = new AgentStakingPool();
|
|
93
|
+
|
|
94
|
+
// Deposit TaskBridge earnings — starts earning yield immediately
|
|
95
|
+
await pool.deposit({
|
|
96
|
+
agentDID: did,
|
|
97
|
+
amountUsdc: 500_000000n, // 500 USDC
|
|
98
|
+
walletClient,
|
|
99
|
+
chain: 'base',
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
// Check balance (principal + yield, minus 0.5% annual management fee)
|
|
103
|
+
const balance = await pool.getBalance(did, 'base');
|
|
104
|
+
console.log(balance.currentBalanceUsdc); // growing
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
### Agent verification — machine-readable trust score
|
|
108
|
+
|
|
109
|
+
Before transacting with an unknown agent, request a trust bundle. Staking balance, task history, wallet age — all signed by the agent's DID. No PII. No central authority.
|
|
110
|
+
|
|
111
|
+
```typescript
|
|
112
|
+
import { verifyAgent, verifyTrustBundle } from 'agentwallet-sdk/verify';
|
|
113
|
+
|
|
114
|
+
const bundle = await verifyAgent({ privateKey, chain: 'base' });
|
|
115
|
+
// {
|
|
116
|
+
// did: "did:key:z6Mk...",
|
|
117
|
+
// walletAddress: "0x...",
|
|
118
|
+
// stakingBalance: 500000000n, // 500 USDC staked
|
|
119
|
+
// reputationScore: 87, // 0-100
|
|
120
|
+
// taskBridgeTasksCompleted: 47,
|
|
121
|
+
// walletAgeDays: 183,
|
|
122
|
+
// signature: "..." // tamper-proof
|
|
123
|
+
// }
|
|
124
|
+
|
|
125
|
+
// Counterparty verifies before accepting payment or task
|
|
126
|
+
console.log(verifyTrustBundle(bundle)); // true
|
|
55
127
|
```
|
|
56
128
|
|
|
57
129
|
### Cross-chain without the ceremony
|
|
58
130
|
|
|
59
|
-
One bridge interface across 17 chains. Coinbase Agentic Wallets are Base-only.
|
|
131
|
+
One bridge interface across 17 chains. Coinbase Agentic Wallets are Base-only.
|
|
60
132
|
|
|
61
133
|
```typescript
|
|
62
134
|
import { UnifiedBridge } from 'agentwallet-sdk';
|
|
63
135
|
|
|
64
136
|
const bridge = new UnifiedBridge({ evmSigner, solanaWallet });
|
|
65
137
|
|
|
66
|
-
// Solana -> Base in one call
|
|
67
138
|
await bridge.bridge({
|
|
68
139
|
amount: 1_000_000n,
|
|
69
140
|
sourceChain: 'solana',
|
|
@@ -103,8 +174,8 @@ const wallet = createWallet({
|
|
|
103
174
|
// Set spend limits once (owner operation)
|
|
104
175
|
await setSpendPolicy(wallet, {
|
|
105
176
|
token: NATIVE_TOKEN,
|
|
106
|
-
perTxLimit: 25_000000000000000n,
|
|
107
|
-
periodLimit: 500_000000000000000n,
|
|
177
|
+
perTxLimit: 25_000000000000000n, // 0.025 ETH per tx
|
|
178
|
+
periodLimit: 500_000000000000000n, // 0.5 ETH per day
|
|
108
179
|
periodLength: 86400,
|
|
109
180
|
});
|
|
110
181
|
|
|
@@ -112,14 +183,18 @@ await setSpendPolicy(wallet, {
|
|
|
112
183
|
await agentExecute(wallet, { to: '0xSOME_SERVICE', value: 10_000000000000000n });
|
|
113
184
|
```
|
|
114
185
|
|
|
115
|
-
##
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
- **
|
|
186
|
+
## Modules
|
|
187
|
+
|
|
188
|
+
| Module | Import | What it does |
|
|
189
|
+
|---|---|---|
|
|
190
|
+
| Core | `agentwallet-sdk` | Wallet creation, spend limits, agent execution |
|
|
191
|
+
| x402 | `agentwallet-sdk/x402` | Automatic API payment handling (HTTP 402) |
|
|
192
|
+
| Bridge | `agentwallet-sdk/bridge` | CCTP V2 cross-chain USDC (17 chains) |
|
|
193
|
+
| Swap | `agentwallet-sdk/swap` | Uniswap V3 token swaps @ **0.77% fee** |
|
|
194
|
+
| Policy | `agentwallet-sdk/policy` | SpendingPolicy — allowlists, rolling caps |
|
|
195
|
+
| Identity | `agentwallet-sdk/identity` | Agent DID (W3C did:key) + Verifiable Credentials |
|
|
196
|
+
| Staking | `agentwallet-sdk/staking` | Agent-only AAVE USDC yield pool |
|
|
197
|
+
| Verify | `agentwallet-sdk/verify` | Trust bundle — DID + staking + reputation |
|
|
123
198
|
|
|
124
199
|
## Resources
|
|
125
200
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agentwallet-sdk",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.4",
|
|
4
4
|
"description": "Non-custodial AI agent wallet SDK. x402 payments, 17-chain CCTP bridging, ERC-6551 identity, SpendingPolicy guardrails, agent DID, staking, trust verification. The agent holds the keys.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|