agentwallet-sdk 4.0.2 → 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 CHANGED
@@ -1,12 +1,13 @@
1
1
  # agentwallet-sdk
2
2
 
3
- Non-custodial agent wallet SDK. Your agent holds its own keys - no custodian, no KYC, no freeze risk.
3
+ Non-custodial agent wallet SDK. Your agent holds its own keys no custodian, no KYC, no freeze risk.
4
4
 
5
5
  [![npm](https://img.shields.io/npm/v/agentwallet-sdk?style=flat-square)](https://www.npmjs.com/package/agentwallet-sdk)
6
6
  [![Discord](https://img.shields.io/discord/1475549260140253194?label=Community&logo=discord&color=5865F2)](https://discord.gg/958AACqf7Y)
7
7
  ![x402](https://img.shields.io/badge/x402-native-green?style=flat-square)
8
8
  ![CCTP V2](https://img.shields.io/badge/CCTP_V2-17_chains-red?style=flat-square)
9
- ![Tests](https://img.shields.io/badge/tests-376_passing-brightgreen?style=flat-square)
9
+ ![Tests](https://img.shields.io/badge/tests-629_passing-brightgreen?style=flat-square)
10
+ ![Swap Fee](https://img.shields.io/badge/swap_fee-0.77%25-blue?style=flat-square)
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 agent-wallet-sdk?
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
- | | agent-wallet-sdk | Coinbase Agentic Wallets | MoonPay Agents |
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 - on-chain only | Yes - platform can freeze | Yes - KYC-gated |
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
- ### Coinbase Agentic Wallets - what "TEE-custodial" means
35
+ ### 0.77% swap fee 12% cheaper than MetaMask and Coinbase Wallet
32
36
 
33
- Coinbase stores private keys in Trusted Execution Environments on their infrastructure. The keys are not yours. If Coinbase freezes your account, halts the service, or gets a court order, your agent stops working. The TEE makes the custody tamper-resistant to Coinbase employees - but it does not make it non-custodial. You are still trusting Coinbase.
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
- ### MoonPay Agents - the CLI-bound, KYC wall
39
+ ```typescript
40
+ import { SwapModule } from 'agentwallet-sdk/swap';
41
+
42
+ const swap = new SwapModule(publicClient, walletClient, accountAddress);
36
43
 
37
- MoonPay requires identity verification before an agent can transact. That kills the autonomous agent use case - you can't run an agent at 2 AM that needs to pay an API if the payment rails need KYC approval first. MoonPay also does not expose an x402 interface, so agents using MoonPay can't participate in the emerging x402 payment ecosystem.
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
- ### agent-wallet-sdk - true non-custody
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 - not by a platform policy that can change overnight.
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
- // Spend limits are on-chain - agent can't exceed them even under prompt injection
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. MoonPay is not cross-chain native.
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, // 0.025 ETH per tx
107
- periodLimit: 500_000000000000000n, // 0.5 ETH per day
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
- ## Key Features
116
-
117
- - **Non-custodial**: Agent holds its own private key. No custodian.
118
- - **x402 native**: Drop-in fetch wrapper for automatic API payment handling
119
- - **17-chain CCTP V2**: Cross-chain USDC via Circle's bridge - EVM + Solana
120
- - **On-chain spend limits**: ERC-6551 token-bound accounts with contract-enforced policies
121
- - **MCP compatible**: Use with any MCP-based agent framework
122
- - **376 tests passing**
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
 
@@ -11,7 +11,7 @@ export declare const UNISWAP_V3_BASE: {
11
11
  QUOTER_V2: string;
12
12
  };
13
13
  /** Protocol fee in bps — 0.875% */
14
- export declare const PROTOCOL_FEE_BPS = 875;
14
+ export declare const PROTOCOL_FEE_BPS = 770;
15
15
  /** Default slippage in bps — 0.5% */
16
16
  export declare const DEFAULT_SLIPPAGE_BPS = 50;
17
17
  //# sourceMappingURL=types.d.ts.map
@@ -12,7 +12,7 @@ export const UNISWAP_V3_BASE = {
12
12
  QUOTER_V2: '0x3d4e44Eb1374240CE5F1B871ab261CD16335B76a',
13
13
  };
14
14
  /** Protocol fee in bps — 0.875% */
15
- export const PROTOCOL_FEE_BPS = 875;
15
+ export const PROTOCOL_FEE_BPS = 770;
16
16
  /** Default slippage in bps — 0.5% */
17
17
  export const DEFAULT_SLIPPAGE_BPS = 50;
18
18
  //# sourceMappingURL=types.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agentwallet-sdk",
3
- "version": "4.0.2",
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",