@exagent/sdk 0.1.21 → 0.2.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/.turbo/turbo-build.log +14 -0
- package/dist/index.d.ts +440 -2082
- package/dist/index.js +67 -2147
- package/package.json +9 -22
- package/src/client.ts +79 -0
- package/src/index.ts +48 -0
- package/src/types.ts +468 -0
- package/tsconfig.json +8 -0
- package/dist/index.d.mts +0 -2131
- package/dist/index.mjs +0 -2136
package/dist/index.d.mts
DELETED
|
@@ -1,2131 +0,0 @@
|
|
|
1
|
-
import * as viem from 'viem';
|
|
2
|
-
import { Address, Hash, Chain, Account, Hex, WalletClient } from 'viem';
|
|
3
|
-
import * as viem_chains from 'viem/chains';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* ERC-8004 Global Agent Identifier
|
|
7
|
-
* Format: eip155:{chainId}:{registryAddress}:{agentId}
|
|
8
|
-
*
|
|
9
|
-
* This creates a universally unique identifier for any agent across
|
|
10
|
-
* all EVM chains, enabling cross-protocol agent discovery.
|
|
11
|
-
*
|
|
12
|
-
* @example
|
|
13
|
-
* ```
|
|
14
|
-
* // Base mainnet agent #42
|
|
15
|
-
* "eip155:8453:0xABC...DEF:42"
|
|
16
|
-
*
|
|
17
|
-
* // Another Base mainnet agent
|
|
18
|
-
* "eip155:8453:0x123...789:7"
|
|
19
|
-
* ```
|
|
20
|
-
*/
|
|
21
|
-
type GlobalAgentId = `eip155:${number}:${Address}:${number}`;
|
|
22
|
-
/**
|
|
23
|
-
* Build an ERC-8004 compliant global agent identifier
|
|
24
|
-
*
|
|
25
|
-
* @param chainId - EVM chain ID (8453 for Base)
|
|
26
|
-
* @param registryAddress - ExagentRegistry contract address
|
|
27
|
-
* @param agentId - On-chain agent ID (from ExagentRegistry)
|
|
28
|
-
* @returns Global agent identifier string
|
|
29
|
-
*
|
|
30
|
-
* @example
|
|
31
|
-
* ```typescript
|
|
32
|
-
* import { buildGlobalAgentId } from '@exagent/sdk';
|
|
33
|
-
*
|
|
34
|
-
* const globalId = buildGlobalAgentId(8453, '0xABC...DEF', 42);
|
|
35
|
-
* // => "eip155:8453:0xABC...DEF:42"
|
|
36
|
-
* ```
|
|
37
|
-
*/
|
|
38
|
-
declare function buildGlobalAgentId(chainId: number, registryAddress: Address, agentId: number | bigint): GlobalAgentId;
|
|
39
|
-
/**
|
|
40
|
-
* Parse an ERC-8004 global agent identifier into its components
|
|
41
|
-
*
|
|
42
|
-
* @param globalId - The global agent identifier string
|
|
43
|
-
* @returns Parsed components: chainId, registryAddress, agentId
|
|
44
|
-
* @throws Error if the format is invalid
|
|
45
|
-
*/
|
|
46
|
-
declare function parseGlobalAgentId(globalId: string): {
|
|
47
|
-
chainId: number;
|
|
48
|
-
registryAddress: Address;
|
|
49
|
-
agentId: number;
|
|
50
|
-
};
|
|
51
|
-
/**
|
|
52
|
-
* Agent profile as stored on-chain
|
|
53
|
-
*/
|
|
54
|
-
interface AgentProfile {
|
|
55
|
-
agentId: bigint;
|
|
56
|
-
owner: Address;
|
|
57
|
-
name: string;
|
|
58
|
-
metadataURI: string;
|
|
59
|
-
registrationTime: bigint;
|
|
60
|
-
verified: boolean;
|
|
61
|
-
linkedWalletCount: bigint;
|
|
62
|
-
}
|
|
63
|
-
/**
|
|
64
|
-
* Agent metadata stored on IPFS
|
|
65
|
-
*/
|
|
66
|
-
interface AgentMetadata {
|
|
67
|
-
name: string;
|
|
68
|
-
description: string;
|
|
69
|
-
capabilities: string[];
|
|
70
|
-
model?: string;
|
|
71
|
-
framework?: string;
|
|
72
|
-
avatar?: string;
|
|
73
|
-
website?: string;
|
|
74
|
-
social?: {
|
|
75
|
-
twitter?: string;
|
|
76
|
-
github?: string;
|
|
77
|
-
};
|
|
78
|
-
}
|
|
79
|
-
/**
|
|
80
|
-
* Trade intent for broadcasting
|
|
81
|
-
*/
|
|
82
|
-
interface TradeIntent {
|
|
83
|
-
action: 'BUY' | 'SELL';
|
|
84
|
-
tokenIn: Address;
|
|
85
|
-
tokenOut: Address;
|
|
86
|
-
amountIn: bigint;
|
|
87
|
-
minAmountOut?: bigint;
|
|
88
|
-
maxSlippageBps?: number;
|
|
89
|
-
deadline?: number;
|
|
90
|
-
/** LLM config hash (bytes32) for epoch attribution — passed to on-chain router */
|
|
91
|
-
configHash?: `0x${string}`;
|
|
92
|
-
}
|
|
93
|
-
/**
|
|
94
|
-
* M2M service request
|
|
95
|
-
*/
|
|
96
|
-
interface ServiceRequest {
|
|
97
|
-
serviceType: string;
|
|
98
|
-
providerId?: bigint;
|
|
99
|
-
maxPriceAX: bigint;
|
|
100
|
-
payload: Record<string, unknown>;
|
|
101
|
-
deadline?: number;
|
|
102
|
-
}
|
|
103
|
-
/**
|
|
104
|
-
* Performance metrics snapshot
|
|
105
|
-
*/
|
|
106
|
-
interface PerformanceSnapshot {
|
|
107
|
-
agentId: bigint;
|
|
108
|
-
timestamp: bigint;
|
|
109
|
-
pnlBps: number;
|
|
110
|
-
tradeCount: number;
|
|
111
|
-
volumeUSD: bigint;
|
|
112
|
-
sharpeRatio?: number;
|
|
113
|
-
sortinoRatio?: number;
|
|
114
|
-
maxDrawdownBps?: number;
|
|
115
|
-
}
|
|
116
|
-
/**
|
|
117
|
-
* DEX route quote from 0x API
|
|
118
|
-
*/
|
|
119
|
-
interface RouteQuote {
|
|
120
|
-
tokenIn: Address;
|
|
121
|
-
tokenOut: Address;
|
|
122
|
-
amountIn: string;
|
|
123
|
-
amountOut: string;
|
|
124
|
-
minAmountOut: string;
|
|
125
|
-
priceImpactBps: number;
|
|
126
|
-
route: RouteStep[];
|
|
127
|
-
transaction: {
|
|
128
|
-
to: Address;
|
|
129
|
-
data: `0x${string}`;
|
|
130
|
-
value: string;
|
|
131
|
-
};
|
|
132
|
-
gasEstimate: string;
|
|
133
|
-
validUntil: number;
|
|
134
|
-
permit2?: {
|
|
135
|
-
eip712: unknown;
|
|
136
|
-
};
|
|
137
|
-
issues?: {
|
|
138
|
-
allowance?: {
|
|
139
|
-
spender: Address;
|
|
140
|
-
actual: string;
|
|
141
|
-
expected: string;
|
|
142
|
-
};
|
|
143
|
-
};
|
|
144
|
-
mock?: boolean;
|
|
145
|
-
}
|
|
146
|
-
/**
|
|
147
|
-
* Route step through a DEX
|
|
148
|
-
*/
|
|
149
|
-
interface RouteStep {
|
|
150
|
-
dex: string;
|
|
151
|
-
pool: string;
|
|
152
|
-
share: number;
|
|
153
|
-
}
|
|
154
|
-
/**
|
|
155
|
-
* Price quote (no transaction data)
|
|
156
|
-
*/
|
|
157
|
-
interface PriceQuote {
|
|
158
|
-
tokenIn: Address;
|
|
159
|
-
tokenOut: Address;
|
|
160
|
-
amountIn: string;
|
|
161
|
-
amountOut: string;
|
|
162
|
-
priceImpactBps: number;
|
|
163
|
-
mock?: boolean;
|
|
164
|
-
}
|
|
165
|
-
/**
|
|
166
|
-
* Router trade response - transaction routed through ExagentRouter
|
|
167
|
-
*/
|
|
168
|
-
interface RouterTradeResponse {
|
|
169
|
-
agentId: number;
|
|
170
|
-
tokenIn: Address;
|
|
171
|
-
tokenOut: Address;
|
|
172
|
-
amountIn: string;
|
|
173
|
-
amountOut: string;
|
|
174
|
-
minAmountOut: string;
|
|
175
|
-
priceImpactBps: number;
|
|
176
|
-
route: RouteStep[];
|
|
177
|
-
transaction: {
|
|
178
|
-
to: Address;
|
|
179
|
-
data: `0x${string}`;
|
|
180
|
-
value: string;
|
|
181
|
-
};
|
|
182
|
-
approvals: Array<{
|
|
183
|
-
token: Address;
|
|
184
|
-
spender: Address;
|
|
185
|
-
amount: string;
|
|
186
|
-
}>;
|
|
187
|
-
gasEstimate: string;
|
|
188
|
-
validUntil: number;
|
|
189
|
-
attribution: {
|
|
190
|
-
router: Address;
|
|
191
|
-
aggregator: Address;
|
|
192
|
-
agentId: number;
|
|
193
|
-
};
|
|
194
|
-
mock?: boolean;
|
|
195
|
-
/** Present when API's pre-flight simulation failed (for sells) */
|
|
196
|
-
simulationSkipped?: boolean;
|
|
197
|
-
/** Warning message when simulation failed */
|
|
198
|
-
simulationWarning?: string;
|
|
199
|
-
/**
|
|
200
|
-
* Raw aggregator params for vault trading.
|
|
201
|
-
* SDK calls vault trade functions directly using these params.
|
|
202
|
-
* Vault adds agentId/configHash; SDK adds deadline at call time.
|
|
203
|
-
*/
|
|
204
|
-
vaultParams?: VaultTradeParams;
|
|
205
|
-
}
|
|
206
|
-
/**
|
|
207
|
-
* Vault trade params returned by the API.
|
|
208
|
-
* Discriminated union on `swapType` — each type has different aggregator fields.
|
|
209
|
-
*/
|
|
210
|
-
type VaultTradeParams = VaultTradeParamsSimple | VaultTradeParamsSwap | VaultTradeParamsMultihop;
|
|
211
|
-
interface VaultTradeParamsSimple {
|
|
212
|
-
swapType: 'simple';
|
|
213
|
-
target: Address;
|
|
214
|
-
data: `0x${string}`;
|
|
215
|
-
feeConvertAggregator: Address;
|
|
216
|
-
feeSwapData: `0x${string}`;
|
|
217
|
-
}
|
|
218
|
-
interface VaultTradeParamsSwap {
|
|
219
|
-
swapType: 'swap';
|
|
220
|
-
aggregator: Address;
|
|
221
|
-
swapData: `0x${string}`;
|
|
222
|
-
feeConvertAggregator: Address;
|
|
223
|
-
feeSwapData: `0x${string}`;
|
|
224
|
-
}
|
|
225
|
-
interface VaultTradeParamsMultihop {
|
|
226
|
-
swapType: 'multihop';
|
|
227
|
-
aggregator1: Address;
|
|
228
|
-
swapData1: `0x${string}`;
|
|
229
|
-
aggregator2: Address;
|
|
230
|
-
swapData2: `0x${string}`;
|
|
231
|
-
}
|
|
232
|
-
/**
|
|
233
|
-
* Trade execution result
|
|
234
|
-
*/
|
|
235
|
-
interface TradeResult {
|
|
236
|
-
hash: Hash;
|
|
237
|
-
agentId: bigint;
|
|
238
|
-
tokenIn: Address;
|
|
239
|
-
tokenOut: Address;
|
|
240
|
-
amountIn: string;
|
|
241
|
-
expectedAmountOut: string;
|
|
242
|
-
}
|
|
243
|
-
/**
|
|
244
|
-
* Vault configuration for creating a new vault
|
|
245
|
-
*/
|
|
246
|
-
interface VaultConfig {
|
|
247
|
-
agentId: bigint;
|
|
248
|
-
asset: Address;
|
|
249
|
-
name: string;
|
|
250
|
-
symbol: string;
|
|
251
|
-
feeRecipient: Address;
|
|
252
|
-
performanceFeeBps?: number;
|
|
253
|
-
managementFeeBps?: number;
|
|
254
|
-
}
|
|
255
|
-
/**
|
|
256
|
-
* Vault summary for listing
|
|
257
|
-
*/
|
|
258
|
-
interface VaultSummary {
|
|
259
|
-
address: Address;
|
|
260
|
-
name: string;
|
|
261
|
-
symbol: string;
|
|
262
|
-
asset: Address;
|
|
263
|
-
agentId: bigint;
|
|
264
|
-
totalAssets: bigint;
|
|
265
|
-
sharePrice: bigint;
|
|
266
|
-
performanceFeeBps: number;
|
|
267
|
-
managementFeeBps: number;
|
|
268
|
-
depositorCount: number;
|
|
269
|
-
totalPnlBps: number;
|
|
270
|
-
isAcceptingDeposits: boolean;
|
|
271
|
-
}
|
|
272
|
-
/**
|
|
273
|
-
* User's vault position for portfolio display
|
|
274
|
-
*/
|
|
275
|
-
interface UserVaultPosition {
|
|
276
|
-
vault: Address;
|
|
277
|
-
vaultName: string;
|
|
278
|
-
shares: bigint;
|
|
279
|
-
assetsValue: bigint;
|
|
280
|
-
entryPrice: bigint;
|
|
281
|
-
currentPrice: bigint;
|
|
282
|
-
pnlBps: number;
|
|
283
|
-
pnlUsd: bigint;
|
|
284
|
-
pendingWithdrawals: bigint;
|
|
285
|
-
}
|
|
286
|
-
/**
|
|
287
|
-
* Vault deposit/withdrawal history entry
|
|
288
|
-
*/
|
|
289
|
-
interface VaultActivityEntry {
|
|
290
|
-
type: 'deposit' | 'withdraw' | 'request_withdrawal' | 'claim_withdrawal' | 'emergency_withdraw';
|
|
291
|
-
user: Address;
|
|
292
|
-
vault: Address;
|
|
293
|
-
shares: bigint;
|
|
294
|
-
assets: bigint;
|
|
295
|
-
timestamp: bigint;
|
|
296
|
-
txHash: Hash;
|
|
297
|
-
}
|
|
298
|
-
/**
|
|
299
|
-
* Vault trade executed by agent
|
|
300
|
-
*/
|
|
301
|
-
interface VaultTradeEntry {
|
|
302
|
-
agentId: bigint;
|
|
303
|
-
vault: Address;
|
|
304
|
-
tokenIn: Address;
|
|
305
|
-
tokenOut: Address;
|
|
306
|
-
amountIn: bigint;
|
|
307
|
-
amountOut: bigint;
|
|
308
|
-
aggregator: Address;
|
|
309
|
-
timestamp: bigint;
|
|
310
|
-
txHash: Hash;
|
|
311
|
-
}
|
|
312
|
-
|
|
313
|
-
/**
|
|
314
|
-
* ABI for ExagentRegistry contract
|
|
315
|
-
*/
|
|
316
|
-
declare const EXAGENT_REGISTRY_ABI: readonly [{
|
|
317
|
-
readonly type: "function";
|
|
318
|
-
readonly name: "registerAgent";
|
|
319
|
-
readonly inputs: readonly [{
|
|
320
|
-
readonly name: "name";
|
|
321
|
-
readonly type: "string";
|
|
322
|
-
}, {
|
|
323
|
-
readonly name: "metadataURI";
|
|
324
|
-
readonly type: "string";
|
|
325
|
-
}, {
|
|
326
|
-
readonly name: "riskUniverse";
|
|
327
|
-
readonly type: "uint8";
|
|
328
|
-
}, {
|
|
329
|
-
readonly name: "maxPositionSizeBps";
|
|
330
|
-
readonly type: "uint256";
|
|
331
|
-
}, {
|
|
332
|
-
readonly name: "maxDailyLossBps";
|
|
333
|
-
readonly type: "uint256";
|
|
334
|
-
}];
|
|
335
|
-
readonly outputs: readonly [{
|
|
336
|
-
readonly name: "agentId";
|
|
337
|
-
readonly type: "uint256";
|
|
338
|
-
}];
|
|
339
|
-
readonly stateMutability: "nonpayable";
|
|
340
|
-
}, {
|
|
341
|
-
readonly type: "function";
|
|
342
|
-
readonly name: "isNameAvailable";
|
|
343
|
-
readonly inputs: readonly [{
|
|
344
|
-
readonly name: "name";
|
|
345
|
-
readonly type: "string";
|
|
346
|
-
}];
|
|
347
|
-
readonly outputs: readonly [{
|
|
348
|
-
readonly name: "available";
|
|
349
|
-
readonly type: "bool";
|
|
350
|
-
}];
|
|
351
|
-
readonly stateMutability: "view";
|
|
352
|
-
}, {
|
|
353
|
-
readonly type: "function";
|
|
354
|
-
readonly name: "getAgentByName";
|
|
355
|
-
readonly inputs: readonly [{
|
|
356
|
-
readonly name: "name";
|
|
357
|
-
readonly type: "string";
|
|
358
|
-
}];
|
|
359
|
-
readonly outputs: readonly [{
|
|
360
|
-
readonly name: "agentId";
|
|
361
|
-
readonly type: "uint256";
|
|
362
|
-
}];
|
|
363
|
-
readonly stateMutability: "view";
|
|
364
|
-
}, {
|
|
365
|
-
readonly type: "function";
|
|
366
|
-
readonly name: "linkWallet";
|
|
367
|
-
readonly inputs: readonly [{
|
|
368
|
-
readonly name: "agentId";
|
|
369
|
-
readonly type: "uint256";
|
|
370
|
-
}, {
|
|
371
|
-
readonly name: "wallet";
|
|
372
|
-
readonly type: "address";
|
|
373
|
-
}, {
|
|
374
|
-
readonly name: "signature";
|
|
375
|
-
readonly type: "bytes";
|
|
376
|
-
}];
|
|
377
|
-
readonly outputs: readonly [];
|
|
378
|
-
readonly stateMutability: "nonpayable";
|
|
379
|
-
}, {
|
|
380
|
-
readonly type: "function";
|
|
381
|
-
readonly name: "linkOwnWallet";
|
|
382
|
-
readonly inputs: readonly [{
|
|
383
|
-
readonly name: "agentId";
|
|
384
|
-
readonly type: "uint256";
|
|
385
|
-
}];
|
|
386
|
-
readonly outputs: readonly [];
|
|
387
|
-
readonly stateMutability: "nonpayable";
|
|
388
|
-
}, {
|
|
389
|
-
readonly type: "function";
|
|
390
|
-
readonly name: "unlinkWallet";
|
|
391
|
-
readonly inputs: readonly [{
|
|
392
|
-
readonly name: "agentId";
|
|
393
|
-
readonly type: "uint256";
|
|
394
|
-
}, {
|
|
395
|
-
readonly name: "wallet";
|
|
396
|
-
readonly type: "address";
|
|
397
|
-
}];
|
|
398
|
-
readonly outputs: readonly [];
|
|
399
|
-
readonly stateMutability: "nonpayable";
|
|
400
|
-
}, {
|
|
401
|
-
readonly type: "function";
|
|
402
|
-
readonly name: "updateMetadata";
|
|
403
|
-
readonly inputs: readonly [{
|
|
404
|
-
readonly name: "agentId";
|
|
405
|
-
readonly type: "uint256";
|
|
406
|
-
}, {
|
|
407
|
-
readonly name: "newURI";
|
|
408
|
-
readonly type: "string";
|
|
409
|
-
}];
|
|
410
|
-
readonly outputs: readonly [];
|
|
411
|
-
readonly stateMutability: "nonpayable";
|
|
412
|
-
}, {
|
|
413
|
-
readonly type: "function";
|
|
414
|
-
readonly name: "agents";
|
|
415
|
-
readonly inputs: readonly [{
|
|
416
|
-
readonly name: "agentId";
|
|
417
|
-
readonly type: "uint256";
|
|
418
|
-
}];
|
|
419
|
-
readonly outputs: readonly [{
|
|
420
|
-
readonly name: "owner";
|
|
421
|
-
readonly type: "address";
|
|
422
|
-
}, {
|
|
423
|
-
readonly name: "name";
|
|
424
|
-
readonly type: "string";
|
|
425
|
-
}, {
|
|
426
|
-
readonly name: "metadataURI";
|
|
427
|
-
readonly type: "string";
|
|
428
|
-
}, {
|
|
429
|
-
readonly name: "registrationTime";
|
|
430
|
-
readonly type: "uint256";
|
|
431
|
-
}, {
|
|
432
|
-
readonly name: "verified";
|
|
433
|
-
readonly type: "bool";
|
|
434
|
-
}, {
|
|
435
|
-
readonly name: "linkedWalletCount";
|
|
436
|
-
readonly type: "uint256";
|
|
437
|
-
}];
|
|
438
|
-
readonly stateMutability: "view";
|
|
439
|
-
}, {
|
|
440
|
-
readonly type: "function";
|
|
441
|
-
readonly name: "getLinkedWallets";
|
|
442
|
-
readonly inputs: readonly [{
|
|
443
|
-
readonly name: "agentId";
|
|
444
|
-
readonly type: "uint256";
|
|
445
|
-
}];
|
|
446
|
-
readonly outputs: readonly [{
|
|
447
|
-
readonly name: "";
|
|
448
|
-
readonly type: "address[]";
|
|
449
|
-
}];
|
|
450
|
-
readonly stateMutability: "view";
|
|
451
|
-
}, {
|
|
452
|
-
readonly type: "function";
|
|
453
|
-
readonly name: "getAgentForWallet";
|
|
454
|
-
readonly inputs: readonly [{
|
|
455
|
-
readonly name: "wallet";
|
|
456
|
-
readonly type: "address";
|
|
457
|
-
}];
|
|
458
|
-
readonly outputs: readonly [{
|
|
459
|
-
readonly name: "";
|
|
460
|
-
readonly type: "uint256";
|
|
461
|
-
}];
|
|
462
|
-
readonly stateMutability: "view";
|
|
463
|
-
}, {
|
|
464
|
-
readonly type: "function";
|
|
465
|
-
readonly name: "walletToAgent";
|
|
466
|
-
readonly inputs: readonly [{
|
|
467
|
-
readonly name: "wallet";
|
|
468
|
-
readonly type: "address";
|
|
469
|
-
}];
|
|
470
|
-
readonly outputs: readonly [{
|
|
471
|
-
readonly name: "";
|
|
472
|
-
readonly type: "uint256";
|
|
473
|
-
}];
|
|
474
|
-
readonly stateMutability: "view";
|
|
475
|
-
}, {
|
|
476
|
-
readonly type: "function";
|
|
477
|
-
readonly name: "nonces";
|
|
478
|
-
readonly inputs: readonly [{
|
|
479
|
-
readonly name: "wallet";
|
|
480
|
-
readonly type: "address";
|
|
481
|
-
}];
|
|
482
|
-
readonly outputs: readonly [{
|
|
483
|
-
readonly name: "";
|
|
484
|
-
readonly type: "uint256";
|
|
485
|
-
}];
|
|
486
|
-
readonly stateMutability: "view";
|
|
487
|
-
}, {
|
|
488
|
-
readonly type: "function";
|
|
489
|
-
readonly name: "ownerOf";
|
|
490
|
-
readonly inputs: readonly [{
|
|
491
|
-
readonly name: "tokenId";
|
|
492
|
-
readonly type: "uint256";
|
|
493
|
-
}];
|
|
494
|
-
readonly outputs: readonly [{
|
|
495
|
-
readonly name: "";
|
|
496
|
-
readonly type: "address";
|
|
497
|
-
}];
|
|
498
|
-
readonly stateMutability: "view";
|
|
499
|
-
}, {
|
|
500
|
-
readonly type: "function";
|
|
501
|
-
readonly name: "balanceOf";
|
|
502
|
-
readonly inputs: readonly [{
|
|
503
|
-
readonly name: "owner";
|
|
504
|
-
readonly type: "address";
|
|
505
|
-
}];
|
|
506
|
-
readonly outputs: readonly [{
|
|
507
|
-
readonly name: "";
|
|
508
|
-
readonly type: "uint256";
|
|
509
|
-
}];
|
|
510
|
-
readonly stateMutability: "view";
|
|
511
|
-
}, {
|
|
512
|
-
readonly type: "event";
|
|
513
|
-
readonly name: "AgentRegistered";
|
|
514
|
-
readonly inputs: readonly [{
|
|
515
|
-
readonly name: "agentId";
|
|
516
|
-
readonly type: "uint256";
|
|
517
|
-
readonly indexed: true;
|
|
518
|
-
}, {
|
|
519
|
-
readonly name: "owner";
|
|
520
|
-
readonly type: "address";
|
|
521
|
-
readonly indexed: true;
|
|
522
|
-
}, {
|
|
523
|
-
readonly name: "name";
|
|
524
|
-
readonly type: "string";
|
|
525
|
-
readonly indexed: false;
|
|
526
|
-
}, {
|
|
527
|
-
readonly name: "metadataURI";
|
|
528
|
-
readonly type: "string";
|
|
529
|
-
readonly indexed: false;
|
|
530
|
-
}];
|
|
531
|
-
}, {
|
|
532
|
-
readonly type: "event";
|
|
533
|
-
readonly name: "WalletLinked";
|
|
534
|
-
readonly inputs: readonly [{
|
|
535
|
-
readonly name: "agentId";
|
|
536
|
-
readonly type: "uint256";
|
|
537
|
-
readonly indexed: true;
|
|
538
|
-
}, {
|
|
539
|
-
readonly name: "wallet";
|
|
540
|
-
readonly type: "address";
|
|
541
|
-
readonly indexed: true;
|
|
542
|
-
}];
|
|
543
|
-
}, {
|
|
544
|
-
readonly type: "event";
|
|
545
|
-
readonly name: "WalletUnlinked";
|
|
546
|
-
readonly inputs: readonly [{
|
|
547
|
-
readonly name: "agentId";
|
|
548
|
-
readonly type: "uint256";
|
|
549
|
-
readonly indexed: true;
|
|
550
|
-
}, {
|
|
551
|
-
readonly name: "wallet";
|
|
552
|
-
readonly type: "address";
|
|
553
|
-
readonly indexed: true;
|
|
554
|
-
}];
|
|
555
|
-
}, {
|
|
556
|
-
readonly type: "function";
|
|
557
|
-
readonly name: "ownerToAgentId";
|
|
558
|
-
readonly inputs: readonly [{
|
|
559
|
-
readonly name: "owner";
|
|
560
|
-
readonly type: "address";
|
|
561
|
-
}];
|
|
562
|
-
readonly outputs: readonly [{
|
|
563
|
-
readonly name: "";
|
|
564
|
-
readonly type: "uint256";
|
|
565
|
-
}];
|
|
566
|
-
readonly stateMutability: "view";
|
|
567
|
-
}, {
|
|
568
|
-
readonly type: "function";
|
|
569
|
-
readonly name: "getAgentByOwner";
|
|
570
|
-
readonly inputs: readonly [{
|
|
571
|
-
readonly name: "wallet";
|
|
572
|
-
readonly type: "address";
|
|
573
|
-
}];
|
|
574
|
-
readonly outputs: readonly [{
|
|
575
|
-
readonly name: "agentId";
|
|
576
|
-
readonly type: "uint256";
|
|
577
|
-
}];
|
|
578
|
-
readonly stateMutability: "view";
|
|
579
|
-
}, {
|
|
580
|
-
readonly type: "function";
|
|
581
|
-
readonly name: "canWalletRegister";
|
|
582
|
-
readonly inputs: readonly [{
|
|
583
|
-
readonly name: "wallet";
|
|
584
|
-
readonly type: "address";
|
|
585
|
-
}];
|
|
586
|
-
readonly outputs: readonly [{
|
|
587
|
-
readonly name: "canRegister";
|
|
588
|
-
readonly type: "bool";
|
|
589
|
-
}, {
|
|
590
|
-
readonly name: "existingAgentId";
|
|
591
|
-
readonly type: "uint256";
|
|
592
|
-
}];
|
|
593
|
-
readonly stateMutability: "view";
|
|
594
|
-
}, {
|
|
595
|
-
readonly type: "function";
|
|
596
|
-
readonly name: "setConfig";
|
|
597
|
-
readonly inputs: readonly [{
|
|
598
|
-
readonly name: "agentId";
|
|
599
|
-
readonly type: "uint256";
|
|
600
|
-
}, {
|
|
601
|
-
readonly name: "configHash";
|
|
602
|
-
readonly type: "bytes32";
|
|
603
|
-
}];
|
|
604
|
-
readonly outputs: readonly [];
|
|
605
|
-
readonly stateMutability: "nonpayable";
|
|
606
|
-
}, {
|
|
607
|
-
readonly type: "function";
|
|
608
|
-
readonly name: "getConfigHash";
|
|
609
|
-
readonly inputs: readonly [{
|
|
610
|
-
readonly name: "agentId";
|
|
611
|
-
readonly type: "uint256";
|
|
612
|
-
}];
|
|
613
|
-
readonly outputs: readonly [{
|
|
614
|
-
readonly name: "";
|
|
615
|
-
readonly type: "bytes32";
|
|
616
|
-
}];
|
|
617
|
-
readonly stateMutability: "view";
|
|
618
|
-
}, {
|
|
619
|
-
readonly type: "function";
|
|
620
|
-
readonly name: "retireAgent";
|
|
621
|
-
readonly inputs: readonly [{
|
|
622
|
-
readonly name: "agentId";
|
|
623
|
-
readonly type: "uint256";
|
|
624
|
-
}];
|
|
625
|
-
readonly outputs: readonly [];
|
|
626
|
-
readonly stateMutability: "nonpayable";
|
|
627
|
-
}, {
|
|
628
|
-
readonly type: "function";
|
|
629
|
-
readonly name: "retired";
|
|
630
|
-
readonly inputs: readonly [{
|
|
631
|
-
readonly name: "agentId";
|
|
632
|
-
readonly type: "uint256";
|
|
633
|
-
}];
|
|
634
|
-
readonly outputs: readonly [{
|
|
635
|
-
readonly type: "bool";
|
|
636
|
-
}];
|
|
637
|
-
readonly stateMutability: "view";
|
|
638
|
-
}, {
|
|
639
|
-
readonly type: "function";
|
|
640
|
-
readonly name: "isRetired";
|
|
641
|
-
readonly inputs: readonly [{
|
|
642
|
-
readonly name: "agentId";
|
|
643
|
-
readonly type: "uint256";
|
|
644
|
-
}];
|
|
645
|
-
readonly outputs: readonly [{
|
|
646
|
-
readonly type: "bool";
|
|
647
|
-
}];
|
|
648
|
-
readonly stateMutability: "view";
|
|
649
|
-
}, {
|
|
650
|
-
readonly type: "function";
|
|
651
|
-
readonly name: "isTradeAllowed";
|
|
652
|
-
readonly inputs: readonly [{
|
|
653
|
-
readonly name: "agentId";
|
|
654
|
-
readonly type: "uint256";
|
|
655
|
-
}, {
|
|
656
|
-
readonly name: "token";
|
|
657
|
-
readonly type: "address";
|
|
658
|
-
}, {
|
|
659
|
-
readonly name: "aggregator";
|
|
660
|
-
readonly type: "address";
|
|
661
|
-
}];
|
|
662
|
-
readonly outputs: readonly [{
|
|
663
|
-
readonly type: "bool";
|
|
664
|
-
}];
|
|
665
|
-
readonly stateMutability: "view";
|
|
666
|
-
}, {
|
|
667
|
-
readonly type: "function";
|
|
668
|
-
readonly name: "getRiskUniverse";
|
|
669
|
-
readonly inputs: readonly [{
|
|
670
|
-
readonly name: "agentId";
|
|
671
|
-
readonly type: "uint256";
|
|
672
|
-
}];
|
|
673
|
-
readonly outputs: readonly [{
|
|
674
|
-
readonly type: "uint8";
|
|
675
|
-
}];
|
|
676
|
-
readonly stateMutability: "view";
|
|
677
|
-
}, {
|
|
678
|
-
readonly type: "function";
|
|
679
|
-
readonly name: "tradeCount";
|
|
680
|
-
readonly inputs: readonly [{
|
|
681
|
-
readonly name: "agentId";
|
|
682
|
-
readonly type: "uint256";
|
|
683
|
-
}];
|
|
684
|
-
readonly outputs: readonly [{
|
|
685
|
-
readonly type: "uint256";
|
|
686
|
-
}];
|
|
687
|
-
readonly stateMutability: "view";
|
|
688
|
-
}, {
|
|
689
|
-
readonly type: "event";
|
|
690
|
-
readonly name: "AgentRetired";
|
|
691
|
-
readonly inputs: readonly [{
|
|
692
|
-
readonly name: "agentId";
|
|
693
|
-
readonly type: "uint256";
|
|
694
|
-
readonly indexed: true;
|
|
695
|
-
}];
|
|
696
|
-
}, {
|
|
697
|
-
readonly type: "event";
|
|
698
|
-
readonly name: "ConfigUpdated";
|
|
699
|
-
readonly inputs: readonly [{
|
|
700
|
-
readonly name: "agentId";
|
|
701
|
-
readonly type: "uint256";
|
|
702
|
-
readonly indexed: true;
|
|
703
|
-
}, {
|
|
704
|
-
readonly name: "oldConfigHash";
|
|
705
|
-
readonly type: "bytes32";
|
|
706
|
-
readonly indexed: false;
|
|
707
|
-
}, {
|
|
708
|
-
readonly name: "newConfigHash";
|
|
709
|
-
readonly type: "bytes32";
|
|
710
|
-
readonly indexed: false;
|
|
711
|
-
}, {
|
|
712
|
-
readonly name: "epochId";
|
|
713
|
-
readonly type: "uint256";
|
|
714
|
-
readonly indexed: false;
|
|
715
|
-
}, {
|
|
716
|
-
readonly name: "blockNumber";
|
|
717
|
-
readonly type: "uint256";
|
|
718
|
-
readonly indexed: false;
|
|
719
|
-
}];
|
|
720
|
-
}, {
|
|
721
|
-
readonly type: "error";
|
|
722
|
-
readonly name: "AgentNotOwner";
|
|
723
|
-
readonly inputs: readonly [];
|
|
724
|
-
}, {
|
|
725
|
-
readonly type: "error";
|
|
726
|
-
readonly name: "WalletAlreadyLinked";
|
|
727
|
-
readonly inputs: readonly [];
|
|
728
|
-
}, {
|
|
729
|
-
readonly type: "error";
|
|
730
|
-
readonly name: "WalletNotLinked";
|
|
731
|
-
readonly inputs: readonly [];
|
|
732
|
-
}, {
|
|
733
|
-
readonly type: "error";
|
|
734
|
-
readonly name: "InvalidSignature";
|
|
735
|
-
readonly inputs: readonly [];
|
|
736
|
-
}, {
|
|
737
|
-
readonly type: "error";
|
|
738
|
-
readonly name: "TransferDisabled";
|
|
739
|
-
readonly inputs: readonly [];
|
|
740
|
-
}, {
|
|
741
|
-
readonly type: "error";
|
|
742
|
-
readonly name: "InvalidMetadataURI";
|
|
743
|
-
readonly inputs: readonly [];
|
|
744
|
-
}, {
|
|
745
|
-
readonly type: "error";
|
|
746
|
-
readonly name: "AgentDoesNotExist";
|
|
747
|
-
readonly inputs: readonly [];
|
|
748
|
-
}, {
|
|
749
|
-
readonly type: "error";
|
|
750
|
-
readonly name: "NameAlreadyTaken";
|
|
751
|
-
readonly inputs: readonly [];
|
|
752
|
-
}, {
|
|
753
|
-
readonly type: "error";
|
|
754
|
-
readonly name: "InvalidName";
|
|
755
|
-
readonly inputs: readonly [];
|
|
756
|
-
}, {
|
|
757
|
-
readonly type: "error";
|
|
758
|
-
readonly name: "OwnerAlreadyHasAgent";
|
|
759
|
-
readonly inputs: readonly [{
|
|
760
|
-
readonly name: "existingAgentId";
|
|
761
|
-
readonly type: "uint256";
|
|
762
|
-
}];
|
|
763
|
-
}, {
|
|
764
|
-
readonly type: "error";
|
|
765
|
-
readonly name: "InvalidRiskUniverse";
|
|
766
|
-
readonly inputs: readonly [];
|
|
767
|
-
}, {
|
|
768
|
-
readonly type: "error";
|
|
769
|
-
readonly name: "InvalidTradingConfig";
|
|
770
|
-
readonly inputs: readonly [];
|
|
771
|
-
}, {
|
|
772
|
-
readonly type: "error";
|
|
773
|
-
readonly name: "NotAuthorizedCaller";
|
|
774
|
-
readonly inputs: readonly [];
|
|
775
|
-
}, {
|
|
776
|
-
readonly type: "error";
|
|
777
|
-
readonly name: "MetadataValueTooLarge";
|
|
778
|
-
readonly inputs: readonly [];
|
|
779
|
-
}, {
|
|
780
|
-
readonly type: "error";
|
|
781
|
-
readonly name: "AgentIsRetired";
|
|
782
|
-
readonly inputs: readonly [];
|
|
783
|
-
}, {
|
|
784
|
-
readonly type: "error";
|
|
785
|
-
readonly name: "InvalidRiskUniverseForWhitelist";
|
|
786
|
-
readonly inputs: readonly [];
|
|
787
|
-
}];
|
|
788
|
-
/**
|
|
789
|
-
* Wrapper for ExagentRegistry contract interactions
|
|
790
|
-
*/
|
|
791
|
-
declare class ExagentRegistry {
|
|
792
|
-
readonly address: Address;
|
|
793
|
-
private readonly publicClient;
|
|
794
|
-
private readonly walletClient?;
|
|
795
|
-
private readonly chain;
|
|
796
|
-
private readonly account?;
|
|
797
|
-
constructor(address: Address, publicClient: any, walletClient: any | undefined, chain: Chain, account?: Account);
|
|
798
|
-
/**
|
|
799
|
-
* Register a new agent
|
|
800
|
-
* @param name Unique agent name (3-32 chars, alphanumeric + spaces/hyphens/underscores)
|
|
801
|
-
* @param metadataURI IPFS URI for agent metadata
|
|
802
|
-
* @param riskUniverse Risk tier: 0=Core, 1=Established, 2=Derivatives, 3=Emerging, 4=Frontier
|
|
803
|
-
* @param maxPositionSizeBps Maximum position size in basis points (1-10000)
|
|
804
|
-
* @param maxDailyLossBps Maximum daily loss in basis points (1-10000)
|
|
805
|
-
* @returns Transaction hash
|
|
806
|
-
*/
|
|
807
|
-
register(name: string, metadataURI: string, riskUniverse?: number, maxPositionSizeBps?: bigint, maxDailyLossBps?: bigint): Promise<Hash>;
|
|
808
|
-
/**
|
|
809
|
-
* Check if a name is available for registration
|
|
810
|
-
* @param name The name to check
|
|
811
|
-
* @returns True if the name can be used
|
|
812
|
-
*/
|
|
813
|
-
isNameAvailable(name: string): Promise<boolean>;
|
|
814
|
-
/**
|
|
815
|
-
* Get the agent ID that owns a specific name
|
|
816
|
-
* @param name The name to look up
|
|
817
|
-
* @returns Agent ID (0 if not taken)
|
|
818
|
-
*/
|
|
819
|
-
getAgentByName(name: string): Promise<bigint>;
|
|
820
|
-
/**
|
|
821
|
-
* Link the wallet used by the agent to their agent ID
|
|
822
|
-
* @param agentId The agent's ID
|
|
823
|
-
* @returns Transaction hash
|
|
824
|
-
*/
|
|
825
|
-
linkOwnWallet(agentId: bigint): Promise<Hash>;
|
|
826
|
-
/**
|
|
827
|
-
* Link an external wallet with signature proof
|
|
828
|
-
* @param agentId The agent's ID
|
|
829
|
-
* @param wallet The wallet to link
|
|
830
|
-
* @param signature Signature from the wallet proving ownership
|
|
831
|
-
* @returns Transaction hash
|
|
832
|
-
*/
|
|
833
|
-
linkWallet(agentId: bigint, wallet: Address, signature: `0x${string}`): Promise<Hash>;
|
|
834
|
-
/**
|
|
835
|
-
* Unlink a wallet from an agent
|
|
836
|
-
* @param agentId The agent's ID
|
|
837
|
-
* @param wallet The wallet to unlink
|
|
838
|
-
* @returns Transaction hash
|
|
839
|
-
*/
|
|
840
|
-
unlinkWallet(agentId: bigint, wallet: Address): Promise<Hash>;
|
|
841
|
-
/**
|
|
842
|
-
* Update agent metadata
|
|
843
|
-
* @param agentId The agent's ID
|
|
844
|
-
* @param newURI New IPFS URI for metadata
|
|
845
|
-
* @returns Transaction hash
|
|
846
|
-
*/
|
|
847
|
-
updateMetadata(agentId: bigint, newURI: string): Promise<Hash>;
|
|
848
|
-
/**
|
|
849
|
-
* Get agent profile by ID
|
|
850
|
-
* @param agentId The agent's ID
|
|
851
|
-
* @returns Agent profile data
|
|
852
|
-
*/
|
|
853
|
-
getAgent(agentId: bigint): Promise<AgentProfile>;
|
|
854
|
-
/**
|
|
855
|
-
* Get all linked wallets for an agent
|
|
856
|
-
* @param agentId The agent's ID
|
|
857
|
-
* @returns Array of linked wallet addresses
|
|
858
|
-
*/
|
|
859
|
-
getLinkedWallets(agentId: bigint): Promise<Address[]>;
|
|
860
|
-
/**
|
|
861
|
-
* Get agent ID for a wallet (for trade attribution)
|
|
862
|
-
* @param wallet The wallet address
|
|
863
|
-
* @returns Agent ID (0 if not linked)
|
|
864
|
-
*/
|
|
865
|
-
getAgentForWallet(wallet: Address): Promise<bigint>;
|
|
866
|
-
/**
|
|
867
|
-
* Check if a wallet is linked to a specific agent
|
|
868
|
-
* @param agentId The agent's ID
|
|
869
|
-
* @param wallet The wallet address to check
|
|
870
|
-
* @returns True if the wallet is linked to the agent
|
|
871
|
-
*/
|
|
872
|
-
isLinkedWallet(agentId: bigint, wallet: Address): Promise<boolean>;
|
|
873
|
-
/**
|
|
874
|
-
* Get the nonce for wallet linking signature
|
|
875
|
-
* @param wallet The wallet address
|
|
876
|
-
* @returns Current nonce
|
|
877
|
-
*/
|
|
878
|
-
getNonce(wallet: Address): Promise<bigint>;
|
|
879
|
-
/**
|
|
880
|
-
* Generate the message hash for wallet linking.
|
|
881
|
-
* Matches the contract's keccak256(abi.encodePacked(...)) exactly.
|
|
882
|
-
* Sign the returned hash with signMessage({ raw: hash }) to produce a valid signature.
|
|
883
|
-
* @param wallet The wallet to link
|
|
884
|
-
* @param agentId The agent ID to link to
|
|
885
|
-
* @param nonce The current nonce for the wallet
|
|
886
|
-
* @returns keccak256 hash of the packed message (32 bytes)
|
|
887
|
-
*/
|
|
888
|
-
static generateLinkMessage(wallet: Address, agentId: bigint, nonce: bigint): Hex;
|
|
889
|
-
/**
|
|
890
|
-
* Get the agent owned by a wallet (not linked, owned)
|
|
891
|
-
* @param wallet The wallet to look up
|
|
892
|
-
* @returns Agent ID (0 if wallet doesn't own an agent)
|
|
893
|
-
*/
|
|
894
|
-
getAgentByOwner(wallet: Address): Promise<bigint>;
|
|
895
|
-
/**
|
|
896
|
-
* Check if a wallet can register a new agent
|
|
897
|
-
* @param wallet The wallet to check
|
|
898
|
-
* @returns Object with canRegister boolean and existingAgentId (0 if none)
|
|
899
|
-
*/
|
|
900
|
-
canWalletRegister(wallet: Address): Promise<{
|
|
901
|
-
canRegister: boolean;
|
|
902
|
-
existingAgentId: bigint;
|
|
903
|
-
}>;
|
|
904
|
-
/**
|
|
905
|
-
* Update the agent's LLM config hash on-chain
|
|
906
|
-
* @param agentId The agent's ID
|
|
907
|
-
* @param configHash The keccak256 hash of (provider, model)
|
|
908
|
-
* @returns Transaction hash
|
|
909
|
-
*/
|
|
910
|
-
updateConfig(agentId: bigint, configHash: `0x${string}`): Promise<Hash>;
|
|
911
|
-
/**
|
|
912
|
-
* Get the current config hash for an agent
|
|
913
|
-
* @param agentId The agent's ID
|
|
914
|
-
* @returns Config hash (bytes32(0) if never set)
|
|
915
|
-
*/
|
|
916
|
-
getConfigHash(agentId: bigint): Promise<`0x${string}`>;
|
|
917
|
-
/**
|
|
918
|
-
* Calculate the config hash for a provider and model
|
|
919
|
-
* @param provider The LLM provider name (e.g., "openai", "anthropic")
|
|
920
|
-
* @param model The model name (e.g., "gpt-4", "claude-opus-4.5")
|
|
921
|
-
* @returns keccak256 hash of the config
|
|
922
|
-
*/
|
|
923
|
-
static calculateConfigHash(provider: string, model: string): `0x${string}`;
|
|
924
|
-
/**
|
|
925
|
-
* Retire an agent — marks it as retired, unlinks all wallets, allows new agent registration
|
|
926
|
-
* @param agentId The agent's ID
|
|
927
|
-
* @returns Transaction hash
|
|
928
|
-
*/
|
|
929
|
-
retireAgent(agentId: bigint): Promise<Hash>;
|
|
930
|
-
/**
|
|
931
|
-
* Check if an agent is retired
|
|
932
|
-
* @param agentId The agent's ID
|
|
933
|
-
* @returns True if agent is retired
|
|
934
|
-
*/
|
|
935
|
-
isRetired(agentId: bigint): Promise<boolean>;
|
|
936
|
-
/**
|
|
937
|
-
* Check if a token trade is allowed for an agent's risk universe
|
|
938
|
-
* @param agentId The agent's ID
|
|
939
|
-
* @param token The token address to check
|
|
940
|
-
* @param aggregator The aggregator being used (for trusted aggregator bypass)
|
|
941
|
-
* @returns True if the trade is allowed
|
|
942
|
-
*/
|
|
943
|
-
isTradeAllowed(agentId: bigint, token: Address, aggregator: Address): Promise<boolean>;
|
|
944
|
-
/**
|
|
945
|
-
* Get the risk universe for an agent
|
|
946
|
-
* @param agentId The agent's ID
|
|
947
|
-
* @returns Risk universe (0=Core, 1=Established, 2=Derivatives, 3=Emerging, 4=Frontier)
|
|
948
|
-
*/
|
|
949
|
-
getRiskUniverse(agentId: bigint): Promise<number>;
|
|
950
|
-
/**
|
|
951
|
-
* Get trade count for an agent
|
|
952
|
-
* @param agentId The agent's ID
|
|
953
|
-
* @returns Number of recorded trades
|
|
954
|
-
*/
|
|
955
|
-
getTradeCount(agentId: bigint): Promise<bigint>;
|
|
956
|
-
}
|
|
957
|
-
|
|
958
|
-
/**
|
|
959
|
-
* Vault info
|
|
960
|
-
*/
|
|
961
|
-
interface VaultInfo {
|
|
962
|
-
address: Address;
|
|
963
|
-
name: string;
|
|
964
|
-
symbol: string;
|
|
965
|
-
asset: Address;
|
|
966
|
-
agentId: bigint;
|
|
967
|
-
totalAssets: bigint;
|
|
968
|
-
totalSupply: bigint;
|
|
969
|
-
sharePrice: bigint;
|
|
970
|
-
highWaterMark: bigint;
|
|
971
|
-
performanceFeeBps: bigint;
|
|
972
|
-
managementFeeBps: bigint;
|
|
973
|
-
feeRecipient: Address;
|
|
974
|
-
depositsPaused: boolean;
|
|
975
|
-
withdrawalsPaused: boolean;
|
|
976
|
-
circuitBreakerActive: boolean;
|
|
977
|
-
}
|
|
978
|
-
/**
|
|
979
|
-
* User's vault position
|
|
980
|
-
*/
|
|
981
|
-
interface VaultPosition {
|
|
982
|
-
shares: bigint;
|
|
983
|
-
effectiveShares: bigint;
|
|
984
|
-
pendingWithdrawals: bigint;
|
|
985
|
-
assetsValue: bigint;
|
|
986
|
-
userHighWaterMark: bigint;
|
|
987
|
-
}
|
|
988
|
-
/**
|
|
989
|
-
* Withdrawal request details
|
|
990
|
-
*/
|
|
991
|
-
interface WithdrawalRequest {
|
|
992
|
-
requestId: bigint;
|
|
993
|
-
owner: Address;
|
|
994
|
-
receiver: Address;
|
|
995
|
-
shares: bigint;
|
|
996
|
-
requestTime: bigint;
|
|
997
|
-
processed: boolean;
|
|
998
|
-
claimableAt: bigint;
|
|
999
|
-
}
|
|
1000
|
-
/**
|
|
1001
|
-
* ExagentVault SDK interface for ERC-4626 copy trading vaults
|
|
1002
|
-
*/
|
|
1003
|
-
declare class ExagentVault {
|
|
1004
|
-
readonly address: Address;
|
|
1005
|
-
private readonly publicClient;
|
|
1006
|
-
private readonly walletClient?;
|
|
1007
|
-
private readonly chain;
|
|
1008
|
-
private readonly account?;
|
|
1009
|
-
constructor(vaultAddress: Address, publicClient: any, walletClient?: any, chain?: Chain, account?: Account);
|
|
1010
|
-
/**
|
|
1011
|
-
* Get comprehensive vault info
|
|
1012
|
-
*/
|
|
1013
|
-
getVaultInfo(): Promise<VaultInfo>;
|
|
1014
|
-
/**
|
|
1015
|
-
* Get user's position in the vault
|
|
1016
|
-
*/
|
|
1017
|
-
getPosition(user: Address): Promise<VaultPosition>;
|
|
1018
|
-
/**
|
|
1019
|
-
* Get current share price (assets per share, scaled to 1e18)
|
|
1020
|
-
*/
|
|
1021
|
-
getSharePrice(): Promise<bigint>;
|
|
1022
|
-
/**
|
|
1023
|
-
* Preview deposit - get shares for given assets
|
|
1024
|
-
*/
|
|
1025
|
-
previewDeposit(assets: bigint): Promise<bigint>;
|
|
1026
|
-
/**
|
|
1027
|
-
* Preview withdrawal - get assets for given shares
|
|
1028
|
-
*/
|
|
1029
|
-
previewRedeem(shares: bigint): Promise<bigint>;
|
|
1030
|
-
/**
|
|
1031
|
-
* Get max deposit amount
|
|
1032
|
-
*/
|
|
1033
|
-
maxDeposit(receiver: Address): Promise<bigint>;
|
|
1034
|
-
/**
|
|
1035
|
-
* Get max withdrawal amount
|
|
1036
|
-
*/
|
|
1037
|
-
maxWithdraw(owner: Address): Promise<bigint>;
|
|
1038
|
-
/**
|
|
1039
|
-
* Get rate limit status
|
|
1040
|
-
*/
|
|
1041
|
-
getRateLimitStatus(): Promise<{
|
|
1042
|
-
remaining: bigint;
|
|
1043
|
-
periodEnds: bigint;
|
|
1044
|
-
}>;
|
|
1045
|
-
/**
|
|
1046
|
-
* Get pending withdrawal request
|
|
1047
|
-
*/
|
|
1048
|
-
getPendingWithdrawal(requestId: bigint): Promise<WithdrawalRequest>;
|
|
1049
|
-
/**
|
|
1050
|
-
* Deposit assets into the vault
|
|
1051
|
-
* @param assets Amount of underlying asset to deposit
|
|
1052
|
-
* @param receiver Address to receive vault shares
|
|
1053
|
-
* @returns Transaction hash
|
|
1054
|
-
*/
|
|
1055
|
-
deposit(assets: bigint, receiver?: Address): Promise<Hash>;
|
|
1056
|
-
/**
|
|
1057
|
-
* Withdraw assets from the vault
|
|
1058
|
-
* @param assets Amount of underlying asset to withdraw
|
|
1059
|
-
* @param receiver Address to receive assets
|
|
1060
|
-
* @param owner Address whose shares to burn (defaults to caller)
|
|
1061
|
-
* @returns Transaction hash
|
|
1062
|
-
*/
|
|
1063
|
-
withdraw(assets: bigint, receiver?: Address, owner?: Address): Promise<Hash>;
|
|
1064
|
-
/**
|
|
1065
|
-
* Redeem shares for assets
|
|
1066
|
-
* @param shares Amount of shares to redeem
|
|
1067
|
-
* @param receiver Address to receive assets
|
|
1068
|
-
* @param owner Address whose shares to burn (defaults to caller)
|
|
1069
|
-
* @returns Transaction hash
|
|
1070
|
-
*/
|
|
1071
|
-
redeem(shares: bigint, receiver?: Address, owner?: Address): Promise<Hash>;
|
|
1072
|
-
/**
|
|
1073
|
-
* Redeem all shares safely — charges performance fee first, then redeems remaining balance.
|
|
1074
|
-
* Use this instead of redeem(fullBalance) to avoid ERC4626ExceededMaxRedeem revert.
|
|
1075
|
-
* @param receiver Address to receive assets
|
|
1076
|
-
* @param owner Address whose shares to burn (defaults to caller)
|
|
1077
|
-
* @returns Transaction hash
|
|
1078
|
-
*/
|
|
1079
|
-
redeemMax(receiver?: Address, owner?: Address): Promise<Hash>;
|
|
1080
|
-
/**
|
|
1081
|
-
* Withdraw all assets safely — charges performance fee first, then withdraws remaining balance.
|
|
1082
|
-
* @param receiver Address to receive assets
|
|
1083
|
-
* @param owner Address whose shares to burn (defaults to caller)
|
|
1084
|
-
* @returns Transaction hash
|
|
1085
|
-
*/
|
|
1086
|
-
withdrawMax(receiver?: Address, owner?: Address): Promise<Hash>;
|
|
1087
|
-
/**
|
|
1088
|
-
* Request a queued withdrawal (for large amounts)
|
|
1089
|
-
* @param shares Amount of shares to withdraw
|
|
1090
|
-
* @param receiver Address to receive assets
|
|
1091
|
-
* @returns Transaction hash
|
|
1092
|
-
*/
|
|
1093
|
-
requestWithdrawal(shares: bigint, receiver?: Address): Promise<Hash>;
|
|
1094
|
-
/**
|
|
1095
|
-
* Claim a pending withdrawal request
|
|
1096
|
-
* @param requestId The withdrawal request ID
|
|
1097
|
-
* @returns Transaction hash
|
|
1098
|
-
*/
|
|
1099
|
-
claimWithdrawal(requestId: bigint): Promise<Hash>;
|
|
1100
|
-
/**
|
|
1101
|
-
* Cancel a pending withdrawal request
|
|
1102
|
-
* @param requestId The withdrawal request ID
|
|
1103
|
-
* @returns Transaction hash
|
|
1104
|
-
*/
|
|
1105
|
-
cancelWithdrawal(requestId: bigint): Promise<Hash>;
|
|
1106
|
-
/**
|
|
1107
|
-
* Emergency withdrawal with penalty (50% if vault < 7 days old, 20% otherwise).
|
|
1108
|
-
* Penalty stays in the vault for remaining backers.
|
|
1109
|
-
* @returns Transaction hash
|
|
1110
|
-
*/
|
|
1111
|
-
emergencyWithdraw(): Promise<Hash>;
|
|
1112
|
-
/**
|
|
1113
|
-
* Approve vault to spend underlying asset
|
|
1114
|
-
* @param assetAddress The asset token address
|
|
1115
|
-
* @param amount Amount to approve
|
|
1116
|
-
* @returns Transaction hash
|
|
1117
|
-
*/
|
|
1118
|
-
approveAsset(assetAddress: Address, amount: bigint): Promise<Hash>;
|
|
1119
|
-
}
|
|
1120
|
-
|
|
1121
|
-
/** SDK version — sent to API for version gating */
|
|
1122
|
-
declare const SDK_VERSION = "0.1.21";
|
|
1123
|
-
/**
|
|
1124
|
-
* Default RPC URL for Base mainnet.
|
|
1125
|
-
* Coinbase's official Base RPC — reliable for reads and transactions.
|
|
1126
|
-
* Users should set BASE_RPC_URL env var for higher rate limits.
|
|
1127
|
-
*/
|
|
1128
|
-
declare const DEFAULT_RPC_URL = "https://mainnet.base.org";
|
|
1129
|
-
/**
|
|
1130
|
-
* Get RPC URL from environment or use default.
|
|
1131
|
-
*/
|
|
1132
|
-
declare function getRpcUrl(): string;
|
|
1133
|
-
declare const CHAIN_CONFIG: {
|
|
1134
|
-
readonly mainnet: {
|
|
1135
|
-
blockExplorers: {
|
|
1136
|
-
readonly default: {
|
|
1137
|
-
readonly name: "Basescan";
|
|
1138
|
-
readonly url: "https://basescan.org";
|
|
1139
|
-
readonly apiUrl: "https://api.basescan.org/api";
|
|
1140
|
-
};
|
|
1141
|
-
};
|
|
1142
|
-
blockTime: 2000;
|
|
1143
|
-
contracts: {
|
|
1144
|
-
readonly disputeGameFactory: {
|
|
1145
|
-
readonly 1: {
|
|
1146
|
-
readonly address: "0x43edB88C4B80fDD2AdFF2412A7BebF9dF42cB40e";
|
|
1147
|
-
};
|
|
1148
|
-
};
|
|
1149
|
-
readonly l2OutputOracle: {
|
|
1150
|
-
readonly 1: {
|
|
1151
|
-
readonly address: "0x56315b90c40730925ec5485cf004d835058518A0";
|
|
1152
|
-
};
|
|
1153
|
-
};
|
|
1154
|
-
readonly multicall3: {
|
|
1155
|
-
readonly address: "0xca11bde05977b3631167028862be2a173976ca11";
|
|
1156
|
-
readonly blockCreated: 5022;
|
|
1157
|
-
};
|
|
1158
|
-
readonly portal: {
|
|
1159
|
-
readonly 1: {
|
|
1160
|
-
readonly address: "0x49048044D57e1C92A77f79988d21Fa8fAF74E97e";
|
|
1161
|
-
readonly blockCreated: 17482143;
|
|
1162
|
-
};
|
|
1163
|
-
};
|
|
1164
|
-
readonly l1StandardBridge: {
|
|
1165
|
-
readonly 1: {
|
|
1166
|
-
readonly address: "0x3154Cf16ccdb4C6d922629664174b904d80F2C35";
|
|
1167
|
-
readonly blockCreated: 17482143;
|
|
1168
|
-
};
|
|
1169
|
-
};
|
|
1170
|
-
readonly gasPriceOracle: {
|
|
1171
|
-
readonly address: "0x420000000000000000000000000000000000000F";
|
|
1172
|
-
};
|
|
1173
|
-
readonly l1Block: {
|
|
1174
|
-
readonly address: "0x4200000000000000000000000000000000000015";
|
|
1175
|
-
};
|
|
1176
|
-
readonly l2CrossDomainMessenger: {
|
|
1177
|
-
readonly address: "0x4200000000000000000000000000000000000007";
|
|
1178
|
-
};
|
|
1179
|
-
readonly l2Erc721Bridge: {
|
|
1180
|
-
readonly address: "0x4200000000000000000000000000000000000014";
|
|
1181
|
-
};
|
|
1182
|
-
readonly l2StandardBridge: {
|
|
1183
|
-
readonly address: "0x4200000000000000000000000000000000000010";
|
|
1184
|
-
};
|
|
1185
|
-
readonly l2ToL1MessagePasser: {
|
|
1186
|
-
readonly address: "0x4200000000000000000000000000000000000016";
|
|
1187
|
-
};
|
|
1188
|
-
};
|
|
1189
|
-
ensTlds?: readonly string[] | undefined;
|
|
1190
|
-
id: 8453;
|
|
1191
|
-
name: "Base";
|
|
1192
|
-
nativeCurrency: {
|
|
1193
|
-
readonly name: "Ether";
|
|
1194
|
-
readonly symbol: "ETH";
|
|
1195
|
-
readonly decimals: 18;
|
|
1196
|
-
};
|
|
1197
|
-
experimental_preconfirmationTime?: number | undefined | undefined;
|
|
1198
|
-
rpcUrls: {
|
|
1199
|
-
readonly default: {
|
|
1200
|
-
readonly http: readonly ["https://mainnet.base.org"];
|
|
1201
|
-
};
|
|
1202
|
-
};
|
|
1203
|
-
sourceId: 1;
|
|
1204
|
-
testnet?: boolean | undefined | undefined;
|
|
1205
|
-
custom?: Record<string, unknown> | undefined;
|
|
1206
|
-
extendSchema?: Record<string, unknown> | undefined;
|
|
1207
|
-
fees?: viem.ChainFees<undefined> | undefined;
|
|
1208
|
-
formatters: {
|
|
1209
|
-
readonly block: {
|
|
1210
|
-
exclude: [] | undefined;
|
|
1211
|
-
format: (args: viem_chains.OpStackRpcBlock, action?: string | undefined) => {
|
|
1212
|
-
baseFeePerGas: bigint | null;
|
|
1213
|
-
blobGasUsed: bigint;
|
|
1214
|
-
difficulty: bigint;
|
|
1215
|
-
excessBlobGas: bigint;
|
|
1216
|
-
extraData: viem.Hex;
|
|
1217
|
-
gasLimit: bigint;
|
|
1218
|
-
gasUsed: bigint;
|
|
1219
|
-
hash: `0x${string}` | null;
|
|
1220
|
-
logsBloom: `0x${string}` | null;
|
|
1221
|
-
miner: `0x${string}`;
|
|
1222
|
-
mixHash: viem.Hash;
|
|
1223
|
-
nonce: `0x${string}` | null;
|
|
1224
|
-
number: bigint | null;
|
|
1225
|
-
parentBeaconBlockRoot?: `0x${string}` | undefined;
|
|
1226
|
-
parentHash: viem.Hash;
|
|
1227
|
-
receiptsRoot: viem.Hex;
|
|
1228
|
-
sealFields: viem.Hex[];
|
|
1229
|
-
sha3Uncles: viem.Hash;
|
|
1230
|
-
size: bigint;
|
|
1231
|
-
stateRoot: viem.Hash;
|
|
1232
|
-
timestamp: bigint;
|
|
1233
|
-
totalDifficulty: bigint | null;
|
|
1234
|
-
transactions: `0x${string}`[] | viem_chains.OpStackTransaction<boolean>[];
|
|
1235
|
-
transactionsRoot: viem.Hash;
|
|
1236
|
-
uncles: viem.Hash[];
|
|
1237
|
-
withdrawals?: viem.Withdrawal[] | undefined | undefined;
|
|
1238
|
-
withdrawalsRoot?: `0x${string}` | undefined;
|
|
1239
|
-
} & {};
|
|
1240
|
-
type: "block";
|
|
1241
|
-
};
|
|
1242
|
-
readonly transaction: {
|
|
1243
|
-
exclude: [] | undefined;
|
|
1244
|
-
format: (args: viem_chains.OpStackRpcTransaction, action?: string | undefined) => ({
|
|
1245
|
-
blockHash: `0x${string}` | null;
|
|
1246
|
-
blockNumber: bigint | null;
|
|
1247
|
-
from: `0x${string}`;
|
|
1248
|
-
gas: bigint;
|
|
1249
|
-
hash: viem.Hash;
|
|
1250
|
-
input: viem.Hex;
|
|
1251
|
-
nonce: number;
|
|
1252
|
-
r: viem.Hex;
|
|
1253
|
-
s: viem.Hex;
|
|
1254
|
-
to: `0x${string}` | null;
|
|
1255
|
-
transactionIndex: number | null;
|
|
1256
|
-
typeHex: viem.Hex | null;
|
|
1257
|
-
v: bigint;
|
|
1258
|
-
value: bigint;
|
|
1259
|
-
yParity: number;
|
|
1260
|
-
gasPrice?: undefined | undefined;
|
|
1261
|
-
maxFeePerBlobGas?: undefined | undefined;
|
|
1262
|
-
maxFeePerGas: bigint;
|
|
1263
|
-
maxPriorityFeePerGas: bigint;
|
|
1264
|
-
isSystemTx?: boolean;
|
|
1265
|
-
mint?: bigint | undefined | undefined;
|
|
1266
|
-
sourceHash: viem.Hex;
|
|
1267
|
-
type: "deposit";
|
|
1268
|
-
} | {
|
|
1269
|
-
r: viem.Hex;
|
|
1270
|
-
s: viem.Hex;
|
|
1271
|
-
v: bigint;
|
|
1272
|
-
to: `0x${string}` | null;
|
|
1273
|
-
from: `0x${string}`;
|
|
1274
|
-
gas: bigint;
|
|
1275
|
-
nonce: number;
|
|
1276
|
-
value: bigint;
|
|
1277
|
-
blockHash: `0x${string}` | null;
|
|
1278
|
-
blockNumber: bigint | null;
|
|
1279
|
-
hash: viem.Hash;
|
|
1280
|
-
input: viem.Hex;
|
|
1281
|
-
transactionIndex: number | null;
|
|
1282
|
-
typeHex: viem.Hex | null;
|
|
1283
|
-
accessList?: undefined | undefined;
|
|
1284
|
-
authorizationList?: undefined | undefined;
|
|
1285
|
-
blobVersionedHashes?: undefined | undefined;
|
|
1286
|
-
chainId?: number | undefined;
|
|
1287
|
-
yParity?: undefined | undefined;
|
|
1288
|
-
type: "legacy";
|
|
1289
|
-
gasPrice: bigint;
|
|
1290
|
-
maxFeePerBlobGas?: undefined | undefined;
|
|
1291
|
-
maxFeePerGas?: undefined | undefined;
|
|
1292
|
-
maxPriorityFeePerGas?: undefined | undefined;
|
|
1293
|
-
isSystemTx?: undefined | undefined;
|
|
1294
|
-
mint?: undefined | undefined;
|
|
1295
|
-
sourceHash?: undefined | undefined;
|
|
1296
|
-
} | {
|
|
1297
|
-
blockHash: `0x${string}` | null;
|
|
1298
|
-
blockNumber: bigint | null;
|
|
1299
|
-
from: `0x${string}`;
|
|
1300
|
-
gas: bigint;
|
|
1301
|
-
hash: viem.Hash;
|
|
1302
|
-
input: viem.Hex;
|
|
1303
|
-
nonce: number;
|
|
1304
|
-
r: viem.Hex;
|
|
1305
|
-
s: viem.Hex;
|
|
1306
|
-
to: `0x${string}` | null;
|
|
1307
|
-
transactionIndex: number | null;
|
|
1308
|
-
typeHex: viem.Hex | null;
|
|
1309
|
-
v: bigint;
|
|
1310
|
-
value: bigint;
|
|
1311
|
-
yParity: number;
|
|
1312
|
-
accessList: viem.AccessList;
|
|
1313
|
-
authorizationList?: undefined | undefined;
|
|
1314
|
-
blobVersionedHashes?: undefined | undefined;
|
|
1315
|
-
chainId: number;
|
|
1316
|
-
type: "eip2930";
|
|
1317
|
-
gasPrice: bigint;
|
|
1318
|
-
maxFeePerBlobGas?: undefined | undefined;
|
|
1319
|
-
maxFeePerGas?: undefined | undefined;
|
|
1320
|
-
maxPriorityFeePerGas?: undefined | undefined;
|
|
1321
|
-
isSystemTx?: undefined | undefined;
|
|
1322
|
-
mint?: undefined | undefined;
|
|
1323
|
-
sourceHash?: undefined | undefined;
|
|
1324
|
-
} | {
|
|
1325
|
-
blockHash: `0x${string}` | null;
|
|
1326
|
-
blockNumber: bigint | null;
|
|
1327
|
-
from: `0x${string}`;
|
|
1328
|
-
gas: bigint;
|
|
1329
|
-
hash: viem.Hash;
|
|
1330
|
-
input: viem.Hex;
|
|
1331
|
-
nonce: number;
|
|
1332
|
-
r: viem.Hex;
|
|
1333
|
-
s: viem.Hex;
|
|
1334
|
-
to: `0x${string}` | null;
|
|
1335
|
-
transactionIndex: number | null;
|
|
1336
|
-
typeHex: viem.Hex | null;
|
|
1337
|
-
v: bigint;
|
|
1338
|
-
value: bigint;
|
|
1339
|
-
yParity: number;
|
|
1340
|
-
accessList: viem.AccessList;
|
|
1341
|
-
authorizationList?: undefined | undefined;
|
|
1342
|
-
blobVersionedHashes?: undefined | undefined;
|
|
1343
|
-
chainId: number;
|
|
1344
|
-
type: "eip1559";
|
|
1345
|
-
gasPrice?: undefined | undefined;
|
|
1346
|
-
maxFeePerBlobGas?: undefined | undefined;
|
|
1347
|
-
maxFeePerGas: bigint;
|
|
1348
|
-
maxPriorityFeePerGas: bigint;
|
|
1349
|
-
isSystemTx?: undefined | undefined;
|
|
1350
|
-
mint?: undefined | undefined;
|
|
1351
|
-
sourceHash?: undefined | undefined;
|
|
1352
|
-
} | {
|
|
1353
|
-
blockHash: `0x${string}` | null;
|
|
1354
|
-
blockNumber: bigint | null;
|
|
1355
|
-
from: `0x${string}`;
|
|
1356
|
-
gas: bigint;
|
|
1357
|
-
hash: viem.Hash;
|
|
1358
|
-
input: viem.Hex;
|
|
1359
|
-
nonce: number;
|
|
1360
|
-
r: viem.Hex;
|
|
1361
|
-
s: viem.Hex;
|
|
1362
|
-
to: `0x${string}` | null;
|
|
1363
|
-
transactionIndex: number | null;
|
|
1364
|
-
typeHex: viem.Hex | null;
|
|
1365
|
-
v: bigint;
|
|
1366
|
-
value: bigint;
|
|
1367
|
-
yParity: number;
|
|
1368
|
-
accessList: viem.AccessList;
|
|
1369
|
-
authorizationList?: undefined | undefined;
|
|
1370
|
-
blobVersionedHashes: readonly viem.Hex[];
|
|
1371
|
-
chainId: number;
|
|
1372
|
-
type: "eip4844";
|
|
1373
|
-
gasPrice?: undefined | undefined;
|
|
1374
|
-
maxFeePerBlobGas: bigint;
|
|
1375
|
-
maxFeePerGas: bigint;
|
|
1376
|
-
maxPriorityFeePerGas: bigint;
|
|
1377
|
-
isSystemTx?: undefined | undefined;
|
|
1378
|
-
mint?: undefined | undefined;
|
|
1379
|
-
sourceHash?: undefined | undefined;
|
|
1380
|
-
} | {
|
|
1381
|
-
blockHash: `0x${string}` | null;
|
|
1382
|
-
blockNumber: bigint | null;
|
|
1383
|
-
from: `0x${string}`;
|
|
1384
|
-
gas: bigint;
|
|
1385
|
-
hash: viem.Hash;
|
|
1386
|
-
input: viem.Hex;
|
|
1387
|
-
nonce: number;
|
|
1388
|
-
r: viem.Hex;
|
|
1389
|
-
s: viem.Hex;
|
|
1390
|
-
to: `0x${string}` | null;
|
|
1391
|
-
transactionIndex: number | null;
|
|
1392
|
-
typeHex: viem.Hex | null;
|
|
1393
|
-
v: bigint;
|
|
1394
|
-
value: bigint;
|
|
1395
|
-
yParity: number;
|
|
1396
|
-
accessList: viem.AccessList;
|
|
1397
|
-
authorizationList: viem.SignedAuthorizationList;
|
|
1398
|
-
blobVersionedHashes?: undefined | undefined;
|
|
1399
|
-
chainId: number;
|
|
1400
|
-
type: "eip7702";
|
|
1401
|
-
gasPrice?: undefined | undefined;
|
|
1402
|
-
maxFeePerBlobGas?: undefined | undefined;
|
|
1403
|
-
maxFeePerGas: bigint;
|
|
1404
|
-
maxPriorityFeePerGas: bigint;
|
|
1405
|
-
isSystemTx?: undefined | undefined;
|
|
1406
|
-
mint?: undefined | undefined;
|
|
1407
|
-
sourceHash?: undefined | undefined;
|
|
1408
|
-
}) & {};
|
|
1409
|
-
type: "transaction";
|
|
1410
|
-
};
|
|
1411
|
-
readonly transactionReceipt: {
|
|
1412
|
-
exclude: [] | undefined;
|
|
1413
|
-
format: (args: viem_chains.OpStackRpcTransactionReceipt, action?: string | undefined) => {
|
|
1414
|
-
blobGasPrice?: bigint | undefined;
|
|
1415
|
-
blobGasUsed?: bigint | undefined;
|
|
1416
|
-
blockHash: viem.Hash;
|
|
1417
|
-
blockNumber: bigint;
|
|
1418
|
-
contractAddress: `0x${string}` | null | undefined;
|
|
1419
|
-
cumulativeGasUsed: bigint;
|
|
1420
|
-
effectiveGasPrice: bigint;
|
|
1421
|
-
from: `0x${string}`;
|
|
1422
|
-
gasUsed: bigint;
|
|
1423
|
-
logs: viem.Log<bigint, number, false>[];
|
|
1424
|
-
logsBloom: viem.Hex;
|
|
1425
|
-
root?: `0x${string}` | undefined;
|
|
1426
|
-
status: "success" | "reverted";
|
|
1427
|
-
to: `0x${string}` | null;
|
|
1428
|
-
transactionHash: viem.Hash;
|
|
1429
|
-
transactionIndex: number;
|
|
1430
|
-
type: viem.TransactionType;
|
|
1431
|
-
l1GasPrice: bigint | null;
|
|
1432
|
-
l1GasUsed: bigint | null;
|
|
1433
|
-
l1Fee: bigint | null;
|
|
1434
|
-
l1FeeScalar: number | null;
|
|
1435
|
-
} & {};
|
|
1436
|
-
type: "transactionReceipt";
|
|
1437
|
-
};
|
|
1438
|
-
};
|
|
1439
|
-
prepareTransactionRequest?: ((args: viem.PrepareTransactionRequestParameters, options: {
|
|
1440
|
-
phase: "beforeFillTransaction" | "beforeFillParameters" | "afterFillParameters";
|
|
1441
|
-
}) => Promise<viem.PrepareTransactionRequestParameters>) | [fn: ((args: viem.PrepareTransactionRequestParameters, options: {
|
|
1442
|
-
phase: "beforeFillTransaction" | "beforeFillParameters" | "afterFillParameters";
|
|
1443
|
-
}) => Promise<viem.PrepareTransactionRequestParameters>) | undefined, options: {
|
|
1444
|
-
runAt: readonly ("beforeFillTransaction" | "beforeFillParameters" | "afterFillParameters")[];
|
|
1445
|
-
}] | undefined;
|
|
1446
|
-
serializers: {
|
|
1447
|
-
readonly transaction: typeof viem_chains.serializeTransactionOpStack;
|
|
1448
|
-
};
|
|
1449
|
-
verifyHash?: ((client: viem.Client, parameters: viem.VerifyHashActionParameters) => Promise<viem.VerifyHashActionReturnType>) | undefined;
|
|
1450
|
-
};
|
|
1451
|
-
};
|
|
1452
|
-
type NetworkType = 'mainnet';
|
|
1453
|
-
/**
|
|
1454
|
-
* Contract addresses by network
|
|
1455
|
-
*/
|
|
1456
|
-
declare const CONTRACT_ADDRESSES: Record<NetworkType, {
|
|
1457
|
-
agentRegistry: Address;
|
|
1458
|
-
router: Address;
|
|
1459
|
-
vaultFactory: Address;
|
|
1460
|
-
feeCollector: Address;
|
|
1461
|
-
serviceEscrow: Address;
|
|
1462
|
-
}>;
|
|
1463
|
-
/**
|
|
1464
|
-
* DEX router addresses on Base
|
|
1465
|
-
*/
|
|
1466
|
-
declare const DEX_ADDRESSES: {
|
|
1467
|
-
readonly aerodromeRouter: Address;
|
|
1468
|
-
readonly aerodromeSlipstream: Address;
|
|
1469
|
-
readonly uniswapUniversalRouter: Address;
|
|
1470
|
-
readonly uniswapV4Router: Address;
|
|
1471
|
-
readonly WETH: Address;
|
|
1472
|
-
readonly USDC: Address;
|
|
1473
|
-
};
|
|
1474
|
-
/**
|
|
1475
|
-
* 0x API configuration
|
|
1476
|
-
*/
|
|
1477
|
-
declare const ZERO_X_CONFIG: {
|
|
1478
|
-
readonly baseUrl: "https://api.0x.org";
|
|
1479
|
-
readonly chainId: 8453;
|
|
1480
|
-
};
|
|
1481
|
-
/**
|
|
1482
|
-
* Exagent API configuration
|
|
1483
|
-
*/
|
|
1484
|
-
declare const EXAGENT_API_CONFIG: {
|
|
1485
|
-
readonly mainnet: "https://exagent-api.onrender.com";
|
|
1486
|
-
};
|
|
1487
|
-
|
|
1488
|
-
/**
|
|
1489
|
-
* Configuration for ExagentClient
|
|
1490
|
-
*/
|
|
1491
|
-
interface ExagentClientConfig {
|
|
1492
|
-
/** Network to connect to */
|
|
1493
|
-
network?: NetworkType;
|
|
1494
|
-
/** Private key for the agent's wallet */
|
|
1495
|
-
privateKey?: `0x${string}`;
|
|
1496
|
-
/** Pre-configured wallet client */
|
|
1497
|
-
walletClient?: WalletClient;
|
|
1498
|
-
/** RPC URL override */
|
|
1499
|
-
rpcUrl?: string;
|
|
1500
|
-
/** Exagent API key (optional, for enhanced features) */
|
|
1501
|
-
apiKey?: string;
|
|
1502
|
-
}
|
|
1503
|
-
/**
|
|
1504
|
-
* Main client for interacting with Exagent
|
|
1505
|
-
*
|
|
1506
|
-
* @example
|
|
1507
|
-
* ```typescript
|
|
1508
|
-
* import { ExagentClient } from '@exagent/sdk';
|
|
1509
|
-
*
|
|
1510
|
-
* const exagent = new ExagentClient({
|
|
1511
|
-
* privateKey: process.env.AGENT_PRIVATE_KEY,
|
|
1512
|
-
* network: 'mainnet',
|
|
1513
|
-
* });
|
|
1514
|
-
*
|
|
1515
|
-
* // Register agent
|
|
1516
|
-
* const agentId = await exagent.register({
|
|
1517
|
-
* name: 'My Trading Agent',
|
|
1518
|
-
* description: 'Momentum-based trading strategy',
|
|
1519
|
-
* capabilities: ['spot_trading'],
|
|
1520
|
-
* });
|
|
1521
|
-
*
|
|
1522
|
-
* // Execute trade (always through ExagentRouter for attribution + fees)
|
|
1523
|
-
* const result = await exagent.trade({
|
|
1524
|
-
* tokenIn: WETH,
|
|
1525
|
-
* tokenOut: USDC,
|
|
1526
|
-
* amountIn: parseEther('1'),
|
|
1527
|
-
* maxSlippageBps: 50,
|
|
1528
|
-
* });
|
|
1529
|
-
* console.log('Trade submitted:', result.hash);
|
|
1530
|
-
* ```
|
|
1531
|
-
*/
|
|
1532
|
-
declare class ExagentClient {
|
|
1533
|
-
private readonly publicClient;
|
|
1534
|
-
private readonly walletClient;
|
|
1535
|
-
private readonly account;
|
|
1536
|
-
private readonly network;
|
|
1537
|
-
private readonly apiKey?;
|
|
1538
|
-
readonly registry: ExagentRegistry;
|
|
1539
|
-
private _agentId?;
|
|
1540
|
-
constructor(config: ExagentClientConfig);
|
|
1541
|
-
/** Standard headers for all API requests (includes SDK version for gating) */
|
|
1542
|
-
private apiHeaders;
|
|
1543
|
-
/**
|
|
1544
|
-
* Register as a new agent on Exagent.
|
|
1545
|
-
*
|
|
1546
|
-
* RECOMMENDED: Register your agent at https://exagent.io instead of using this method.
|
|
1547
|
-
* The website handles the full registration flow including risk universe selection,
|
|
1548
|
-
* position size limits, daily loss limits, and metadata upload — all in one step.
|
|
1549
|
-
* After registering on the website, use your agent ID in agent-config.json.
|
|
1550
|
-
*
|
|
1551
|
-
* This SDK method is available for programmatic registration but uses default
|
|
1552
|
-
* risk parameters (universe=1, maxPositionSize=10%, maxDailyLoss=5%).
|
|
1553
|
-
*
|
|
1554
|
-
* @param metadata Agent metadata (will be uploaded to IPFS)
|
|
1555
|
-
* @returns The assigned agent ID
|
|
1556
|
-
* @throws Error if wallet already owns an agent (one agent per wallet rule)
|
|
1557
|
-
*/
|
|
1558
|
-
register(metadata: AgentMetadata): Promise<bigint>;
|
|
1559
|
-
/**
|
|
1560
|
-
* Check if an agent name is available for registration
|
|
1561
|
-
* @param name The name to check
|
|
1562
|
-
* @returns True if the name is available
|
|
1563
|
-
*/
|
|
1564
|
-
isNameAvailable(name: string): Promise<boolean>;
|
|
1565
|
-
/**
|
|
1566
|
-
* Get agent by name (returns 0 if not found)
|
|
1567
|
-
* @param name The agent name to look up
|
|
1568
|
-
* @returns Agent ID or 0 if not found
|
|
1569
|
-
*/
|
|
1570
|
-
getAgentByName(name: string): Promise<bigint>;
|
|
1571
|
-
/**
|
|
1572
|
-
* Get the current agent's ID (if registered).
|
|
1573
|
-
*
|
|
1574
|
-
* Resolution order:
|
|
1575
|
-
* 1. Cached value (from prior register() or getAgentId() call)
|
|
1576
|
-
* 2. walletToAgent mapping (linked wallets)
|
|
1577
|
-
* 3. Owner lookup (unlinked owner wallet)
|
|
1578
|
-
*
|
|
1579
|
-
* If the agent was just registered, public RPCs may return stale data (0).
|
|
1580
|
-
* Use `retries` to wait for the on-chain state to propagate.
|
|
1581
|
-
*
|
|
1582
|
-
* @param retries Number of retries with 2s delay for stale RPC reads (default: 0)
|
|
1583
|
-
*/
|
|
1584
|
-
getAgentId(retries?: number): Promise<bigint | undefined>;
|
|
1585
|
-
/**
|
|
1586
|
-
* Get agent profile
|
|
1587
|
-
* @param agentId Optional agent ID (defaults to current agent)
|
|
1588
|
-
*/
|
|
1589
|
-
getAgent(agentId?: bigint): Promise<AgentProfile>;
|
|
1590
|
-
/**
|
|
1591
|
-
* Link an additional wallet to this agent
|
|
1592
|
-
* @param wallet Wallet address to link
|
|
1593
|
-
* @param signMessage Function to sign the message hash with the wallet (use signMessage({ raw: hash }))
|
|
1594
|
-
*/
|
|
1595
|
-
linkWallet(wallet: Address, signMessage: (message: {
|
|
1596
|
-
raw: `0x${string}`;
|
|
1597
|
-
}) => Promise<`0x${string}`>): Promise<Hash>;
|
|
1598
|
-
/**
|
|
1599
|
-
* Get all wallets linked to this agent
|
|
1600
|
-
*/
|
|
1601
|
-
getLinkedWallets(): Promise<Address[]>;
|
|
1602
|
-
/**
|
|
1603
|
-
* Execute a trade through ExagentRouter
|
|
1604
|
-
*
|
|
1605
|
-
* All trades MUST go through the ExagentRouter. This ensures:
|
|
1606
|
-
* - Trade attribution for leaderboard ranking
|
|
1607
|
-
* - Protocol fee collection (0.2%)
|
|
1608
|
-
* - On-chain performance tracking
|
|
1609
|
-
* - Token whitelist enforcement per risk universe
|
|
1610
|
-
*
|
|
1611
|
-
* There is no way to trade outside the router. This is by design.
|
|
1612
|
-
*
|
|
1613
|
-
* @param intent Trade parameters
|
|
1614
|
-
* @returns Trade result with transaction hash
|
|
1615
|
-
*
|
|
1616
|
-
* @example
|
|
1617
|
-
* ```typescript
|
|
1618
|
-
* const result = await exagent.trade({
|
|
1619
|
-
* tokenIn: WETH,
|
|
1620
|
-
* tokenOut: USDC,
|
|
1621
|
-
* amountIn: parseEther('1'),
|
|
1622
|
-
* maxSlippageBps: 50,
|
|
1623
|
-
* });
|
|
1624
|
-
* console.log('Trade submitted:', result.hash);
|
|
1625
|
-
* ```
|
|
1626
|
-
*/
|
|
1627
|
-
trade(intent: Omit<TradeIntent, 'action'>): Promise<TradeResult>;
|
|
1628
|
-
/**
|
|
1629
|
-
* Build a router trade transaction without executing
|
|
1630
|
-
* Useful for simulation or multi-step workflows
|
|
1631
|
-
*/
|
|
1632
|
-
buildRouterTrade(intent: Omit<TradeIntent, 'action'>, agentId?: bigint): Promise<RouterTradeResponse>;
|
|
1633
|
-
/**
|
|
1634
|
-
* Check if an address is the ETH sentinel or WETH
|
|
1635
|
-
*/
|
|
1636
|
-
private isETHAddress;
|
|
1637
|
-
/**
|
|
1638
|
-
* Read current ERC-20 allowance for a (token, spender) pair
|
|
1639
|
-
*/
|
|
1640
|
-
private getAllowance;
|
|
1641
|
-
/**
|
|
1642
|
-
* Approve token spending for router.
|
|
1643
|
-
* Verifies the approval receipt succeeded — previous version silently continued
|
|
1644
|
-
* on reverted approvals, causing downstream "transfer amount exceeds allowance" errors.
|
|
1645
|
-
*/
|
|
1646
|
-
private approveToken;
|
|
1647
|
-
/**
|
|
1648
|
-
* Encode ERC20 approve calldata
|
|
1649
|
-
*/
|
|
1650
|
-
private encodeApprove;
|
|
1651
|
-
/**
|
|
1652
|
-
* Request a service from another agent
|
|
1653
|
-
*/
|
|
1654
|
-
requestService(request: ServiceRequest): Promise<{
|
|
1655
|
-
requestId: string;
|
|
1656
|
-
}>;
|
|
1657
|
-
/**
|
|
1658
|
-
* List available services
|
|
1659
|
-
*/
|
|
1660
|
-
listServices(serviceType?: string): Promise<unknown[]>;
|
|
1661
|
-
/**
|
|
1662
|
-
* Get agent leaderboard
|
|
1663
|
-
*/
|
|
1664
|
-
getLeaderboard(options?: {
|
|
1665
|
-
category?: string;
|
|
1666
|
-
limit?: number;
|
|
1667
|
-
offset?: number;
|
|
1668
|
-
}): Promise<AgentProfile[]>;
|
|
1669
|
-
/**
|
|
1670
|
-
* Get a vault interface for interacting with an ExagentVault
|
|
1671
|
-
* @param vaultAddress The vault contract address
|
|
1672
|
-
* @returns ExagentVault instance
|
|
1673
|
-
*/
|
|
1674
|
-
getVault(vaultAddress: Address): ExagentVault;
|
|
1675
|
-
/**
|
|
1676
|
-
* List all vaults for a given agent
|
|
1677
|
-
* @param agentId Agent ID to get vaults for
|
|
1678
|
-
* @returns Array of vault summaries
|
|
1679
|
-
*/
|
|
1680
|
-
getAgentVaults(agentId?: bigint): Promise<VaultSummary[]>;
|
|
1681
|
-
/**
|
|
1682
|
-
* List all vaults the user has positions in
|
|
1683
|
-
* @param userAddress User address (defaults to connected wallet)
|
|
1684
|
-
* @returns Array of vault summaries with user position info
|
|
1685
|
-
*/
|
|
1686
|
-
getUserVaults(userAddress?: Address): Promise<VaultSummary[]>;
|
|
1687
|
-
/**
|
|
1688
|
-
* List top performing vaults
|
|
1689
|
-
* @param options Filter options
|
|
1690
|
-
* @returns Array of vault summaries sorted by performance
|
|
1691
|
-
*/
|
|
1692
|
-
getTopVaults(options?: {
|
|
1693
|
-
asset?: Address;
|
|
1694
|
-
minTvl?: bigint;
|
|
1695
|
-
period?: '7d' | '30d' | '90d' | 'all';
|
|
1696
|
-
limit?: number;
|
|
1697
|
-
}): Promise<VaultSummary[]>;
|
|
1698
|
-
/**
|
|
1699
|
-
* Deposit into a vault
|
|
1700
|
-
* @param vaultAddress Vault contract address
|
|
1701
|
-
* @param amount Amount of underlying asset to deposit
|
|
1702
|
-
* @returns Transaction hash
|
|
1703
|
-
*/
|
|
1704
|
-
depositToVault(vaultAddress: Address, amount: bigint): Promise<Hash>;
|
|
1705
|
-
/**
|
|
1706
|
-
* Withdraw from a vault
|
|
1707
|
-
* @param vaultAddress Vault contract address
|
|
1708
|
-
* @param assets Amount of underlying asset to withdraw
|
|
1709
|
-
* @returns Transaction hash
|
|
1710
|
-
*/
|
|
1711
|
-
withdrawFromVault(vaultAddress: Address, assets: bigint): Promise<Hash>;
|
|
1712
|
-
/**
|
|
1713
|
-
* Redeem shares from a vault
|
|
1714
|
-
* @param vaultAddress Vault contract address
|
|
1715
|
-
* @param shares Amount of shares to redeem
|
|
1716
|
-
* @returns Transaction hash
|
|
1717
|
-
*/
|
|
1718
|
-
redeemFromVault(vaultAddress: Address, shares: bigint): Promise<Hash>;
|
|
1719
|
-
/**
|
|
1720
|
-
* Get the ERC-8004 global agent identifier for the current agent
|
|
1721
|
-
*
|
|
1722
|
-
* Format: eip155:{chainId}:{registryAddress}:{agentId}
|
|
1723
|
-
*
|
|
1724
|
-
* This creates a universally unique identifier that can be used for
|
|
1725
|
-
* cross-protocol agent discovery and interoperability.
|
|
1726
|
-
*
|
|
1727
|
-
* @returns The global agent ID string
|
|
1728
|
-
* @throws Error if agent is not registered
|
|
1729
|
-
*
|
|
1730
|
-
* @example
|
|
1731
|
-
* ```typescript
|
|
1732
|
-
* const globalId = await exagent.getGlobalAgentId();
|
|
1733
|
-
* // => "eip155:8453:0xABC...DEF:42"
|
|
1734
|
-
* ```
|
|
1735
|
-
*/
|
|
1736
|
-
getGlobalAgentId(): Promise<GlobalAgentId>;
|
|
1737
|
-
/**
|
|
1738
|
-
* Build a global agent ID for any agent (static utility)
|
|
1739
|
-
*
|
|
1740
|
-
* @param chainId - EVM chain ID
|
|
1741
|
-
* @param registryAddress - ExagentRegistry contract address
|
|
1742
|
-
* @param agentId - On-chain agent ID
|
|
1743
|
-
* @returns ERC-8004 global agent identifier
|
|
1744
|
-
*/
|
|
1745
|
-
static buildGlobalAgentId(chainId: number, registryAddress: Address, agentId: number | bigint): GlobalAgentId;
|
|
1746
|
-
/**
|
|
1747
|
-
* Get the agent's wallet address
|
|
1748
|
-
*/
|
|
1749
|
-
get address(): Address;
|
|
1750
|
-
/**
|
|
1751
|
-
* Sign a message with the wallet's private key (EIP-191 personal sign)
|
|
1752
|
-
* @param message The message to sign — string for UTF-8, or { raw: Hex } for raw bytes
|
|
1753
|
-
* @returns The signature
|
|
1754
|
-
*/
|
|
1755
|
-
signMessage(message: string | {
|
|
1756
|
-
raw: `0x${string}`;
|
|
1757
|
-
}): Promise<`0x${string}`>;
|
|
1758
|
-
private uploadMetadata;
|
|
1759
|
-
private parseAgentIdFromReceipt;
|
|
1760
|
-
}
|
|
1761
|
-
|
|
1762
|
-
/**
|
|
1763
|
-
* ABI for ExagentRouter custom errors
|
|
1764
|
-
* Used for decoding revert reasons from router transactions
|
|
1765
|
-
*/
|
|
1766
|
-
declare const EXAGENT_ROUTER_ABI: readonly [{
|
|
1767
|
-
readonly type: "error";
|
|
1768
|
-
readonly name: "InvalidAgentId";
|
|
1769
|
-
readonly inputs: readonly [];
|
|
1770
|
-
}, {
|
|
1771
|
-
readonly type: "error";
|
|
1772
|
-
readonly name: "SwapFailed";
|
|
1773
|
-
readonly inputs: readonly [];
|
|
1774
|
-
}, {
|
|
1775
|
-
readonly type: "error";
|
|
1776
|
-
readonly name: "InsufficientOutput";
|
|
1777
|
-
readonly inputs: readonly [];
|
|
1778
|
-
}, {
|
|
1779
|
-
readonly type: "error";
|
|
1780
|
-
readonly name: "ZeroAddress";
|
|
1781
|
-
readonly inputs: readonly [];
|
|
1782
|
-
}, {
|
|
1783
|
-
readonly type: "error";
|
|
1784
|
-
readonly name: "ZeroAmount";
|
|
1785
|
-
readonly inputs: readonly [];
|
|
1786
|
-
}, {
|
|
1787
|
-
readonly type: "error";
|
|
1788
|
-
readonly name: "AggregatorNotWhitelisted";
|
|
1789
|
-
readonly inputs: readonly [];
|
|
1790
|
-
}, {
|
|
1791
|
-
readonly type: "error";
|
|
1792
|
-
readonly name: "ETHTransferFailed";
|
|
1793
|
-
readonly inputs: readonly [];
|
|
1794
|
-
}, {
|
|
1795
|
-
readonly type: "error";
|
|
1796
|
-
readonly name: "FeeBpsTooHigh";
|
|
1797
|
-
readonly inputs: readonly [];
|
|
1798
|
-
}, {
|
|
1799
|
-
readonly type: "error";
|
|
1800
|
-
readonly name: "NotAuthorizedForAgent";
|
|
1801
|
-
readonly inputs: readonly [{
|
|
1802
|
-
readonly name: "agentId";
|
|
1803
|
-
readonly type: "uint256";
|
|
1804
|
-
}, {
|
|
1805
|
-
readonly name: "caller";
|
|
1806
|
-
readonly type: "address";
|
|
1807
|
-
}];
|
|
1808
|
-
}, {
|
|
1809
|
-
readonly type: "error";
|
|
1810
|
-
readonly name: "ConfigMismatch";
|
|
1811
|
-
readonly inputs: readonly [{
|
|
1812
|
-
readonly name: "provided";
|
|
1813
|
-
readonly type: "bytes32";
|
|
1814
|
-
}, {
|
|
1815
|
-
readonly name: "onChain";
|
|
1816
|
-
readonly type: "bytes32";
|
|
1817
|
-
}];
|
|
1818
|
-
}, {
|
|
1819
|
-
readonly type: "error";
|
|
1820
|
-
readonly name: "MsgValueMismatch";
|
|
1821
|
-
readonly inputs: readonly [];
|
|
1822
|
-
}, {
|
|
1823
|
-
readonly type: "error";
|
|
1824
|
-
readonly name: "FeeCollectorNotSet";
|
|
1825
|
-
readonly inputs: readonly [];
|
|
1826
|
-
}, {
|
|
1827
|
-
readonly type: "error";
|
|
1828
|
-
readonly name: "TokenNotAllowedForAgent";
|
|
1829
|
-
readonly inputs: readonly [{
|
|
1830
|
-
readonly name: "agentId";
|
|
1831
|
-
readonly type: "uint256";
|
|
1832
|
-
}, {
|
|
1833
|
-
readonly name: "token";
|
|
1834
|
-
readonly type: "address";
|
|
1835
|
-
}];
|
|
1836
|
-
}, {
|
|
1837
|
-
readonly type: "error";
|
|
1838
|
-
readonly name: "NotAuthorized";
|
|
1839
|
-
readonly inputs: readonly [];
|
|
1840
|
-
}, {
|
|
1841
|
-
readonly type: "error";
|
|
1842
|
-
readonly name: "RiskUniverseTooLow";
|
|
1843
|
-
readonly inputs: readonly [{
|
|
1844
|
-
readonly name: "agentId";
|
|
1845
|
-
readonly type: "uint256";
|
|
1846
|
-
}, {
|
|
1847
|
-
readonly name: "riskUniverse";
|
|
1848
|
-
readonly type: "uint256";
|
|
1849
|
-
}];
|
|
1850
|
-
}, {
|
|
1851
|
-
readonly type: "error";
|
|
1852
|
-
readonly name: "FillAlreadyProcessed";
|
|
1853
|
-
readonly inputs: readonly [{
|
|
1854
|
-
readonly name: "fillId";
|
|
1855
|
-
readonly type: "bytes32";
|
|
1856
|
-
}];
|
|
1857
|
-
}];
|
|
1858
|
-
|
|
1859
|
-
/**
|
|
1860
|
-
* ExagentVaultFactory ABI (Mainnet — no burn fee, seed-based creation)
|
|
1861
|
-
*/
|
|
1862
|
-
declare const EXAGENT_VAULT_FACTORY_ABI: readonly [{
|
|
1863
|
-
readonly type: "function";
|
|
1864
|
-
readonly name: "owner";
|
|
1865
|
-
readonly inputs: readonly [];
|
|
1866
|
-
readonly outputs: readonly [{
|
|
1867
|
-
readonly type: "address";
|
|
1868
|
-
}];
|
|
1869
|
-
readonly stateMutability: "view";
|
|
1870
|
-
}, {
|
|
1871
|
-
readonly type: "function";
|
|
1872
|
-
readonly name: "registry";
|
|
1873
|
-
readonly inputs: readonly [];
|
|
1874
|
-
readonly outputs: readonly [{
|
|
1875
|
-
readonly type: "address";
|
|
1876
|
-
}];
|
|
1877
|
-
readonly stateMutability: "view";
|
|
1878
|
-
}, {
|
|
1879
|
-
readonly type: "function";
|
|
1880
|
-
readonly name: "router";
|
|
1881
|
-
readonly inputs: readonly [];
|
|
1882
|
-
readonly outputs: readonly [{
|
|
1883
|
-
readonly type: "address";
|
|
1884
|
-
}];
|
|
1885
|
-
readonly stateMutability: "view";
|
|
1886
|
-
}, {
|
|
1887
|
-
readonly type: "function";
|
|
1888
|
-
readonly name: "feeCollector";
|
|
1889
|
-
readonly inputs: readonly [];
|
|
1890
|
-
readonly outputs: readonly [{
|
|
1891
|
-
readonly type: "address";
|
|
1892
|
-
}];
|
|
1893
|
-
readonly stateMutability: "view";
|
|
1894
|
-
}, {
|
|
1895
|
-
readonly type: "function";
|
|
1896
|
-
readonly name: "stakingContract";
|
|
1897
|
-
readonly inputs: readonly [];
|
|
1898
|
-
readonly outputs: readonly [{
|
|
1899
|
-
readonly type: "address";
|
|
1900
|
-
}];
|
|
1901
|
-
readonly stateMutability: "view";
|
|
1902
|
-
}, {
|
|
1903
|
-
readonly type: "function";
|
|
1904
|
-
readonly name: "VERIFIED_VEXA_REQUIREMENT";
|
|
1905
|
-
readonly inputs: readonly [];
|
|
1906
|
-
readonly outputs: readonly [{
|
|
1907
|
-
readonly type: "uint256";
|
|
1908
|
-
}];
|
|
1909
|
-
readonly stateMutability: "view";
|
|
1910
|
-
}, {
|
|
1911
|
-
readonly type: "function";
|
|
1912
|
-
readonly name: "MIN_SEED_AMOUNT";
|
|
1913
|
-
readonly inputs: readonly [];
|
|
1914
|
-
readonly outputs: readonly [{
|
|
1915
|
-
readonly type: "uint256";
|
|
1916
|
-
}];
|
|
1917
|
-
readonly stateMutability: "view";
|
|
1918
|
-
}, {
|
|
1919
|
-
readonly type: "function";
|
|
1920
|
-
readonly name: "UNVERIFIED_CAP_MULTIPLIER";
|
|
1921
|
-
readonly inputs: readonly [];
|
|
1922
|
-
readonly outputs: readonly [{
|
|
1923
|
-
readonly type: "uint256";
|
|
1924
|
-
}];
|
|
1925
|
-
readonly stateMutability: "view";
|
|
1926
|
-
}, {
|
|
1927
|
-
readonly type: "function";
|
|
1928
|
-
readonly name: "VERIFIED_CAP_MULTIPLIER";
|
|
1929
|
-
readonly inputs: readonly [];
|
|
1930
|
-
readonly outputs: readonly [{
|
|
1931
|
-
readonly type: "uint256";
|
|
1932
|
-
}];
|
|
1933
|
-
readonly stateMutability: "view";
|
|
1934
|
-
}, {
|
|
1935
|
-
readonly type: "function";
|
|
1936
|
-
readonly name: "allowedAssets";
|
|
1937
|
-
readonly inputs: readonly [{
|
|
1938
|
-
readonly name: "asset";
|
|
1939
|
-
readonly type: "address";
|
|
1940
|
-
}];
|
|
1941
|
-
readonly outputs: readonly [{
|
|
1942
|
-
readonly type: "bool";
|
|
1943
|
-
}];
|
|
1944
|
-
readonly stateMutability: "view";
|
|
1945
|
-
}, {
|
|
1946
|
-
readonly type: "function";
|
|
1947
|
-
readonly name: "vaults";
|
|
1948
|
-
readonly inputs: readonly [{
|
|
1949
|
-
readonly name: "agentId";
|
|
1950
|
-
readonly type: "uint256";
|
|
1951
|
-
}, {
|
|
1952
|
-
readonly name: "asset";
|
|
1953
|
-
readonly type: "address";
|
|
1954
|
-
}];
|
|
1955
|
-
readonly outputs: readonly [{
|
|
1956
|
-
readonly type: "address";
|
|
1957
|
-
}];
|
|
1958
|
-
readonly stateMutability: "view";
|
|
1959
|
-
}, {
|
|
1960
|
-
readonly type: "function";
|
|
1961
|
-
readonly name: "agentVaultCount";
|
|
1962
|
-
readonly inputs: readonly [{
|
|
1963
|
-
readonly name: "agentId";
|
|
1964
|
-
readonly type: "uint256";
|
|
1965
|
-
}];
|
|
1966
|
-
readonly outputs: readonly [{
|
|
1967
|
-
readonly type: "uint256";
|
|
1968
|
-
}];
|
|
1969
|
-
readonly stateMutability: "view";
|
|
1970
|
-
}, {
|
|
1971
|
-
readonly type: "function";
|
|
1972
|
-
readonly name: "createVault";
|
|
1973
|
-
readonly inputs: readonly [{
|
|
1974
|
-
readonly name: "agentId";
|
|
1975
|
-
readonly type: "uint256";
|
|
1976
|
-
}, {
|
|
1977
|
-
readonly name: "asset";
|
|
1978
|
-
readonly type: "address";
|
|
1979
|
-
}, {
|
|
1980
|
-
readonly name: "seedAmount";
|
|
1981
|
-
readonly type: "uint256";
|
|
1982
|
-
}, {
|
|
1983
|
-
readonly name: "name";
|
|
1984
|
-
readonly type: "string";
|
|
1985
|
-
}, {
|
|
1986
|
-
readonly name: "symbol";
|
|
1987
|
-
readonly type: "string";
|
|
1988
|
-
}, {
|
|
1989
|
-
readonly name: "feeRecipient";
|
|
1990
|
-
readonly type: "address";
|
|
1991
|
-
}];
|
|
1992
|
-
readonly outputs: readonly [{
|
|
1993
|
-
readonly type: "address";
|
|
1994
|
-
}];
|
|
1995
|
-
readonly stateMutability: "nonpayable";
|
|
1996
|
-
}, {
|
|
1997
|
-
readonly type: "event";
|
|
1998
|
-
readonly name: "VaultCreated";
|
|
1999
|
-
readonly inputs: readonly [{
|
|
2000
|
-
readonly name: "vault";
|
|
2001
|
-
readonly type: "address";
|
|
2002
|
-
readonly indexed: true;
|
|
2003
|
-
}, {
|
|
2004
|
-
readonly name: "agentId";
|
|
2005
|
-
readonly type: "uint256";
|
|
2006
|
-
readonly indexed: true;
|
|
2007
|
-
}, {
|
|
2008
|
-
readonly name: "asset";
|
|
2009
|
-
readonly type: "address";
|
|
2010
|
-
readonly indexed: true;
|
|
2011
|
-
}, {
|
|
2012
|
-
readonly name: "creator";
|
|
2013
|
-
readonly type: "address";
|
|
2014
|
-
readonly indexed: false;
|
|
2015
|
-
}, {
|
|
2016
|
-
readonly name: "name";
|
|
2017
|
-
readonly type: "string";
|
|
2018
|
-
readonly indexed: false;
|
|
2019
|
-
}, {
|
|
2020
|
-
readonly name: "symbol";
|
|
2021
|
-
readonly type: "string";
|
|
2022
|
-
readonly indexed: false;
|
|
2023
|
-
}];
|
|
2024
|
-
}, {
|
|
2025
|
-
readonly type: "event";
|
|
2026
|
-
readonly name: "AllowedAssetUpdated";
|
|
2027
|
-
readonly inputs: readonly [{
|
|
2028
|
-
readonly name: "asset";
|
|
2029
|
-
readonly type: "address";
|
|
2030
|
-
readonly indexed: true;
|
|
2031
|
-
}, {
|
|
2032
|
-
readonly name: "allowed";
|
|
2033
|
-
readonly type: "bool";
|
|
2034
|
-
readonly indexed: false;
|
|
2035
|
-
}];
|
|
2036
|
-
}];
|
|
2037
|
-
/**
|
|
2038
|
-
* Vault creation requirements from the mainnet factory
|
|
2039
|
-
*/
|
|
2040
|
-
interface VaultCreationRequirements {
|
|
2041
|
-
minSeedAmount: bigint;
|
|
2042
|
-
unverifiedCapMultiplier: bigint;
|
|
2043
|
-
verifiedCapMultiplier: bigint;
|
|
2044
|
-
}
|
|
2045
|
-
/**
|
|
2046
|
-
* Result of checking if an address can create a vault
|
|
2047
|
-
*/
|
|
2048
|
-
interface CanCreateVaultResult {
|
|
2049
|
-
canCreate: boolean;
|
|
2050
|
-
reason: string;
|
|
2051
|
-
}
|
|
2052
|
-
/**
|
|
2053
|
-
* Options for creating a vault
|
|
2054
|
-
*/
|
|
2055
|
-
interface CreateVaultOptions {
|
|
2056
|
-
agentId: bigint;
|
|
2057
|
-
asset: Address;
|
|
2058
|
-
seedAmount: bigint;
|
|
2059
|
-
name: string;
|
|
2060
|
-
symbol: string;
|
|
2061
|
-
feeRecipient?: Address;
|
|
2062
|
-
}
|
|
2063
|
-
/**
|
|
2064
|
-
* ExagentVaultFactory SDK class for vault creation and management
|
|
2065
|
-
*/
|
|
2066
|
-
declare class ExagentVaultFactory {
|
|
2067
|
-
readonly address: Address;
|
|
2068
|
-
private readonly publicClient;
|
|
2069
|
-
private readonly walletClient?;
|
|
2070
|
-
private readonly chain;
|
|
2071
|
-
private readonly account?;
|
|
2072
|
-
constructor(factoryAddress: Address, publicClient: any, walletClient?: any, chain?: Chain, account?: Account);
|
|
2073
|
-
/**
|
|
2074
|
-
* Get vault creation requirements (mainnet: seed-based, no burn fee)
|
|
2075
|
-
*/
|
|
2076
|
-
getRequirements(): Promise<VaultCreationRequirements>;
|
|
2077
|
-
/**
|
|
2078
|
-
* Check if an address can create a vault.
|
|
2079
|
-
* Performs inline validation since the on-chain contract does not expose
|
|
2080
|
-
* a canCreateVault() view function.
|
|
2081
|
-
* @param creator Address to check
|
|
2082
|
-
*/
|
|
2083
|
-
canCreateVault(creator: Address): Promise<CanCreateVaultResult>;
|
|
2084
|
-
/**
|
|
2085
|
-
* Check if an asset is whitelisted for vault creation
|
|
2086
|
-
* @param asset Asset address to check
|
|
2087
|
-
*/
|
|
2088
|
-
isAssetAllowed(asset: Address): Promise<boolean>;
|
|
2089
|
-
/**
|
|
2090
|
-
* Get existing vault for an agent and asset
|
|
2091
|
-
* @param agentId Agent ID
|
|
2092
|
-
* @param asset Asset address
|
|
2093
|
-
* @returns Vault address or zero address if none exists
|
|
2094
|
-
*/
|
|
2095
|
-
getVault(agentId: bigint, asset: Address): Promise<Address>;
|
|
2096
|
-
/**
|
|
2097
|
-
* Get count of vaults for an agent
|
|
2098
|
-
* @param agentId Agent ID
|
|
2099
|
-
*/
|
|
2100
|
-
getAgentVaultCount(agentId: bigint): Promise<bigint>;
|
|
2101
|
-
/**
|
|
2102
|
-
* Check if agent already has a vault for an asset
|
|
2103
|
-
* @param agentId Agent ID
|
|
2104
|
-
* @param asset Asset address
|
|
2105
|
-
*/
|
|
2106
|
-
hasVault(agentId: bigint, asset: Address): Promise<boolean>;
|
|
2107
|
-
/**
|
|
2108
|
-
* Create a new vault for an agent (mainnet: requires seed amount)
|
|
2109
|
-
* @param options Vault creation options including seedAmount
|
|
2110
|
-
* @returns Transaction hash
|
|
2111
|
-
*/
|
|
2112
|
-
createVault(options: CreateVaultOptions): Promise<Hash>;
|
|
2113
|
-
/**
|
|
2114
|
-
* Check all requirements and create a vault if possible
|
|
2115
|
-
* Returns detailed status about each requirement
|
|
2116
|
-
*/
|
|
2117
|
-
checkAndCreateVault(agentId: bigint, asset: Address, seedAmount: bigint, name: string, symbol: string, feeRecipient?: Address): Promise<{
|
|
2118
|
-
success: boolean;
|
|
2119
|
-
vaultAddress?: Address;
|
|
2120
|
-
txHash?: Hash;
|
|
2121
|
-
error?: string;
|
|
2122
|
-
checks: {
|
|
2123
|
-
canCreate: boolean;
|
|
2124
|
-
canCreateReason: string;
|
|
2125
|
-
assetAllowed: boolean;
|
|
2126
|
-
hasExistingVault: boolean;
|
|
2127
|
-
};
|
|
2128
|
-
}>;
|
|
2129
|
-
}
|
|
2130
|
-
|
|
2131
|
-
export { type AgentMetadata, type AgentProfile, CHAIN_CONFIG, CONTRACT_ADDRESSES, type CanCreateVaultResult, type CreateVaultOptions, DEFAULT_RPC_URL, DEX_ADDRESSES, EXAGENT_API_CONFIG, EXAGENT_REGISTRY_ABI, EXAGENT_ROUTER_ABI, EXAGENT_VAULT_FACTORY_ABI, ExagentClient, type ExagentClientConfig, ExagentRegistry, ExagentVault, ExagentVaultFactory, type GlobalAgentId, type NetworkType, type PerformanceSnapshot, type PriceQuote, type RouteQuote, type RouteStep, type RouterTradeResponse, SDK_VERSION, type ServiceRequest, type TradeIntent, type TradeResult, type UserVaultPosition, type VaultActivityEntry, type VaultConfig, type VaultCreationRequirements, type VaultInfo, type VaultPosition, type VaultSummary, type VaultTradeEntry, type VaultTradeParams, type VaultTradeParamsMultihop, type VaultTradeParamsSimple, type VaultTradeParamsSwap, type WithdrawalRequest, ZERO_X_CONFIG, buildGlobalAgentId, getRpcUrl, parseGlobalAgentId };
|