agentwallet-sdk 6.1.0 → 6.2.0
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 +108 -1
- package/dist/bridge/solana.d.ts.map +1 -1
- package/dist/bridge/types.d.ts.map +1 -1
- package/dist/index.d.ts +4990 -13961
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/policy/UptoBillingPolicy.d.ts +88 -0
- package/dist/policy/UptoBillingPolicy.d.ts.map +1 -0
- package/dist/policy/UptoBillingPolicy.js +183 -0
- package/dist/policy/UptoBillingPolicy.js.map +1 -0
- package/dist/policy/UptoBillingPolicy.test.d.ts +2 -0
- package/dist/policy/UptoBillingPolicy.test.d.ts.map +1 -0
- package/dist/policy/UptoBillingPolicy.test.js +102 -0
- package/dist/policy/UptoBillingPolicy.test.js.map +1 -0
- package/dist/router/PaymentRouter.js +1 -1
- package/dist/router/PaymentRouter.js.map +1 -1
- package/dist/swap/SwapModule.d.ts +2 -2
- package/dist/swap/SwapModule.d.ts.map +1 -1
- package/dist/swap/types.d.ts.map +1 -1
- package/dist/tokens/solana.d.ts.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# AgentWallet SDK
|
|
2
2
|
|
|
3
|
-
> **v6.
|
|
3
|
+
> **v6.2.0** · MIT · **Patent Pending**
|
|
4
4
|
>
|
|
5
5
|
> USPTO Provisional filed March 2026: "Non-Custodial Multi-Chain Financial Infrastructure System for Autonomous AI Agents"
|
|
6
6
|
|
|
@@ -58,6 +58,67 @@ await setSpendPolicy(wallet, {
|
|
|
58
58
|
});
|
|
59
59
|
```
|
|
60
60
|
|
|
61
|
+
### Contract Source, Deployment Status, and `AGENT_WALLET_ADDRESS`
|
|
62
|
+
|
|
63
|
+
Today this package ships the contract ABIs in `src/abi.ts` and the TypeScript deployment helpers in `deployWallet()` and `getWalletAddress()`. It does **not** currently publish Solidity sources or an official multi-network deployment manifest in this repo.
|
|
64
|
+
|
|
65
|
+
That means:
|
|
66
|
+
|
|
67
|
+
- `AgentAccountV2Abi` and `AgentAccountFactoryV2Abi` are public and versioned here
|
|
68
|
+
- `deployWallet()` can deploy a new `AgentAccountV2` through a factory you control
|
|
69
|
+
- `getWalletAddress()` returns the deterministic CREATE2 wallet address before deployment
|
|
70
|
+
- `AGENT_WALLET_ADDRESS` is the deployed or predicted `AgentAccountV2` address, not an EOA
|
|
71
|
+
- No canonical Base/Ethereum/Hedera deployment address list is published here yet
|
|
72
|
+
|
|
73
|
+
If you need reproducible deployments, use your own verified factory deployment and pass its address explicitly:
|
|
74
|
+
|
|
75
|
+
```typescript
|
|
76
|
+
import { deployWallet, getWalletAddress } from 'agentwallet-sdk';
|
|
77
|
+
|
|
78
|
+
const walletAddress = await getWalletAddress({
|
|
79
|
+
factoryAddress: '0xFactory',
|
|
80
|
+
tokenContract: '0xIdentityToken',
|
|
81
|
+
tokenId: 1n,
|
|
82
|
+
chain: 'base',
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
const deployment = await deployWallet({
|
|
86
|
+
factoryAddress: '0xFactory',
|
|
87
|
+
tokenContract: '0xIdentityToken',
|
|
88
|
+
tokenId: 1n,
|
|
89
|
+
chain: 'base',
|
|
90
|
+
walletClient,
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
console.log(walletAddress, deployment.txHash);
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### External Signers and MoonPay OWS
|
|
97
|
+
|
|
98
|
+
`privateKeyToAccount()` in the quick-start is a convenience path, not a hard requirement. The core SDK entrypoint is `createWallet({ accountAddress, chain, walletClient })`, so any signer that can produce a viem-compatible `WalletClient` can be used.
|
|
99
|
+
|
|
100
|
+
That includes:
|
|
101
|
+
|
|
102
|
+
- local private keys
|
|
103
|
+
- HSM-backed signers
|
|
104
|
+
- MPC or custodial signers you control
|
|
105
|
+
- an Open Wallet Standard (OWS) adapter that exposes a viem `WalletClient`
|
|
106
|
+
|
|
107
|
+
There is **not** a first-party MoonPay OWS adapter bundled in this repo today. The integration point is the injected `walletClient`.
|
|
108
|
+
|
|
109
|
+
### Custody, Execution Flow, and Gas
|
|
110
|
+
|
|
111
|
+
The intended model is:
|
|
112
|
+
|
|
113
|
+
- funds live in the on-chain `AgentAccountV2` smart wallet
|
|
114
|
+
- the signer attached to `walletClient` authorizes contract calls
|
|
115
|
+
- policy enforcement happens in the wallet contract before execution
|
|
116
|
+
- `AGENT_PRIVATE_KEY` signs the contract interaction, not an off-chain bypass transaction that can skip policy checks
|
|
117
|
+
|
|
118
|
+
So the SDK is not using an "EOA holds the funds and the contract only validates metadata" model. The smart wallet is the custody boundary.
|
|
119
|
+
|
|
120
|
+
Gas is still paid by the execution signer unless you add your own account-abstraction or paymaster stack. This repo does not ship a first-party paymaster integration yet, so sponsored transactions should currently be treated as an external integration layer.
|
|
121
|
+
|
|
61
122
|
### Pay for an API (the 402 Flow)
|
|
62
123
|
|
|
63
124
|
```typescript
|
|
@@ -77,6 +138,35 @@ const data = await response.json();
|
|
|
77
138
|
// Every payment: tx hash on Base, auditable on basescan.org
|
|
78
139
|
```
|
|
79
140
|
|
|
141
|
+
### Usage-based billing with x402 "upto"
|
|
142
|
+
|
|
143
|
+
```typescript
|
|
144
|
+
import { UptoBillingPolicy } from 'agentwallet-sdk';
|
|
145
|
+
|
|
146
|
+
const upto = new UptoBillingPolicy();
|
|
147
|
+
|
|
148
|
+
const auth = upto.authorize({
|
|
149
|
+
authorizationId: 'req-42',
|
|
150
|
+
service: 'api.example.com',
|
|
151
|
+
resource: 'POST /v1/generate',
|
|
152
|
+
network: 'base:8453',
|
|
153
|
+
asset: '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913',
|
|
154
|
+
payTo: '0xMerchant',
|
|
155
|
+
maxAmount: 2_000_000n, // authorize up to $2.00 USDC
|
|
156
|
+
});
|
|
157
|
+
|
|
158
|
+
const snapshot = upto.recordSettlement(auth.authorizationId, 740_000n, {
|
|
159
|
+
txHash: '0xsettlement',
|
|
160
|
+
finalize: true,
|
|
161
|
+
});
|
|
162
|
+
|
|
163
|
+
console.log(snapshot.authorization.settledAmount); // 740000n
|
|
164
|
+
console.log(snapshot.authorization.releasedAmount); // 1260000n
|
|
165
|
+
console.log(upto.getNetWalletDelta(auth.authorizationId)); // -740000n
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
This gives the wallet a clean local ledger for x402 usage-based billing: max authorized, actual settlement, and explicit release of unused capacity.
|
|
169
|
+
|
|
80
170
|
## The Trust Layer
|
|
81
171
|
|
|
82
172
|
This is what makes supervised payments different from autonomous payments.
|
|
@@ -504,6 +594,23 @@ AgentWallet SDK is designed to work **on top of** [MoonPay's Open Wallet Standar
|
|
|
504
594
|
|
|
505
595
|
If your agent framework or wallet provider already implements OWS, AgentWallet SDK plugs in as the payment execution and policy layer. Your agent gets supervised spending, multi-rail routing, and auditable on-chain payments without replacing your existing key management.
|
|
506
596
|
|
|
597
|
+
## Enterprise Compliance (August 2026)
|
|
598
|
+
|
|
599
|
+
The EU AI Act's high-risk compliance deadline lands **August 2, 2026**. AI systems that execute or facilitate financial transactions fall under Annex III high-risk classification. For agent developers, this means four mandatory controls:
|
|
600
|
+
|
|
601
|
+
| Requirement | AgentWallet SDK Feature |
|
|
602
|
+
|---|---|
|
|
603
|
+
| **Spend caps** | `setSpendPolicy()` — per-transaction and daily limits enforced on-chain. The agent cannot override them, even if instructed to. |
|
|
604
|
+
| **Audit trails** | Every transaction recorded on-chain with block number, timestamp, amount, and recipient. Immutable and independently verifiable on basescan.org. |
|
|
605
|
+
| **Session controls** | Session-scoped budgets, safe abort (`safeAbort()`), and NFT-based instant revocation of all agent permissions. |
|
|
606
|
+
| **Human oversight** | Human-in-the-loop approval for transactions above configurable thresholds. Fail-closed — any policy engine error produces rejection. |
|
|
607
|
+
|
|
608
|
+
These aren't optional features — they're regulatory requirements with fines up to €35M or 7% of global annual revenue. Germany published its national enforcement bill in February 2026.
|
|
609
|
+
|
|
610
|
+
For enterprises evaluating agent payment infrastructure: AgentWallet SDK satisfies EU AI Act high-risk requirements out of the box, with on-chain enforcement (not application-level trust) and zero third-party custody.
|
|
611
|
+
|
|
612
|
+
---
|
|
613
|
+
|
|
507
614
|
## Market Context
|
|
508
615
|
|
|
509
616
|
The agentic AI SDK market is projected to grow from **$2.4B (2025) to $16B by 2030** (Mordor Intelligence). AI agents are forecast to drive **$262B in bank sales** via embedded payments and lending by 2026. x402 alone has processed **140M+ agent payment transactions** ($43M) in 9 months, with 98.6% USDC settlement.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"solana.d.ts","sourceRoot":"","sources":["../../src/bridge/solana.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAML,KAAK,OAAO,EACZ,KAAK,IAAI,EACT,KAAK,GAAG,EAER,KAAK,YAAY,EAClB,MAAM,MAAM,CAAC;AAGd,OAAO,EASL,KAAK,cAAc,EACpB,MAAM,YAAY,CAAC;AAIpB,4BAA4B;AAC5B,eAAO,MAAM,kBAAkB,IAAI,CAAC;AAEpC,yCAAyC;AACzC,eAAO,MAAM,gBAAgB,
|
|
1
|
+
{"version":3,"file":"solana.d.ts","sourceRoot":"","sources":["../../src/bridge/solana.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAML,KAAK,OAAO,EACZ,KAAK,IAAI,EACT,KAAK,GAAG,EAER,KAAK,YAAY,EAClB,MAAM,MAAM,CAAC;AAGd,OAAO,EASL,KAAK,cAAc,EACpB,MAAM,YAAY,CAAC;AAIpB,4BAA4B;AAC5B,eAAO,MAAM,kBAAkB,IAAI,CAAC;AAEpC,yCAAyC;AACzC,eAAO,MAAM,gBAAgB,EAAG,8CAAuD,CAAC;AAExF;;;;;;GAMG;AACH,eAAO,MAAM,sBAAsB,EAAG,8CAAuD,CAAC;AAE9F;;;;;GAKG;AACH,eAAO,MAAM,0BA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