@axonfi/sdk 0.1.0 → 0.1.2

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/dist/index.d.cts CHANGED
@@ -1,4 +1,325 @@
1
- import { Address, Hex, WalletClient, PublicClient, Chain } from 'viem';
1
+ import { Address, Hex, WalletClient, PublicClient, Chain as Chain$1 } from 'viem';
2
+
3
+ declare enum Token {
4
+ USDC = "USDC",
5
+ USDT = "USDT",
6
+ DAI = "DAI",
7
+ WETH = "WETH",
8
+ WBTC = "WBTC",
9
+ cbBTC = "cbBTC",
10
+ cbETH = "cbETH",
11
+ wstETH = "wstETH",
12
+ rETH = "rETH",
13
+ LINK = "LINK",
14
+ UNI = "UNI",
15
+ AAVE = "AAVE",
16
+ COMP = "COMP",
17
+ CRV = "CRV",
18
+ SNX = "SNX",
19
+ ARB = "ARB",
20
+ AERO = "AERO",
21
+ GMX = "GMX"
22
+ }
23
+ interface KnownToken {
24
+ symbol: string;
25
+ name: string;
26
+ decimals: number;
27
+ /** Address per chainId. Missing key = not available on that chain. */
28
+ addresses: Partial<Record<number, Address>>;
29
+ }
30
+ /**
31
+ * Master token registry keyed by symbol.
32
+ * At a glance you see which chains each token lives on.
33
+ *
34
+ * Chain IDs: 8453 = Base, 84532 = Base Sepolia, 42161 = Arbitrum One, 421614 = Arbitrum Sepolia
35
+ */
36
+ declare const KNOWN_TOKENS: {
37
+ readonly USDC: {
38
+ readonly symbol: "USDC";
39
+ readonly name: "USD Coin";
40
+ readonly decimals: 6;
41
+ readonly addresses: {
42
+ readonly 8453: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913";
43
+ readonly 84532: "0x036CbD53842c5426634e7929541eC2318f3dCF7e";
44
+ readonly 42161: "0xaf88d065e77c8cC2239327C5EDb3A432268e5831";
45
+ readonly 421614: "0x75faf114eafb1BDbe2F0316DF893fd58CE46AA4d";
46
+ };
47
+ };
48
+ readonly USDT: {
49
+ readonly symbol: "USDT";
50
+ readonly name: "Tether USD";
51
+ readonly decimals: 6;
52
+ readonly addresses: {
53
+ readonly 8453: "0xfde4C96c8593536E31F229EA8f37b2ADa2699bb2";
54
+ readonly 42161: "0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9";
55
+ };
56
+ };
57
+ readonly DAI: {
58
+ readonly symbol: "DAI";
59
+ readonly name: "Dai Stablecoin";
60
+ readonly decimals: 18;
61
+ readonly addresses: {
62
+ readonly 8453: "0x50c5725949A6F0c72E6C4a641F24049A917DB0Cb";
63
+ readonly 84532: "0x819ffecd4e64f193e959944bcd57eedc7755e17a";
64
+ readonly 42161: "0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1";
65
+ };
66
+ };
67
+ readonly WETH: {
68
+ readonly symbol: "WETH";
69
+ readonly name: "Wrapped Ether";
70
+ readonly decimals: 18;
71
+ readonly addresses: {
72
+ readonly 8453: "0x4200000000000000000000000000000000000006";
73
+ readonly 84532: "0x4200000000000000000000000000000000000006";
74
+ readonly 42161: "0x82aF49447D8a07e3bd95BD0d56f35241523fBab1";
75
+ };
76
+ };
77
+ readonly WBTC: {
78
+ readonly symbol: "WBTC";
79
+ readonly name: "Wrapped BTC";
80
+ readonly decimals: 8;
81
+ readonly addresses: {
82
+ readonly 8453: "0x0555E30da8f98308EdB960aa94C0Db47230d2B9c";
83
+ readonly 42161: "0x2f2a2543B76A4166549F7aaB2e75Bef0aefC5B0f";
84
+ };
85
+ };
86
+ readonly cbBTC: {
87
+ readonly symbol: "cbBTC";
88
+ readonly name: "Coinbase Wrapped BTC";
89
+ readonly decimals: 8;
90
+ readonly addresses: {
91
+ readonly 8453: "0xcbB7C0000aB88B473b1f5aFd9ef808440eed33Bf";
92
+ readonly 42161: "0xcbB7C0000aB88B473b1f5aFd9ef808440eed33Bf";
93
+ };
94
+ };
95
+ readonly cbETH: {
96
+ readonly symbol: "cbETH";
97
+ readonly name: "Coinbase Staked ETH";
98
+ readonly decimals: 18;
99
+ readonly addresses: {
100
+ readonly 8453: "0x2Ae3F1Ec7F1F5012CFEab0185bfc7aa3cf0DEc22";
101
+ readonly 42161: "0x1DEBd73E752bEaF79865Fd6446b0c970EaE7732f";
102
+ };
103
+ };
104
+ readonly wstETH: {
105
+ readonly symbol: "wstETH";
106
+ readonly name: "Lido Wrapped stETH";
107
+ readonly decimals: 18;
108
+ readonly addresses: {
109
+ readonly 8453: "0xc1CBa3fCea344f92D9239c08C0568f6F2F0ee452";
110
+ readonly 42161: "0x5979D7b546E38E414F7E9822514be443A4800529";
111
+ };
112
+ };
113
+ readonly rETH: {
114
+ readonly symbol: "rETH";
115
+ readonly name: "Rocket Pool ETH";
116
+ readonly decimals: 18;
117
+ readonly addresses: {
118
+ readonly 42161: "0xEC70Dcb4A1EFa46b8F2D97C310C9c4790ba5ffA8";
119
+ };
120
+ };
121
+ readonly LINK: {
122
+ readonly symbol: "LINK";
123
+ readonly name: "Chainlink";
124
+ readonly decimals: 18;
125
+ readonly addresses: {
126
+ readonly 8453: "0x88Fb150BDc53A65fe94Dea0c9BA0a6dAf8C6e196";
127
+ readonly 84532: "0xE4aB69C077896252FAFBD49EFD26B5D171A32410";
128
+ readonly 42161: "0xf97f4df75117a78c1A5a0DBb814Af92458539FB4";
129
+ };
130
+ };
131
+ readonly UNI: {
132
+ readonly symbol: "UNI";
133
+ readonly name: "Uniswap";
134
+ readonly decimals: 18;
135
+ readonly addresses: {
136
+ readonly 8453: "0xc3De830EA07524a0761646a6a4e4be0e114a3C83";
137
+ readonly 42161: "0xFa7F8980b0f1E64A2062791cc3b0871572f1F7f0";
138
+ };
139
+ };
140
+ readonly AAVE: {
141
+ readonly symbol: "AAVE";
142
+ readonly name: "Aave";
143
+ readonly decimals: 18;
144
+ readonly addresses: {
145
+ readonly 8453: "0x63706e401c06ac8513145b7687A14804d17f814b";
146
+ readonly 42161: "0xba5DdD1f9d7F570dc94a51479a000E3BCE967196";
147
+ };
148
+ };
149
+ readonly COMP: {
150
+ readonly symbol: "COMP";
151
+ readonly name: "Compound";
152
+ readonly decimals: 18;
153
+ readonly addresses: {
154
+ readonly 8453: "0x9e1028F5F1D5eDE59748FFceE5532509976840E0";
155
+ readonly 42161: "0x354A6dA3fcde098F8389cad84b0182725c6C91dE";
156
+ };
157
+ };
158
+ readonly CRV: {
159
+ readonly symbol: "CRV";
160
+ readonly name: "Curve DAO";
161
+ readonly decimals: 18;
162
+ readonly addresses: {
163
+ readonly 8453: "0x8Ee73c484A26e0A5df2Ee2a4960B789967dd0415";
164
+ readonly 42161: "0x11cDb42B0EB46D95f990BeDD4695A6e3fA034978";
165
+ };
166
+ };
167
+ readonly SNX: {
168
+ readonly symbol: "SNX";
169
+ readonly name: "Synthetix";
170
+ readonly decimals: 18;
171
+ readonly addresses: {
172
+ readonly 8453: "0x22e6966B799c4D5B13BE962E1D117b56327FDa66";
173
+ };
174
+ };
175
+ readonly ARB: {
176
+ readonly symbol: "ARB";
177
+ readonly name: "Arbitrum";
178
+ readonly decimals: 18;
179
+ readonly addresses: {
180
+ readonly 42161: "0x912CE59144191C1204E64559FE8253a0e49E6548";
181
+ };
182
+ };
183
+ readonly AERO: {
184
+ readonly symbol: "AERO";
185
+ readonly name: "Aerodrome";
186
+ readonly decimals: 18;
187
+ readonly addresses: {
188
+ readonly 8453: "0x940181a94A35A4569E4529A3CDfB74e38FD98631";
189
+ };
190
+ };
191
+ readonly GMX: {
192
+ readonly symbol: "GMX";
193
+ readonly name: "GMX";
194
+ readonly decimals: 18;
195
+ readonly addresses: {
196
+ readonly 42161: "0xfc5A1A6EB076a2C7aD06eD22C90d7E710E35ad0a";
197
+ };
198
+ };
199
+ };
200
+ type KnownTokenSymbol = keyof typeof KNOWN_TOKENS;
201
+ /** All known tokens available on a specific chain. */
202
+ declare function getKnownTokensForChain(chainId: number): (KnownToken & {
203
+ address: Address;
204
+ })[];
205
+ /** Reverse-lookup: address → symbol (case-insensitive). Returns null if unknown. */
206
+ declare function getTokenSymbolByAddress(address: string): string | null;
207
+ /**
208
+ * Resolve a Token enum symbol to its on-chain address for a given chain.
209
+ * If an Address (0x...) is passed, it is returned as-is.
210
+ *
211
+ * @throws if the symbol has no address on the given chain.
212
+ */
213
+ declare function resolveToken(token: Address | Token, chainId: number): Address;
214
+
215
+ /**
216
+ * keccak256 of the PaymentIntent type string — used for manual digest
217
+ * verification. viem's signTypedData computes this internally; you don't
218
+ * need this value for signing, only for low-level verification.
219
+ */
220
+ declare const PAYMENT_INTENT_TYPEHASH: `0x${string}`;
221
+ /** keccak256 of the ExecuteIntent type string for DeFi protocol interactions. */
222
+ declare const EXECUTE_INTENT_TYPEHASH: `0x${string}`;
223
+ /** keccak256 of the SwapIntent type string for in-vault token rebalancing. */
224
+ declare const SWAP_INTENT_TYPEHASH: `0x${string}`;
225
+ /** EIP-712 domain name and version for AxonVault. Matches the constructor. */
226
+ declare const EIP712_DOMAIN_NAME: "AxonVault";
227
+ declare const EIP712_DOMAIN_VERSION: "1";
228
+ /** Sentinel address representing native ETH in PaymentIntents and deposits. */
229
+ declare const NATIVE_ETH: Address;
230
+ declare const USDC: Record<number, Address>;
231
+ declare enum Chain {
232
+ Base = 8453,
233
+ BaseSepolia = 84532,
234
+ Arbitrum = 42161,
235
+ ArbitrumSepolia = 421614
236
+ }
237
+ declare const SUPPORTED_CHAIN_IDS: readonly [8453, 84532, 42161, 421614];
238
+ type SupportedChainId = (typeof SUPPORTED_CHAIN_IDS)[number];
239
+ /** Human-readable chain names. */
240
+ declare const CHAIN_NAMES: Record<number, string>;
241
+ /** Block explorer TX URL prefix per chain. */
242
+ declare const EXPLORER_TX: Record<number, string>;
243
+ /** Block explorer address URL prefix per chain. */
244
+ declare const EXPLORER_ADDR: Record<number, string>;
245
+ /** Default intent validity window when no deadline is specified. */
246
+ declare const DEFAULT_DEADLINE_SECONDS = 300;
247
+ /** Window presets for SpendingLimit.windowSeconds. */
248
+ declare const WINDOW: {
249
+ readonly ONE_HOUR: 3600n;
250
+ readonly ONE_DAY: 86400n;
251
+ readonly ONE_WEEK: 604800n;
252
+ readonly THIRTY_DAYS: 2592000n;
253
+ };
254
+ /**
255
+ * Structured error codes returned by the relayer when a payment is rejected.
256
+ * Bots should import these to programmatically handle failures.
257
+ */
258
+ declare const PaymentErrorCode: {
259
+ /** Payment destination is the vault itself */
260
+ readonly SELF_PAYMENT: "SELF_PAYMENT";
261
+ /** Payment destination is the zero address */
262
+ readonly ZERO_ADDRESS: "ZERO_ADDRESS";
263
+ /** Payment amount is zero */
264
+ readonly ZERO_AMOUNT: "ZERO_AMOUNT";
265
+ /** Vault does not hold enough of the requested token */
266
+ readonly INSUFFICIENT_BALANCE: "INSUFFICIENT_BALANCE";
267
+ /** EIP-712 signature verification failed */
268
+ readonly INVALID_SIGNATURE: "INVALID_SIGNATURE";
269
+ /** Payment intent deadline has passed */
270
+ readonly DEADLINE_EXPIRED: "DEADLINE_EXPIRED";
271
+ /** Bot is temporarily paused by the operator */
272
+ readonly BOT_PAUSED: "BOT_PAUSED";
273
+ /** Bot address is not registered/active in the vault */
274
+ readonly BOT_NOT_ACTIVE: "BOT_NOT_ACTIVE";
275
+ /** Destination address is on the global or vault blacklist */
276
+ readonly BLACKLISTED: "BLACKLISTED";
277
+ /** Rolling-window spending limit (USD amount) exceeded */
278
+ readonly SPENDING_LIMIT_EXCEEDED: "SPENDING_LIMIT_EXCEEDED";
279
+ /** Rolling-window transaction count limit exceeded */
280
+ readonly TX_COUNT_EXCEEDED: "TX_COUNT_EXCEEDED";
281
+ /** Single transaction exceeds the bot's on-chain maxPerTxAmount */
282
+ readonly MAX_PER_TX_EXCEEDED: "MAX_PER_TX_EXCEEDED";
283
+ /** Vault-level daily aggregate spending limit exceeded */
284
+ readonly VAULT_AGGREGATE_EXCEEDED: "VAULT_AGGREGATE_EXCEEDED";
285
+ /** eth_call simulation of the on-chain transaction reverted */
286
+ readonly SIMULATION_FAILED: "SIMULATION_FAILED";
287
+ /** Routed to human review (AI scan flagged or no consensus) */
288
+ readonly PENDING_REVIEW: "PENDING_REVIEW";
289
+ /** Relayer wallet has insufficient gas to submit the transaction */
290
+ readonly RELAYER_OUT_OF_GAS: "RELAYER_OUT_OF_GAS";
291
+ /** On-chain transaction submission failed */
292
+ readonly SUBMISSION_FAILED: "SUBMISSION_FAILED";
293
+ /** Destination not in the vault/bot whitelist */
294
+ readonly DESTINATION_NOT_WHITELISTED: "DESTINATION_NOT_WHITELISTED";
295
+ /** Vault address is not a valid AxonVault or was not deployed by a known factory */
296
+ readonly INVALID_VAULT: "INVALID_VAULT";
297
+ /** Rebalance output token is not in the whitelist (on-chain or relayer default) */
298
+ readonly REBALANCE_TOKEN_NOT_ALLOWED: "REBALANCE_TOKEN_NOT_ALLOWED";
299
+ /** Rebalance input amount exceeds the bot's maxRebalanceAmount cap */
300
+ readonly MAX_REBALANCE_AMOUNT_EXCEEDED: "MAX_REBALANCE_AMOUNT_EXCEEDED";
301
+ /** Unknown or internal error */
302
+ readonly INTERNAL_ERROR: "INTERNAL_ERROR";
303
+ };
304
+ type PaymentErrorCode = (typeof PaymentErrorCode)[keyof typeof PaymentErrorCode];
305
+ declare const RELAYER_API: {
306
+ readonly PAYMENTS: "/v1/payments";
307
+ readonly payment: (requestId: string) => string;
308
+ readonly EXECUTE: "/v1/execute";
309
+ readonly execute: (requestId: string) => string;
310
+ readonly SWAP: "/v1/swap";
311
+ readonly swap: (requestId: string) => string;
312
+ readonly vaultBalance: (vault: string, token: string, chainId: number) => string;
313
+ readonly vaultBalances: (vault: string, chainId: number) => string;
314
+ readonly vaultInfo: (vault: string, chainId: number) => string;
315
+ readonly botStatus: (vault: string, bot: string, chainId: number) => string;
316
+ readonly destinationCheck: (vault: string, bot: string, destination: string, chainId: number) => string;
317
+ readonly protocolCheck: (vault: string, protocol: string, chainId: number) => string;
318
+ readonly rebalanceTokens: (vault: string, chainId: number) => string;
319
+ readonly rebalanceTokenCheck: (vault: string, token: string, chainId: number) => string;
320
+ readonly tosStatus: (wallet: string) => string;
321
+ readonly TOS_ACCEPT: "/v1/tos/accept";
322
+ };
2
323
 
3
324
  /** Rolling window spending limit. Stored on-chain, enforced by relayer. */
4
325
  interface SpendingLimit {
@@ -77,8 +398,8 @@ interface PaymentIntent {
77
398
  interface PayInput {
78
399
  /** Payment recipient. */
79
400
  to: Address;
80
- /** Desired output token (e.g. USDC[chainId]). */
81
- token: Address;
401
+ /** Desired output token — an address or a Token enum symbol (e.g. Token.USDC). */
402
+ token: Address | Token;
82
403
  /** Amount in token base units. For USDC: 1 USDC = 1_000_000n. */
83
404
  amount: bigint;
84
405
  /**
@@ -176,8 +497,8 @@ interface ExecuteInput {
176
497
  protocol: Address;
177
498
  /** The actual calldata bytes to send to the protocol. */
178
499
  callData: Hex;
179
- /** Token to approve to the protocol. */
180
- token: Address;
500
+ /** Token to approve to the protocol — an address or a Token enum symbol. */
501
+ token: Address | Token;
181
502
  /** Amount to approve (in token base units). */
182
503
  amount: bigint;
183
504
  /** Human-readable description. Gets keccak256-hashed to ref. */
@@ -205,8 +526,8 @@ interface ExecuteInput {
205
526
  * the relayer's POST /v1/swap endpoint.
206
527
  */
207
528
  interface SwapInput {
208
- /** Desired output token. */
209
- toToken: Address;
529
+ /** Desired output token — an address or a Token enum symbol. */
530
+ toToken: Address | Token;
210
531
  /** Minimum output amount (slippage floor). */
211
532
  minToAmount: bigint;
212
533
  /** Human-readable description. Gets keccak256-hashed to ref. */
@@ -268,8 +589,8 @@ interface TosStatus {
268
589
  interface AxonClientConfig {
269
590
  /** Vault contract address to sign against. */
270
591
  vaultAddress: Address;
271
- /** Chain ID of the network the vault is deployed on. */
272
- chainId: number;
592
+ /** Chain ID a number or a Chain enum value (e.g. Chain.Base). */
593
+ chainId: Chain | number;
273
594
  /**
274
595
  * Bot's private key (hex, 0x-prefixed). Used to sign payment intents.
275
596
  * The SDK constructs a local signer internally — no RPC connection needed.
@@ -353,174 +674,77 @@ declare class AxonClient {
353
674
  * Returns a record mapping token address → balance.
354
675
  */
355
676
  getBalances(tokens: Address[]): Promise<Record<Address, bigint>>;
356
- /** Returns whether this bot is registered and active in the vault (via relayer). */
357
- isActive(): Promise<boolean>;
358
- /** Returns whether the vault is currently paused (via relayer). */
359
- isPaused(): Promise<boolean>;
360
- /** Returns high-level vault info (owner, operator, paused, version, trackUsedIntents) via relayer. */
361
- getVaultInfo(): Promise<VaultInfo>;
362
- /**
363
- * Check whether this bot can pay to a given destination address (via relayer).
364
- * Checks blacklist → global whitelist → bot whitelist, matching on-chain logic.
365
- */
366
- canPayTo(destination: Address): Promise<DestinationCheckResult>;
367
- /** Returns whether a protocol address is approved for executeProtocol() calls (via relayer). */
368
- isProtocolApproved(protocol: Address): Promise<boolean>;
369
- /**
370
- * Returns the effective rebalance token whitelist for this vault.
371
- *
372
- * If the owner set tokens on-chain, those override entirely.
373
- * If no on-chain whitelist, returns relayer defaults (USDC, WETH, USDT).
374
- * Use this before calling swap() to check which output tokens are allowed.
375
- */
376
- getRebalanceTokens(): Promise<RebalanceTokensResult>;
377
- /** Check if a specific token is allowed for rebalancing (executeSwap output) on this vault. */
378
- isRebalanceTokenAllowed(token: Address): Promise<{
379
- allowed: boolean;
380
- source: 'default' | 'on_chain';
381
- }>;
382
- /** Check if a wallet has accepted the current TOS version. */
383
- getTosStatus(wallet: string): Promise<TosStatus>;
384
- /**
385
- * Sign and submit TOS acceptance. Uses the owner's wallet (not the bot key).
386
- *
387
- * @param signer - Object with a `signMessage` method (e.g. a viem WalletClient
388
- * or ethers Signer). This should be the vault owner's wallet, not the bot key.
389
- * @param wallet - The owner's wallet address (must match the signer).
390
- */
391
- acceptTos(signer: {
392
- signMessage: (args: {
393
- message: string;
394
- }) => Promise<Hex>;
395
- }, wallet: string): Promise<TosStatus>;
396
- /**
397
- * Poll the relayer for the status of an async payment.
398
- *
399
- * Use this when pay() returns `status: "pending_review"`. Poll until
400
- * status is `"approved"` or `"rejected"`.
401
- *
402
- * Recommended polling interval: 5–10 seconds.
403
- */
404
- poll(requestId: string): Promise<PaymentResult>;
405
- /** Poll the relayer for the status of an async protocol execution. */
406
- pollExecute(requestId: string): Promise<PaymentResult>;
407
- /** Poll the relayer for the status of an async swap. */
408
- pollSwap(requestId: string): Promise<PaymentResult>;
409
- /**
410
- * Sign a PaymentIntent directly without submitting to the relayer.
411
- *
412
- * Use this if you want to build the intent yourself and pass the signature
413
- * to another system (e.g. a custom relayer integration).
414
- */
415
- signPayment(intent: PaymentIntent): Promise<Hex>;
416
- private _get;
417
- private _defaultDeadline;
418
- private _resolveRef;
419
- private _buildPaymentIntent;
420
- private _buildExecuteIntent;
421
- private _buildSwapIntent;
422
- private _submitPayment;
423
- private _submitExecute;
424
- private _submitSwap;
425
- private _post;
426
- }
427
-
428
- /**
429
- * keccak256 of the PaymentIntent type string — used for manual digest
430
- * verification. viem's signTypedData computes this internally; you don't
431
- * need this value for signing, only for low-level verification.
432
- */
433
- declare const PAYMENT_INTENT_TYPEHASH: `0x${string}`;
434
- /** keccak256 of the ExecuteIntent type string for DeFi protocol interactions. */
435
- declare const EXECUTE_INTENT_TYPEHASH: `0x${string}`;
436
- /** keccak256 of the SwapIntent type string for in-vault token rebalancing. */
437
- declare const SWAP_INTENT_TYPEHASH: `0x${string}`;
438
- /** EIP-712 domain name and version for AxonVault. Matches the constructor. */
439
- declare const EIP712_DOMAIN_NAME: "AxonVault";
440
- declare const EIP712_DOMAIN_VERSION: "1";
441
- /** Sentinel address representing native ETH in PaymentIntents and deposits. */
442
- declare const NATIVE_ETH: Address;
443
- declare const USDC: Record<number, Address>;
444
- declare const SUPPORTED_CHAIN_IDS: readonly [8453, 84532, 42161, 421614];
445
- type SupportedChainId = (typeof SUPPORTED_CHAIN_IDS)[number];
446
- /** Default intent validity window when no deadline is specified. */
447
- declare const DEFAULT_DEADLINE_SECONDS = 300;
448
- /** Window presets for SpendingLimit.windowSeconds. */
449
- declare const WINDOW: {
450
- readonly ONE_HOUR: 3600n;
451
- readonly ONE_DAY: 86400n;
452
- readonly ONE_WEEK: 604800n;
453
- readonly THIRTY_DAYS: 2592000n;
454
- };
455
- /**
456
- * Structured error codes returned by the relayer when a payment is rejected.
457
- * Bots should import these to programmatically handle failures.
458
- */
459
- declare const PaymentErrorCode: {
460
- /** Payment destination is the vault itself */
461
- readonly SELF_PAYMENT: "SELF_PAYMENT";
462
- /** Payment destination is the zero address */
463
- readonly ZERO_ADDRESS: "ZERO_ADDRESS";
464
- /** Payment amount is zero */
465
- readonly ZERO_AMOUNT: "ZERO_AMOUNT";
466
- /** Vault does not hold enough of the requested token */
467
- readonly INSUFFICIENT_BALANCE: "INSUFFICIENT_BALANCE";
468
- /** EIP-712 signature verification failed */
469
- readonly INVALID_SIGNATURE: "INVALID_SIGNATURE";
470
- /** Payment intent deadline has passed */
471
- readonly DEADLINE_EXPIRED: "DEADLINE_EXPIRED";
472
- /** Bot is temporarily paused by the operator */
473
- readonly BOT_PAUSED: "BOT_PAUSED";
474
- /** Bot address is not registered/active in the vault */
475
- readonly BOT_NOT_ACTIVE: "BOT_NOT_ACTIVE";
476
- /** Destination address is on the global or vault blacklist */
477
- readonly BLACKLISTED: "BLACKLISTED";
478
- /** Rolling-window spending limit (USD amount) exceeded */
479
- readonly SPENDING_LIMIT_EXCEEDED: "SPENDING_LIMIT_EXCEEDED";
480
- /** Rolling-window transaction count limit exceeded */
481
- readonly TX_COUNT_EXCEEDED: "TX_COUNT_EXCEEDED";
482
- /** Single transaction exceeds the bot's on-chain maxPerTxAmount */
483
- readonly MAX_PER_TX_EXCEEDED: "MAX_PER_TX_EXCEEDED";
484
- /** Vault-level daily aggregate spending limit exceeded */
485
- readonly VAULT_AGGREGATE_EXCEEDED: "VAULT_AGGREGATE_EXCEEDED";
486
- /** eth_call simulation of the on-chain transaction reverted */
487
- readonly SIMULATION_FAILED: "SIMULATION_FAILED";
488
- /** Routed to human review (AI scan flagged or no consensus) */
489
- readonly PENDING_REVIEW: "PENDING_REVIEW";
490
- /** Relayer wallet has insufficient gas to submit the transaction */
491
- readonly RELAYER_OUT_OF_GAS: "RELAYER_OUT_OF_GAS";
492
- /** On-chain transaction submission failed */
493
- readonly SUBMISSION_FAILED: "SUBMISSION_FAILED";
494
- /** Destination not in the vault/bot whitelist */
495
- readonly DESTINATION_NOT_WHITELISTED: "DESTINATION_NOT_WHITELISTED";
496
- /** Vault address is not a valid AxonVault or was not deployed by a known factory */
497
- readonly INVALID_VAULT: "INVALID_VAULT";
498
- /** Rebalance output token is not in the whitelist (on-chain or relayer default) */
499
- readonly REBALANCE_TOKEN_NOT_ALLOWED: "REBALANCE_TOKEN_NOT_ALLOWED";
500
- /** Rebalance input amount exceeds the bot's maxRebalanceAmount cap */
501
- readonly MAX_REBALANCE_AMOUNT_EXCEEDED: "MAX_REBALANCE_AMOUNT_EXCEEDED";
502
- /** Unknown or internal error */
503
- readonly INTERNAL_ERROR: "INTERNAL_ERROR";
504
- };
505
- type PaymentErrorCode = (typeof PaymentErrorCode)[keyof typeof PaymentErrorCode];
506
- declare const RELAYER_API: {
507
- readonly PAYMENTS: "/v1/payments";
508
- readonly payment: (requestId: string) => string;
509
- readonly EXECUTE: "/v1/execute";
510
- readonly execute: (requestId: string) => string;
511
- readonly SWAP: "/v1/swap";
512
- readonly swap: (requestId: string) => string;
513
- readonly vaultBalance: (vault: string, token: string, chainId: number) => string;
514
- readonly vaultBalances: (vault: string, chainId: number) => string;
515
- readonly vaultInfo: (vault: string, chainId: number) => string;
516
- readonly botStatus: (vault: string, bot: string, chainId: number) => string;
517
- readonly destinationCheck: (vault: string, bot: string, destination: string, chainId: number) => string;
518
- readonly protocolCheck: (vault: string, protocol: string, chainId: number) => string;
519
- readonly rebalanceTokens: (vault: string, chainId: number) => string;
520
- readonly rebalanceTokenCheck: (vault: string, token: string, chainId: number) => string;
521
- readonly tosStatus: (wallet: string) => string;
522
- readonly TOS_ACCEPT: "/v1/tos/accept";
523
- };
677
+ /** Returns whether this bot is registered and active in the vault (via relayer). */
678
+ isActive(): Promise<boolean>;
679
+ /** Returns whether the vault is currently paused (via relayer). */
680
+ isPaused(): Promise<boolean>;
681
+ /** Returns high-level vault info (owner, operator, paused, version, trackUsedIntents) via relayer. */
682
+ getVaultInfo(): Promise<VaultInfo>;
683
+ /**
684
+ * Check whether this bot can pay to a given destination address (via relayer).
685
+ * Checks blacklist → global whitelist → bot whitelist, matching on-chain logic.
686
+ */
687
+ canPayTo(destination: Address): Promise<DestinationCheckResult>;
688
+ /** Returns whether a protocol address is approved for executeProtocol() calls (via relayer). */
689
+ isProtocolApproved(protocol: Address): Promise<boolean>;
690
+ /**
691
+ * Returns the effective rebalance token whitelist for this vault.
692
+ *
693
+ * If the owner set tokens on-chain, those override entirely.
694
+ * If no on-chain whitelist, returns relayer defaults (USDC, WETH, USDT).
695
+ * Use this before calling swap() to check which output tokens are allowed.
696
+ */
697
+ getRebalanceTokens(): Promise<RebalanceTokensResult>;
698
+ /** Check if a specific token is allowed for rebalancing (executeSwap output) on this vault. */
699
+ isRebalanceTokenAllowed(token: Address): Promise<{
700
+ allowed: boolean;
701
+ source: 'default' | 'on_chain';
702
+ }>;
703
+ /** Check if a wallet has accepted the current TOS version. */
704
+ getTosStatus(wallet: string): Promise<TosStatus>;
705
+ /**
706
+ * Sign and submit TOS acceptance. Uses the owner's wallet (not the bot key).
707
+ *
708
+ * @param signer - Object with a `signMessage` method (e.g. a viem WalletClient
709
+ * or ethers Signer). This should be the vault owner's wallet, not the bot key.
710
+ * @param wallet - The owner's wallet address (must match the signer).
711
+ */
712
+ acceptTos(signer: {
713
+ signMessage: (args: {
714
+ message: string;
715
+ }) => Promise<Hex>;
716
+ }, wallet: string): Promise<TosStatus>;
717
+ /**
718
+ * Poll the relayer for the status of an async payment.
719
+ *
720
+ * Use this when pay() returns `status: "pending_review"`. Poll until
721
+ * status is `"approved"` or `"rejected"`.
722
+ *
723
+ * Recommended polling interval: 5–10 seconds.
724
+ */
725
+ poll(requestId: string): Promise<PaymentResult>;
726
+ /** Poll the relayer for the status of an async protocol execution. */
727
+ pollExecute(requestId: string): Promise<PaymentResult>;
728
+ /** Poll the relayer for the status of an async swap. */
729
+ pollSwap(requestId: string): Promise<PaymentResult>;
730
+ /**
731
+ * Sign a PaymentIntent directly without submitting to the relayer.
732
+ *
733
+ * Use this if you want to build the intent yourself and pass the signature
734
+ * to another system (e.g. a custom relayer integration).
735
+ */
736
+ signPayment(intent: PaymentIntent): Promise<Hex>;
737
+ private _get;
738
+ private _defaultDeadline;
739
+ private _resolveRef;
740
+ private _buildPaymentIntent;
741
+ private _buildExecuteIntent;
742
+ private _buildSwapIntent;
743
+ private _submitPayment;
744
+ private _submitExecute;
745
+ private _submitSwap;
746
+ private _post;
747
+ }
524
748
 
525
749
  /**
526
750
  * Sign a PaymentIntent using EIP-712 typed structured data.
@@ -556,7 +780,7 @@ declare function signSwapIntent(walletClient: WalletClient, vaultAddress: Addres
556
780
  declare function encodeRef(memo: string): Hex;
557
781
 
558
782
  /** Returns the viem Chain object for a supported Axon chain ID. */
559
- declare function getChain(chainId: number): Chain;
783
+ declare function getChain(chainId: number): Chain$1;
560
784
  /** Create a viem PublicClient for the given chain and RPC URL. */
561
785
  declare function createAxonPublicClient(chainId: number, rpcUrl: string): PublicClient;
562
786
  /** Create a viem WalletClient from a raw private key (signing-only, no RPC needed). */
@@ -677,191 +901,6 @@ declare function encryptKeystore(privateKey: Hex, passphrase: string): Promise<K
677
901
  */
678
902
  declare function decryptKeystore(keystore: KeystoreV3 | string, passphrase: string): Promise<Hex>;
679
903
 
680
- interface KnownToken {
681
- symbol: string;
682
- name: string;
683
- decimals: number;
684
- /** Address per chainId. Missing key = not available on that chain. */
685
- addresses: Partial<Record<number, Address>>;
686
- }
687
- /**
688
- * Master token registry keyed by symbol.
689
- * At a glance you see which chains each token lives on.
690
- *
691
- * Chain IDs: 8453 = Base, 84532 = Base Sepolia, 42161 = Arbitrum One, 421614 = Arbitrum Sepolia
692
- */
693
- declare const KNOWN_TOKENS: {
694
- readonly USDC: {
695
- readonly symbol: "USDC";
696
- readonly name: "USD Coin";
697
- readonly decimals: 6;
698
- readonly addresses: {
699
- readonly 8453: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913";
700
- readonly 84532: "0x036CbD53842c5426634e7929541eC2318f3dCF7e";
701
- readonly 42161: "0xaf88d065e77c8cC2239327C5EDb3A432268e5831";
702
- readonly 421614: "0x75faf114eafb1BDbe2F0316DF893fd58CE46AA4d";
703
- };
704
- };
705
- readonly USDT: {
706
- readonly symbol: "USDT";
707
- readonly name: "Tether USD";
708
- readonly decimals: 6;
709
- readonly addresses: {
710
- readonly 8453: "0xfde4C96c8593536E31F229EA8f37b2ADa2699bb2";
711
- readonly 42161: "0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9";
712
- };
713
- };
714
- readonly DAI: {
715
- readonly symbol: "DAI";
716
- readonly name: "Dai Stablecoin";
717
- readonly decimals: 18;
718
- readonly addresses: {
719
- readonly 8453: "0x50c5725949A6F0c72E6C4a641F24049A917DB0Cb";
720
- readonly 84532: "0x819ffecd4e64f193e959944bcd57eedc7755e17a";
721
- readonly 42161: "0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1";
722
- };
723
- };
724
- readonly WETH: {
725
- readonly symbol: "WETH";
726
- readonly name: "Wrapped Ether";
727
- readonly decimals: 18;
728
- readonly addresses: {
729
- readonly 8453: "0x4200000000000000000000000000000000000006";
730
- readonly 84532: "0x4200000000000000000000000000000000000006";
731
- readonly 42161: "0x82aF49447D8a07e3bd95BD0d56f35241523fBab1";
732
- };
733
- };
734
- readonly WBTC: {
735
- readonly symbol: "WBTC";
736
- readonly name: "Wrapped BTC";
737
- readonly decimals: 8;
738
- readonly addresses: {
739
- readonly 8453: "0x0555E30da8f98308EdB960aa94C0Db47230d2B9c";
740
- readonly 42161: "0x2f2a2543B76A4166549F7aaB2e75Bef0aefC5B0f";
741
- };
742
- };
743
- readonly cbBTC: {
744
- readonly symbol: "cbBTC";
745
- readonly name: "Coinbase Wrapped BTC";
746
- readonly decimals: 8;
747
- readonly addresses: {
748
- readonly 8453: "0xcbB7C0000aB88B473b1f5aFd9ef808440eed33Bf";
749
- readonly 42161: "0xcbB7C0000aB88B473b1f5aFd9ef808440eed33Bf";
750
- };
751
- };
752
- readonly cbETH: {
753
- readonly symbol: "cbETH";
754
- readonly name: "Coinbase Staked ETH";
755
- readonly decimals: 18;
756
- readonly addresses: {
757
- readonly 8453: "0x2Ae3F1Ec7F1F5012CFEab0185bfc7aa3cf0DEc22";
758
- readonly 42161: "0x1DEBd73E752bEaF79865Fd6446b0c970EaE7732f";
759
- };
760
- };
761
- readonly wstETH: {
762
- readonly symbol: "wstETH";
763
- readonly name: "Lido Wrapped stETH";
764
- readonly decimals: 18;
765
- readonly addresses: {
766
- readonly 8453: "0xc1CBa3fCea344f92D9239c08C0568f6F2F0ee452";
767
- readonly 42161: "0x5979D7b546E38E414F7E9822514be443A4800529";
768
- };
769
- };
770
- readonly rETH: {
771
- readonly symbol: "rETH";
772
- readonly name: "Rocket Pool ETH";
773
- readonly decimals: 18;
774
- readonly addresses: {
775
- readonly 42161: "0xEC70Dcb4A1EFa46b8F2D97C310C9c4790ba5ffA8";
776
- };
777
- };
778
- readonly LINK: {
779
- readonly symbol: "LINK";
780
- readonly name: "Chainlink";
781
- readonly decimals: 18;
782
- readonly addresses: {
783
- readonly 8453: "0x88Fb150BDc53A65fe94Dea0c9BA0a6dAf8C6e196";
784
- readonly 84532: "0xE4aB69C077896252FAFBD49EFD26B5D171A32410";
785
- readonly 42161: "0xf97f4df75117a78c1A5a0DBb814Af92458539FB4";
786
- };
787
- };
788
- readonly UNI: {
789
- readonly symbol: "UNI";
790
- readonly name: "Uniswap";
791
- readonly decimals: 18;
792
- readonly addresses: {
793
- readonly 8453: "0xc3De830EA07524a0761646a6a4e4be0e114a3C83";
794
- readonly 42161: "0xFa7F8980b0f1E64A2062791cc3b0871572f1F7f0";
795
- };
796
- };
797
- readonly AAVE: {
798
- readonly symbol: "AAVE";
799
- readonly name: "Aave";
800
- readonly decimals: 18;
801
- readonly addresses: {
802
- readonly 8453: "0x63706e401c06ac8513145b7687A14804d17f814b";
803
- readonly 42161: "0xba5DdD1f9d7F570dc94a51479a000E3BCE967196";
804
- };
805
- };
806
- readonly COMP: {
807
- readonly symbol: "COMP";
808
- readonly name: "Compound";
809
- readonly decimals: 18;
810
- readonly addresses: {
811
- readonly 8453: "0x9e1028F5F1D5eDE59748FFceE5532509976840E0";
812
- readonly 42161: "0x354A6dA3fcde098F8389cad84b0182725c6C91dE";
813
- };
814
- };
815
- readonly CRV: {
816
- readonly symbol: "CRV";
817
- readonly name: "Curve DAO";
818
- readonly decimals: 18;
819
- readonly addresses: {
820
- readonly 8453: "0x8Ee73c484A26e0A5df2Ee2a4960B789967dd0415";
821
- readonly 42161: "0x11cDb42B0EB46D95f990BeDD4695A6e3fA034978";
822
- };
823
- };
824
- readonly SNX: {
825
- readonly symbol: "SNX";
826
- readonly name: "Synthetix";
827
- readonly decimals: 18;
828
- readonly addresses: {
829
- readonly 8453: "0x22e6966B799c4D5B13BE962E1D117b56327FDa66";
830
- };
831
- };
832
- readonly ARB: {
833
- readonly symbol: "ARB";
834
- readonly name: "Arbitrum";
835
- readonly decimals: 18;
836
- readonly addresses: {
837
- readonly 42161: "0x912CE59144191C1204E64559FE8253a0e49E6548";
838
- };
839
- };
840
- readonly AERO: {
841
- readonly symbol: "AERO";
842
- readonly name: "Aerodrome";
843
- readonly decimals: 18;
844
- readonly addresses: {
845
- readonly 8453: "0x940181a94A35A4569E4529A3CDfB74e38FD98631";
846
- };
847
- };
848
- readonly GMX: {
849
- readonly symbol: "GMX";
850
- readonly name: "GMX";
851
- readonly decimals: 18;
852
- readonly addresses: {
853
- readonly 42161: "0xfc5A1A6EB076a2C7aD06eD22C90d7E710E35ad0a";
854
- };
855
- };
856
- };
857
- type KnownTokenSymbol = keyof typeof KNOWN_TOKENS;
858
- /** All known tokens available on a specific chain. */
859
- declare function getKnownTokensForChain(chainId: number): (KnownToken & {
860
- address: Address;
861
- })[];
862
- /** Reverse-lookup: address → symbol (case-insensitive). Returns null if unknown. */
863
- declare function getTokenSymbolByAddress(address: string): string | null;
864
-
865
904
  declare const AxonVaultAbi: readonly [{
866
905
  readonly type: "constructor";
867
906
  readonly inputs: readonly [{
@@ -2959,4 +2998,4 @@ declare const AxonRegistryAbi: readonly [{
2959
2998
  readonly inputs: readonly [];
2960
2999
  }];
2961
3000
 
2962
- export { AxonClient, type AxonClientConfig, AxonRegistryAbi, AxonVaultAbi, AxonVaultFactoryAbi, type BotConfig, type BotConfigParams, DEFAULT_DEADLINE_SECONDS, type DestinationCheckResult, EIP712_DOMAIN_NAME, EIP712_DOMAIN_VERSION, EXECUTE_INTENT_TYPEHASH, type ExecuteInput, type ExecuteIntent, KNOWN_TOKENS, type KeystoreV3, type KnownToken, type KnownTokenSymbol, NATIVE_ETH, type OperatorCeilings, PAYMENT_INTENT_TYPEHASH, type PayInput, PaymentErrorCode, type PaymentIntent, type PaymentResult, type PaymentStatus, RELAYER_API, type RebalanceTokensResult, SUPPORTED_CHAIN_IDS, SWAP_INTENT_TYPEHASH, type SpendingLimit, type SupportedChainId, type SwapInput, type SwapIntent, type TosStatus, USDC, type VaultInfo, WINDOW, createAxonPublicClient, createAxonWalletClient, decryptKeystore, deployVault, encodeRef, encryptKeystore, getBotConfig, getChain, getDomainSeparator, getKnownTokensForChain, getOperatorCeilings, getRebalanceTokenCount, getTokenSymbolByAddress, getTrackUsedIntents, getVaultOperator, getVaultOwner, getVaultVersion, isBotActive, isDestinationAllowed, isRebalanceTokenWhitelisted, isVaultPaused, operatorMaxDrainPerDay, signExecuteIntent, signPayment, signSwapIntent };
3001
+ export { AxonClient, type AxonClientConfig, AxonRegistryAbi, AxonVaultAbi, AxonVaultFactoryAbi, type BotConfig, type BotConfigParams, CHAIN_NAMES, Chain, DEFAULT_DEADLINE_SECONDS, type DestinationCheckResult, EIP712_DOMAIN_NAME, EIP712_DOMAIN_VERSION, EXECUTE_INTENT_TYPEHASH, EXPLORER_ADDR, EXPLORER_TX, type ExecuteInput, type ExecuteIntent, KNOWN_TOKENS, type KeystoreV3, type KnownToken, type KnownTokenSymbol, NATIVE_ETH, type OperatorCeilings, PAYMENT_INTENT_TYPEHASH, type PayInput, PaymentErrorCode, type PaymentIntent, type PaymentResult, type PaymentStatus, RELAYER_API, type RebalanceTokensResult, SUPPORTED_CHAIN_IDS, SWAP_INTENT_TYPEHASH, type SpendingLimit, type SupportedChainId, type SwapInput, type SwapIntent, Token, type TosStatus, USDC, type VaultInfo, WINDOW, createAxonPublicClient, createAxonWalletClient, decryptKeystore, deployVault, encodeRef, encryptKeystore, getBotConfig, getChain, getDomainSeparator, getKnownTokensForChain, getOperatorCeilings, getRebalanceTokenCount, getTokenSymbolByAddress, getTrackUsedIntents, getVaultOperator, getVaultOwner, getVaultVersion, isBotActive, isDestinationAllowed, isRebalanceTokenWhitelisted, isVaultPaused, operatorMaxDrainPerDay, resolveToken, signExecuteIntent, signPayment, signSwapIntent };