moltspay 0.5.4 → 0.7.1
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 +0 -124
- package/dist/cdp/index.d.mts +111 -0
- package/dist/cdp/index.d.ts +111 -0
- package/dist/cdp/index.js +30655 -0
- package/dist/cdp/index.js.map +1 -0
- package/dist/cdp/index.mjs +30631 -0
- package/dist/cdp/index.mjs.map +1 -0
- package/dist/chains/index.d.mts +1 -1
- package/dist/chains/index.d.ts +1 -1
- package/dist/cli/index.js +990 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/index.mjs +967 -0
- package/dist/cli/index.mjs.map +1 -0
- package/dist/client/index.d.mts +134 -0
- package/dist/client/index.d.ts +134 -0
- package/dist/client/index.js +331 -0
- package/dist/client/index.js.map +1 -0
- package/dist/client/index.mjs +296 -0
- package/dist/client/index.mjs.map +1 -0
- package/dist/createWallet-D53qu7ie.d.mts +77 -0
- package/dist/createWallet-D53qu7ie.d.ts +77 -0
- package/dist/index-Dg8n6wdW.d.mts +32 -0
- package/dist/index-Dg8n6wdW.d.ts +32 -0
- package/dist/index.d.mts +6 -1483
- package/dist/index.d.ts +6 -1483
- package/dist/index.js +31039 -4254
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +31042 -4203
- package/dist/index.mjs.map +1 -1
- package/dist/server/index.d.mts +120 -0
- package/dist/server/index.d.ts +120 -0
- package/dist/server/index.js +418 -0
- package/dist/server/index.js.map +1 -0
- package/dist/server/index.mjs +393 -0
- package/dist/server/index.mjs.map +1 -0
- package/dist/wallet/index.d.mts +3 -451
- package/dist/wallet/index.d.ts +3 -451
- package/dist/wallet/index.js +5 -1021
- package/dist/wallet/index.js.map +1 -1
- package/dist/wallet/index.mjs +16 -1015
- package/dist/wallet/index.mjs.map +1 -1
- package/package.json +19 -19
- package/dist/cli.js +0 -1984
- package/dist/cli.js.map +0 -1
- package/dist/cli.mjs +0 -1969
- package/dist/cli.mjs.map +0 -1
- package/dist/guide/index.d.mts +0 -39
- package/dist/guide/index.d.ts +0 -39
- package/dist/guide/index.js +0 -181
- package/dist/guide/index.js.map +0 -1
- package/dist/guide/index.mjs +0 -152
- package/dist/guide/index.mjs.map +0 -1
- package/dist/index-CyFg9s2m.d.mts +0 -161
- package/dist/index-CyFg9s2m.d.ts +0 -161
- package/dist/orders/index.d.mts +0 -97
- package/dist/orders/index.d.ts +0 -97
- package/dist/orders/index.js +0 -162
- package/dist/orders/index.js.map +0 -1
- package/dist/orders/index.mjs +0 -136
- package/dist/orders/index.mjs.map +0 -1
- package/dist/permit/index.d.mts +0 -49
- package/dist/permit/index.d.ts +0 -49
- package/dist/permit/index.js +0 -273
- package/dist/permit/index.js.map +0 -1
- package/dist/permit/index.mjs +0 -246
- package/dist/permit/index.mjs.map +0 -1
- /package/dist/{cli.d.mts → cli/index.d.mts} +0 -0
- /package/dist/{cli.d.ts → cli/index.d.ts} +0 -0
package/dist/wallet/index.d.mts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { C as ChainName, a as ChainConfig, W as WalletBalance,
|
|
1
|
+
import { C as ChainName, a as ChainConfig, W as WalletBalance, T as TransferResult } from '../index-Dg8n6wdW.mjs';
|
|
2
|
+
export { C as CreateWalletOptions, a as CreateWalletResult, W as WalletData, c as createWallet, g as getWalletAddress, l as loadWallet, w as walletExists } from '../createWallet-D53qu7ie.mjs';
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* Wallet - Basic Custody Wallet
|
|
@@ -39,453 +40,4 @@ declare class Wallet {
|
|
|
39
40
|
getUsdcBalance(): Promise<string>;
|
|
40
41
|
}
|
|
41
42
|
|
|
42
|
-
|
|
43
|
-
private wallet;
|
|
44
|
-
private limits;
|
|
45
|
-
private whitelist;
|
|
46
|
-
private auditLog;
|
|
47
|
-
private dailyTotal;
|
|
48
|
-
private dailyDate;
|
|
49
|
-
private pendingTransfers;
|
|
50
|
-
constructor(config?: SecureWalletConfig);
|
|
51
|
-
/**
|
|
52
|
-
* Get wallet address
|
|
53
|
-
*/
|
|
54
|
-
get address(): string;
|
|
55
|
-
/**
|
|
56
|
-
* Get balance
|
|
57
|
-
*/
|
|
58
|
-
getBalance(): Promise<WalletBalance>;
|
|
59
|
-
/**
|
|
60
|
-
* Secure transfer (with limit and whitelist checks)
|
|
61
|
-
*
|
|
62
|
-
* Supports two calling methods:
|
|
63
|
-
* - transfer({ to, amount, reason?, requester? })
|
|
64
|
-
* - transfer(to, amount)
|
|
65
|
-
*/
|
|
66
|
-
transfer(paramsOrTo: TransferParams | string, amountArg?: number | string): Promise<TransferResult>;
|
|
67
|
-
/**
|
|
68
|
-
* Approve pending transfer
|
|
69
|
-
*/
|
|
70
|
-
approve(requestId: string, approver: string): Promise<TransferResult>;
|
|
71
|
-
/**
|
|
72
|
-
* Reject pending transfer
|
|
73
|
-
*/
|
|
74
|
-
reject(requestId: string, rejecter: string, reason?: string): Promise<void>;
|
|
75
|
-
/**
|
|
76
|
-
* Add to whitelist
|
|
77
|
-
*/
|
|
78
|
-
addToWhitelist(address: string, addedBy: string): Promise<void>;
|
|
79
|
-
/**
|
|
80
|
-
* Remove from whitelist
|
|
81
|
-
*/
|
|
82
|
-
removeFromWhitelist(address: string, removedBy: string): Promise<void>;
|
|
83
|
-
/**
|
|
84
|
-
* Check if address is whitelisted
|
|
85
|
-
*/
|
|
86
|
-
isWhitelisted(address: string): boolean;
|
|
87
|
-
/**
|
|
88
|
-
* Get pending transfers list
|
|
89
|
-
*/
|
|
90
|
-
getPendingTransfers(): PendingTransfer[];
|
|
91
|
-
/**
|
|
92
|
-
* Get current limit config
|
|
93
|
-
*/
|
|
94
|
-
getLimits(): SecurityLimits;
|
|
95
|
-
/**
|
|
96
|
-
* Get daily used amount
|
|
97
|
-
*/
|
|
98
|
-
getDailyUsed(): number;
|
|
99
|
-
/**
|
|
100
|
-
* Update daily limit counter
|
|
101
|
-
*/
|
|
102
|
-
private updateDailyTotal;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
/**
|
|
106
|
-
* createWallet - Create a new wallet for Agent
|
|
107
|
-
*
|
|
108
|
-
* Features:
|
|
109
|
-
* - Generate new Ethereum wallet
|
|
110
|
-
* - Securely store private key (encrypted or plaintext, depending on config)
|
|
111
|
-
* - Return wallet address (never return private key)
|
|
112
|
-
*/
|
|
113
|
-
interface CreateWalletOptions {
|
|
114
|
-
/** Storage path, default ~/.moltspay/wallet.json */
|
|
115
|
-
storagePath?: string;
|
|
116
|
-
/** Encryption password (optional, plaintext if not provided) */
|
|
117
|
-
password?: string;
|
|
118
|
-
/** Wallet label/name */
|
|
119
|
-
label?: string;
|
|
120
|
-
/** Overwrite if wallet exists */
|
|
121
|
-
overwrite?: boolean;
|
|
122
|
-
}
|
|
123
|
-
interface WalletData {
|
|
124
|
-
address: string;
|
|
125
|
-
label?: string;
|
|
126
|
-
createdAt: string;
|
|
127
|
-
encrypted: boolean;
|
|
128
|
-
/** Encrypted or plaintext private key */
|
|
129
|
-
privateKey: string;
|
|
130
|
-
/** Encryption IV */
|
|
131
|
-
iv?: string;
|
|
132
|
-
/** Encryption salt */
|
|
133
|
-
salt?: string;
|
|
134
|
-
}
|
|
135
|
-
interface CreateWalletResult {
|
|
136
|
-
success: boolean;
|
|
137
|
-
address?: string;
|
|
138
|
-
storagePath?: string;
|
|
139
|
-
error?: string;
|
|
140
|
-
/** Whether newly created (false means loaded existing) */
|
|
141
|
-
isNew?: boolean;
|
|
142
|
-
}
|
|
143
|
-
/**
|
|
144
|
-
* Create new wallet
|
|
145
|
-
*
|
|
146
|
-
* @example
|
|
147
|
-
* ```typescript
|
|
148
|
-
* // Create unencrypted wallet
|
|
149
|
-
* const result = await createWallet();
|
|
150
|
-
* console.log('Wallet address:', result.address);
|
|
151
|
-
*
|
|
152
|
-
* // Create encrypted wallet
|
|
153
|
-
* const result = await createWallet({ password: 'mySecurePassword' });
|
|
154
|
-
*
|
|
155
|
-
* // Specify storage path
|
|
156
|
-
* const result = await createWallet({ storagePath: './my-wallet.json' });
|
|
157
|
-
* ```
|
|
158
|
-
*/
|
|
159
|
-
declare function createWallet(options?: CreateWalletOptions): CreateWalletResult;
|
|
160
|
-
/**
|
|
161
|
-
* Load existing wallet
|
|
162
|
-
*/
|
|
163
|
-
declare function loadWallet(options?: {
|
|
164
|
-
storagePath?: string;
|
|
165
|
-
password?: string;
|
|
166
|
-
}): {
|
|
167
|
-
success: boolean;
|
|
168
|
-
address?: string;
|
|
169
|
-
privateKey?: string;
|
|
170
|
-
error?: string;
|
|
171
|
-
};
|
|
172
|
-
/**
|
|
173
|
-
* Get wallet address (no password required)
|
|
174
|
-
*/
|
|
175
|
-
declare function getWalletAddress(storagePath?: string): string | null;
|
|
176
|
-
/**
|
|
177
|
-
* Check if wallet exists
|
|
178
|
-
*/
|
|
179
|
-
declare function walletExists(storagePath?: string): boolean;
|
|
180
|
-
|
|
181
|
-
/**
|
|
182
|
-
* PermitWallet - Pay using Boss's Permit authorization
|
|
183
|
-
*
|
|
184
|
-
* Scenario:
|
|
185
|
-
* - Agent doesn't have USDC, but Boss gave a Permit authorization
|
|
186
|
-
* - Agent uses Permit signature + own wallet to execute transferFrom
|
|
187
|
-
* - Agent only needs small amount of ETH for gas, USDC is deducted from Boss's wallet
|
|
188
|
-
*/
|
|
189
|
-
|
|
190
|
-
interface PermitData {
|
|
191
|
-
/** Boss's wallet address (USDC holder) */
|
|
192
|
-
owner: string;
|
|
193
|
-
/** Agent's wallet address (authorized spender) */
|
|
194
|
-
spender: string;
|
|
195
|
-
/** Authorized amount (USDC, raw 6 decimal value) */
|
|
196
|
-
value: string;
|
|
197
|
-
/** Expiration timestamp */
|
|
198
|
-
deadline: number;
|
|
199
|
-
/** Signature v */
|
|
200
|
-
v: number;
|
|
201
|
-
/** Signature r */
|
|
202
|
-
r: string;
|
|
203
|
-
/** Signature s */
|
|
204
|
-
s: string;
|
|
205
|
-
}
|
|
206
|
-
interface PermitWalletConfig {
|
|
207
|
-
chain?: ChainName;
|
|
208
|
-
/** Agent's private key (for executing transactions) */
|
|
209
|
-
privateKey?: string;
|
|
210
|
-
/** Load private key from file */
|
|
211
|
-
walletPath?: string;
|
|
212
|
-
/** Decryption password */
|
|
213
|
-
walletPassword?: string;
|
|
214
|
-
rpcUrl?: string;
|
|
215
|
-
}
|
|
216
|
-
interface TransferWithPermitParams {
|
|
217
|
-
/** Recipient address */
|
|
218
|
-
to: string;
|
|
219
|
-
/** Amount (USDC) */
|
|
220
|
-
amount: number;
|
|
221
|
-
/** Boss-signed Permit data */
|
|
222
|
-
permit: PermitData;
|
|
223
|
-
}
|
|
224
|
-
interface TransferWithPermitResult extends TransferResult {
|
|
225
|
-
/** Permit transaction hash */
|
|
226
|
-
permitTxHash?: string;
|
|
227
|
-
/** Transfer transaction hash */
|
|
228
|
-
transferTxHash?: string;
|
|
229
|
-
}
|
|
230
|
-
declare class PermitWallet {
|
|
231
|
-
readonly chain: ChainName;
|
|
232
|
-
readonly chainConfig: ChainConfig;
|
|
233
|
-
readonly address: string;
|
|
234
|
-
private wallet;
|
|
235
|
-
private provider;
|
|
236
|
-
private usdcContract;
|
|
237
|
-
constructor(config?: PermitWalletConfig);
|
|
238
|
-
/**
|
|
239
|
-
* Check if Permit is valid (current allowance)
|
|
240
|
-
*/
|
|
241
|
-
checkPermitAllowance(owner: string): Promise<string>;
|
|
242
|
-
/**
|
|
243
|
-
* Pay using Permit authorization
|
|
244
|
-
*
|
|
245
|
-
* Flow:
|
|
246
|
-
* 1. Call permit() to record Boss's authorization in the contract
|
|
247
|
-
* 2. Call transferFrom() to transfer from Boss's wallet to recipient
|
|
248
|
-
*
|
|
249
|
-
* @example
|
|
250
|
-
* ```typescript
|
|
251
|
-
* const wallet = new PermitWallet({ chain: 'base' });
|
|
252
|
-
*
|
|
253
|
-
* // Boss-signed permit data
|
|
254
|
-
* const permit = {
|
|
255
|
-
* owner: '0xBOSS...',
|
|
256
|
-
* spender: wallet.address,
|
|
257
|
-
* value: '10000000', // 10 USDC
|
|
258
|
-
* deadline: 1234567890,
|
|
259
|
-
* v: 27,
|
|
260
|
-
* r: '0x...',
|
|
261
|
-
* s: '0x...'
|
|
262
|
-
* };
|
|
263
|
-
*
|
|
264
|
-
* const result = await wallet.transferWithPermit({
|
|
265
|
-
* to: '0xSELLER...',
|
|
266
|
-
* amount: 3.99,
|
|
267
|
-
* permit
|
|
268
|
-
* });
|
|
269
|
-
* ```
|
|
270
|
-
*/
|
|
271
|
-
transferWithPermit(params: TransferWithPermitParams): Promise<TransferWithPermitResult>;
|
|
272
|
-
/**
|
|
273
|
-
* Get ETH balance (for gas)
|
|
274
|
-
*/
|
|
275
|
-
getGasBalance(): Promise<string>;
|
|
276
|
-
/**
|
|
277
|
-
* Check if there's enough gas
|
|
278
|
-
*/
|
|
279
|
-
hasEnoughGas(minEth?: number): Promise<boolean>;
|
|
280
|
-
}
|
|
281
|
-
/**
|
|
282
|
-
* Format Permit request message (to send to Boss)
|
|
283
|
-
*/
|
|
284
|
-
declare function formatPermitRequest(params: {
|
|
285
|
-
agentAddress: string;
|
|
286
|
-
amount: number;
|
|
287
|
-
deadlineHours?: number;
|
|
288
|
-
chain?: ChainName;
|
|
289
|
-
reason?: string;
|
|
290
|
-
}): string;
|
|
291
|
-
|
|
292
|
-
/**
|
|
293
|
-
* signPermit - Agent signs EIP-2612 Permit to authorize another address to spend USDC
|
|
294
|
-
*
|
|
295
|
-
* Used for Agent-to-Agent payments where the client agent authorizes
|
|
296
|
-
* the service provider to pull payment.
|
|
297
|
-
*/
|
|
298
|
-
|
|
299
|
-
interface SignPermitParams {
|
|
300
|
-
/** Spender address (service provider's wallet) */
|
|
301
|
-
spender: string;
|
|
302
|
-
/** Amount in USDC (e.g., 0.99) */
|
|
303
|
-
amount: number;
|
|
304
|
-
/** Deadline timestamp (Unix seconds) or minutes from now if < 1000000 */
|
|
305
|
-
deadline?: number;
|
|
306
|
-
}
|
|
307
|
-
interface SignPermitResult {
|
|
308
|
-
/** Permit owner (signer's address) */
|
|
309
|
-
owner: string;
|
|
310
|
-
/** Authorized spender */
|
|
311
|
-
spender: string;
|
|
312
|
-
/** Authorized amount (raw, 6 decimals) */
|
|
313
|
-
value: string;
|
|
314
|
-
/** Expiration timestamp */
|
|
315
|
-
deadline: number;
|
|
316
|
-
/** Nonce used */
|
|
317
|
-
nonce: number;
|
|
318
|
-
/** Signature v */
|
|
319
|
-
v: number;
|
|
320
|
-
/** Signature r */
|
|
321
|
-
r: string;
|
|
322
|
-
/** Signature s */
|
|
323
|
-
s: string;
|
|
324
|
-
}
|
|
325
|
-
interface SignPermitConfig {
|
|
326
|
-
chain?: ChainName;
|
|
327
|
-
privateKey?: string;
|
|
328
|
-
rpcUrl?: string;
|
|
329
|
-
}
|
|
330
|
-
/**
|
|
331
|
-
* Sign an EIP-2612 Permit
|
|
332
|
-
*
|
|
333
|
-
* @example
|
|
334
|
-
* ```typescript
|
|
335
|
-
* import { signPermit } from 'moltspay';
|
|
336
|
-
*
|
|
337
|
-
* const permit = await signPermit(
|
|
338
|
-
* { chain: 'base', privateKey: process.env.WALLET_KEY },
|
|
339
|
-
* {
|
|
340
|
-
* spender: '0xZen7Wallet...',
|
|
341
|
-
* amount: 0.99,
|
|
342
|
-
* deadline: 30 // 30 minutes from now
|
|
343
|
-
* }
|
|
344
|
-
* );
|
|
345
|
-
*
|
|
346
|
-
* // Send permit to service provider
|
|
347
|
-
* await fetch('https://service/api/pay', {
|
|
348
|
-
* body: JSON.stringify({ permit })
|
|
349
|
-
* });
|
|
350
|
-
* ```
|
|
351
|
-
*/
|
|
352
|
-
declare function signPermit(config: SignPermitConfig, params: SignPermitParams): Promise<SignPermitResult>;
|
|
353
|
-
/**
|
|
354
|
-
* Convenient class method version
|
|
355
|
-
*/
|
|
356
|
-
declare class PermitSigner {
|
|
357
|
-
private config;
|
|
358
|
-
constructor(config: SignPermitConfig);
|
|
359
|
-
sign(params: SignPermitParams): Promise<SignPermitResult>;
|
|
360
|
-
}
|
|
361
|
-
|
|
362
|
-
/**
|
|
363
|
-
* AllowanceWallet - Agent spends from Owner's wallet using Permit allowance
|
|
364
|
-
*
|
|
365
|
-
* This is the recommended pattern for AI Agents:
|
|
366
|
-
* 1. Owner signs EIP-2612 Permit in MetaMask (off-chain, no gas)
|
|
367
|
-
* 2. Owner sends Permit data to Agent
|
|
368
|
-
* 3. Agent stores Permit and spends within the allowance
|
|
369
|
-
* 4. Agent only needs minimal ETH for gas, USDC stays in Owner's wallet
|
|
370
|
-
*
|
|
371
|
-
* Benefits:
|
|
372
|
-
* - Agent never holds significant funds
|
|
373
|
-
* - Owner maintains custody of USDC
|
|
374
|
-
* - Owner can revoke by spending/transferring USDC
|
|
375
|
-
* - Clear audit trail of Agent spending
|
|
376
|
-
*/
|
|
377
|
-
|
|
378
|
-
interface OwnerPermit {
|
|
379
|
-
/** Owner's wallet address (USDC holder, e.g., MetaMask) */
|
|
380
|
-
owner: string;
|
|
381
|
-
/** Authorized amount (raw, 6 decimals for USDC) */
|
|
382
|
-
value: string;
|
|
383
|
-
/** Expiration timestamp (Unix seconds) */
|
|
384
|
-
deadline: number;
|
|
385
|
-
/** Nonce used when signing */
|
|
386
|
-
nonce: number;
|
|
387
|
-
/** Signature components */
|
|
388
|
-
v: number;
|
|
389
|
-
r: string;
|
|
390
|
-
s: string;
|
|
391
|
-
}
|
|
392
|
-
interface AllowanceWalletConfig {
|
|
393
|
-
chain?: ChainName;
|
|
394
|
-
/** Agent's private key (only for gas, not for USDC) */
|
|
395
|
-
privateKey: string;
|
|
396
|
-
rpcUrl?: string;
|
|
397
|
-
}
|
|
398
|
-
interface SpendParams {
|
|
399
|
-
/** Recipient address (e.g., service provider) */
|
|
400
|
-
to: string;
|
|
401
|
-
/** Amount in USDC */
|
|
402
|
-
amount: number;
|
|
403
|
-
/** Owner's Permit (if not yet submitted on-chain) */
|
|
404
|
-
permit?: OwnerPermit;
|
|
405
|
-
}
|
|
406
|
-
interface SpendResult {
|
|
407
|
-
success: boolean;
|
|
408
|
-
txHash?: string;
|
|
409
|
-
error?: string;
|
|
410
|
-
from: string;
|
|
411
|
-
to: string;
|
|
412
|
-
amount: number;
|
|
413
|
-
remainingAllowance?: string;
|
|
414
|
-
explorerUrl?: string;
|
|
415
|
-
}
|
|
416
|
-
interface AllowanceStatus {
|
|
417
|
-
owner: string;
|
|
418
|
-
agent: string;
|
|
419
|
-
allowance: string;
|
|
420
|
-
ownerBalance: string;
|
|
421
|
-
agentGasBalance: string;
|
|
422
|
-
canSpend: boolean;
|
|
423
|
-
chain: string;
|
|
424
|
-
}
|
|
425
|
-
declare class AllowanceWallet {
|
|
426
|
-
readonly chain: ChainName;
|
|
427
|
-
readonly chainConfig: ChainConfig;
|
|
428
|
-
readonly address: string;
|
|
429
|
-
private wallet;
|
|
430
|
-
private provider;
|
|
431
|
-
private usdcContract;
|
|
432
|
-
/** Stored permits from owners */
|
|
433
|
-
private permits;
|
|
434
|
-
constructor(config: AllowanceWalletConfig);
|
|
435
|
-
/**
|
|
436
|
-
* Store a Permit received from Owner
|
|
437
|
-
* Call this when Owner sends you a signed Permit
|
|
438
|
-
*/
|
|
439
|
-
storePermit(permit: OwnerPermit): void;
|
|
440
|
-
/**
|
|
441
|
-
* Get stored Permit for an owner
|
|
442
|
-
*/
|
|
443
|
-
getPermit(owner: string): OwnerPermit | undefined;
|
|
444
|
-
/**
|
|
445
|
-
* Check allowance status with an owner
|
|
446
|
-
*/
|
|
447
|
-
checkAllowance(owner: string): Promise<AllowanceStatus>;
|
|
448
|
-
/**
|
|
449
|
-
* Spend from Owner's wallet using Permit allowance
|
|
450
|
-
*
|
|
451
|
-
* @example
|
|
452
|
-
* ```typescript
|
|
453
|
-
* const agent = new AllowanceWallet({
|
|
454
|
-
* chain: 'base',
|
|
455
|
-
* privateKey: process.env.AGENT_KEY // Only needs gas
|
|
456
|
-
* });
|
|
457
|
-
*
|
|
458
|
-
* // Owner gave us a Permit
|
|
459
|
-
* agent.storePermit(ownerPermit);
|
|
460
|
-
*
|
|
461
|
-
* // Spend to pay for a service
|
|
462
|
-
* const result = await agent.spend({
|
|
463
|
-
* to: '0xServiceProvider...',
|
|
464
|
-
* amount: 2.99,
|
|
465
|
-
* });
|
|
466
|
-
* ```
|
|
467
|
-
*/
|
|
468
|
-
spend(params: SpendParams): Promise<SpendResult>;
|
|
469
|
-
/**
|
|
470
|
-
* Get Agent's gas balance (ETH)
|
|
471
|
-
*/
|
|
472
|
-
getGasBalance(): Promise<string>;
|
|
473
|
-
}
|
|
474
|
-
/**
|
|
475
|
-
* Generate instructions for Owner to sign a Permit in MetaMask
|
|
476
|
-
*
|
|
477
|
-
* Owner can use this with eth_signTypedData_v4 in any web3 wallet
|
|
478
|
-
*/
|
|
479
|
-
declare function generatePermitInstructions(params: {
|
|
480
|
-
ownerAddress: string;
|
|
481
|
-
agentAddress: string;
|
|
482
|
-
amount: number;
|
|
483
|
-
deadlineHours?: number;
|
|
484
|
-
chain?: ChainName;
|
|
485
|
-
}): {
|
|
486
|
-
instructions: string;
|
|
487
|
-
typedData: object;
|
|
488
|
-
eip712Domain: object;
|
|
489
|
-
};
|
|
490
|
-
|
|
491
|
-
export { type AllowanceStatus, AllowanceWallet, type AllowanceWalletConfig, type CreateWalletOptions, type CreateWalletResult, type OwnerPermit, type PermitData, PermitSigner, PermitWallet, type PermitWalletConfig, SecureWallet, type SignPermitConfig, type SignPermitParams, type SignPermitResult, type SpendParams, type SpendResult, type TransferWithPermitParams, type TransferWithPermitResult, Wallet, type WalletConfig, type WalletData, createWallet, formatPermitRequest, generatePermitInstructions, getWalletAddress, loadWallet, signPermit, walletExists };
|
|
43
|
+
export { Wallet, type WalletConfig };
|