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/dist/tokens/solana.js
DELETED
|
@@ -1,306 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @module tokens/solana
|
|
3
|
-
* Solana SPL token support for AgentWallet v6.
|
|
4
|
-
*
|
|
5
|
-
* Uses @solana/web3.js as an optional peer dependency.
|
|
6
|
-
* All imports are done dynamically so EVM-only users pay zero overhead.
|
|
7
|
-
*
|
|
8
|
-
* Token addresses verified against:
|
|
9
|
-
* - Solana SPL Token Registry: https://raw.githubusercontent.com/solana-labs/token-list/main/src/tokens/solana.tokenlist.json
|
|
10
|
-
* - USDC on Solana: https://developers.circle.com/stablecoins/usdc-contract-addresses
|
|
11
|
-
* - Raydium: https://docs.raydium.io/raydium/token-pairs-and-liquidity
|
|
12
|
-
*/
|
|
13
|
-
// ─── Well-known Solana token mint addresses ───────────────────────────────────
|
|
14
|
-
//
|
|
15
|
-
// All addresses are base-58 encoded Solana public keys.
|
|
16
|
-
// Sources: Solana token registry + Circle USDC docs
|
|
17
|
-
export const SOLANA_TOKENS = {
|
|
18
|
-
// Native SOL (special: no mint address, use null or SystemProgram)
|
|
19
|
-
SOL: null, // native, not a mint
|
|
20
|
-
// USDC on Solana mainnet — Circle official
|
|
21
|
-
USDC: 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v',
|
|
22
|
-
// USDT on Solana — Tether official
|
|
23
|
-
USDT: 'Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB',
|
|
24
|
-
// Raydium
|
|
25
|
-
RAY: '4k3Dyjzvzp8eMZWUXbBCjEvwSkkk59S5iCNLY3QrkX6R',
|
|
26
|
-
// Serum (now Openbook predecessor token)
|
|
27
|
-
SRM: 'SRMuApVNdxXokk5GT7XD5cUUgXMBCoAz2LHeuAoKWRt',
|
|
28
|
-
// Bonk memecoin
|
|
29
|
-
BONK: 'DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263',
|
|
30
|
-
// JitoSOL — Jito staked SOL
|
|
31
|
-
JITOSOL: 'J1toso1uCk3RLmjorhTtrVwY9HJ7X8V9yYac6Y7kGCPn',
|
|
32
|
-
// mSOL — Marinade staked SOL
|
|
33
|
-
MSOL: 'mSoLzYCxHdYgdzU16g5QSh3i5K3z3KZK7ytfqcJm7So',
|
|
34
|
-
// Wrapped BTC on Solana (Portal/Wormhole)
|
|
35
|
-
WBTC: '3NZ9JMVBmGAqocybic2c7LQCJScmgsAZ6vQqTDzcqmJh',
|
|
36
|
-
// Wrapped ETH on Solana (Portal/Wormhole)
|
|
37
|
-
WETH: '7vfCXTUXx5WJV5JADk17DUJ4ksgau7utNKj4b963voxs',
|
|
38
|
-
};
|
|
39
|
-
/** Known decimals for Solana tokens */
|
|
40
|
-
export const SOLANA_TOKEN_DECIMALS = {
|
|
41
|
-
SOL: 9,
|
|
42
|
-
USDC: 6,
|
|
43
|
-
USDT: 6,
|
|
44
|
-
RAY: 6,
|
|
45
|
-
SRM: 6,
|
|
46
|
-
BONK: 5,
|
|
47
|
-
JITOSOL: 9,
|
|
48
|
-
MSOL: 9,
|
|
49
|
-
WBTC: 8,
|
|
50
|
-
WETH: 8,
|
|
51
|
-
};
|
|
52
|
-
// ─── Dynamic import helper ────────────────────────────────────────────────────
|
|
53
|
-
// ─── Base58 decode (built-in, no extra dependency) ───────────────────────────
|
|
54
|
-
const BASE58_ALPHABET = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz';
|
|
55
|
-
function base58Decode(str) {
|
|
56
|
-
const bytes = [0];
|
|
57
|
-
for (const char of str) {
|
|
58
|
-
const idx = BASE58_ALPHABET.indexOf(char);
|
|
59
|
-
if (idx < 0)
|
|
60
|
-
throw new Error(`base58Decode: invalid character "${char}"`);
|
|
61
|
-
let carry = idx;
|
|
62
|
-
for (let i = 0; i < bytes.length; i++) {
|
|
63
|
-
carry += bytes[i] * 58;
|
|
64
|
-
bytes[i] = carry & 0xff;
|
|
65
|
-
carry >>= 8;
|
|
66
|
-
}
|
|
67
|
-
while (carry > 0) {
|
|
68
|
-
bytes.push(carry & 0xff);
|
|
69
|
-
carry >>= 8;
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
// Add leading zeros for leading '1' chars
|
|
73
|
-
for (const char of str) {
|
|
74
|
-
if (char !== '1')
|
|
75
|
-
break;
|
|
76
|
-
bytes.push(0);
|
|
77
|
-
}
|
|
78
|
-
return new Uint8Array(bytes.reverse());
|
|
79
|
-
}
|
|
80
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
81
|
-
async function loadSolanaWeb3() {
|
|
82
|
-
try {
|
|
83
|
-
// @ts-expect-error — @solana/web3.js is an optional peer dependency
|
|
84
|
-
const mod = await import('@solana/web3.js');
|
|
85
|
-
return mod;
|
|
86
|
-
}
|
|
87
|
-
catch {
|
|
88
|
-
throw new Error('SolanaWallet requires @solana/web3.js. Install it: npm install @solana/web3.js');
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
92
|
-
async function loadSplToken() {
|
|
93
|
-
try {
|
|
94
|
-
// @ts-expect-error — @solana/spl-token is an optional peer dependency
|
|
95
|
-
const mod = await import('@solana/spl-token');
|
|
96
|
-
return mod;
|
|
97
|
-
}
|
|
98
|
-
catch {
|
|
99
|
-
throw new Error('SolanaWallet SPL token operations require @solana/spl-token. Install it: npm install @solana/spl-token');
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
/**
|
|
103
|
-
* Solana wallet for native SOL and SPL token operations.
|
|
104
|
-
* Uses @solana/web3.js (optional peer dependency, dynamically imported).
|
|
105
|
-
*/
|
|
106
|
-
export class SolanaWallet {
|
|
107
|
-
constructor(config = {}) {
|
|
108
|
-
// Lazily loaded modules and connection
|
|
109
|
-
this._connection = null;
|
|
110
|
-
this._keypair = null;
|
|
111
|
-
this.rpcUrl = config.rpcUrl ?? 'https://api.mainnet-beta.solana.com';
|
|
112
|
-
this.config = config;
|
|
113
|
-
}
|
|
114
|
-
async getConnection() {
|
|
115
|
-
if (this._connection)
|
|
116
|
-
return this._connection;
|
|
117
|
-
const { Connection } = await loadSolanaWeb3();
|
|
118
|
-
this._connection = new Connection(this.rpcUrl, 'confirmed');
|
|
119
|
-
return this._connection;
|
|
120
|
-
}
|
|
121
|
-
async getKeypair() {
|
|
122
|
-
if (this._keypair)
|
|
123
|
-
return this._keypair;
|
|
124
|
-
const { Keypair } = await loadSolanaWeb3();
|
|
125
|
-
if (this.config.keypairBytes) {
|
|
126
|
-
this._keypair = Keypair.fromSecretKey(this.config.keypairBytes);
|
|
127
|
-
}
|
|
128
|
-
else if (this.config.privateKeyBase58) {
|
|
129
|
-
// bs58 decode — use the solana web3 module's bundled bs58 or a custom decode
|
|
130
|
-
const solWeb3 = await loadSolanaWeb3();
|
|
131
|
-
let decoded;
|
|
132
|
-
if (solWeb3.bs58) {
|
|
133
|
-
decoded = solWeb3.bs58.decode(this.config.privateKeyBase58);
|
|
134
|
-
}
|
|
135
|
-
else {
|
|
136
|
-
// Fallback: manually decode base58 (no external dep needed)
|
|
137
|
-
decoded = base58Decode(this.config.privateKeyBase58);
|
|
138
|
-
}
|
|
139
|
-
this._keypair = Keypair.fromSecretKey(decoded);
|
|
140
|
-
}
|
|
141
|
-
else {
|
|
142
|
-
throw new Error('SolanaWallet: no private key provided. Set keypairBytes or privateKeyBase58 in config.');
|
|
143
|
-
}
|
|
144
|
-
return this._keypair;
|
|
145
|
-
}
|
|
146
|
-
/** Get signer's public key as base-58 string */
|
|
147
|
-
async getPublicKey() {
|
|
148
|
-
const kp = await this.getKeypair();
|
|
149
|
-
return kp.publicKey.toBase58();
|
|
150
|
-
}
|
|
151
|
-
/**
|
|
152
|
-
* Get native SOL balance.
|
|
153
|
-
* @param address - Optional base-58 public key to check (defaults to wallet's key)
|
|
154
|
-
*/
|
|
155
|
-
async getSolBalance(address) {
|
|
156
|
-
const { PublicKey } = await loadSolanaWeb3();
|
|
157
|
-
const connection = await this.getConnection();
|
|
158
|
-
let pubkey;
|
|
159
|
-
if (address) {
|
|
160
|
-
pubkey = new PublicKey(address);
|
|
161
|
-
}
|
|
162
|
-
else {
|
|
163
|
-
const kp = await this.getKeypair();
|
|
164
|
-
pubkey = kp.publicKey;
|
|
165
|
-
}
|
|
166
|
-
const lamports = await connection.getBalance(pubkey);
|
|
167
|
-
const rawBalance = BigInt(lamports);
|
|
168
|
-
const sol = (lamports / 1e9).toFixed(9).replace(/\.?0+$/, '');
|
|
169
|
-
return { rawBalance, sol };
|
|
170
|
-
}
|
|
171
|
-
/**
|
|
172
|
-
* Get SPL token balance for a given mint.
|
|
173
|
-
* @param mintAddress - SPL token mint address (base-58)
|
|
174
|
-
* @param owner - Optional owner address (defaults to wallet's key)
|
|
175
|
-
*/
|
|
176
|
-
async getSplTokenBalance(mintAddress, owner) {
|
|
177
|
-
const { PublicKey } = await loadSolanaWeb3();
|
|
178
|
-
const splToken = await loadSplToken();
|
|
179
|
-
const connection = await this.getConnection();
|
|
180
|
-
let ownerPubkey;
|
|
181
|
-
if (owner) {
|
|
182
|
-
ownerPubkey = new PublicKey(owner);
|
|
183
|
-
}
|
|
184
|
-
else {
|
|
185
|
-
const kp = await this.getKeypair();
|
|
186
|
-
ownerPubkey = kp.publicKey;
|
|
187
|
-
}
|
|
188
|
-
const mintPubkey = new PublicKey(mintAddress);
|
|
189
|
-
// Get associated token account
|
|
190
|
-
const ata = await splToken.getAssociatedTokenAddress(mintPubkey, ownerPubkey);
|
|
191
|
-
let rawBalance = 0n;
|
|
192
|
-
let decimals = 9;
|
|
193
|
-
try {
|
|
194
|
-
const accountInfo = await splToken.getAccount(connection, ata);
|
|
195
|
-
rawBalance = accountInfo.amount;
|
|
196
|
-
// Get mint info for decimals
|
|
197
|
-
const mintInfo = await splToken.getMint(connection, mintPubkey);
|
|
198
|
-
decimals = mintInfo.decimals;
|
|
199
|
-
}
|
|
200
|
-
catch {
|
|
201
|
-
// Token account doesn't exist — balance is 0
|
|
202
|
-
}
|
|
203
|
-
const humanBalance = (Number(rawBalance) / 10 ** decimals).toFixed(decimals).replace(/\.?0+$/, '') || '0';
|
|
204
|
-
return { mint: mintAddress, rawBalance, humanBalance, decimals };
|
|
205
|
-
}
|
|
206
|
-
/**
|
|
207
|
-
* Send native SOL to a recipient.
|
|
208
|
-
* @param to - Recipient base-58 public key
|
|
209
|
-
* @param amount - Lamports (bigint) OR SOL amount as string (e.g. "1.5")
|
|
210
|
-
*/
|
|
211
|
-
async sendSol(to, amount) {
|
|
212
|
-
const { PublicKey, SystemProgram, Transaction, sendAndConfirmTransaction } = await loadSolanaWeb3();
|
|
213
|
-
const connection = await this.getConnection();
|
|
214
|
-
const keypair = await this.getKeypair();
|
|
215
|
-
let lamports;
|
|
216
|
-
if (typeof amount === 'string') {
|
|
217
|
-
// Parse SOL string (9 decimals)
|
|
218
|
-
const parts = amount.split('.');
|
|
219
|
-
const intPart = BigInt(parts[0] || '0');
|
|
220
|
-
const fracStr = (parts[1] ?? '').padEnd(9, '0').slice(0, 9);
|
|
221
|
-
lamports = intPart * 1000000000n + BigInt(fracStr);
|
|
222
|
-
}
|
|
223
|
-
else {
|
|
224
|
-
lamports = amount;
|
|
225
|
-
}
|
|
226
|
-
const transaction = new Transaction().add(SystemProgram.transfer({
|
|
227
|
-
fromPubkey: keypair.publicKey,
|
|
228
|
-
toPubkey: new PublicKey(to),
|
|
229
|
-
lamports: Number(lamports),
|
|
230
|
-
}));
|
|
231
|
-
const signature = await sendAndConfirmTransaction(connection, transaction, [keypair]);
|
|
232
|
-
return { signature };
|
|
233
|
-
}
|
|
234
|
-
/**
|
|
235
|
-
* Send SPL tokens to a recipient.
|
|
236
|
-
* Creates the recipient's associated token account if it doesn't exist.
|
|
237
|
-
*
|
|
238
|
-
* @param to - Recipient base-58 public key
|
|
239
|
-
* @param amount - Raw token units (bigint) OR human-readable string
|
|
240
|
-
* @param mintAddress - SPL token mint address (base-58)
|
|
241
|
-
*/
|
|
242
|
-
async sendSplToken(to, amount, mintAddress) {
|
|
243
|
-
const { PublicKey } = await loadSolanaWeb3();
|
|
244
|
-
const splToken = await loadSplToken();
|
|
245
|
-
const connection = await this.getConnection();
|
|
246
|
-
const keypair = await this.getKeypair();
|
|
247
|
-
const mintPubkey = new PublicKey(mintAddress);
|
|
248
|
-
const toPubkey = new PublicKey(to);
|
|
249
|
-
// Get mint info for decimals
|
|
250
|
-
const mintInfo = await splToken.getMint(connection, mintPubkey);
|
|
251
|
-
const { decimals } = mintInfo;
|
|
252
|
-
// Parse amount
|
|
253
|
-
let rawAmount;
|
|
254
|
-
if (typeof amount === 'string') {
|
|
255
|
-
const parts = amount.split('.');
|
|
256
|
-
const intPart = BigInt(parts[0] || '0');
|
|
257
|
-
const fracStr = (parts[1] ?? '').padEnd(decimals, '0').slice(0, decimals);
|
|
258
|
-
rawAmount = intPart * (10n ** BigInt(decimals)) + BigInt(fracStr);
|
|
259
|
-
}
|
|
260
|
-
else {
|
|
261
|
-
rawAmount = amount;
|
|
262
|
-
}
|
|
263
|
-
// Get sender's associated token account
|
|
264
|
-
const fromAta = await splToken.getAssociatedTokenAddress(mintPubkey, keypair.publicKey);
|
|
265
|
-
// Get or create recipient's associated token account
|
|
266
|
-
const toAta = await splToken.getAssociatedTokenAddress(mintPubkey, toPubkey);
|
|
267
|
-
// Build instructions
|
|
268
|
-
const instructions = [];
|
|
269
|
-
// Check if recipient ATA exists
|
|
270
|
-
const toAtaInfo = await connection.getAccountInfo(toAta);
|
|
271
|
-
if (!toAtaInfo) {
|
|
272
|
-
instructions.push(splToken.createAssociatedTokenAccountInstruction(keypair.publicKey, // payer
|
|
273
|
-
toAta, toPubkey, mintPubkey));
|
|
274
|
-
}
|
|
275
|
-
// Transfer instruction
|
|
276
|
-
instructions.push(splToken.createTransferInstruction(fromAta, toAta, keypair.publicKey, rawAmount));
|
|
277
|
-
const { Transaction, sendAndConfirmTransaction } = await loadSolanaWeb3();
|
|
278
|
-
const transaction = new Transaction().add(...instructions);
|
|
279
|
-
const signature = await sendAndConfirmTransaction(connection, transaction, [keypair]);
|
|
280
|
-
return { signature };
|
|
281
|
-
}
|
|
282
|
-
/**
|
|
283
|
-
* List all SPL token accounts for the wallet.
|
|
284
|
-
*/
|
|
285
|
-
async listSplTokenAccounts() {
|
|
286
|
-
const splToken = await loadSplToken();
|
|
287
|
-
const connection = await this.getConnection();
|
|
288
|
-
const keypair = await this.getKeypair();
|
|
289
|
-
const tokenAccounts = await connection.getParsedTokenAccountsByOwner(keypair.publicKey, { programId: splToken.TOKEN_PROGRAM_ID });
|
|
290
|
-
return tokenAccounts.value.map((acc) => {
|
|
291
|
-
const info = acc.account.data.parsed.info;
|
|
292
|
-
return {
|
|
293
|
-
mint: info.mint,
|
|
294
|
-
amount: BigInt(info.tokenAmount.amount),
|
|
295
|
-
decimals: info.tokenAmount.decimals,
|
|
296
|
-
};
|
|
297
|
-
});
|
|
298
|
-
}
|
|
299
|
-
}
|
|
300
|
-
/**
|
|
301
|
-
* Create a SolanaWallet instance.
|
|
302
|
-
*/
|
|
303
|
-
export function createSolanaWallet(config) {
|
|
304
|
-
return new SolanaWallet(config);
|
|
305
|
-
}
|
|
306
|
-
//# sourceMappingURL=solana.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"solana.js","sourceRoot":"","sources":["../../src/tokens/solana.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,iFAAiF;AACjF,EAAE;AACF,wDAAwD;AACxD,oDAAoD;AAEpD,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,mEAAmE;IACnE,GAAG,EAAG,IAAY,EAAE,qBAAqB;IAEzC,2CAA2C;IAC3C,IAAI,EAAE,8CAA8C;IAEpD,mCAAmC;IACnC,IAAI,EAAE,8CAA8C;IAEpD,UAAU;IACV,GAAG,EAAG,8CAA8C;IAEpD,yCAA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IAAI,CAAC,WAAW,CAAC,MAAM,CAAC;gBACvC,QAAQ,EAAE,IAAI,CAAC,WAAW,CAAC,QAAQ;aACpC,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AAED;;GAEG;AACH,MAAM,UAAU,kBAAkB,CAAC,MAA0B;IAC3D,OAAO,IAAI,YAAY,CAAC,MAAM,CAAC,CAAC;AAClC,CAAC"}
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @module tokens/transfers
|
|
3
|
-
* Multi-token transfer utilities for AgentWallet v6.
|
|
4
|
-
*
|
|
5
|
-
* Provides send/balance functions for any ERC-20 token or native gas token,
|
|
6
|
-
* with flexible amount input (raw bigint or human-readable string).
|
|
7
|
-
*
|
|
8
|
-
* All transfer functions go through viem's wallet client — they do NOT
|
|
9
|
-
* route through the AgentAccountV2 contract (use agentTransferToken for that).
|
|
10
|
-
* These are direct EOA/smart-wallet operations for wallets that hold the key.
|
|
11
|
-
*/
|
|
12
|
-
import { type Address, type Hash, type PublicClient, type WalletClient } from 'viem';
|
|
13
|
-
export interface TransferOptions {
|
|
14
|
-
/** Gas price override */
|
|
15
|
-
gasPrice?: bigint;
|
|
16
|
-
/** Max fee per gas (EIP-1559) */
|
|
17
|
-
maxFeePerGas?: bigint;
|
|
18
|
-
/** Max priority fee per gas (EIP-1559) */
|
|
19
|
-
maxPriorityFeePerGas?: bigint;
|
|
20
|
-
/** Gas limit override */
|
|
21
|
-
gas?: bigint;
|
|
22
|
-
/** Chain ID for multi-chain operations */
|
|
23
|
-
chainId?: number;
|
|
24
|
-
}
|
|
25
|
-
export interface TokenBalanceResult {
|
|
26
|
-
address: Address;
|
|
27
|
-
symbol: string;
|
|
28
|
-
name: string;
|
|
29
|
-
decimals: number;
|
|
30
|
-
rawBalance: bigint;
|
|
31
|
-
humanBalance: string;
|
|
32
|
-
formatted: string;
|
|
33
|
-
}
|
|
34
|
-
export interface NativeBalanceResult {
|
|
35
|
-
symbol: string;
|
|
36
|
-
decimals: number;
|
|
37
|
-
rawBalance: bigint;
|
|
38
|
-
humanBalance: string;
|
|
39
|
-
}
|
|
40
|
-
export interface TransferContext {
|
|
41
|
-
publicClient: PublicClient;
|
|
42
|
-
walletClient: WalletClient;
|
|
43
|
-
/** Caller's address (used as from address) */
|
|
44
|
-
account: Address;
|
|
45
|
-
/** Chain ID for registry lookups */
|
|
46
|
-
chainId?: number;
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* Send any ERC-20 token.
|
|
50
|
-
*
|
|
51
|
-
* @param ctx - Public + wallet clients and account
|
|
52
|
-
* @param to - Recipient address
|
|
53
|
-
* @param amount - Amount as raw bigint OR human-readable string (requires tokenAddress decimals lookup)
|
|
54
|
-
* @param tokenAddress - ERC-20 contract address
|
|
55
|
-
* @param options - Optional gas overrides
|
|
56
|
-
*/
|
|
57
|
-
export declare function sendToken(ctx: TransferContext, to: Address, amount: string | bigint, tokenAddress: Address, options?: TransferOptions): Promise<Hash>;
|
|
58
|
-
/**
|
|
59
|
-
* Send native gas token (ETH, MATIC, AVAX, etc.).
|
|
60
|
-
*
|
|
61
|
-
* @param ctx - Transfer context
|
|
62
|
-
* @param to - Recipient address
|
|
63
|
-
* @param amount - Raw bigint OR human-readable string (18 decimals for ETH/MATIC/AVAX)
|
|
64
|
-
* @param options - Optional gas overrides
|
|
65
|
-
*/
|
|
66
|
-
export declare function sendNative(ctx: TransferContext, to: Address, amount: string | bigint, options?: TransferOptions): Promise<Hash>;
|
|
67
|
-
/**
|
|
68
|
-
* Get the ERC-20 balance of the current account (or a specified address).
|
|
69
|
-
*
|
|
70
|
-
* @param ctx - Transfer context
|
|
71
|
-
* @param tokenAddress - ERC-20 contract address
|
|
72
|
-
* @param holder - Address to check (defaults to ctx.account)
|
|
73
|
-
*/
|
|
74
|
-
export declare function getTokenBalance(ctx: TransferContext, tokenAddress: Address, holder?: Address): Promise<TokenBalanceResult>;
|
|
75
|
-
/**
|
|
76
|
-
* Get the native gas token balance of the current account (or a specified address).
|
|
77
|
-
*
|
|
78
|
-
* @param ctx - Transfer context
|
|
79
|
-
* @param holder - Address to check (defaults to ctx.account)
|
|
80
|
-
*/
|
|
81
|
-
export declare function getNativeBalance(ctx: TransferContext, holder?: Address): Promise<NativeBalanceResult>;
|
|
82
|
-
/**
|
|
83
|
-
* Batch query balances for multiple ERC-20 tokens.
|
|
84
|
-
*
|
|
85
|
-
* @param ctx - Transfer context
|
|
86
|
-
* @param tokenAddresses - List of ERC-20 addresses to query (or null/empty for all registry tokens)
|
|
87
|
-
* @param holder - Address to check (defaults to ctx.account)
|
|
88
|
-
*/
|
|
89
|
-
export declare function getBalances(ctx: TransferContext, tokenAddresses?: Address[], holder?: Address): Promise<TokenBalanceResult[]>;
|
|
90
|
-
/**
|
|
91
|
-
* Encode an ERC-20 transfer call as raw calldata.
|
|
92
|
-
* Useful for building calldata for agentExecute() or multicall.
|
|
93
|
-
*/
|
|
94
|
-
export declare function encodeERC20Transfer(to: Address, amount: bigint): `0x${string}`;
|
|
95
|
-
//# sourceMappingURL=transfers.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"transfers.d.ts","sourceRoot":"","sources":["../../src/tokens/transfers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAGL,KAAK,OAAO,EACZ,KAAK,IAAI,EACT,KAAK,YAAY,EACjB,KAAK,YAAY,EAElB,MAAM,MAAM,CAAC;AAiBd,MAAM,WAAW,eAAe;IAC9B,yBAAyB;IACzB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,iCAAiC;IACjC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,0CAA0C;IAC1C,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,yBAAyB;IACzB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,0CAA0C;IAC1C,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,kBAAkB;I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;AAED;;;;;;GAMG;AACH,wBAAsB,WAAW,CAC/B,GAAG,EAAE,eAAe,EACpB,cAAc,CAAC,EAAE,OAAO,EAAE,EAC1B,MAAM,CAAC,EAAE,OAAO,GACf,OAAO,CAAC,kBAAkB,EAAE,CAAC,CAyB/B;AAwBD;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,GAAG,KAAK,MAAM,EAAE,CAM9E"}
|
package/dist/tokens/transfers.js
DELETED
|
@@ -1,196 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @module tokens/transfers
|
|
3
|
-
* Multi-token transfer utilities for AgentWallet v6.
|
|
4
|
-
*
|
|
5
|
-
* Provides send/balance functions for any ERC-20 token or native gas token,
|
|
6
|
-
* with flexible amount input (raw bigint or human-readable string).
|
|
7
|
-
*
|
|
8
|
-
* All transfer functions go through viem's wallet client — they do NOT
|
|
9
|
-
* route through the AgentAccountV2 contract (use agentTransferToken for that).
|
|
10
|
-
* These are direct EOA/smart-wallet operations for wallets that hold the key.
|
|
11
|
-
*/
|
|
12
|
-
import { encodeFunctionData, parseAbi, zeroAddress, } from 'viem';
|
|
13
|
-
import { getGlobalRegistry } from './registry.js';
|
|
14
|
-
import { parseAmount, toHuman, formatBalance } from './decimals.js';
|
|
15
|
-
// ─── ERC20 ABI (minimal) ─────────────────────────────────────────────────────
|
|
16
|
-
const ERC20_ABI = parseAbi([
|
|
17
|
-
'function transfer(address to, uint256 amount) returns (bool)',
|
|
18
|
-
'function balanceOf(address account) view returns (uint256)',
|
|
19
|
-
'function decimals() view returns (uint8)',
|
|
20
|
-
'function symbol() view returns (string)',
|
|
21
|
-
'function name() view returns (string)',
|
|
22
|
-
]);
|
|
23
|
-
// ─── Core transfer functions ──────────────────────────────────────────────────
|
|
24
|
-
/**
|
|
25
|
-
* Send any ERC-20 token.
|
|
26
|
-
*
|
|
27
|
-
* @param ctx - Public + wallet clients and account
|
|
28
|
-
* @param to - Recipient address
|
|
29
|
-
* @param amount - Amount as raw bigint OR human-readable string (requires tokenAddress decimals lookup)
|
|
30
|
-
* @param tokenAddress - ERC-20 contract address
|
|
31
|
-
* @param options - Optional gas overrides
|
|
32
|
-
*/
|
|
33
|
-
export async function sendToken(ctx, to, amount, tokenAddress, options = {}) {
|
|
34
|
-
let rawAmount;
|
|
35
|
-
if (typeof amount === 'string') {
|
|
36
|
-
// Need decimals to parse string amount
|
|
37
|
-
let decimals;
|
|
38
|
-
// Try registry first
|
|
39
|
-
if (ctx.chainId != null) {
|
|
40
|
-
const entry = getGlobalRegistry().getTokenByAddress(tokenAddress, ctx.chainId);
|
|
41
|
-
decimals = entry?.decimals ?? await fetchTokenDecimals(ctx.publicClient, tokenAddress);
|
|
42
|
-
}
|
|
43
|
-
else {
|
|
44
|
-
decimals = await fetchTokenDecimals(ctx.publicClient, tokenAddress);
|
|
45
|
-
}
|
|
46
|
-
rawAmount = parseAmount(amount, decimals);
|
|
47
|
-
}
|
|
48
|
-
else {
|
|
49
|
-
rawAmount = amount;
|
|
50
|
-
}
|
|
51
|
-
const data = encodeFunctionData({
|
|
52
|
-
abi: ERC20_ABI,
|
|
53
|
-
functionName: 'transfer',
|
|
54
|
-
args: [to, rawAmount],
|
|
55
|
-
});
|
|
56
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
57
|
-
return ctx.walletClient.sendTransaction({
|
|
58
|
-
account: ctx.account,
|
|
59
|
-
to: tokenAddress,
|
|
60
|
-
data,
|
|
61
|
-
...buildGasOptions(options),
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
/**
|
|
65
|
-
* Send native gas token (ETH, MATIC, AVAX, etc.).
|
|
66
|
-
*
|
|
67
|
-
* @param ctx - Transfer context
|
|
68
|
-
* @param to - Recipient address
|
|
69
|
-
* @param amount - Raw bigint OR human-readable string (18 decimals for ETH/MATIC/AVAX)
|
|
70
|
-
* @param options - Optional gas overrides
|
|
71
|
-
*/
|
|
72
|
-
export async function sendNative(ctx, to, amount, options = {}) {
|
|
73
|
-
const rawAmount = parseAmount(amount, 18);
|
|
74
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
75
|
-
return ctx.walletClient.sendTransaction({
|
|
76
|
-
account: ctx.account,
|
|
77
|
-
to,
|
|
78
|
-
value: rawAmount,
|
|
79
|
-
...buildGasOptions(options),
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
|
-
/**
|
|
83
|
-
* Get the ERC-20 balance of the current account (or a specified address).
|
|
84
|
-
*
|
|
85
|
-
* @param ctx - Transfer context
|
|
86
|
-
* @param tokenAddress - ERC-20 contract address
|
|
87
|
-
* @param holder - Address to check (defaults to ctx.account)
|
|
88
|
-
*/
|
|
89
|
-
export async function getTokenBalance(ctx, tokenAddress, holder) {
|
|
90
|
-
const target = holder ?? ctx.account;
|
|
91
|
-
// Batch read: balanceOf + decimals + symbol + name
|
|
92
|
-
const [rawBalance, decimals, symbol, name] = await Promise.all([
|
|
93
|
-
ctx.publicClient.readContract({
|
|
94
|
-
address: tokenAddress,
|
|
95
|
-
abi: ERC20_ABI,
|
|
96
|
-
functionName: 'balanceOf',
|
|
97
|
-
args: [target],
|
|
98
|
-
}),
|
|
99
|
-
ctx.publicClient.readContract({
|
|
100
|
-
address: tokenAddress,
|
|
101
|
-
abi: ERC20_ABI,
|
|
102
|
-
functionName: 'decimals',
|
|
103
|
-
}),
|
|
104
|
-
ctx.publicClient.readContract({
|
|
105
|
-
address: tokenAddress,
|
|
106
|
-
abi: ERC20_ABI,
|
|
107
|
-
functionName: 'symbol',
|
|
108
|
-
}),
|
|
109
|
-
ctx.publicClient.readContract({
|
|
110
|
-
address: tokenAddress,
|
|
111
|
-
abi: ERC20_ABI,
|
|
112
|
-
functionName: 'name',
|
|
113
|
-
}),
|
|
114
|
-
]);
|
|
115
|
-
const humanBalance = toHuman(rawBalance, decimals);
|
|
116
|
-
const formatted = formatBalance(rawBalance, { symbol, decimals });
|
|
117
|
-
return { address: tokenAddress, symbol, name, decimals, rawBalance, humanBalance, formatted };
|
|
118
|
-
}
|
|
119
|
-
/**
|
|
120
|
-
* Get the native gas token balance of the current account (or a specified address).
|
|
121
|
-
*
|
|
122
|
-
* @param ctx - Transfer context
|
|
123
|
-
* @param holder - Address to check (defaults to ctx.account)
|
|
124
|
-
*/
|
|
125
|
-
export async function getNativeBalance(ctx, holder) {
|
|
126
|
-
const target = holder ?? ctx.account;
|
|
127
|
-
const rawBalance = await ctx.publicClient.getBalance({ address: target });
|
|
128
|
-
// Determine native token symbol from registry if chainId is known
|
|
129
|
-
let symbol = 'ETH';
|
|
130
|
-
if (ctx.chainId != null) {
|
|
131
|
-
const native = getGlobalRegistry().getTokenByAddress(zeroAddress, ctx.chainId);
|
|
132
|
-
symbol = native?.symbol ?? 'ETH';
|
|
133
|
-
}
|
|
134
|
-
const humanBalance = toHuman(rawBalance, 18);
|
|
135
|
-
return { symbol, decimals: 18, rawBalance, humanBalance };
|
|
136
|
-
}
|
|
137
|
-
/**
|
|
138
|
-
* Batch query balances for multiple ERC-20 tokens.
|
|
139
|
-
*
|
|
140
|
-
* @param ctx - Transfer context
|
|
141
|
-
* @param tokenAddresses - List of ERC-20 addresses to query (or null/empty for all registry tokens)
|
|
142
|
-
* @param holder - Address to check (defaults to ctx.account)
|
|
143
|
-
*/
|
|
144
|
-
export async function getBalances(ctx, tokenAddresses, holder) {
|
|
145
|
-
const target = holder ?? ctx.account;
|
|
146
|
-
let addresses = tokenAddresses;
|
|
147
|
-
// If no addresses provided and chainId is known, use all registry tokens
|
|
148
|
-
if (!addresses || addresses.length === 0) {
|
|
149
|
-
if (ctx.chainId != null) {
|
|
150
|
-
const tokens = getGlobalRegistry().listTokens(ctx.chainId);
|
|
151
|
-
addresses = tokens
|
|
152
|
-
.filter(t => !t.isNative)
|
|
153
|
-
.map(t => t.address);
|
|
154
|
-
}
|
|
155
|
-
else {
|
|
156
|
-
return [];
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
// Parallel balance fetches
|
|
160
|
-
const results = await Promise.allSettled(addresses.map(addr => getTokenBalance(ctx, addr, target)));
|
|
161
|
-
return results
|
|
162
|
-
.filter((r) => r.status === 'fulfilled')
|
|
163
|
-
.map(r => r.value);
|
|
164
|
-
}
|
|
165
|
-
// ─── Helpers ──────────────────────────────────────────────────────────────────
|
|
166
|
-
async function fetchTokenDecimals(publicClient, tokenAddress) {
|
|
167
|
-
return publicClient.readContract({
|
|
168
|
-
address: tokenAddress,
|
|
169
|
-
abi: ERC20_ABI,
|
|
170
|
-
functionName: 'decimals',
|
|
171
|
-
});
|
|
172
|
-
}
|
|
173
|
-
function buildGasOptions(options) {
|
|
174
|
-
const gas = {};
|
|
175
|
-
if (options.gas != null)
|
|
176
|
-
gas.gas = options.gas;
|
|
177
|
-
if (options.gasPrice != null)
|
|
178
|
-
gas.gasPrice = options.gasPrice;
|
|
179
|
-
if (options.maxFeePerGas != null)
|
|
180
|
-
gas.maxFeePerGas = options.maxFeePerGas;
|
|
181
|
-
if (options.maxPriorityFeePerGas != null)
|
|
182
|
-
gas.maxPriorityFeePerGas = options.maxPriorityFeePerGas;
|
|
183
|
-
return gas;
|
|
184
|
-
}
|
|
185
|
-
/**
|
|
186
|
-
* Encode an ERC-20 transfer call as raw calldata.
|
|
187
|
-
* Useful for building calldata for agentExecute() or multicall.
|
|
188
|
-
*/
|
|
189
|
-
export function encodeERC20Transfer(to, amount) {
|
|
190
|
-
return encodeFunctionData({
|
|
191
|
-
abi: ERC20_ABI,
|
|
192
|
-
functionName: 'transfer',
|
|
193
|
-
args: [to, amount],
|
|
194
|
-
});
|
|
195
|
-
}
|
|
196
|
-
//# sourceMappingURL=transfers.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"transfers.js","sourceRoot":"","sources":["../../src/tokens/transfers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EACL,kBAAkB,EAClB,QAAQ,EAKR,WAAW,GACZ,MA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