agentwallet-sdk 5.0.4 → 5.0.5
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/LICENSE +21 -0
- package/README.md +19 -0
- package/dist/x402/chains/stellar/index.d.ts +136 -0
- package/dist/x402/chains/stellar/index.d.ts.map +1 -0
- package/dist/x402/chains/stellar/index.js +190 -0
- package/dist/x402/chains/stellar/index.js.map +1 -0
- package/package.json +1 -1
- package/dist/plugins/elizaos.d.ts +0 -52
- package/dist/plugins/elizaos.d.ts.map +0 -1
- package/dist/plugins/elizaos.js +0 -89
- package/dist/plugins/elizaos.js.map +0 -1
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 up2itnow0822
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
# AgentWallet SDK
|
|
2
2
|
|
|
3
|
+
> **📦 CANONICAL PACKAGE:** This is the actively maintained source for the `agentwallet-sdk` npm package (v5+). The old `agentwallet-sdk` GitHub repo is deprecated — use this repo.
|
|
4
|
+
|
|
5
|
+
|
|
3
6
|
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.
|
|
4
7
|
|
|
5
8
|
Agent Wallet gives AI agents autonomous spending power with hard on-chain limits. No more choosing between "agent can drain everything" and "every transaction needs manual approval."
|
|
@@ -231,6 +234,22 @@ Testnet: Base Sepolia, Arbitrum Sepolia, and corresponding testnets.
|
|
|
231
234
|
- [GitHub](https://github.com/agentnexus/agent-wallet-sdk)
|
|
232
235
|
- [npm](https://www.npmjs.com/package/agentwallet-sdk)
|
|
233
236
|
|
|
237
|
+
|
|
238
|
+
## Why agent-wallet-sdk vs. Polygon Agent CLI
|
|
239
|
+
|
|
240
|
+
| Feature | agent-wallet-sdk | Polygon Agent CLI |
|
|
241
|
+
|---|---|---|
|
|
242
|
+
| Wallet model | Non-custodial, agent holds keys | CLI-based, operator-managed |
|
|
243
|
+
| x402 support | Native, automatic negotiation | Not supported |
|
|
244
|
+
| Spend limits | Programmable (daily, per-tx, per-agent) | Manual configuration |
|
|
245
|
+
| Multi-chain | Ethereum, Base, Etherlink, Polygon, 10+ chains | Polygon-only |
|
|
246
|
+
| Integration | npm package, works in any JS/TS runtime | CLI tool, requires shell access |
|
|
247
|
+
| Agent frameworks | Any (LangChain, CrewAI, Cursor, NemoClaw) | Polygon ecosystem only |
|
|
248
|
+
| Audit trail | Built-in transaction logging | External tooling required |
|
|
249
|
+
| Use case | Autonomous agent payments at scale | Polygon-specific agent ops |
|
|
250
|
+
|
|
251
|
+
agent-wallet-sdk is chain-agnostic, framework-agnostic, and built for autonomous agents that need to pay for things without human approval. Polygon Agent CLI is a solid tool if you are all-in on Polygon infrastructure - but if your agents need to operate across chains or use x402 payment headers, agent-wallet-sdk is the better fit.
|
|
252
|
+
|
|
234
253
|
## License
|
|
235
254
|
|
|
236
255
|
MIT
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Stellar x402 Payment Adapter
|
|
3
|
+
*
|
|
4
|
+
* Implements x402 payment protocol on Stellar network.
|
|
5
|
+
* Stellar x402 support went live March 11, 2026.
|
|
6
|
+
*
|
|
7
|
+
* Chain identifiers:
|
|
8
|
+
* - Stellar Mainnet: "stellar:pubnet"
|
|
9
|
+
* - Stellar Testnet: "stellar:testnet"
|
|
10
|
+
*
|
|
11
|
+
* Key differences from EVM chains:
|
|
12
|
+
* - Uses Ed25519 keypairs (not secp256k1)
|
|
13
|
+
* - Transaction format: Stellar XDR (not EVM tx)
|
|
14
|
+
* - Settlement: ~5 seconds (1 ledger close)
|
|
15
|
+
* - Fees: ~0.00001 XLM per operation (effectively free at scale)
|
|
16
|
+
* - USDC: Circle-issued USDC on Stellar
|
|
17
|
+
*
|
|
18
|
+
* Requires optional peer dependency: npm install @stellar/stellar-sdk
|
|
19
|
+
*/
|
|
20
|
+
export declare const STELLAR_NETWORK: {
|
|
21
|
+
readonly pubnet: {
|
|
22
|
+
readonly horizonUrl: "https://horizon.stellar.org";
|
|
23
|
+
readonly networkPassphrase: "Public Global Stellar Network ; September 2015";
|
|
24
|
+
readonly chainId: "stellar:pubnet";
|
|
25
|
+
};
|
|
26
|
+
readonly testnet: {
|
|
27
|
+
readonly horizonUrl: "https://horizon-testnet.stellar.org";
|
|
28
|
+
readonly networkPassphrase: "Test SDF Network ; September 2015";
|
|
29
|
+
readonly chainId: "stellar:testnet";
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* Circle USDC on Stellar (Mainnet)
|
|
34
|
+
* Asset code: USDC
|
|
35
|
+
* Issuer: GA5ZSEJYB37JRC5AVCIA5MOP4RHTM335X2KGX3IHOJAPP5RE34K4KZVN
|
|
36
|
+
*/
|
|
37
|
+
export declare const STELLAR_USDC: {
|
|
38
|
+
readonly pubnet: {
|
|
39
|
+
readonly code: "USDC";
|
|
40
|
+
readonly issuer: "GA5ZSEJYB37JRC5AVCIA5MOP4RHTM335X2KGX3IHOJAPP5RE34K4KZVN";
|
|
41
|
+
};
|
|
42
|
+
readonly testnet: {
|
|
43
|
+
readonly code: "USDC";
|
|
44
|
+
readonly issuer: "GBBD47IF6LWK7P7MDEVSCWR7DPUWV3NY3DTQEVFL4NAT4AQH3ZLLFLA5";
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
export type StellarNetwork = 'pubnet' | 'testnet';
|
|
48
|
+
export interface StellarPaymentConfig {
|
|
49
|
+
/** Which Stellar network to use */
|
|
50
|
+
network?: StellarNetwork;
|
|
51
|
+
/** x402 resource identifier (for memo) */
|
|
52
|
+
resource?: string;
|
|
53
|
+
/** Custom Horizon URL (overrides default) */
|
|
54
|
+
horizonUrl?: string;
|
|
55
|
+
}
|
|
56
|
+
export interface StellarPaymentRequest {
|
|
57
|
+
/** Destination Stellar account (G... address) */
|
|
58
|
+
destination: string;
|
|
59
|
+
/** Amount in USDC (decimal string, e.g. "0.50") */
|
|
60
|
+
amount: string;
|
|
61
|
+
/** Source Stellar account public key */
|
|
62
|
+
sourcePublicKey: string;
|
|
63
|
+
/** x402 resource path for memo */
|
|
64
|
+
resource?: string;
|
|
65
|
+
/** Network to use */
|
|
66
|
+
network?: StellarNetwork;
|
|
67
|
+
}
|
|
68
|
+
export interface StellarPaymentResult {
|
|
69
|
+
/** Stellar transaction hash */
|
|
70
|
+
hash: string;
|
|
71
|
+
/** Ledger number the transaction landed in */
|
|
72
|
+
ledger: number;
|
|
73
|
+
/** Successful */
|
|
74
|
+
successful: boolean;
|
|
75
|
+
/** Network used */
|
|
76
|
+
network: StellarNetwork;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* StellarX402Adapter
|
|
80
|
+
*
|
|
81
|
+
* Handles x402 payment flow for Stellar network.
|
|
82
|
+
*
|
|
83
|
+
* Requires optional peer dependency: npm install @stellar/stellar-sdk
|
|
84
|
+
*
|
|
85
|
+
* Usage:
|
|
86
|
+
* ```typescript
|
|
87
|
+
* const adapter = new StellarX402Adapter({ network: 'pubnet' });
|
|
88
|
+
* const xdr = await adapter.buildPaymentTransaction({
|
|
89
|
+
* destination: 'GDES...',
|
|
90
|
+
* amount: '0.50',
|
|
91
|
+
* sourcePublicKey: keypair.publicKey(),
|
|
92
|
+
* resource: '/api/data-endpoint',
|
|
93
|
+
* });
|
|
94
|
+
* // sign xdr with your keypair, then:
|
|
95
|
+
* const result = await adapter.submitTransaction(signedXdr);
|
|
96
|
+
* ```
|
|
97
|
+
*/
|
|
98
|
+
export declare class StellarX402Adapter {
|
|
99
|
+
private network;
|
|
100
|
+
private horizonUrl;
|
|
101
|
+
constructor(config?: StellarPaymentConfig);
|
|
102
|
+
/**
|
|
103
|
+
* Parse an x402 402 response and extract Stellar payment details.
|
|
104
|
+
*/
|
|
105
|
+
parseX402Response(headers: Record<string, string>): {
|
|
106
|
+
supported: boolean;
|
|
107
|
+
destination?: string;
|
|
108
|
+
amount?: string;
|
|
109
|
+
resource?: string;
|
|
110
|
+
};
|
|
111
|
+
/**
|
|
112
|
+
* Build a Stellar USDC payment transaction XDR.
|
|
113
|
+
*
|
|
114
|
+
* Requires @stellar/stellar-sdk installed as a peer dependency.
|
|
115
|
+
* The returned XDR string must be signed before submission.
|
|
116
|
+
*/
|
|
117
|
+
buildPaymentTransaction(request: StellarPaymentRequest): Promise<string>;
|
|
118
|
+
/**
|
|
119
|
+
* Submit a signed Stellar transaction XDR to Horizon.
|
|
120
|
+
*/
|
|
121
|
+
submitTransaction(signedXdr: string): Promise<StellarPaymentResult>;
|
|
122
|
+
private _loadAccount;
|
|
123
|
+
/** Chain ID for this adapter (e.g. "stellar:pubnet") */
|
|
124
|
+
get chainId(): string;
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Full x402 payment flow for Stellar.
|
|
128
|
+
* Requires @stellar/stellar-sdk installed as peer dependency.
|
|
129
|
+
*/
|
|
130
|
+
export declare function stellarX402Pay(params: {
|
|
131
|
+
responseHeaders: Record<string, string>;
|
|
132
|
+
sourcePublicKey: string;
|
|
133
|
+
sign: (xdr: string) => Promise<string>;
|
|
134
|
+
network?: StellarNetwork;
|
|
135
|
+
}): Promise<StellarPaymentResult>;
|
|
136
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/x402/chains/stellar/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAIH,eAAO,MAAM,eAAe;;;;;;;;;;;CAWlB,CAAC;AAEX;;;;GAIG;AACH,eAAO,MAAM,YAAY;;;;;;;;;CASf,CAAC;AAIX,MAAM,MAAM,cAAc,GAAG,QAAQ,GAAG,SAAS,CAAC;AAElD,MAAM,WAAW,oBAAoB;IACnC,mCAAmC;IACnC,OAAO,CAAC,EAAE,cAAc,CAAC;IACzB,0CAA0C;IAC1C,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,6CAA6C;IAC7C,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,qBAAqB;IACpC,iDAAiD;IACjD,WAAW,EAAE,MAAM,CAAC;IACpB,mDAAmD;IACnD,MAAM,EAAE,MAAM,CAAC;IACf,wCAAwC;IACxC,eAAe,EAAE,MAAM,CAAC;IACxB,kCAAkC;IAClC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,qBAAqB;IACrB,OAAO,CAAC,EAAE,cAAc,CAAC;CAC1B;AAED,MAAM,WAAW,oBAAoB;IACnC,+BAA+B;IAC/B,IAAI,EAAE,M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11, 2026.
|
|
6
|
+
*
|
|
7
|
+
* Chain identifiers:
|
|
8
|
+
* - Stellar Mainnet: "stellar:pubnet"
|
|
9
|
+
* - Stellar Testnet: "stellar:testnet"
|
|
10
|
+
*
|
|
11
|
+
* Key differences from EVM chains:
|
|
12
|
+
* - Uses Ed25519 keypairs (not secp256k1)
|
|
13
|
+
* - Transaction format: Stellar XDR (not EVM tx)
|
|
14
|
+
* - Settlement: ~5 seconds (1 ledger close)
|
|
15
|
+
* - Fees: ~0.00001 XLM per operation (effectively free at scale)
|
|
16
|
+
* - USDC: Circle-issued USDC on Stellar
|
|
17
|
+
*
|
|
18
|
+
* Requires optional peer dependency: npm install @stellar/stellar-sdk
|
|
19
|
+
*/
|
|
20
|
+
// ─── Stellar Chain Constants ─────────────────────────────────────────────────
|
|
21
|
+
export const STELLAR_NETWORK = {
|
|
22
|
+
pubnet: {
|
|
23
|
+
horizonUrl: 'https://horizon.stellar.org',
|
|
24
|
+
networkPassphrase: 'Public Global Stellar Network ; September 2015',
|
|
25
|
+
chainId: 'stellar:pubnet',
|
|
26
|
+
},
|
|
27
|
+
testnet: {
|
|
28
|
+
horizonUrl: 'https://horizon-testnet.stellar.org',
|
|
29
|
+
networkPassphrase: 'Test SDF Network ; September 2015',
|
|
30
|
+
chainId: 'stellar:testnet',
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Circle USDC on Stellar (Mainnet)
|
|
35
|
+
* Asset code: USDC
|
|
36
|
+
* Issuer: GA5ZSEJYB37JRC5AVCIA5MOP4RHTM335X2KGX3IHOJAPP5RE34K4KZVN
|
|
37
|
+
*/
|
|
38
|
+
export const STELLAR_USDC = {
|
|
39
|
+
pubnet: {
|
|
40
|
+
code: 'USDC',
|
|
41
|
+
issuer: 'GA5ZSEJYB37JRC5AVCIA5MOP4RHTM335X2KGX3IHOJAPP5RE34K4KZVN',
|
|
42
|
+
},
|
|
43
|
+
testnet: {
|
|
44
|
+
code: 'USDC',
|
|
45
|
+
issuer: 'GBBD47IF6LWK7P7MDEVSCWR7DPUWV3NY3DTQEVFL4NAT4AQH3ZLLFLA5',
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
// ─── Stellar x402 Payment Adapter ────────────────────────────────────────────
|
|
49
|
+
/**
|
|
50
|
+
* StellarX402Adapter
|
|
51
|
+
*
|
|
52
|
+
* Handles x402 payment flow for Stellar network.
|
|
53
|
+
*
|
|
54
|
+
* Requires optional peer dependency: npm install @stellar/stellar-sdk
|
|
55
|
+
*
|
|
56
|
+
* Usage:
|
|
57
|
+
* ```typescript
|
|
58
|
+
* const adapter = new StellarX402Adapter({ network: 'pubnet' });
|
|
59
|
+
* const xdr = await adapter.buildPaymentTransaction({
|
|
60
|
+
* destination: 'GDES...',
|
|
61
|
+
* amount: '0.50',
|
|
62
|
+
* sourcePublicKey: keypair.publicKey(),
|
|
63
|
+
* resource: '/api/data-endpoint',
|
|
64
|
+
* });
|
|
65
|
+
* // sign xdr with your keypair, then:
|
|
66
|
+
* const result = await adapter.submitTransaction(signedXdr);
|
|
67
|
+
* ```
|
|
68
|
+
*/
|
|
69
|
+
export class StellarX402Adapter {
|
|
70
|
+
constructor(config = {}) {
|
|
71
|
+
this.network = config.network ?? 'pubnet';
|
|
72
|
+
this.horizonUrl = config.horizonUrl ?? STELLAR_NETWORK[this.network].horizonUrl;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Parse an x402 402 response and extract Stellar payment details.
|
|
76
|
+
*/
|
|
77
|
+
parseX402Response(headers) {
|
|
78
|
+
const chains = headers['x-payment-chains'] ?? headers['X-Payment-Chains'] ?? '';
|
|
79
|
+
const chainId = STELLAR_NETWORK[this.network].chainId;
|
|
80
|
+
if (!chains.includes(chainId) && !chains.includes('stellar')) {
|
|
81
|
+
return { supported: false };
|
|
82
|
+
}
|
|
83
|
+
return {
|
|
84
|
+
supported: true,
|
|
85
|
+
destination: headers['x-payment-destination'] ?? headers['X-Payment-Destination'],
|
|
86
|
+
amount: headers['x-payment-amount'] ?? headers['X-Payment-Amount'],
|
|
87
|
+
resource: headers['x-payment-resource'] ?? headers['X-Payment-Resource'],
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Build a Stellar USDC payment transaction XDR.
|
|
92
|
+
*
|
|
93
|
+
* Requires @stellar/stellar-sdk installed as a peer dependency.
|
|
94
|
+
* The returned XDR string must be signed before submission.
|
|
95
|
+
*/
|
|
96
|
+
async buildPaymentTransaction(request) {
|
|
97
|
+
// Dynamic import to avoid hard dependency on @stellar/stellar-sdk
|
|
98
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
99
|
+
let StellarSdk;
|
|
100
|
+
try {
|
|
101
|
+
StellarSdk = await import(
|
|
102
|
+
/* webpackIgnore: true */
|
|
103
|
+
'@stellar/stellar-sdk');
|
|
104
|
+
}
|
|
105
|
+
catch {
|
|
106
|
+
throw new Error('Stellar support requires @stellar/stellar-sdk: npm install @stellar/stellar-sdk');
|
|
107
|
+
}
|
|
108
|
+
const networkConfig = STELLAR_NETWORK[request.network ?? this.network];
|
|
109
|
+
const usdcAsset = STELLAR_USDC[request.network ?? this.network];
|
|
110
|
+
const account = await this._loadAccount(request.sourcePublicKey, networkConfig.horizonUrl);
|
|
111
|
+
const stellarAccount = new StellarSdk.Account(request.sourcePublicKey, account.sequence);
|
|
112
|
+
const asset = new StellarSdk.Asset(usdcAsset.code, usdcAsset.issuer);
|
|
113
|
+
const memoText = request.resource
|
|
114
|
+
? request.resource.slice(0, 28)
|
|
115
|
+
: 'x402-payment';
|
|
116
|
+
const transaction = new StellarSdk.TransactionBuilder(stellarAccount, {
|
|
117
|
+
fee: StellarSdk.BASE_FEE,
|
|
118
|
+
networkPassphrase: networkConfig.networkPassphrase,
|
|
119
|
+
})
|
|
120
|
+
.addOperation(StellarSdk.Operation.payment({
|
|
121
|
+
destination: request.destination,
|
|
122
|
+
asset,
|
|
123
|
+
amount: request.amount,
|
|
124
|
+
}))
|
|
125
|
+
.addMemo(StellarSdk.Memo.text(memoText))
|
|
126
|
+
.setTimeout(300)
|
|
127
|
+
.build();
|
|
128
|
+
return transaction.toXDR();
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Submit a signed Stellar transaction XDR to Horizon.
|
|
132
|
+
*/
|
|
133
|
+
async submitTransaction(signedXdr) {
|
|
134
|
+
const networkConfig = STELLAR_NETWORK[this.network];
|
|
135
|
+
const body = new URLSearchParams({ tx: signedXdr }).toString();
|
|
136
|
+
const resp = await fetch(`${networkConfig.horizonUrl}/transactions`, {
|
|
137
|
+
method: 'POST',
|
|
138
|
+
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
|
|
139
|
+
body,
|
|
140
|
+
});
|
|
141
|
+
if (!resp.ok) {
|
|
142
|
+
const err = await resp.text();
|
|
143
|
+
throw new Error(`Stellar transaction failed: ${resp.status} ${err.slice(0, 200)}`);
|
|
144
|
+
}
|
|
145
|
+
const result = await resp.json();
|
|
146
|
+
return {
|
|
147
|
+
hash: result.hash,
|
|
148
|
+
ledger: result.ledger,
|
|
149
|
+
successful: result.successful ?? true,
|
|
150
|
+
network: this.network,
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
async _loadAccount(publicKey, horizonUrl) {
|
|
154
|
+
const resp = await fetch(`${horizonUrl}/accounts/${publicKey}`);
|
|
155
|
+
if (!resp.ok) {
|
|
156
|
+
throw new Error(`Cannot load Stellar account ${publicKey}: ${resp.status}. ` +
|
|
157
|
+
`Ensure the account exists and has a USDC trustline established.`);
|
|
158
|
+
}
|
|
159
|
+
return await resp.json();
|
|
160
|
+
}
|
|
161
|
+
/** Chain ID for this adapter (e.g. "stellar:pubnet") */
|
|
162
|
+
get chainId() {
|
|
163
|
+
return STELLAR_NETWORK[this.network].chainId;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
// ─── x402 Auto-Pay Helper ────────────────────────────────────────────────────
|
|
167
|
+
/**
|
|
168
|
+
* Full x402 payment flow for Stellar.
|
|
169
|
+
* Requires @stellar/stellar-sdk installed as peer dependency.
|
|
170
|
+
*/
|
|
171
|
+
export async function stellarX402Pay(params) {
|
|
172
|
+
const adapter = new StellarX402Adapter({ network: params.network ?? 'pubnet' });
|
|
173
|
+
const details = adapter.parseX402Response(params.responseHeaders);
|
|
174
|
+
if (!details.supported) {
|
|
175
|
+
throw new Error('This endpoint does not support Stellar x402 payments');
|
|
176
|
+
}
|
|
177
|
+
if (!details.destination || !details.amount) {
|
|
178
|
+
throw new Error('x402 response missing destination or amount headers');
|
|
179
|
+
}
|
|
180
|
+
const xdr = await adapter.buildPaymentTransaction({
|
|
181
|
+
destination: details.destination,
|
|
182
|
+
amount: details.amount,
|
|
183
|
+
sourcePublicKey: params.sourcePublicKey,
|
|
184
|
+
resource: details.resource,
|
|
185
|
+
network: params.network ?? 'pubnet',
|
|
186
|
+
});
|
|
187
|
+
const signedXdr = await params.sign(xdr);
|
|
188
|
+
return adapter.submitTransaction(signedXdr);
|
|
189
|
+
}
|
|
190
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/x402/chains/stellar/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,gFAAgF;AAEhF,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,MAAM,EAAE;QACN,UAAU,EAAE,6BAA6B;QACzC,iBAAiB,EAAE,gDAAgD;QACnE,OAAO,EAAE,gBAAgB;KAC1B;IACD,OAAO,EAAE;QACP,UAAU,EAAE,qCAAqC;QACjD,iBAAiB,EAAE,mCAAmC;QACtD,OAAO,EAAE,iBAAiB;KAC3B;CACO,CAAC;AAEX;;;;GAIG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,MAAM,EAAE;QACN,IAAI,EAAE,MAAM;QACZ,MAAM,EAAE,0DAA0D;KACnE;IACD,OAAO,EAAE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
"version": "5.0.5",
|
|
4
4
|
"description": "Non-custodial AI agent wallet SDK. ERC-8004 identity & reputation registries, mutual stake escrow, x402 payments, 17-chain CCTP bridging, ERC-6551 TBA, SpendingPolicy guardrails, Uniswap V3 swap. The agent holds the keys.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @elizaos/plugin-agentwallet
|
|
3
|
-
*
|
|
4
|
-
* ElizaOS plugin for agentwallet-sdk — non-custodial AI agent wallet with
|
|
5
|
-
* x402 payment support, CCTP V2 cross-chain transfers, and on-chain spend limits.
|
|
6
|
-
*
|
|
7
|
-
* Your agent holds its own private key. No custodian. No KYC.
|
|
8
|
-
*/
|
|
9
|
-
import type { Plugin } from '@elizaos/core';
|
|
10
|
-
import { createWallet } from '../index.js';
|
|
11
|
-
type AgentWallet = ReturnType<typeof createWallet>;
|
|
12
|
-
export interface AgentWalletPluginConfig {
|
|
13
|
-
/** Agent private key — stays in your environment, never transmitted */
|
|
14
|
-
privateKey: `0x${string}`;
|
|
15
|
-
/** Deployed AgentAccountV2 contract address */
|
|
16
|
-
accountAddress: `0x${string}`;
|
|
17
|
-
/** Chain to connect to (default: 'base') */
|
|
18
|
-
chain?: 'base' | 'base-sepolia' | 'ethereum' | 'arbitrum' | 'polygon' | 'etherlink';
|
|
19
|
-
/** Optional custom RPC URL */
|
|
20
|
-
rpcUrl?: string;
|
|
21
|
-
/** Optional daily x402 spend limit in USDC base units (default: 50 USDC = 50_000_000n) */
|
|
22
|
-
x402DailyLimit?: bigint;
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Get or create the agent wallet singleton.
|
|
26
|
-
*/
|
|
27
|
-
export declare function getAgentWallet(config: AgentWalletPluginConfig): AgentWallet;
|
|
28
|
-
/**
|
|
29
|
-
* Create an x402-enabled fetch function for the agent to pay APIs automatically.
|
|
30
|
-
*/
|
|
31
|
-
export declare function createAgentFetch(config: AgentWalletPluginConfig): typeof fetch;
|
|
32
|
-
/**
|
|
33
|
-
* ElizaOS Plugin definition for agentwallet-sdk.
|
|
34
|
-
*
|
|
35
|
-
* Usage in your Eliza character config:
|
|
36
|
-
*
|
|
37
|
-
* ```json
|
|
38
|
-
* {
|
|
39
|
-
* "plugins": ["@elizaos/plugin-agentwallet"],
|
|
40
|
-
* "settings": {
|
|
41
|
-
* "AGENT_PRIVATE_KEY": "0x...",
|
|
42
|
-
* "AGENT_ACCOUNT_ADDRESS": "0x...",
|
|
43
|
-
* "AGENT_CHAIN": "base",
|
|
44
|
-
* "X402_DAILY_LIMIT": "50000000"
|
|
45
|
-
* }
|
|
46
|
-
* }
|
|
47
|
-
* ```
|
|
48
|
-
*/
|
|
49
|
-
declare const AgentWalletPlugin: Plugin;
|
|
50
|
-
export default AgentWalletPlugin;
|
|
51
|
-
export { AgentWalletPlugin };
|
|
52
|
-
//# sourceMappingURL=elizaos.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"elizaos.d.ts","sourceRoot":"","sources":["../../src/plugins/elizaos.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EACL,YAAY,EAGb,MAAM,aAAa,CAAC;AAGrB,KAAK,WAAW,GAAG,UAAU,CAAC,OAAO,YAAY,CAAC,CAAC;AAInD,MAAM,WAAW,uBAAuB;IACtC,uEAAuE;IACvE,UAAU,EAAE,KAAK,MAAM,EAAE,CAAC;IAC1B,+CAA+C;IAC/C,cAAc,EAAE,KAAK,MAAM,EAAE,CAAC;IAC9B,4CAA4C;IAC5C,KAAK,CAAC,EAAE,MAAM,GAAG,cAAc,GAAG,UAAU,GAAG,UAAU,GAAG,SAAS,GAAG,WAAW,CAAC;IACpF,8BAA8B;IAC9B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,0FAA0F;IAC1F,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAID;;GAEG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,uBAAuB,GAAG,WAAW,CAuB3E;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,uBAAuB,gBAK/D;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,QAAA,MAAM,iBAAiB,EAAE,MAiCxB,CAAC;AAEF,eAAe,iBAAiB,CAAC;AACjC,OAAO,EAAE,iBAAiB,EAAE,CAAC"}
|
package/dist/plugins/elizaos.js
DELETED
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
import { createWallet, createX402Fetch, } from '../index.js';
|
|
2
|
-
import { createWalletClient, http } from 'viem';
|
|
3
|
-
import { privateKeyToAccount } from 'viem/accounts';
|
|
4
|
-
let walletInstance = null;
|
|
5
|
-
/**
|
|
6
|
-
* Get or create the agent wallet singleton.
|
|
7
|
-
*/
|
|
8
|
-
export function getAgentWallet(config) {
|
|
9
|
-
if (!walletInstance) {
|
|
10
|
-
const account = privateKeyToAccount(config.privateKey);
|
|
11
|
-
const rpcUrls = {
|
|
12
|
-
base: 'https://mainnet.base.org',
|
|
13
|
-
'base-sepolia': 'https://sepolia.base.org',
|
|
14
|
-
ethereum: 'https://eth.llamarpc.com',
|
|
15
|
-
arbitrum: 'https://arb1.arbitrum.io/rpc',
|
|
16
|
-
polygon: 'https://polygon-rpc.com',
|
|
17
|
-
etherlink: 'https://node.mainnet.etherlink.com',
|
|
18
|
-
};
|
|
19
|
-
const chain = config.chain ?? 'base';
|
|
20
|
-
const walletClient = createWalletClient({
|
|
21
|
-
account,
|
|
22
|
-
transport: http(config.rpcUrl ?? rpcUrls[chain] ?? rpcUrls.base),
|
|
23
|
-
});
|
|
24
|
-
walletInstance = createWallet({
|
|
25
|
-
accountAddress: config.accountAddress,
|
|
26
|
-
chain,
|
|
27
|
-
walletClient,
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
return walletInstance;
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* Create an x402-enabled fetch function for the agent to pay APIs automatically.
|
|
34
|
-
*/
|
|
35
|
-
export function createAgentFetch(config) {
|
|
36
|
-
const wallet = getAgentWallet(config);
|
|
37
|
-
return createX402Fetch(wallet, {
|
|
38
|
-
globalDailyLimit: config.x402DailyLimit ?? 50000000n, // 50 USDC default
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* ElizaOS Plugin definition for agentwallet-sdk.
|
|
43
|
-
*
|
|
44
|
-
* Usage in your Eliza character config:
|
|
45
|
-
*
|
|
46
|
-
* ```json
|
|
47
|
-
* {
|
|
48
|
-
* "plugins": ["@elizaos/plugin-agentwallet"],
|
|
49
|
-
* "settings": {
|
|
50
|
-
* "AGENT_PRIVATE_KEY": "0x...",
|
|
51
|
-
* "AGENT_ACCOUNT_ADDRESS": "0x...",
|
|
52
|
-
* "AGENT_CHAIN": "base",
|
|
53
|
-
* "X402_DAILY_LIMIT": "50000000"
|
|
54
|
-
* }
|
|
55
|
-
* }
|
|
56
|
-
* ```
|
|
57
|
-
*/
|
|
58
|
-
const AgentWalletPlugin = {
|
|
59
|
-
name: '@elizaos/plugin-agentwallet',
|
|
60
|
-
description: 'Non-custodial agent wallet for ElizaOS — x402 payments, CCTP cross-chain, on-chain spend limits. Agent holds its own keys.',
|
|
61
|
-
actions: [],
|
|
62
|
-
providers: [
|
|
63
|
-
{
|
|
64
|
-
name: 'agentWallet',
|
|
65
|
-
description: 'Provides agent wallet and x402 fetch capability to the runtime',
|
|
66
|
-
async get(runtime) {
|
|
67
|
-
const privateKey = runtime.getSetting('AGENT_PRIVATE_KEY');
|
|
68
|
-
const accountAddress = runtime.getSetting('AGENT_ACCOUNT_ADDRESS');
|
|
69
|
-
const chain = (runtime.getSetting('AGENT_CHAIN') ?? 'base');
|
|
70
|
-
const dailyLimitStr = runtime.getSetting('X402_DAILY_LIMIT');
|
|
71
|
-
const x402DailyLimit = dailyLimitStr ? BigInt(dailyLimitStr) : 50000000n;
|
|
72
|
-
if (!privateKey || !accountAddress) {
|
|
73
|
-
return 'AgentWallet not configured: AGENT_PRIVATE_KEY and AGENT_ACCOUNT_ADDRESS required.';
|
|
74
|
-
}
|
|
75
|
-
const config = { privateKey, accountAddress, chain, x402DailyLimit };
|
|
76
|
-
const wallet = getAgentWallet(config);
|
|
77
|
-
const x402Fetch = createAgentFetch(config);
|
|
78
|
-
// Expose on runtime for actions to use
|
|
79
|
-
runtime.agentWallet = wallet;
|
|
80
|
-
runtime.x402Fetch = x402Fetch;
|
|
81
|
-
return `AgentWallet ready — non-custodial, keys stay local. Chain: ${chain}. x402 daily limit: ${x402DailyLimit / 1000000n} USDC.`;
|
|
82
|
-
},
|
|
83
|
-
},
|
|
84
|
-
],
|
|
85
|
-
evaluators: [],
|
|
86
|
-
};
|
|
87
|
-
export default AgentWalletPlugin;
|
|
88
|
-
export { AgentWalletPlugin };
|
|
89
|
-
//# sourceMappingURL=elizaos.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"elizaos.js","sourceRoot":"","sources":["../../src/plugins/elizaos.ts"],"names":[],"mappings":"AASA,OAAO,EACL,YAAY,EAEZ,eAAe,GAChB,MAAM,aAAa,CAAC;AAIrB,OAAO,EAAE,kBAAkB,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAChD,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAepD,IAAI,cAAc,GAAuB,IAAI,CAAC;AAE9C;;GAEG;AACH,MAAM,UAAU,cAAc,CAAC,MAA+B;IAC5D,IAAI,CAAC,cAAc,EAAE,CAAC;QACpB,MAAM,OAAO,GAAG,mBAAmB,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;QACvD,MAAM,OAAO,GAA2B;YACtC,IAAI,EAAE,0BAA0B;YAChC,cAAc,EAAE,0BAA0B;YAC1C,QAAQ,EAAE,0BAA0B;YACpC,QAAQ,EAAE,8BAA8B;YACx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