@axonfi/sdk 0.4.0 → 0.4.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.
Files changed (97) hide show
  1. package/README.md +15 -9
  2. package/dist/index.cjs +4325 -0
  3. package/dist/index.cjs.map +1 -0
  4. package/dist/index.d.cts +3256 -0
  5. package/dist/index.d.ts +3256 -21
  6. package/dist/index.js +4261 -27
  7. package/dist/index.js.map +1 -1
  8. package/package.json +1 -1
  9. package/dist/abis/AxonRegistry.d.ts +0 -294
  10. package/dist/abis/AxonRegistry.d.ts.map +0 -1
  11. package/dist/abis/AxonRegistry.js +0 -381
  12. package/dist/abis/AxonRegistry.js.map +0 -1
  13. package/dist/abis/AxonVault.d.ts +0 -1577
  14. package/dist/abis/AxonVault.d.ts.map +0 -1
  15. package/dist/abis/AxonVault.js +0 -2026
  16. package/dist/abis/AxonVault.js.map +0 -1
  17. package/dist/abis/AxonVaultFactory.d.ts +0 -207
  18. package/dist/abis/AxonVaultFactory.d.ts.map +0 -1
  19. package/dist/abis/AxonVaultFactory.js +0 -269
  20. package/dist/abis/AxonVaultFactory.js.map +0 -1
  21. package/dist/amounts.d.ts +0 -37
  22. package/dist/amounts.d.ts.map +0 -1
  23. package/dist/amounts.js +0 -72
  24. package/dist/amounts.js.map +0 -1
  25. package/dist/amounts.spec.d.ts +0 -2
  26. package/dist/amounts.spec.d.ts.map +0 -1
  27. package/dist/amounts.spec.js +0 -92
  28. package/dist/amounts.spec.js.map +0 -1
  29. package/dist/client.d.ts +0 -196
  30. package/dist/client.d.ts.map +0 -1
  31. package/dist/client.js +0 -621
  32. package/dist/client.js.map +0 -1
  33. package/dist/client.spec.d.ts +0 -2
  34. package/dist/client.spec.d.ts.map +0 -1
  35. package/dist/client.spec.js +0 -437
  36. package/dist/client.spec.js.map +0 -1
  37. package/dist/constants.d.ts +0 -110
  38. package/dist/constants.d.ts.map +0 -1
  39. package/dist/constants.js +0 -172
  40. package/dist/constants.js.map +0 -1
  41. package/dist/constants.spec.d.ts +0 -2
  42. package/dist/constants.spec.d.ts.map +0 -1
  43. package/dist/constants.spec.js +0 -95
  44. package/dist/constants.spec.js.map +0 -1
  45. package/dist/eip3009.d.ts +0 -45
  46. package/dist/eip3009.d.ts.map +0 -1
  47. package/dist/eip3009.js +0 -85
  48. package/dist/eip3009.js.map +0 -1
  49. package/dist/index.d.ts.map +0 -1
  50. package/dist/keystore.d.ts +0 -60
  51. package/dist/keystore.d.ts.map +0 -1
  52. package/dist/keystore.js +0 -182
  53. package/dist/keystore.js.map +0 -1
  54. package/dist/keystore.spec.d.ts +0 -2
  55. package/dist/keystore.spec.d.ts.map +0 -1
  56. package/dist/keystore.spec.js +0 -71
  57. package/dist/keystore.spec.js.map +0 -1
  58. package/dist/permit2.d.ts +0 -45
  59. package/dist/permit2.d.ts.map +0 -1
  60. package/dist/permit2.js +0 -81
  61. package/dist/permit2.js.map +0 -1
  62. package/dist/signer.d.ts +0 -35
  63. package/dist/signer.d.ts.map +0 -1
  64. package/dist/signer.js +0 -132
  65. package/dist/signer.js.map +0 -1
  66. package/dist/signer.spec.d.ts +0 -2
  67. package/dist/signer.spec.d.ts.map +0 -1
  68. package/dist/signer.spec.js +0 -94
  69. package/dist/signer.spec.js.map +0 -1
  70. package/dist/tokens.d.ts +0 -215
  71. package/dist/tokens.d.ts.map +0 -1
  72. package/dist/tokens.js +0 -247
  73. package/dist/tokens.js.map +0 -1
  74. package/dist/types.d.ts +0 -302
  75. package/dist/types.d.ts.map +0 -1
  76. package/dist/types.js +0 -2
  77. package/dist/types.js.map +0 -1
  78. package/dist/utils.d.ts +0 -8
  79. package/dist/utils.d.ts.map +0 -1
  80. package/dist/utils.js +0 -29
  81. package/dist/utils.js.map +0 -1
  82. package/dist/vault.d.ts +0 -60
  83. package/dist/vault.d.ts.map +0 -1
  84. package/dist/vault.js +0 -267
  85. package/dist/vault.js.map +0 -1
  86. package/dist/vault.spec.d.ts +0 -2
  87. package/dist/vault.spec.d.ts.map +0 -1
  88. package/dist/vault.spec.js +0 -162
  89. package/dist/vault.spec.js.map +0 -1
  90. package/dist/x402.d.ts +0 -88
  91. package/dist/x402.d.ts.map +0 -1
  92. package/dist/x402.js +0 -124
  93. package/dist/x402.js.map +0 -1
  94. package/dist/x402.spec.d.ts +0 -2
  95. package/dist/x402.spec.d.ts.map +0 -1
  96. package/dist/x402.spec.js +0 -411
  97. package/dist/x402.spec.js.map +0 -1
package/dist/index.js CHANGED
@@ -1,28 +1,4262 @@
1
- // ============================================================================
2
- // @axonfi/sdk Treasury and payment infrastructure for autonomous AI agents
3
- // ============================================================================
4
- // Main client
5
- export { AxonClient } from './client.js';
6
- // Constants
7
- export { Chain, NATIVE_ETH, USDC, WINDOW, CHAIN_NAMES, EXPLORER_TX, EXPLORER_ADDR, PAYMENT_INTENT_TYPEHASH, EXECUTE_INTENT_TYPEHASH, SWAP_INTENT_TYPEHASH, EIP712_DOMAIN_NAME, EIP712_DOMAIN_VERSION, SUPPORTED_CHAIN_IDS, DEFAULT_DEADLINE_SECONDS, PaymentErrorCode, RELAYER_API, } from './constants.js';
8
- // Signing utilities
9
- export { signPayment, signExecuteIntent, signSwapIntent, encodeRef } from './signer.js';
10
- // Vault helpers (for dashboards and tooling that need direct chain access)
11
- export { isBotActive, getBotConfig, getOperatorCeilings, operatorMaxDrainPerDay, isVaultPaused, getDomainSeparator, getVaultVersion, getVaultOwner, getVaultOperator, isDestinationAllowed, getRebalanceTokenCount, isRebalanceTokenWhitelisted, deployVault, createAxonPublicClient, createAxonWalletClient, getChain, } from './vault.js';
12
- // Keystore utilities
13
- export { encryptKeystore, decryptKeystore } from './keystore.js';
14
- // Token registry (shared by dashboard, relayer, and SDK consumers)
15
- export { Token, KNOWN_TOKENS, getKnownTokensForChain, getTokenSymbolByAddress, resolveToken } from './tokens.js';
16
- // Amount conversion utilities
17
- export { parseAmount, resolveTokenDecimals } from './amounts.js';
18
- // EIP-3009 (USDC TransferWithAuthorization)
19
- export { signTransferWithAuthorization, randomNonce, USDC_EIP712_DOMAIN } from './eip3009.js';
20
- // Permit2 (universal ERC-20 approvals)
21
- export { signPermit2WitnessTransfer, randomPermit2Nonce, PERMIT2_ADDRESS, X402_PROXY_ADDRESS, WITNESS_TYPE_STRING, } from './permit2.js';
22
- // x402 protocol utilities
23
- export { parsePaymentRequired, parseChainId, findMatchingOption, extractX402Metadata, formatPaymentSignature, } from './x402.js';
24
- // ABIs (useful for wagmi/viem integrations in frontends/dashboards)
25
- export { AxonVaultAbi } from './abis/AxonVault.js';
26
- export { AxonVaultFactoryAbi } from './abis/AxonVaultFactory.js';
27
- export { AxonRegistryAbi } from './abis/AxonRegistry.js';
1
+ import { keccak256, stringToBytes, createPublicClient, http, createWalletClient, parseUnits } from 'viem';
2
+ import { privateKeyToAccount } from 'viem/accounts';
3
+ import { arbitrumSepolia, arbitrum, baseSepolia, base } from 'viem/chains';
4
+ import { scryptAsync } from '@noble/hashes/scrypt';
5
+ import { keccak_256 } from '@noble/hashes/sha3';
6
+ import { ctr } from '@noble/ciphers/aes';
7
+
8
+ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
9
+ get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
10
+ }) : x)(function(x) {
11
+ if (typeof require !== "undefined") return require.apply(this, arguments);
12
+ throw Error('Dynamic require of "' + x + '" is not supported');
13
+ });
14
+ var PAYMENT_INTENT_TYPEHASH = keccak256(
15
+ stringToBytes("PaymentIntent(address bot,address to,address token,uint256 amount,uint256 deadline,bytes32 ref)")
16
+ );
17
+ var EXECUTE_INTENT_TYPEHASH = keccak256(
18
+ stringToBytes(
19
+ "ExecuteIntent(address bot,address protocol,bytes32 calldataHash,address token,uint256 amount,uint256 deadline,bytes32 ref)"
20
+ )
21
+ );
22
+ var SWAP_INTENT_TYPEHASH = keccak256(
23
+ stringToBytes("SwapIntent(address bot,address toToken,uint256 minToAmount,uint256 deadline,bytes32 ref)")
24
+ );
25
+ var EIP712_DOMAIN_NAME = "AxonVault";
26
+ var EIP712_DOMAIN_VERSION = "1";
27
+ var NATIVE_ETH = "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE";
28
+ var USDC = {
29
+ // Base mainnet
30
+ 8453: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
31
+ // Base Sepolia
32
+ 84532: "0x036CbD53842c5426634e7929541eC2318f3dCF7e",
33
+ // Arbitrum One
34
+ 42161: "0xaf88d065e77c8cC2239327C5EDb3A432268e5831",
35
+ // Arbitrum Sepolia
36
+ 421614: "0x75faf114eafb1BDbe2F0316DF893fd58CE46AA4d"
37
+ };
38
+ var Chain = /* @__PURE__ */ ((Chain2) => {
39
+ Chain2[Chain2["Base"] = 8453] = "Base";
40
+ Chain2[Chain2["BaseSepolia"] = 84532] = "BaseSepolia";
41
+ Chain2[Chain2["Arbitrum"] = 42161] = "Arbitrum";
42
+ Chain2[Chain2["ArbitrumSepolia"] = 421614] = "ArbitrumSepolia";
43
+ return Chain2;
44
+ })(Chain || {});
45
+ var SUPPORTED_CHAIN_IDS = [8453, 84532, 42161, 421614];
46
+ var CHAIN_NAMES = {
47
+ [8453 /* Base */]: "Base",
48
+ [84532 /* BaseSepolia */]: "Base Sepolia",
49
+ [42161 /* Arbitrum */]: "Arbitrum One",
50
+ [421614 /* ArbitrumSepolia */]: "Arbitrum Sepolia",
51
+ // Future v1 chains (metadata only — not in SUPPORTED_CHAIN_IDS yet)
52
+ 10: "Optimism",
53
+ 11155420: "OP Sepolia",
54
+ 137: "Polygon",
55
+ 80002: "Polygon Amoy"
56
+ };
57
+ var EXPLORER_TX = {
58
+ [8453 /* Base */]: "https://basescan.org/tx/",
59
+ [84532 /* BaseSepolia */]: "https://sepolia.basescan.org/tx/",
60
+ [42161 /* Arbitrum */]: "https://arbiscan.io/tx/",
61
+ [421614 /* ArbitrumSepolia */]: "https://sepolia.arbiscan.io/tx/",
62
+ 10: "https://optimistic.etherscan.io/tx/",
63
+ 11155420: "https://sepolia-optimism.etherscan.io/tx/",
64
+ 137: "https://polygonscan.com/tx/",
65
+ 80002: "https://amoy.polygonscan.com/tx/"
66
+ };
67
+ var EXPLORER_ADDR = {
68
+ [8453 /* Base */]: "https://basescan.org/address/",
69
+ [84532 /* BaseSepolia */]: "https://sepolia.basescan.org/address/",
70
+ [42161 /* Arbitrum */]: "https://arbiscan.io/address/",
71
+ [421614 /* ArbitrumSepolia */]: "https://sepolia.arbiscan.io/address/",
72
+ 10: "https://optimistic.etherscan.io/address/",
73
+ 11155420: "https://sepolia-optimism.etherscan.io/address/",
74
+ 137: "https://polygonscan.com/address/",
75
+ 80002: "https://amoy.polygonscan.com/address/"
76
+ };
77
+ var DEFAULT_DEADLINE_SECONDS = 300;
78
+ var WINDOW = {
79
+ ONE_HOUR: 3600n,
80
+ ONE_DAY: 86400n,
81
+ ONE_WEEK: 604800n,
82
+ THIRTY_DAYS: 2592000n
83
+ };
84
+ var PaymentErrorCode = {
85
+ /** Payment destination is the vault itself */
86
+ SELF_PAYMENT: "SELF_PAYMENT",
87
+ /** Payment destination is the zero address */
88
+ ZERO_ADDRESS: "ZERO_ADDRESS",
89
+ /** Payment amount is zero */
90
+ ZERO_AMOUNT: "ZERO_AMOUNT",
91
+ /** Vault does not hold enough of the requested token */
92
+ INSUFFICIENT_BALANCE: "INSUFFICIENT_BALANCE",
93
+ /** EIP-712 signature verification failed */
94
+ INVALID_SIGNATURE: "INVALID_SIGNATURE",
95
+ /** Payment intent deadline has passed */
96
+ DEADLINE_EXPIRED: "DEADLINE_EXPIRED",
97
+ /** Bot is temporarily paused by the operator */
98
+ BOT_PAUSED: "BOT_PAUSED",
99
+ /** Bot address is not registered/active in the vault */
100
+ BOT_NOT_ACTIVE: "BOT_NOT_ACTIVE",
101
+ /** Destination address is on the global or vault blacklist */
102
+ BLACKLISTED: "BLACKLISTED",
103
+ /** Rolling-window spending limit (USD amount) exceeded */
104
+ SPENDING_LIMIT_EXCEEDED: "SPENDING_LIMIT_EXCEEDED",
105
+ /** Rolling-window transaction count limit exceeded */
106
+ TX_COUNT_EXCEEDED: "TX_COUNT_EXCEEDED",
107
+ /** Single transaction exceeds the bot's on-chain maxPerTxAmount */
108
+ MAX_PER_TX_EXCEEDED: "MAX_PER_TX_EXCEEDED",
109
+ /** Vault-level daily aggregate spending limit exceeded */
110
+ VAULT_AGGREGATE_EXCEEDED: "VAULT_AGGREGATE_EXCEEDED",
111
+ /** eth_call simulation of the on-chain transaction reverted */
112
+ SIMULATION_FAILED: "SIMULATION_FAILED",
113
+ /** Routed to human review (AI scan flagged or no consensus) */
114
+ PENDING_REVIEW: "PENDING_REVIEW",
115
+ /** Relayer wallet has insufficient gas to submit the transaction */
116
+ RELAYER_OUT_OF_GAS: "RELAYER_OUT_OF_GAS",
117
+ /** On-chain transaction submission failed */
118
+ SUBMISSION_FAILED: "SUBMISSION_FAILED",
119
+ /** Destination not in the vault/bot whitelist */
120
+ DESTINATION_NOT_WHITELISTED: "DESTINATION_NOT_WHITELISTED",
121
+ /** Vault address is not a valid AxonVault or was not deployed by a known factory */
122
+ INVALID_VAULT: "INVALID_VAULT",
123
+ /** Rebalance output token is not in the whitelist (on-chain or relayer default) */
124
+ REBALANCE_TOKEN_NOT_ALLOWED: "REBALANCE_TOKEN_NOT_ALLOWED",
125
+ /** Rebalance input amount exceeds the bot's maxRebalanceAmount cap */
126
+ MAX_REBALANCE_AMOUNT_EXCEEDED: "MAX_REBALANCE_AMOUNT_EXCEEDED",
127
+ /** Unknown or internal error */
128
+ INTERNAL_ERROR: "INTERNAL_ERROR"
129
+ };
130
+ var RELAYER_API = {
131
+ PAYMENTS: "/v1/payments",
132
+ payment: (requestId) => `/v1/payments/${requestId}`,
133
+ EXECUTE: "/v1/execute",
134
+ execute: (requestId) => `/v1/execute/${requestId}`,
135
+ SWAP: "/v1/swap",
136
+ swap: (requestId) => `/v1/swap/${requestId}`,
137
+ // Vault read endpoints (relayer reads chain on behalf of bots)
138
+ vaultBalance: (vault, token, chainId) => `/v1/vault/${vault}/balance/${token}?chainId=${chainId}`,
139
+ vaultBalances: (vault, chainId) => `/v1/vault/${vault}/balances`,
140
+ vaultInfo: (vault, chainId) => `/v1/vault/${vault}/info?chainId=${chainId}`,
141
+ botStatus: (vault, bot, chainId) => `/v1/vault/${vault}/bot/${bot}/status?chainId=${chainId}`,
142
+ destinationCheck: (vault, bot, destination, chainId) => `/v1/vault/${vault}/bot/${bot}/destination/${destination}?chainId=${chainId}`,
143
+ protocolCheck: (vault, protocol, chainId) => `/v1/vault/${vault}/protocol/${protocol}?chainId=${chainId}`,
144
+ rebalanceTokens: (vault, chainId) => `/v1/vault/${vault}/rebalance-tokens?chainId=${chainId}`,
145
+ rebalanceTokenCheck: (vault, token, chainId) => `/v1/vault/${vault}/rebalance-token/${token}?chainId=${chainId}`,
146
+ // TOS endpoints
147
+ tosStatus: (wallet) => `/v1/tos/status?wallet=${wallet}`,
148
+ TOS_ACCEPT: "/v1/tos/accept"
149
+ };
150
+
151
+ // src/signer.ts
152
+ var PAYMENT_INTENT_TYPES = {
153
+ PaymentIntent: [
154
+ { name: "bot", type: "address" },
155
+ { name: "to", type: "address" },
156
+ { name: "token", type: "address" },
157
+ { name: "amount", type: "uint256" },
158
+ { name: "deadline", type: "uint256" },
159
+ { name: "ref", type: "bytes32" }
160
+ ]
161
+ };
162
+ var EXECUTE_INTENT_TYPES = {
163
+ ExecuteIntent: [
164
+ { name: "bot", type: "address" },
165
+ { name: "protocol", type: "address" },
166
+ { name: "calldataHash", type: "bytes32" },
167
+ { name: "token", type: "address" },
168
+ { name: "amount", type: "uint256" },
169
+ { name: "deadline", type: "uint256" },
170
+ { name: "ref", type: "bytes32" }
171
+ ]
172
+ };
173
+ var SWAP_INTENT_TYPES = {
174
+ SwapIntent: [
175
+ { name: "bot", type: "address" },
176
+ { name: "toToken", type: "address" },
177
+ { name: "minToAmount", type: "uint256" },
178
+ { name: "deadline", type: "uint256" },
179
+ { name: "ref", type: "bytes32" }
180
+ ]
181
+ };
182
+ function makeDomain(vaultAddress, chainId) {
183
+ return {
184
+ name: EIP712_DOMAIN_NAME,
185
+ version: EIP712_DOMAIN_VERSION,
186
+ chainId,
187
+ verifyingContract: vaultAddress
188
+ };
189
+ }
190
+ async function signPayment(walletClient, vaultAddress, chainId, intent) {
191
+ if (!walletClient.account) {
192
+ throw new Error("walletClient has no account attached");
193
+ }
194
+ return walletClient.signTypedData({
195
+ account: walletClient.account,
196
+ domain: makeDomain(vaultAddress, chainId),
197
+ types: PAYMENT_INTENT_TYPES,
198
+ primaryType: "PaymentIntent",
199
+ message: {
200
+ bot: intent.bot,
201
+ to: intent.to,
202
+ token: intent.token,
203
+ amount: intent.amount,
204
+ deadline: intent.deadline,
205
+ ref: intent.ref
206
+ }
207
+ });
208
+ }
209
+ async function signExecuteIntent(walletClient, vaultAddress, chainId, intent) {
210
+ if (!walletClient.account) {
211
+ throw new Error("walletClient has no account attached");
212
+ }
213
+ return walletClient.signTypedData({
214
+ account: walletClient.account,
215
+ domain: makeDomain(vaultAddress, chainId),
216
+ types: EXECUTE_INTENT_TYPES,
217
+ primaryType: "ExecuteIntent",
218
+ message: {
219
+ bot: intent.bot,
220
+ protocol: intent.protocol,
221
+ calldataHash: intent.calldataHash,
222
+ token: intent.token,
223
+ amount: intent.amount,
224
+ deadline: intent.deadline,
225
+ ref: intent.ref
226
+ }
227
+ });
228
+ }
229
+ async function signSwapIntent(walletClient, vaultAddress, chainId, intent) {
230
+ if (!walletClient.account) {
231
+ throw new Error("walletClient has no account attached");
232
+ }
233
+ return walletClient.signTypedData({
234
+ account: walletClient.account,
235
+ domain: makeDomain(vaultAddress, chainId),
236
+ types: SWAP_INTENT_TYPES,
237
+ primaryType: "SwapIntent",
238
+ message: {
239
+ bot: intent.bot,
240
+ toToken: intent.toToken,
241
+ minToAmount: intent.minToAmount,
242
+ deadline: intent.deadline,
243
+ ref: intent.ref
244
+ }
245
+ });
246
+ }
247
+ function encodeRef(memo) {
248
+ return keccak256(stringToBytes(memo));
249
+ }
250
+
251
+ // src/abis/AxonVault.ts
252
+ var AxonVaultAbi = [
253
+ {
254
+ "type": "constructor",
255
+ "inputs": [
256
+ {
257
+ "name": "_owner",
258
+ "type": "address",
259
+ "internalType": "address"
260
+ },
261
+ {
262
+ "name": "_axonRegistry",
263
+ "type": "address",
264
+ "internalType": "address"
265
+ }
266
+ ],
267
+ "stateMutability": "nonpayable"
268
+ },
269
+ {
270
+ "type": "receive",
271
+ "stateMutability": "payable"
272
+ },
273
+ {
274
+ "type": "function",
275
+ "name": "DOMAIN_SEPARATOR",
276
+ "inputs": [],
277
+ "outputs": [
278
+ {
279
+ "name": "",
280
+ "type": "bytes32",
281
+ "internalType": "bytes32"
282
+ }
283
+ ],
284
+ "stateMutability": "view"
285
+ },
286
+ {
287
+ "type": "function",
288
+ "name": "MAX_SPENDING_LIMITS",
289
+ "inputs": [],
290
+ "outputs": [
291
+ {
292
+ "name": "",
293
+ "type": "uint8",
294
+ "internalType": "uint8"
295
+ }
296
+ ],
297
+ "stateMutability": "view"
298
+ },
299
+ {
300
+ "type": "function",
301
+ "name": "NATIVE_ETH",
302
+ "inputs": [],
303
+ "outputs": [
304
+ {
305
+ "name": "",
306
+ "type": "address",
307
+ "internalType": "address"
308
+ }
309
+ ],
310
+ "stateMutability": "view"
311
+ },
312
+ {
313
+ "type": "function",
314
+ "name": "VERSION",
315
+ "inputs": [],
316
+ "outputs": [
317
+ {
318
+ "name": "",
319
+ "type": "uint16",
320
+ "internalType": "uint16"
321
+ }
322
+ ],
323
+ "stateMutability": "view"
324
+ },
325
+ {
326
+ "type": "function",
327
+ "name": "acceptOwnership",
328
+ "inputs": [],
329
+ "outputs": [],
330
+ "stateMutability": "nonpayable"
331
+ },
332
+ {
333
+ "type": "function",
334
+ "name": "addBot",
335
+ "inputs": [
336
+ {
337
+ "name": "bot",
338
+ "type": "address",
339
+ "internalType": "address"
340
+ },
341
+ {
342
+ "name": "params",
343
+ "type": "tuple",
344
+ "internalType": "struct AxonVault.BotConfigParams",
345
+ "components": [
346
+ {
347
+ "name": "maxPerTxAmount",
348
+ "type": "uint256",
349
+ "internalType": "uint256"
350
+ },
351
+ {
352
+ "name": "maxRebalanceAmount",
353
+ "type": "uint256",
354
+ "internalType": "uint256"
355
+ },
356
+ {
357
+ "name": "spendingLimits",
358
+ "type": "tuple[]",
359
+ "internalType": "struct AxonVault.SpendingLimit[]",
360
+ "components": [
361
+ {
362
+ "name": "amount",
363
+ "type": "uint256",
364
+ "internalType": "uint256"
365
+ },
366
+ {
367
+ "name": "maxCount",
368
+ "type": "uint256",
369
+ "internalType": "uint256"
370
+ },
371
+ {
372
+ "name": "windowSeconds",
373
+ "type": "uint256",
374
+ "internalType": "uint256"
375
+ }
376
+ ]
377
+ },
378
+ {
379
+ "name": "aiTriggerThreshold",
380
+ "type": "uint256",
381
+ "internalType": "uint256"
382
+ },
383
+ {
384
+ "name": "requireAiVerification",
385
+ "type": "bool",
386
+ "internalType": "bool"
387
+ }
388
+ ]
389
+ }
390
+ ],
391
+ "outputs": [],
392
+ "stateMutability": "nonpayable"
393
+ },
394
+ {
395
+ "type": "function",
396
+ "name": "addBotDestination",
397
+ "inputs": [
398
+ {
399
+ "name": "bot",
400
+ "type": "address",
401
+ "internalType": "address"
402
+ },
403
+ {
404
+ "name": "destination",
405
+ "type": "address",
406
+ "internalType": "address"
407
+ }
408
+ ],
409
+ "outputs": [],
410
+ "stateMutability": "nonpayable"
411
+ },
412
+ {
413
+ "type": "function",
414
+ "name": "addGlobalBlacklist",
415
+ "inputs": [
416
+ {
417
+ "name": "destination",
418
+ "type": "address",
419
+ "internalType": "address"
420
+ }
421
+ ],
422
+ "outputs": [],
423
+ "stateMutability": "nonpayable"
424
+ },
425
+ {
426
+ "type": "function",
427
+ "name": "addGlobalDestination",
428
+ "inputs": [
429
+ {
430
+ "name": "destination",
431
+ "type": "address",
432
+ "internalType": "address"
433
+ }
434
+ ],
435
+ "outputs": [],
436
+ "stateMutability": "nonpayable"
437
+ },
438
+ {
439
+ "type": "function",
440
+ "name": "addProtocol",
441
+ "inputs": [
442
+ {
443
+ "name": "protocol",
444
+ "type": "address",
445
+ "internalType": "address"
446
+ }
447
+ ],
448
+ "outputs": [],
449
+ "stateMutability": "nonpayable"
450
+ },
451
+ {
452
+ "type": "function",
453
+ "name": "addRebalanceTokens",
454
+ "inputs": [
455
+ {
456
+ "name": "tokens",
457
+ "type": "address[]",
458
+ "internalType": "address[]"
459
+ }
460
+ ],
461
+ "outputs": [],
462
+ "stateMutability": "nonpayable"
463
+ },
464
+ {
465
+ "type": "function",
466
+ "name": "approvedProtocolCount",
467
+ "inputs": [],
468
+ "outputs": [
469
+ {
470
+ "name": "",
471
+ "type": "uint256",
472
+ "internalType": "uint256"
473
+ }
474
+ ],
475
+ "stateMutability": "view"
476
+ },
477
+ {
478
+ "type": "function",
479
+ "name": "approvedProtocols",
480
+ "inputs": [
481
+ {
482
+ "name": "",
483
+ "type": "address",
484
+ "internalType": "address"
485
+ }
486
+ ],
487
+ "outputs": [
488
+ {
489
+ "name": "",
490
+ "type": "bool",
491
+ "internalType": "bool"
492
+ }
493
+ ],
494
+ "stateMutability": "view"
495
+ },
496
+ {
497
+ "type": "function",
498
+ "name": "axonRegistry",
499
+ "inputs": [],
500
+ "outputs": [
501
+ {
502
+ "name": "",
503
+ "type": "address",
504
+ "internalType": "address"
505
+ }
506
+ ],
507
+ "stateMutability": "view"
508
+ },
509
+ {
510
+ "type": "function",
511
+ "name": "botAddedByOperator",
512
+ "inputs": [
513
+ {
514
+ "name": "",
515
+ "type": "address",
516
+ "internalType": "address"
517
+ }
518
+ ],
519
+ "outputs": [
520
+ {
521
+ "name": "",
522
+ "type": "bool",
523
+ "internalType": "bool"
524
+ }
525
+ ],
526
+ "stateMutability": "view"
527
+ },
528
+ {
529
+ "type": "function",
530
+ "name": "botDestinationCount",
531
+ "inputs": [
532
+ {
533
+ "name": "",
534
+ "type": "address",
535
+ "internalType": "address"
536
+ }
537
+ ],
538
+ "outputs": [
539
+ {
540
+ "name": "",
541
+ "type": "uint256",
542
+ "internalType": "uint256"
543
+ }
544
+ ],
545
+ "stateMutability": "view"
546
+ },
547
+ {
548
+ "type": "function",
549
+ "name": "botDestinationWhitelist",
550
+ "inputs": [
551
+ {
552
+ "name": "",
553
+ "type": "address",
554
+ "internalType": "address"
555
+ },
556
+ {
557
+ "name": "",
558
+ "type": "address",
559
+ "internalType": "address"
560
+ }
561
+ ],
562
+ "outputs": [
563
+ {
564
+ "name": "",
565
+ "type": "bool",
566
+ "internalType": "bool"
567
+ }
568
+ ],
569
+ "stateMutability": "view"
570
+ },
571
+ {
572
+ "type": "function",
573
+ "name": "deposit",
574
+ "inputs": [
575
+ {
576
+ "name": "token",
577
+ "type": "address",
578
+ "internalType": "address"
579
+ },
580
+ {
581
+ "name": "amount",
582
+ "type": "uint256",
583
+ "internalType": "uint256"
584
+ },
585
+ {
586
+ "name": "ref",
587
+ "type": "bytes32",
588
+ "internalType": "bytes32"
589
+ }
590
+ ],
591
+ "outputs": [],
592
+ "stateMutability": "payable"
593
+ },
594
+ {
595
+ "type": "function",
596
+ "name": "eip712Domain",
597
+ "inputs": [],
598
+ "outputs": [
599
+ {
600
+ "name": "fields",
601
+ "type": "bytes1",
602
+ "internalType": "bytes1"
603
+ },
604
+ {
605
+ "name": "name",
606
+ "type": "string",
607
+ "internalType": "string"
608
+ },
609
+ {
610
+ "name": "version",
611
+ "type": "string",
612
+ "internalType": "string"
613
+ },
614
+ {
615
+ "name": "chainId",
616
+ "type": "uint256",
617
+ "internalType": "uint256"
618
+ },
619
+ {
620
+ "name": "verifyingContract",
621
+ "type": "address",
622
+ "internalType": "address"
623
+ },
624
+ {
625
+ "name": "salt",
626
+ "type": "bytes32",
627
+ "internalType": "bytes32"
628
+ },
629
+ {
630
+ "name": "extensions",
631
+ "type": "uint256[]",
632
+ "internalType": "uint256[]"
633
+ }
634
+ ],
635
+ "stateMutability": "view"
636
+ },
637
+ {
638
+ "type": "function",
639
+ "name": "executePayment",
640
+ "inputs": [
641
+ {
642
+ "name": "intent",
643
+ "type": "tuple",
644
+ "internalType": "struct AxonVault.PaymentIntent",
645
+ "components": [
646
+ {
647
+ "name": "bot",
648
+ "type": "address",
649
+ "internalType": "address"
650
+ },
651
+ {
652
+ "name": "to",
653
+ "type": "address",
654
+ "internalType": "address"
655
+ },
656
+ {
657
+ "name": "token",
658
+ "type": "address",
659
+ "internalType": "address"
660
+ },
661
+ {
662
+ "name": "amount",
663
+ "type": "uint256",
664
+ "internalType": "uint256"
665
+ },
666
+ {
667
+ "name": "deadline",
668
+ "type": "uint256",
669
+ "internalType": "uint256"
670
+ },
671
+ {
672
+ "name": "ref",
673
+ "type": "bytes32",
674
+ "internalType": "bytes32"
675
+ }
676
+ ]
677
+ },
678
+ {
679
+ "name": "signature",
680
+ "type": "bytes",
681
+ "internalType": "bytes"
682
+ },
683
+ {
684
+ "name": "fromToken",
685
+ "type": "address",
686
+ "internalType": "address"
687
+ },
688
+ {
689
+ "name": "maxFromAmount",
690
+ "type": "uint256",
691
+ "internalType": "uint256"
692
+ },
693
+ {
694
+ "name": "swapRouter",
695
+ "type": "address",
696
+ "internalType": "address"
697
+ },
698
+ {
699
+ "name": "swapCalldata",
700
+ "type": "bytes",
701
+ "internalType": "bytes"
702
+ }
703
+ ],
704
+ "outputs": [],
705
+ "stateMutability": "nonpayable"
706
+ },
707
+ {
708
+ "type": "function",
709
+ "name": "executeProtocol",
710
+ "inputs": [
711
+ {
712
+ "name": "intent",
713
+ "type": "tuple",
714
+ "internalType": "struct AxonVault.ExecuteIntent",
715
+ "components": [
716
+ {
717
+ "name": "bot",
718
+ "type": "address",
719
+ "internalType": "address"
720
+ },
721
+ {
722
+ "name": "protocol",
723
+ "type": "address",
724
+ "internalType": "address"
725
+ },
726
+ {
727
+ "name": "calldataHash",
728
+ "type": "bytes32",
729
+ "internalType": "bytes32"
730
+ },
731
+ {
732
+ "name": "token",
733
+ "type": "address",
734
+ "internalType": "address"
735
+ },
736
+ {
737
+ "name": "amount",
738
+ "type": "uint256",
739
+ "internalType": "uint256"
740
+ },
741
+ {
742
+ "name": "deadline",
743
+ "type": "uint256",
744
+ "internalType": "uint256"
745
+ },
746
+ {
747
+ "name": "ref",
748
+ "type": "bytes32",
749
+ "internalType": "bytes32"
750
+ }
751
+ ]
752
+ },
753
+ {
754
+ "name": "signature",
755
+ "type": "bytes",
756
+ "internalType": "bytes"
757
+ },
758
+ {
759
+ "name": "callData",
760
+ "type": "bytes",
761
+ "internalType": "bytes"
762
+ },
763
+ {
764
+ "name": "fromToken",
765
+ "type": "address",
766
+ "internalType": "address"
767
+ },
768
+ {
769
+ "name": "maxFromAmount",
770
+ "type": "uint256",
771
+ "internalType": "uint256"
772
+ },
773
+ {
774
+ "name": "swapRouter",
775
+ "type": "address",
776
+ "internalType": "address"
777
+ },
778
+ {
779
+ "name": "swapCalldata",
780
+ "type": "bytes",
781
+ "internalType": "bytes"
782
+ }
783
+ ],
784
+ "outputs": [
785
+ {
786
+ "name": "",
787
+ "type": "bytes",
788
+ "internalType": "bytes"
789
+ }
790
+ ],
791
+ "stateMutability": "nonpayable"
792
+ },
793
+ {
794
+ "type": "function",
795
+ "name": "executeSwap",
796
+ "inputs": [
797
+ {
798
+ "name": "intent",
799
+ "type": "tuple",
800
+ "internalType": "struct AxonVault.SwapIntent",
801
+ "components": [
802
+ {
803
+ "name": "bot",
804
+ "type": "address",
805
+ "internalType": "address"
806
+ },
807
+ {
808
+ "name": "toToken",
809
+ "type": "address",
810
+ "internalType": "address"
811
+ },
812
+ {
813
+ "name": "minToAmount",
814
+ "type": "uint256",
815
+ "internalType": "uint256"
816
+ },
817
+ {
818
+ "name": "deadline",
819
+ "type": "uint256",
820
+ "internalType": "uint256"
821
+ },
822
+ {
823
+ "name": "ref",
824
+ "type": "bytes32",
825
+ "internalType": "bytes32"
826
+ }
827
+ ]
828
+ },
829
+ {
830
+ "name": "signature",
831
+ "type": "bytes",
832
+ "internalType": "bytes"
833
+ },
834
+ {
835
+ "name": "fromToken",
836
+ "type": "address",
837
+ "internalType": "address"
838
+ },
839
+ {
840
+ "name": "maxFromAmount",
841
+ "type": "uint256",
842
+ "internalType": "uint256"
843
+ },
844
+ {
845
+ "name": "swapRouter",
846
+ "type": "address",
847
+ "internalType": "address"
848
+ },
849
+ {
850
+ "name": "swapCalldata",
851
+ "type": "bytes",
852
+ "internalType": "bytes"
853
+ }
854
+ ],
855
+ "outputs": [],
856
+ "stateMutability": "nonpayable"
857
+ },
858
+ {
859
+ "type": "function",
860
+ "name": "getBotConfig",
861
+ "inputs": [
862
+ {
863
+ "name": "bot",
864
+ "type": "address",
865
+ "internalType": "address"
866
+ }
867
+ ],
868
+ "outputs": [
869
+ {
870
+ "name": "",
871
+ "type": "tuple",
872
+ "internalType": "struct AxonVault.BotConfig",
873
+ "components": [
874
+ {
875
+ "name": "isActive",
876
+ "type": "bool",
877
+ "internalType": "bool"
878
+ },
879
+ {
880
+ "name": "registeredAt",
881
+ "type": "uint256",
882
+ "internalType": "uint256"
883
+ },
884
+ {
885
+ "name": "maxPerTxAmount",
886
+ "type": "uint256",
887
+ "internalType": "uint256"
888
+ },
889
+ {
890
+ "name": "maxRebalanceAmount",
891
+ "type": "uint256",
892
+ "internalType": "uint256"
893
+ },
894
+ {
895
+ "name": "spendingLimits",
896
+ "type": "tuple[]",
897
+ "internalType": "struct AxonVault.SpendingLimit[]",
898
+ "components": [
899
+ {
900
+ "name": "amount",
901
+ "type": "uint256",
902
+ "internalType": "uint256"
903
+ },
904
+ {
905
+ "name": "maxCount",
906
+ "type": "uint256",
907
+ "internalType": "uint256"
908
+ },
909
+ {
910
+ "name": "windowSeconds",
911
+ "type": "uint256",
912
+ "internalType": "uint256"
913
+ }
914
+ ]
915
+ },
916
+ {
917
+ "name": "aiTriggerThreshold",
918
+ "type": "uint256",
919
+ "internalType": "uint256"
920
+ },
921
+ {
922
+ "name": "requireAiVerification",
923
+ "type": "bool",
924
+ "internalType": "bool"
925
+ }
926
+ ]
927
+ }
928
+ ],
929
+ "stateMutability": "view"
930
+ },
931
+ {
932
+ "type": "function",
933
+ "name": "globalBlacklistCount",
934
+ "inputs": [],
935
+ "outputs": [
936
+ {
937
+ "name": "",
938
+ "type": "uint256",
939
+ "internalType": "uint256"
940
+ }
941
+ ],
942
+ "stateMutability": "view"
943
+ },
944
+ {
945
+ "type": "function",
946
+ "name": "globalDestinationBlacklist",
947
+ "inputs": [
948
+ {
949
+ "name": "",
950
+ "type": "address",
951
+ "internalType": "address"
952
+ }
953
+ ],
954
+ "outputs": [
955
+ {
956
+ "name": "",
957
+ "type": "bool",
958
+ "internalType": "bool"
959
+ }
960
+ ],
961
+ "stateMutability": "view"
962
+ },
963
+ {
964
+ "type": "function",
965
+ "name": "globalDestinationCount",
966
+ "inputs": [],
967
+ "outputs": [
968
+ {
969
+ "name": "",
970
+ "type": "uint256",
971
+ "internalType": "uint256"
972
+ }
973
+ ],
974
+ "stateMutability": "view"
975
+ },
976
+ {
977
+ "type": "function",
978
+ "name": "globalDestinationWhitelist",
979
+ "inputs": [
980
+ {
981
+ "name": "",
982
+ "type": "address",
983
+ "internalType": "address"
984
+ }
985
+ ],
986
+ "outputs": [
987
+ {
988
+ "name": "",
989
+ "type": "bool",
990
+ "internalType": "bool"
991
+ }
992
+ ],
993
+ "stateMutability": "view"
994
+ },
995
+ {
996
+ "type": "function",
997
+ "name": "isBotActive",
998
+ "inputs": [
999
+ {
1000
+ "name": "bot",
1001
+ "type": "address",
1002
+ "internalType": "address"
1003
+ }
1004
+ ],
1005
+ "outputs": [
1006
+ {
1007
+ "name": "",
1008
+ "type": "bool",
1009
+ "internalType": "bool"
1010
+ }
1011
+ ],
1012
+ "stateMutability": "view"
1013
+ },
1014
+ {
1015
+ "type": "function",
1016
+ "name": "isProtocolApproved",
1017
+ "inputs": [
1018
+ {
1019
+ "name": "protocol",
1020
+ "type": "address",
1021
+ "internalType": "address"
1022
+ }
1023
+ ],
1024
+ "outputs": [
1025
+ {
1026
+ "name": "",
1027
+ "type": "bool",
1028
+ "internalType": "bool"
1029
+ }
1030
+ ],
1031
+ "stateMutability": "view"
1032
+ },
1033
+ {
1034
+ "type": "function",
1035
+ "name": "operator",
1036
+ "inputs": [],
1037
+ "outputs": [
1038
+ {
1039
+ "name": "",
1040
+ "type": "address",
1041
+ "internalType": "address"
1042
+ }
1043
+ ],
1044
+ "stateMutability": "view"
1045
+ },
1046
+ {
1047
+ "type": "function",
1048
+ "name": "operatorBotCount",
1049
+ "inputs": [],
1050
+ "outputs": [
1051
+ {
1052
+ "name": "",
1053
+ "type": "uint256",
1054
+ "internalType": "uint256"
1055
+ }
1056
+ ],
1057
+ "stateMutability": "view"
1058
+ },
1059
+ {
1060
+ "type": "function",
1061
+ "name": "operatorCeilings",
1062
+ "inputs": [],
1063
+ "outputs": [
1064
+ {
1065
+ "name": "maxPerTxAmount",
1066
+ "type": "uint256",
1067
+ "internalType": "uint256"
1068
+ },
1069
+ {
1070
+ "name": "maxBotDailyLimit",
1071
+ "type": "uint256",
1072
+ "internalType": "uint256"
1073
+ },
1074
+ {
1075
+ "name": "maxOperatorBots",
1076
+ "type": "uint256",
1077
+ "internalType": "uint256"
1078
+ },
1079
+ {
1080
+ "name": "vaultDailyAggregate",
1081
+ "type": "uint256",
1082
+ "internalType": "uint256"
1083
+ },
1084
+ {
1085
+ "name": "minAiTriggerFloor",
1086
+ "type": "uint256",
1087
+ "internalType": "uint256"
1088
+ }
1089
+ ],
1090
+ "stateMutability": "view"
1091
+ },
1092
+ {
1093
+ "type": "function",
1094
+ "name": "operatorMaxDrainPerDay",
1095
+ "inputs": [],
1096
+ "outputs": [
1097
+ {
1098
+ "name": "",
1099
+ "type": "uint256",
1100
+ "internalType": "uint256"
1101
+ }
1102
+ ],
1103
+ "stateMutability": "view"
1104
+ },
1105
+ {
1106
+ "type": "function",
1107
+ "name": "owner",
1108
+ "inputs": [],
1109
+ "outputs": [
1110
+ {
1111
+ "name": "",
1112
+ "type": "address",
1113
+ "internalType": "address"
1114
+ }
1115
+ ],
1116
+ "stateMutability": "view"
1117
+ },
1118
+ {
1119
+ "type": "function",
1120
+ "name": "pause",
1121
+ "inputs": [],
1122
+ "outputs": [],
1123
+ "stateMutability": "nonpayable"
1124
+ },
1125
+ {
1126
+ "type": "function",
1127
+ "name": "paused",
1128
+ "inputs": [],
1129
+ "outputs": [
1130
+ {
1131
+ "name": "",
1132
+ "type": "bool",
1133
+ "internalType": "bool"
1134
+ }
1135
+ ],
1136
+ "stateMutability": "view"
1137
+ },
1138
+ {
1139
+ "type": "function",
1140
+ "name": "pendingOwner",
1141
+ "inputs": [],
1142
+ "outputs": [
1143
+ {
1144
+ "name": "",
1145
+ "type": "address",
1146
+ "internalType": "address"
1147
+ }
1148
+ ],
1149
+ "stateMutability": "view"
1150
+ },
1151
+ {
1152
+ "type": "function",
1153
+ "name": "rebalanceTokenCount",
1154
+ "inputs": [],
1155
+ "outputs": [
1156
+ {
1157
+ "name": "",
1158
+ "type": "uint256",
1159
+ "internalType": "uint256"
1160
+ }
1161
+ ],
1162
+ "stateMutability": "view"
1163
+ },
1164
+ {
1165
+ "type": "function",
1166
+ "name": "rebalanceTokenWhitelist",
1167
+ "inputs": [
1168
+ {
1169
+ "name": "",
1170
+ "type": "address",
1171
+ "internalType": "address"
1172
+ }
1173
+ ],
1174
+ "outputs": [
1175
+ {
1176
+ "name": "",
1177
+ "type": "bool",
1178
+ "internalType": "bool"
1179
+ }
1180
+ ],
1181
+ "stateMutability": "view"
1182
+ },
1183
+ {
1184
+ "type": "function",
1185
+ "name": "removeBot",
1186
+ "inputs": [
1187
+ {
1188
+ "name": "bot",
1189
+ "type": "address",
1190
+ "internalType": "address"
1191
+ }
1192
+ ],
1193
+ "outputs": [],
1194
+ "stateMutability": "nonpayable"
1195
+ },
1196
+ {
1197
+ "type": "function",
1198
+ "name": "removeBotDestination",
1199
+ "inputs": [
1200
+ {
1201
+ "name": "bot",
1202
+ "type": "address",
1203
+ "internalType": "address"
1204
+ },
1205
+ {
1206
+ "name": "destination",
1207
+ "type": "address",
1208
+ "internalType": "address"
1209
+ }
1210
+ ],
1211
+ "outputs": [],
1212
+ "stateMutability": "nonpayable"
1213
+ },
1214
+ {
1215
+ "type": "function",
1216
+ "name": "removeGlobalBlacklist",
1217
+ "inputs": [
1218
+ {
1219
+ "name": "destination",
1220
+ "type": "address",
1221
+ "internalType": "address"
1222
+ }
1223
+ ],
1224
+ "outputs": [],
1225
+ "stateMutability": "nonpayable"
1226
+ },
1227
+ {
1228
+ "type": "function",
1229
+ "name": "removeGlobalDestination",
1230
+ "inputs": [
1231
+ {
1232
+ "name": "destination",
1233
+ "type": "address",
1234
+ "internalType": "address"
1235
+ }
1236
+ ],
1237
+ "outputs": [],
1238
+ "stateMutability": "nonpayable"
1239
+ },
1240
+ {
1241
+ "type": "function",
1242
+ "name": "removeProtocol",
1243
+ "inputs": [
1244
+ {
1245
+ "name": "protocol",
1246
+ "type": "address",
1247
+ "internalType": "address"
1248
+ }
1249
+ ],
1250
+ "outputs": [],
1251
+ "stateMutability": "nonpayable"
1252
+ },
1253
+ {
1254
+ "type": "function",
1255
+ "name": "removeRebalanceTokens",
1256
+ "inputs": [
1257
+ {
1258
+ "name": "tokens",
1259
+ "type": "address[]",
1260
+ "internalType": "address[]"
1261
+ }
1262
+ ],
1263
+ "outputs": [],
1264
+ "stateMutability": "nonpayable"
1265
+ },
1266
+ {
1267
+ "type": "function",
1268
+ "name": "renounceOwnership",
1269
+ "inputs": [],
1270
+ "outputs": [],
1271
+ "stateMutability": "nonpayable"
1272
+ },
1273
+ {
1274
+ "type": "function",
1275
+ "name": "setOperator",
1276
+ "inputs": [
1277
+ {
1278
+ "name": "_operator",
1279
+ "type": "address",
1280
+ "internalType": "address"
1281
+ }
1282
+ ],
1283
+ "outputs": [],
1284
+ "stateMutability": "nonpayable"
1285
+ },
1286
+ {
1287
+ "type": "function",
1288
+ "name": "setOperatorCeilings",
1289
+ "inputs": [
1290
+ {
1291
+ "name": "ceilings",
1292
+ "type": "tuple",
1293
+ "internalType": "struct AxonVault.OperatorCeilings",
1294
+ "components": [
1295
+ {
1296
+ "name": "maxPerTxAmount",
1297
+ "type": "uint256",
1298
+ "internalType": "uint256"
1299
+ },
1300
+ {
1301
+ "name": "maxBotDailyLimit",
1302
+ "type": "uint256",
1303
+ "internalType": "uint256"
1304
+ },
1305
+ {
1306
+ "name": "maxOperatorBots",
1307
+ "type": "uint256",
1308
+ "internalType": "uint256"
1309
+ },
1310
+ {
1311
+ "name": "vaultDailyAggregate",
1312
+ "type": "uint256",
1313
+ "internalType": "uint256"
1314
+ },
1315
+ {
1316
+ "name": "minAiTriggerFloor",
1317
+ "type": "uint256",
1318
+ "internalType": "uint256"
1319
+ }
1320
+ ]
1321
+ }
1322
+ ],
1323
+ "outputs": [],
1324
+ "stateMutability": "nonpayable"
1325
+ },
1326
+ {
1327
+ "type": "function",
1328
+ "name": "transferOwnership",
1329
+ "inputs": [
1330
+ {
1331
+ "name": "newOwner",
1332
+ "type": "address",
1333
+ "internalType": "address"
1334
+ }
1335
+ ],
1336
+ "outputs": [],
1337
+ "stateMutability": "nonpayable"
1338
+ },
1339
+ {
1340
+ "type": "function",
1341
+ "name": "unpause",
1342
+ "inputs": [],
1343
+ "outputs": [],
1344
+ "stateMutability": "nonpayable"
1345
+ },
1346
+ {
1347
+ "type": "function",
1348
+ "name": "updateBotConfig",
1349
+ "inputs": [
1350
+ {
1351
+ "name": "bot",
1352
+ "type": "address",
1353
+ "internalType": "address"
1354
+ },
1355
+ {
1356
+ "name": "params",
1357
+ "type": "tuple",
1358
+ "internalType": "struct AxonVault.BotConfigParams",
1359
+ "components": [
1360
+ {
1361
+ "name": "maxPerTxAmount",
1362
+ "type": "uint256",
1363
+ "internalType": "uint256"
1364
+ },
1365
+ {
1366
+ "name": "maxRebalanceAmount",
1367
+ "type": "uint256",
1368
+ "internalType": "uint256"
1369
+ },
1370
+ {
1371
+ "name": "spendingLimits",
1372
+ "type": "tuple[]",
1373
+ "internalType": "struct AxonVault.SpendingLimit[]",
1374
+ "components": [
1375
+ {
1376
+ "name": "amount",
1377
+ "type": "uint256",
1378
+ "internalType": "uint256"
1379
+ },
1380
+ {
1381
+ "name": "maxCount",
1382
+ "type": "uint256",
1383
+ "internalType": "uint256"
1384
+ },
1385
+ {
1386
+ "name": "windowSeconds",
1387
+ "type": "uint256",
1388
+ "internalType": "uint256"
1389
+ }
1390
+ ]
1391
+ },
1392
+ {
1393
+ "name": "aiTriggerThreshold",
1394
+ "type": "uint256",
1395
+ "internalType": "uint256"
1396
+ },
1397
+ {
1398
+ "name": "requireAiVerification",
1399
+ "type": "bool",
1400
+ "internalType": "bool"
1401
+ }
1402
+ ]
1403
+ }
1404
+ ],
1405
+ "outputs": [],
1406
+ "stateMutability": "nonpayable"
1407
+ },
1408
+ {
1409
+ "type": "function",
1410
+ "name": "usedIntents",
1411
+ "inputs": [
1412
+ {
1413
+ "name": "",
1414
+ "type": "bytes32",
1415
+ "internalType": "bytes32"
1416
+ }
1417
+ ],
1418
+ "outputs": [
1419
+ {
1420
+ "name": "",
1421
+ "type": "bool",
1422
+ "internalType": "bool"
1423
+ }
1424
+ ],
1425
+ "stateMutability": "view"
1426
+ },
1427
+ {
1428
+ "type": "function",
1429
+ "name": "withdraw",
1430
+ "inputs": [
1431
+ {
1432
+ "name": "token",
1433
+ "type": "address",
1434
+ "internalType": "address"
1435
+ },
1436
+ {
1437
+ "name": "amount",
1438
+ "type": "uint256",
1439
+ "internalType": "uint256"
1440
+ },
1441
+ {
1442
+ "name": "to",
1443
+ "type": "address",
1444
+ "internalType": "address"
1445
+ }
1446
+ ],
1447
+ "outputs": [],
1448
+ "stateMutability": "nonpayable"
1449
+ },
1450
+ {
1451
+ "type": "event",
1452
+ "name": "BotAdded",
1453
+ "inputs": [
1454
+ {
1455
+ "name": "bot",
1456
+ "type": "address",
1457
+ "indexed": true,
1458
+ "internalType": "address"
1459
+ },
1460
+ {
1461
+ "name": "addedBy",
1462
+ "type": "address",
1463
+ "indexed": true,
1464
+ "internalType": "address"
1465
+ }
1466
+ ],
1467
+ "anonymous": false
1468
+ },
1469
+ {
1470
+ "type": "event",
1471
+ "name": "BotConfigUpdated",
1472
+ "inputs": [
1473
+ {
1474
+ "name": "bot",
1475
+ "type": "address",
1476
+ "indexed": true,
1477
+ "internalType": "address"
1478
+ },
1479
+ {
1480
+ "name": "updatedBy",
1481
+ "type": "address",
1482
+ "indexed": true,
1483
+ "internalType": "address"
1484
+ }
1485
+ ],
1486
+ "anonymous": false
1487
+ },
1488
+ {
1489
+ "type": "event",
1490
+ "name": "BotDestinationAdded",
1491
+ "inputs": [
1492
+ {
1493
+ "name": "bot",
1494
+ "type": "address",
1495
+ "indexed": true,
1496
+ "internalType": "address"
1497
+ },
1498
+ {
1499
+ "name": "destination",
1500
+ "type": "address",
1501
+ "indexed": true,
1502
+ "internalType": "address"
1503
+ }
1504
+ ],
1505
+ "anonymous": false
1506
+ },
1507
+ {
1508
+ "type": "event",
1509
+ "name": "BotDestinationRemoved",
1510
+ "inputs": [
1511
+ {
1512
+ "name": "bot",
1513
+ "type": "address",
1514
+ "indexed": true,
1515
+ "internalType": "address"
1516
+ },
1517
+ {
1518
+ "name": "destination",
1519
+ "type": "address",
1520
+ "indexed": true,
1521
+ "internalType": "address"
1522
+ }
1523
+ ],
1524
+ "anonymous": false
1525
+ },
1526
+ {
1527
+ "type": "event",
1528
+ "name": "BotRemoved",
1529
+ "inputs": [
1530
+ {
1531
+ "name": "bot",
1532
+ "type": "address",
1533
+ "indexed": true,
1534
+ "internalType": "address"
1535
+ },
1536
+ {
1537
+ "name": "removedBy",
1538
+ "type": "address",
1539
+ "indexed": true,
1540
+ "internalType": "address"
1541
+ }
1542
+ ],
1543
+ "anonymous": false
1544
+ },
1545
+ {
1546
+ "type": "event",
1547
+ "name": "Deposited",
1548
+ "inputs": [
1549
+ {
1550
+ "name": "from",
1551
+ "type": "address",
1552
+ "indexed": true,
1553
+ "internalType": "address"
1554
+ },
1555
+ {
1556
+ "name": "token",
1557
+ "type": "address",
1558
+ "indexed": true,
1559
+ "internalType": "address"
1560
+ },
1561
+ {
1562
+ "name": "amount",
1563
+ "type": "uint256",
1564
+ "indexed": false,
1565
+ "internalType": "uint256"
1566
+ },
1567
+ {
1568
+ "name": "ref",
1569
+ "type": "bytes32",
1570
+ "indexed": false,
1571
+ "internalType": "bytes32"
1572
+ }
1573
+ ],
1574
+ "anonymous": false
1575
+ },
1576
+ {
1577
+ "type": "event",
1578
+ "name": "EIP712DomainChanged",
1579
+ "inputs": [],
1580
+ "anonymous": false
1581
+ },
1582
+ {
1583
+ "type": "event",
1584
+ "name": "GlobalBlacklistAdded",
1585
+ "inputs": [
1586
+ {
1587
+ "name": "destination",
1588
+ "type": "address",
1589
+ "indexed": true,
1590
+ "internalType": "address"
1591
+ }
1592
+ ],
1593
+ "anonymous": false
1594
+ },
1595
+ {
1596
+ "type": "event",
1597
+ "name": "GlobalBlacklistRemoved",
1598
+ "inputs": [
1599
+ {
1600
+ "name": "destination",
1601
+ "type": "address",
1602
+ "indexed": true,
1603
+ "internalType": "address"
1604
+ }
1605
+ ],
1606
+ "anonymous": false
1607
+ },
1608
+ {
1609
+ "type": "event",
1610
+ "name": "GlobalDestinationAdded",
1611
+ "inputs": [
1612
+ {
1613
+ "name": "destination",
1614
+ "type": "address",
1615
+ "indexed": true,
1616
+ "internalType": "address"
1617
+ }
1618
+ ],
1619
+ "anonymous": false
1620
+ },
1621
+ {
1622
+ "type": "event",
1623
+ "name": "GlobalDestinationRemoved",
1624
+ "inputs": [
1625
+ {
1626
+ "name": "destination",
1627
+ "type": "address",
1628
+ "indexed": true,
1629
+ "internalType": "address"
1630
+ }
1631
+ ],
1632
+ "anonymous": false
1633
+ },
1634
+ {
1635
+ "type": "event",
1636
+ "name": "OperatorCeilingsUpdated",
1637
+ "inputs": [
1638
+ {
1639
+ "name": "ceilings",
1640
+ "type": "tuple",
1641
+ "indexed": false,
1642
+ "internalType": "struct AxonVault.OperatorCeilings",
1643
+ "components": [
1644
+ {
1645
+ "name": "maxPerTxAmount",
1646
+ "type": "uint256",
1647
+ "internalType": "uint256"
1648
+ },
1649
+ {
1650
+ "name": "maxBotDailyLimit",
1651
+ "type": "uint256",
1652
+ "internalType": "uint256"
1653
+ },
1654
+ {
1655
+ "name": "maxOperatorBots",
1656
+ "type": "uint256",
1657
+ "internalType": "uint256"
1658
+ },
1659
+ {
1660
+ "name": "vaultDailyAggregate",
1661
+ "type": "uint256",
1662
+ "internalType": "uint256"
1663
+ },
1664
+ {
1665
+ "name": "minAiTriggerFloor",
1666
+ "type": "uint256",
1667
+ "internalType": "uint256"
1668
+ }
1669
+ ]
1670
+ }
1671
+ ],
1672
+ "anonymous": false
1673
+ },
1674
+ {
1675
+ "type": "event",
1676
+ "name": "OperatorSet",
1677
+ "inputs": [
1678
+ {
1679
+ "name": "oldOperator",
1680
+ "type": "address",
1681
+ "indexed": true,
1682
+ "internalType": "address"
1683
+ },
1684
+ {
1685
+ "name": "newOperator",
1686
+ "type": "address",
1687
+ "indexed": true,
1688
+ "internalType": "address"
1689
+ }
1690
+ ],
1691
+ "anonymous": false
1692
+ },
1693
+ {
1694
+ "type": "event",
1695
+ "name": "OwnershipTransferStarted",
1696
+ "inputs": [
1697
+ {
1698
+ "name": "previousOwner",
1699
+ "type": "address",
1700
+ "indexed": true,
1701
+ "internalType": "address"
1702
+ },
1703
+ {
1704
+ "name": "newOwner",
1705
+ "type": "address",
1706
+ "indexed": true,
1707
+ "internalType": "address"
1708
+ }
1709
+ ],
1710
+ "anonymous": false
1711
+ },
1712
+ {
1713
+ "type": "event",
1714
+ "name": "OwnershipTransferred",
1715
+ "inputs": [
1716
+ {
1717
+ "name": "previousOwner",
1718
+ "type": "address",
1719
+ "indexed": true,
1720
+ "internalType": "address"
1721
+ },
1722
+ {
1723
+ "name": "newOwner",
1724
+ "type": "address",
1725
+ "indexed": true,
1726
+ "internalType": "address"
1727
+ }
1728
+ ],
1729
+ "anonymous": false
1730
+ },
1731
+ {
1732
+ "type": "event",
1733
+ "name": "Paused",
1734
+ "inputs": [
1735
+ {
1736
+ "name": "account",
1737
+ "type": "address",
1738
+ "indexed": false,
1739
+ "internalType": "address"
1740
+ }
1741
+ ],
1742
+ "anonymous": false
1743
+ },
1744
+ {
1745
+ "type": "event",
1746
+ "name": "PaymentExecuted",
1747
+ "inputs": [
1748
+ {
1749
+ "name": "bot",
1750
+ "type": "address",
1751
+ "indexed": true,
1752
+ "internalType": "address"
1753
+ },
1754
+ {
1755
+ "name": "to",
1756
+ "type": "address",
1757
+ "indexed": true,
1758
+ "internalType": "address"
1759
+ },
1760
+ {
1761
+ "name": "token",
1762
+ "type": "address",
1763
+ "indexed": true,
1764
+ "internalType": "address"
1765
+ },
1766
+ {
1767
+ "name": "amount",
1768
+ "type": "uint256",
1769
+ "indexed": false,
1770
+ "internalType": "uint256"
1771
+ },
1772
+ {
1773
+ "name": "ref",
1774
+ "type": "bytes32",
1775
+ "indexed": false,
1776
+ "internalType": "bytes32"
1777
+ }
1778
+ ],
1779
+ "anonymous": false
1780
+ },
1781
+ {
1782
+ "type": "event",
1783
+ "name": "ProtocolAdded",
1784
+ "inputs": [
1785
+ {
1786
+ "name": "protocol",
1787
+ "type": "address",
1788
+ "indexed": true,
1789
+ "internalType": "address"
1790
+ }
1791
+ ],
1792
+ "anonymous": false
1793
+ },
1794
+ {
1795
+ "type": "event",
1796
+ "name": "ProtocolExecuted",
1797
+ "inputs": [
1798
+ {
1799
+ "name": "bot",
1800
+ "type": "address",
1801
+ "indexed": true,
1802
+ "internalType": "address"
1803
+ },
1804
+ {
1805
+ "name": "protocol",
1806
+ "type": "address",
1807
+ "indexed": true,
1808
+ "internalType": "address"
1809
+ },
1810
+ {
1811
+ "name": "token",
1812
+ "type": "address",
1813
+ "indexed": false,
1814
+ "internalType": "address"
1815
+ },
1816
+ {
1817
+ "name": "amount",
1818
+ "type": "uint256",
1819
+ "indexed": false,
1820
+ "internalType": "uint256"
1821
+ },
1822
+ {
1823
+ "name": "ref",
1824
+ "type": "bytes32",
1825
+ "indexed": false,
1826
+ "internalType": "bytes32"
1827
+ }
1828
+ ],
1829
+ "anonymous": false
1830
+ },
1831
+ {
1832
+ "type": "event",
1833
+ "name": "ProtocolRemoved",
1834
+ "inputs": [
1835
+ {
1836
+ "name": "protocol",
1837
+ "type": "address",
1838
+ "indexed": true,
1839
+ "internalType": "address"
1840
+ }
1841
+ ],
1842
+ "anonymous": false
1843
+ },
1844
+ {
1845
+ "type": "event",
1846
+ "name": "RebalanceTokenAdded",
1847
+ "inputs": [
1848
+ {
1849
+ "name": "token",
1850
+ "type": "address",
1851
+ "indexed": true,
1852
+ "internalType": "address"
1853
+ }
1854
+ ],
1855
+ "anonymous": false
1856
+ },
1857
+ {
1858
+ "type": "event",
1859
+ "name": "RebalanceTokenRemoved",
1860
+ "inputs": [
1861
+ {
1862
+ "name": "token",
1863
+ "type": "address",
1864
+ "indexed": true,
1865
+ "internalType": "address"
1866
+ }
1867
+ ],
1868
+ "anonymous": false
1869
+ },
1870
+ {
1871
+ "type": "event",
1872
+ "name": "SwapExecuted",
1873
+ "inputs": [
1874
+ {
1875
+ "name": "bot",
1876
+ "type": "address",
1877
+ "indexed": true,
1878
+ "internalType": "address"
1879
+ },
1880
+ {
1881
+ "name": "fromToken",
1882
+ "type": "address",
1883
+ "indexed": false,
1884
+ "internalType": "address"
1885
+ },
1886
+ {
1887
+ "name": "toToken",
1888
+ "type": "address",
1889
+ "indexed": false,
1890
+ "internalType": "address"
1891
+ },
1892
+ {
1893
+ "name": "fromAmount",
1894
+ "type": "uint256",
1895
+ "indexed": false,
1896
+ "internalType": "uint256"
1897
+ },
1898
+ {
1899
+ "name": "toAmount",
1900
+ "type": "uint256",
1901
+ "indexed": false,
1902
+ "internalType": "uint256"
1903
+ },
1904
+ {
1905
+ "name": "ref",
1906
+ "type": "bytes32",
1907
+ "indexed": false,
1908
+ "internalType": "bytes32"
1909
+ }
1910
+ ],
1911
+ "anonymous": false
1912
+ },
1913
+ {
1914
+ "type": "event",
1915
+ "name": "SwapPaymentExecuted",
1916
+ "inputs": [
1917
+ {
1918
+ "name": "bot",
1919
+ "type": "address",
1920
+ "indexed": true,
1921
+ "internalType": "address"
1922
+ },
1923
+ {
1924
+ "name": "to",
1925
+ "type": "address",
1926
+ "indexed": true,
1927
+ "internalType": "address"
1928
+ },
1929
+ {
1930
+ "name": "fromToken",
1931
+ "type": "address",
1932
+ "indexed": false,
1933
+ "internalType": "address"
1934
+ },
1935
+ {
1936
+ "name": "toToken",
1937
+ "type": "address",
1938
+ "indexed": false,
1939
+ "internalType": "address"
1940
+ },
1941
+ {
1942
+ "name": "fromAmount",
1943
+ "type": "uint256",
1944
+ "indexed": false,
1945
+ "internalType": "uint256"
1946
+ },
1947
+ {
1948
+ "name": "toAmount",
1949
+ "type": "uint256",
1950
+ "indexed": false,
1951
+ "internalType": "uint256"
1952
+ },
1953
+ {
1954
+ "name": "ref",
1955
+ "type": "bytes32",
1956
+ "indexed": false,
1957
+ "internalType": "bytes32"
1958
+ }
1959
+ ],
1960
+ "anonymous": false
1961
+ },
1962
+ {
1963
+ "type": "event",
1964
+ "name": "Unpaused",
1965
+ "inputs": [
1966
+ {
1967
+ "name": "account",
1968
+ "type": "address",
1969
+ "indexed": false,
1970
+ "internalType": "address"
1971
+ }
1972
+ ],
1973
+ "anonymous": false
1974
+ },
1975
+ {
1976
+ "type": "event",
1977
+ "name": "Withdrawn",
1978
+ "inputs": [
1979
+ {
1980
+ "name": "token",
1981
+ "type": "address",
1982
+ "indexed": true,
1983
+ "internalType": "address"
1984
+ },
1985
+ {
1986
+ "name": "amount",
1987
+ "type": "uint256",
1988
+ "indexed": false,
1989
+ "internalType": "uint256"
1990
+ },
1991
+ {
1992
+ "name": "to",
1993
+ "type": "address",
1994
+ "indexed": true,
1995
+ "internalType": "address"
1996
+ }
1997
+ ],
1998
+ "anonymous": false
1999
+ },
2000
+ {
2001
+ "type": "error",
2002
+ "name": "AlreadyApprovedProtocol",
2003
+ "inputs": []
2004
+ },
2005
+ {
2006
+ "type": "error",
2007
+ "name": "AmountMismatch",
2008
+ "inputs": []
2009
+ },
2010
+ {
2011
+ "type": "error",
2012
+ "name": "BotAlreadyExists",
2013
+ "inputs": []
2014
+ },
2015
+ {
2016
+ "type": "error",
2017
+ "name": "BotDoesNotExist",
2018
+ "inputs": []
2019
+ },
2020
+ {
2021
+ "type": "error",
2022
+ "name": "BotNotActive",
2023
+ "inputs": []
2024
+ },
2025
+ {
2026
+ "type": "error",
2027
+ "name": "CalldataHashMismatch",
2028
+ "inputs": []
2029
+ },
2030
+ {
2031
+ "type": "error",
2032
+ "name": "DeadlineExpired",
2033
+ "inputs": []
2034
+ },
2035
+ {
2036
+ "type": "error",
2037
+ "name": "DestinationBlacklisted",
2038
+ "inputs": []
2039
+ },
2040
+ {
2041
+ "type": "error",
2042
+ "name": "DestinationNotWhitelisted",
2043
+ "inputs": []
2044
+ },
2045
+ {
2046
+ "type": "error",
2047
+ "name": "ECDSAInvalidSignature",
2048
+ "inputs": []
2049
+ },
2050
+ {
2051
+ "type": "error",
2052
+ "name": "ECDSAInvalidSignatureLength",
2053
+ "inputs": [
2054
+ {
2055
+ "name": "length",
2056
+ "type": "uint256",
2057
+ "internalType": "uint256"
2058
+ }
2059
+ ]
2060
+ },
2061
+ {
2062
+ "type": "error",
2063
+ "name": "ECDSAInvalidSignatureS",
2064
+ "inputs": [
2065
+ {
2066
+ "name": "s",
2067
+ "type": "bytes32",
2068
+ "internalType": "bytes32"
2069
+ }
2070
+ ]
2071
+ },
2072
+ {
2073
+ "type": "error",
2074
+ "name": "EnforcedPause",
2075
+ "inputs": []
2076
+ },
2077
+ {
2078
+ "type": "error",
2079
+ "name": "ExceedsOperatorCeiling",
2080
+ "inputs": []
2081
+ },
2082
+ {
2083
+ "type": "error",
2084
+ "name": "ExpectedPause",
2085
+ "inputs": []
2086
+ },
2087
+ {
2088
+ "type": "error",
2089
+ "name": "InsufficientBalance",
2090
+ "inputs": []
2091
+ },
2092
+ {
2093
+ "type": "error",
2094
+ "name": "IntentAlreadyUsed",
2095
+ "inputs": []
2096
+ },
2097
+ {
2098
+ "type": "error",
2099
+ "name": "InvalidShortString",
2100
+ "inputs": []
2101
+ },
2102
+ {
2103
+ "type": "error",
2104
+ "name": "InvalidSignature",
2105
+ "inputs": []
2106
+ },
2107
+ {
2108
+ "type": "error",
2109
+ "name": "MaxPerTxExceeded",
2110
+ "inputs": []
2111
+ },
2112
+ {
2113
+ "type": "error",
2114
+ "name": "MaxRebalanceAmountExceeded",
2115
+ "inputs": []
2116
+ },
2117
+ {
2118
+ "type": "error",
2119
+ "name": "NativeTransferFailed",
2120
+ "inputs": []
2121
+ },
2122
+ {
2123
+ "type": "error",
2124
+ "name": "NotAuthorized",
2125
+ "inputs": []
2126
+ },
2127
+ {
2128
+ "type": "error",
2129
+ "name": "NotAuthorizedRelayer",
2130
+ "inputs": []
2131
+ },
2132
+ {
2133
+ "type": "error",
2134
+ "name": "OperatorBotLimitReached",
2135
+ "inputs": []
2136
+ },
2137
+ {
2138
+ "type": "error",
2139
+ "name": "OperatorCannotBeOwner",
2140
+ "inputs": []
2141
+ },
2142
+ {
2143
+ "type": "error",
2144
+ "name": "OracleNotConfigured",
2145
+ "inputs": []
2146
+ },
2147
+ {
2148
+ "type": "error",
2149
+ "name": "OracleUnavailable",
2150
+ "inputs": []
2151
+ },
2152
+ {
2153
+ "type": "error",
2154
+ "name": "OwnableInvalidOwner",
2155
+ "inputs": [
2156
+ {
2157
+ "name": "owner",
2158
+ "type": "address",
2159
+ "internalType": "address"
2160
+ }
2161
+ ]
2162
+ },
2163
+ {
2164
+ "type": "error",
2165
+ "name": "OwnableUnauthorizedAccount",
2166
+ "inputs": [
2167
+ {
2168
+ "name": "account",
2169
+ "type": "address",
2170
+ "internalType": "address"
2171
+ }
2172
+ ]
2173
+ },
2174
+ {
2175
+ "type": "error",
2176
+ "name": "OwnerCannotBeBot",
2177
+ "inputs": []
2178
+ },
2179
+ {
2180
+ "type": "error",
2181
+ "name": "PaymentToZeroAddress",
2182
+ "inputs": []
2183
+ },
2184
+ {
2185
+ "type": "error",
2186
+ "name": "ProtocolCallFailed",
2187
+ "inputs": []
2188
+ },
2189
+ {
2190
+ "type": "error",
2191
+ "name": "ProtocolNotApproved",
2192
+ "inputs": []
2193
+ },
2194
+ {
2195
+ "type": "error",
2196
+ "name": "ProtocolNotInList",
2197
+ "inputs": []
2198
+ },
2199
+ {
2200
+ "type": "error",
2201
+ "name": "RebalanceTokenNotAllowed",
2202
+ "inputs": []
2203
+ },
2204
+ {
2205
+ "type": "error",
2206
+ "name": "ReentrancyGuardReentrantCall",
2207
+ "inputs": []
2208
+ },
2209
+ {
2210
+ "type": "error",
2211
+ "name": "RouterNotApproved",
2212
+ "inputs": []
2213
+ },
2214
+ {
2215
+ "type": "error",
2216
+ "name": "SafeERC20FailedOperation",
2217
+ "inputs": [
2218
+ {
2219
+ "name": "token",
2220
+ "type": "address",
2221
+ "internalType": "address"
2222
+ }
2223
+ ]
2224
+ },
2225
+ {
2226
+ "type": "error",
2227
+ "name": "SameTokenSwap",
2228
+ "inputs": []
2229
+ },
2230
+ {
2231
+ "type": "error",
2232
+ "name": "SelfPayment",
2233
+ "inputs": []
2234
+ },
2235
+ {
2236
+ "type": "error",
2237
+ "name": "StringTooLong",
2238
+ "inputs": [
2239
+ {
2240
+ "name": "str",
2241
+ "type": "string",
2242
+ "internalType": "string"
2243
+ }
2244
+ ]
2245
+ },
2246
+ {
2247
+ "type": "error",
2248
+ "name": "SwapFailed",
2249
+ "inputs": []
2250
+ },
2251
+ {
2252
+ "type": "error",
2253
+ "name": "SwapOutputInsufficient",
2254
+ "inputs": []
2255
+ },
2256
+ {
2257
+ "type": "error",
2258
+ "name": "TooManySpendingLimits",
2259
+ "inputs": []
2260
+ },
2261
+ {
2262
+ "type": "error",
2263
+ "name": "UnexpectedETH",
2264
+ "inputs": []
2265
+ },
2266
+ {
2267
+ "type": "error",
2268
+ "name": "ZeroAddress",
2269
+ "inputs": []
2270
+ },
2271
+ {
2272
+ "type": "error",
2273
+ "name": "ZeroAmount",
2274
+ "inputs": []
2275
+ }
2276
+ ];
2277
+
2278
+ // src/abis/AxonVaultFactory.ts
2279
+ var AxonVaultFactoryAbi = [
2280
+ {
2281
+ "type": "constructor",
2282
+ "inputs": [
2283
+ {
2284
+ "name": "_axonRegistry",
2285
+ "type": "address",
2286
+ "internalType": "address"
2287
+ },
2288
+ {
2289
+ "name": "factoryOwner",
2290
+ "type": "address",
2291
+ "internalType": "address"
2292
+ }
2293
+ ],
2294
+ "stateMutability": "nonpayable"
2295
+ },
2296
+ {
2297
+ "type": "function",
2298
+ "name": "acceptOwnership",
2299
+ "inputs": [],
2300
+ "outputs": [],
2301
+ "stateMutability": "nonpayable"
2302
+ },
2303
+ {
2304
+ "type": "function",
2305
+ "name": "allVaults",
2306
+ "inputs": [
2307
+ {
2308
+ "name": "",
2309
+ "type": "uint256",
2310
+ "internalType": "uint256"
2311
+ }
2312
+ ],
2313
+ "outputs": [
2314
+ {
2315
+ "name": "",
2316
+ "type": "address",
2317
+ "internalType": "address"
2318
+ }
2319
+ ],
2320
+ "stateMutability": "view"
2321
+ },
2322
+ {
2323
+ "type": "function",
2324
+ "name": "axonRegistry",
2325
+ "inputs": [],
2326
+ "outputs": [
2327
+ {
2328
+ "name": "",
2329
+ "type": "address",
2330
+ "internalType": "address"
2331
+ }
2332
+ ],
2333
+ "stateMutability": "view"
2334
+ },
2335
+ {
2336
+ "type": "function",
2337
+ "name": "deployVault",
2338
+ "inputs": [],
2339
+ "outputs": [
2340
+ {
2341
+ "name": "vault",
2342
+ "type": "address",
2343
+ "internalType": "address"
2344
+ }
2345
+ ],
2346
+ "stateMutability": "nonpayable"
2347
+ },
2348
+ {
2349
+ "type": "function",
2350
+ "name": "owner",
2351
+ "inputs": [],
2352
+ "outputs": [
2353
+ {
2354
+ "name": "",
2355
+ "type": "address",
2356
+ "internalType": "address"
2357
+ }
2358
+ ],
2359
+ "stateMutability": "view"
2360
+ },
2361
+ {
2362
+ "type": "function",
2363
+ "name": "ownerVaultCount",
2364
+ "inputs": [
2365
+ {
2366
+ "name": "owner",
2367
+ "type": "address",
2368
+ "internalType": "address"
2369
+ }
2370
+ ],
2371
+ "outputs": [
2372
+ {
2373
+ "name": "",
2374
+ "type": "uint256",
2375
+ "internalType": "uint256"
2376
+ }
2377
+ ],
2378
+ "stateMutability": "view"
2379
+ },
2380
+ {
2381
+ "type": "function",
2382
+ "name": "ownerVaults",
2383
+ "inputs": [
2384
+ {
2385
+ "name": "",
2386
+ "type": "address",
2387
+ "internalType": "address"
2388
+ },
2389
+ {
2390
+ "name": "",
2391
+ "type": "uint256",
2392
+ "internalType": "uint256"
2393
+ }
2394
+ ],
2395
+ "outputs": [
2396
+ {
2397
+ "name": "",
2398
+ "type": "address",
2399
+ "internalType": "address"
2400
+ }
2401
+ ],
2402
+ "stateMutability": "view"
2403
+ },
2404
+ {
2405
+ "type": "function",
2406
+ "name": "pendingOwner",
2407
+ "inputs": [],
2408
+ "outputs": [
2409
+ {
2410
+ "name": "",
2411
+ "type": "address",
2412
+ "internalType": "address"
2413
+ }
2414
+ ],
2415
+ "stateMutability": "view"
2416
+ },
2417
+ {
2418
+ "type": "function",
2419
+ "name": "renounceOwnership",
2420
+ "inputs": [],
2421
+ "outputs": [],
2422
+ "stateMutability": "nonpayable"
2423
+ },
2424
+ {
2425
+ "type": "function",
2426
+ "name": "transferOwnership",
2427
+ "inputs": [
2428
+ {
2429
+ "name": "newOwner",
2430
+ "type": "address",
2431
+ "internalType": "address"
2432
+ }
2433
+ ],
2434
+ "outputs": [],
2435
+ "stateMutability": "nonpayable"
2436
+ },
2437
+ {
2438
+ "type": "function",
2439
+ "name": "vaultCount",
2440
+ "inputs": [],
2441
+ "outputs": [
2442
+ {
2443
+ "name": "",
2444
+ "type": "uint256",
2445
+ "internalType": "uint256"
2446
+ }
2447
+ ],
2448
+ "stateMutability": "view"
2449
+ },
2450
+ {
2451
+ "type": "event",
2452
+ "name": "OwnershipTransferStarted",
2453
+ "inputs": [
2454
+ {
2455
+ "name": "previousOwner",
2456
+ "type": "address",
2457
+ "indexed": true,
2458
+ "internalType": "address"
2459
+ },
2460
+ {
2461
+ "name": "newOwner",
2462
+ "type": "address",
2463
+ "indexed": true,
2464
+ "internalType": "address"
2465
+ }
2466
+ ],
2467
+ "anonymous": false
2468
+ },
2469
+ {
2470
+ "type": "event",
2471
+ "name": "OwnershipTransferred",
2472
+ "inputs": [
2473
+ {
2474
+ "name": "previousOwner",
2475
+ "type": "address",
2476
+ "indexed": true,
2477
+ "internalType": "address"
2478
+ },
2479
+ {
2480
+ "name": "newOwner",
2481
+ "type": "address",
2482
+ "indexed": true,
2483
+ "internalType": "address"
2484
+ }
2485
+ ],
2486
+ "anonymous": false
2487
+ },
2488
+ {
2489
+ "type": "event",
2490
+ "name": "VaultDeployed",
2491
+ "inputs": [
2492
+ {
2493
+ "name": "owner",
2494
+ "type": "address",
2495
+ "indexed": true,
2496
+ "internalType": "address"
2497
+ },
2498
+ {
2499
+ "name": "vault",
2500
+ "type": "address",
2501
+ "indexed": true,
2502
+ "internalType": "address"
2503
+ },
2504
+ {
2505
+ "name": "version",
2506
+ "type": "uint16",
2507
+ "indexed": false,
2508
+ "internalType": "uint16"
2509
+ },
2510
+ {
2511
+ "name": "axonRegistry",
2512
+ "type": "address",
2513
+ "indexed": false,
2514
+ "internalType": "address"
2515
+ }
2516
+ ],
2517
+ "anonymous": false
2518
+ },
2519
+ {
2520
+ "type": "error",
2521
+ "name": "OwnableInvalidOwner",
2522
+ "inputs": [
2523
+ {
2524
+ "name": "owner",
2525
+ "type": "address",
2526
+ "internalType": "address"
2527
+ }
2528
+ ]
2529
+ },
2530
+ {
2531
+ "type": "error",
2532
+ "name": "OwnableUnauthorizedAccount",
2533
+ "inputs": [
2534
+ {
2535
+ "name": "account",
2536
+ "type": "address",
2537
+ "internalType": "address"
2538
+ }
2539
+ ]
2540
+ },
2541
+ {
2542
+ "type": "error",
2543
+ "name": "ZeroAddress",
2544
+ "inputs": []
2545
+ }
2546
+ ];
2547
+
2548
+ // src/vault.ts
2549
+ function getChain(chainId) {
2550
+ switch (chainId) {
2551
+ case 8453:
2552
+ return base;
2553
+ case 84532:
2554
+ return baseSepolia;
2555
+ case 42161:
2556
+ return arbitrum;
2557
+ case 421614:
2558
+ return arbitrumSepolia;
2559
+ default:
2560
+ throw new Error(
2561
+ `Unsupported chainId: ${chainId}. Supported: 8453 (Base), 84532 (Base Sepolia), 42161 (Arbitrum), 421614 (Arbitrum Sepolia)`
2562
+ );
2563
+ }
2564
+ }
2565
+ function createAxonPublicClient(chainId, rpcUrl) {
2566
+ return createPublicClient({
2567
+ chain: getChain(chainId),
2568
+ transport: http(rpcUrl)
2569
+ });
2570
+ }
2571
+ function createAxonWalletClient(privateKey, chainId) {
2572
+ const account = privateKeyToAccount(privateKey);
2573
+ return createWalletClient({
2574
+ account,
2575
+ chain: getChain(chainId),
2576
+ transport: http()
2577
+ // signing is local — transport is unused but required by viem
2578
+ });
2579
+ }
2580
+ async function getBotConfig(publicClient, vaultAddress, botAddress) {
2581
+ const result = await publicClient.readContract({
2582
+ address: vaultAddress,
2583
+ abi: AxonVaultAbi,
2584
+ functionName: "getBotConfig",
2585
+ args: [botAddress]
2586
+ });
2587
+ return {
2588
+ isActive: result.isActive,
2589
+ registeredAt: result.registeredAt,
2590
+ maxPerTxAmount: result.maxPerTxAmount,
2591
+ maxRebalanceAmount: result.maxRebalanceAmount,
2592
+ spendingLimits: result.spendingLimits.map((sl) => ({
2593
+ amount: sl.amount,
2594
+ maxCount: sl.maxCount,
2595
+ windowSeconds: sl.windowSeconds
2596
+ })),
2597
+ aiTriggerThreshold: result.aiTriggerThreshold,
2598
+ requireAiVerification: result.requireAiVerification
2599
+ };
2600
+ }
2601
+ async function isBotActive(publicClient, vaultAddress, botAddress) {
2602
+ return publicClient.readContract({
2603
+ address: vaultAddress,
2604
+ abi: AxonVaultAbi,
2605
+ functionName: "isBotActive",
2606
+ args: [botAddress]
2607
+ });
2608
+ }
2609
+ async function getOperatorCeilings(publicClient, vaultAddress) {
2610
+ const result = await publicClient.readContract({
2611
+ address: vaultAddress,
2612
+ abi: AxonVaultAbi,
2613
+ functionName: "operatorCeilings"
2614
+ });
2615
+ const [maxPerTxAmount, maxBotDailyLimit, maxOperatorBots, vaultDailyAggregate, minAiTriggerFloor] = result;
2616
+ return {
2617
+ maxPerTxAmount,
2618
+ maxBotDailyLimit,
2619
+ maxOperatorBots,
2620
+ vaultDailyAggregate,
2621
+ minAiTriggerFloor
2622
+ };
2623
+ }
2624
+ async function operatorMaxDrainPerDay(publicClient, vaultAddress) {
2625
+ return publicClient.readContract({
2626
+ address: vaultAddress,
2627
+ abi: AxonVaultAbi,
2628
+ functionName: "operatorMaxDrainPerDay"
2629
+ });
2630
+ }
2631
+ async function isVaultPaused(publicClient, vaultAddress) {
2632
+ return publicClient.readContract({
2633
+ address: vaultAddress,
2634
+ abi: AxonVaultAbi,
2635
+ functionName: "paused"
2636
+ });
2637
+ }
2638
+ async function getDomainSeparator(publicClient, vaultAddress) {
2639
+ return publicClient.readContract({
2640
+ address: vaultAddress,
2641
+ abi: AxonVaultAbi,
2642
+ functionName: "DOMAIN_SEPARATOR"
2643
+ });
2644
+ }
2645
+ async function getVaultVersion(publicClient, vaultAddress) {
2646
+ const version = await publicClient.readContract({
2647
+ address: vaultAddress,
2648
+ abi: AxonVaultAbi,
2649
+ functionName: "VERSION"
2650
+ });
2651
+ return Number(version);
2652
+ }
2653
+ async function getVaultOwner(publicClient, vaultAddress) {
2654
+ return publicClient.readContract({
2655
+ address: vaultAddress,
2656
+ abi: AxonVaultAbi,
2657
+ functionName: "owner"
2658
+ });
2659
+ }
2660
+ async function getVaultOperator(publicClient, vaultAddress) {
2661
+ return publicClient.readContract({
2662
+ address: vaultAddress,
2663
+ abi: AxonVaultAbi,
2664
+ functionName: "operator"
2665
+ });
2666
+ }
2667
+ async function isDestinationAllowed(publicClient, vaultAddress, botAddress, destination) {
2668
+ const isBlacklisted = await publicClient.readContract({
2669
+ address: vaultAddress,
2670
+ abi: AxonVaultAbi,
2671
+ functionName: "globalDestinationBlacklist",
2672
+ args: [destination]
2673
+ });
2674
+ if (isBlacklisted) {
2675
+ return { allowed: false, reason: "Destination is on the global blacklist" };
2676
+ }
2677
+ const globalCount = await publicClient.readContract({
2678
+ address: vaultAddress,
2679
+ abi: AxonVaultAbi,
2680
+ functionName: "globalDestinationCount"
2681
+ });
2682
+ if (globalCount > 0n) {
2683
+ const isGlobalWhitelisted = await publicClient.readContract({
2684
+ address: vaultAddress,
2685
+ abi: AxonVaultAbi,
2686
+ functionName: "globalDestinationWhitelist",
2687
+ args: [destination]
2688
+ });
2689
+ if (!isGlobalWhitelisted) {
2690
+ return { allowed: false, reason: "Destination is not on the global whitelist" };
2691
+ }
2692
+ }
2693
+ const botCount = await publicClient.readContract({
2694
+ address: vaultAddress,
2695
+ abi: AxonVaultAbi,
2696
+ functionName: "botDestinationCount",
2697
+ args: [botAddress]
2698
+ });
2699
+ if (botCount > 0n) {
2700
+ const isBotWhitelisted = await publicClient.readContract({
2701
+ address: vaultAddress,
2702
+ abi: AxonVaultAbi,
2703
+ functionName: "botDestinationWhitelist",
2704
+ args: [botAddress, destination]
2705
+ });
2706
+ if (!isBotWhitelisted) {
2707
+ return { allowed: false, reason: "Destination is not on the bot whitelist" };
2708
+ }
2709
+ }
2710
+ return { allowed: true };
2711
+ }
2712
+ async function getRebalanceTokenCount(publicClient, vaultAddress) {
2713
+ const count = await publicClient.readContract({
2714
+ address: vaultAddress,
2715
+ abi: AxonVaultAbi,
2716
+ functionName: "rebalanceTokenCount"
2717
+ });
2718
+ return Number(count);
2719
+ }
2720
+ async function isRebalanceTokenWhitelisted(publicClient, vaultAddress, token) {
2721
+ return publicClient.readContract({
2722
+ address: vaultAddress,
2723
+ abi: AxonVaultAbi,
2724
+ functionName: "rebalanceTokenWhitelist",
2725
+ args: [token]
2726
+ });
2727
+ }
2728
+ async function deployVault(walletClient, publicClient, factoryAddress) {
2729
+ if (!walletClient.account) {
2730
+ throw new Error("walletClient has no account attached");
2731
+ }
2732
+ const hash = await walletClient.writeContract({
2733
+ address: factoryAddress,
2734
+ abi: AxonVaultFactoryAbi,
2735
+ functionName: "deployVault",
2736
+ args: [],
2737
+ account: walletClient.account,
2738
+ chain: walletClient.chain ?? null
2739
+ });
2740
+ const receipt = await publicClient.waitForTransactionReceipt({ hash });
2741
+ for (const log of receipt.logs) {
2742
+ try {
2743
+ if (log.topics.length >= 3 && log.topics[2]) {
2744
+ const vaultAddress = `0x${log.topics[2].slice(26)}`;
2745
+ return vaultAddress;
2746
+ }
2747
+ } catch {
2748
+ }
2749
+ }
2750
+ throw new Error("VaultDeployed event not found in transaction receipt");
2751
+ }
2752
+
2753
+ // src/tokens.ts
2754
+ var Token = /* @__PURE__ */ ((Token2) => {
2755
+ Token2["USDC"] = "USDC";
2756
+ Token2["USDT"] = "USDT";
2757
+ Token2["DAI"] = "DAI";
2758
+ Token2["WETH"] = "WETH";
2759
+ Token2["WBTC"] = "WBTC";
2760
+ Token2["cbBTC"] = "cbBTC";
2761
+ Token2["cbETH"] = "cbETH";
2762
+ Token2["wstETH"] = "wstETH";
2763
+ Token2["rETH"] = "rETH";
2764
+ Token2["LINK"] = "LINK";
2765
+ Token2["UNI"] = "UNI";
2766
+ Token2["AAVE"] = "AAVE";
2767
+ Token2["COMP"] = "COMP";
2768
+ Token2["CRV"] = "CRV";
2769
+ Token2["SNX"] = "SNX";
2770
+ Token2["ARB"] = "ARB";
2771
+ Token2["AERO"] = "AERO";
2772
+ Token2["GMX"] = "GMX";
2773
+ return Token2;
2774
+ })(Token || {});
2775
+ var KNOWN_TOKENS = {
2776
+ // ── Core stables + wrapped ──────────────────────────────
2777
+ USDC: {
2778
+ symbol: "USDC",
2779
+ name: "USD Coin",
2780
+ decimals: 6,
2781
+ addresses: {
2782
+ 8453: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
2783
+ 84532: "0x036CbD53842c5426634e7929541eC2318f3dCF7e",
2784
+ 42161: "0xaf88d065e77c8cC2239327C5EDb3A432268e5831",
2785
+ 421614: "0x75faf114eafb1BDbe2F0316DF893fd58CE46AA4d"
2786
+ }
2787
+ },
2788
+ USDT: {
2789
+ symbol: "USDT",
2790
+ name: "Tether USD",
2791
+ decimals: 6,
2792
+ addresses: {
2793
+ 8453: "0xfde4C96c8593536E31F229EA8f37b2ADa2699bb2",
2794
+ 84532: "0x323e78f944A9a1FcF3a10efcC5319DBb0bB6e673",
2795
+ 42161: "0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9"
2796
+ }
2797
+ },
2798
+ DAI: {
2799
+ symbol: "DAI",
2800
+ name: "Dai Stablecoin",
2801
+ decimals: 18,
2802
+ addresses: {
2803
+ 8453: "0x50c5725949A6F0c72E6C4a641F24049A917DB0Cb",
2804
+ 84532: "0x819ffecd4e64f193e959944bcd57eedc7755e17a",
2805
+ 42161: "0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1"
2806
+ }
2807
+ },
2808
+ WETH: {
2809
+ symbol: "WETH",
2810
+ name: "Wrapped Ether",
2811
+ decimals: 18,
2812
+ addresses: {
2813
+ 8453: "0x4200000000000000000000000000000000000006",
2814
+ 84532: "0x4200000000000000000000000000000000000006",
2815
+ 42161: "0x82aF49447D8a07e3bd95BD0d56f35241523fBab1",
2816
+ 421614: "0x980B62Da83eFf3D4576C647993b0c1D7faf17c73"
2817
+ }
2818
+ },
2819
+ WBTC: {
2820
+ symbol: "WBTC",
2821
+ name: "Wrapped BTC",
2822
+ decimals: 8,
2823
+ addresses: {
2824
+ 8453: "0x0555E30da8f98308EdB960aa94C0Db47230d2B9c",
2825
+ 42161: "0x2f2a2543B76A4166549F7aaB2e75Bef0aefC5B0f"
2826
+ }
2827
+ },
2828
+ cbBTC: {
2829
+ symbol: "cbBTC",
2830
+ name: "Coinbase Wrapped BTC",
2831
+ decimals: 8,
2832
+ addresses: {
2833
+ 8453: "0xcbB7C0000aB88B473b1f5aFd9ef808440eed33Bf",
2834
+ 42161: "0xcbB7C0000aB88B473b1f5aFd9ef808440eed33Bf"
2835
+ }
2836
+ },
2837
+ // ── Liquid staking ──────────────────────────────────────
2838
+ cbETH: {
2839
+ symbol: "cbETH",
2840
+ name: "Coinbase Staked ETH",
2841
+ decimals: 18,
2842
+ addresses: {
2843
+ 8453: "0x2Ae3F1Ec7F1F5012CFEab0185bfc7aa3cf0DEc22",
2844
+ 42161: "0x1DEBd73E752bEaF79865Fd6446b0c970EaE7732f"
2845
+ }
2846
+ },
2847
+ wstETH: {
2848
+ symbol: "wstETH",
2849
+ name: "Lido Wrapped stETH",
2850
+ decimals: 18,
2851
+ addresses: {
2852
+ 8453: "0xc1CBa3fCea344f92D9239c08C0568f6F2F0ee452",
2853
+ 42161: "0x5979D7b546E38E414F7E9822514be443A4800529"
2854
+ }
2855
+ },
2856
+ rETH: {
2857
+ symbol: "rETH",
2858
+ name: "Rocket Pool ETH",
2859
+ decimals: 18,
2860
+ addresses: {
2861
+ 42161: "0xEC70Dcb4A1EFa46b8F2D97C310C9c4790ba5ffA8"
2862
+ }
2863
+ },
2864
+ // ── DeFi blue-chips ─────────────────────────────────────
2865
+ LINK: {
2866
+ symbol: "LINK",
2867
+ name: "Chainlink",
2868
+ decimals: 18,
2869
+ addresses: {
2870
+ 8453: "0x88Fb150BDc53A65fe94Dea0c9BA0a6dAf8C6e196",
2871
+ 84532: "0xE4aB69C077896252FAFBD49EFD26B5D171A32410",
2872
+ 42161: "0xf97f4df75117a78c1A5a0DBb814Af92458539FB4"
2873
+ }
2874
+ },
2875
+ UNI: {
2876
+ symbol: "UNI",
2877
+ name: "Uniswap",
2878
+ decimals: 18,
2879
+ addresses: {
2880
+ 8453: "0xc3De830EA07524a0761646a6a4e4be0e114a3C83",
2881
+ 42161: "0xFa7F8980b0f1E64A2062791cc3b0871572f1F7f0"
2882
+ }
2883
+ },
2884
+ AAVE: {
2885
+ symbol: "AAVE",
2886
+ name: "Aave",
2887
+ decimals: 18,
2888
+ addresses: {
2889
+ 8453: "0x63706e401c06ac8513145b7687A14804d17f814b",
2890
+ 42161: "0xba5DdD1f9d7F570dc94a51479a000E3BCE967196"
2891
+ }
2892
+ },
2893
+ COMP: {
2894
+ symbol: "COMP",
2895
+ name: "Compound",
2896
+ decimals: 18,
2897
+ addresses: {
2898
+ 8453: "0x9e1028F5F1D5eDE59748FFceE5532509976840E0",
2899
+ 42161: "0x354A6dA3fcde098F8389cad84b0182725c6C91dE"
2900
+ }
2901
+ },
2902
+ CRV: {
2903
+ symbol: "CRV",
2904
+ name: "Curve DAO",
2905
+ decimals: 18,
2906
+ addresses: {
2907
+ 8453: "0x8Ee73c484A26e0A5df2Ee2a4960B789967dd0415",
2908
+ 42161: "0x11cDb42B0EB46D95f990BeDD4695A6e3fA034978"
2909
+ }
2910
+ },
2911
+ SNX: {
2912
+ symbol: "SNX",
2913
+ name: "Synthetix",
2914
+ decimals: 18,
2915
+ addresses: {
2916
+ 8453: "0x22e6966B799c4D5B13BE962E1D117b56327FDa66"
2917
+ }
2918
+ },
2919
+ // ── Chain-native governance ─────────────────────────────
2920
+ ARB: {
2921
+ symbol: "ARB",
2922
+ name: "Arbitrum",
2923
+ decimals: 18,
2924
+ addresses: {
2925
+ 42161: "0x912CE59144191C1204E64559FE8253a0e49E6548"
2926
+ }
2927
+ },
2928
+ AERO: {
2929
+ symbol: "AERO",
2930
+ name: "Aerodrome",
2931
+ decimals: 18,
2932
+ addresses: {
2933
+ 8453: "0x940181a94A35A4569E4529A3CDfB74e38FD98631"
2934
+ }
2935
+ },
2936
+ GMX: {
2937
+ symbol: "GMX",
2938
+ name: "GMX",
2939
+ decimals: 18,
2940
+ addresses: {
2941
+ 42161: "0xfc5A1A6EB076a2C7aD06eD22C90d7E710E35ad0a"
2942
+ }
2943
+ }
2944
+ };
2945
+ var addressToSymbol = /* @__PURE__ */ new Map();
2946
+ for (const token of Object.values(KNOWN_TOKENS)) {
2947
+ for (const addr of Object.values(token.addresses)) {
2948
+ addressToSymbol.set(addr.toLowerCase(), token.symbol);
2949
+ }
2950
+ }
2951
+ function getKnownTokensForChain(chainId) {
2952
+ const result = [];
2953
+ for (const token of Object.values(KNOWN_TOKENS)) {
2954
+ const addr = token.addresses[chainId];
2955
+ if (addr) {
2956
+ result.push({ ...token, address: addr });
2957
+ }
2958
+ }
2959
+ return result;
2960
+ }
2961
+ function getTokenSymbolByAddress(address) {
2962
+ return addressToSymbol.get(address.toLowerCase()) ?? null;
2963
+ }
2964
+ function resolveToken(token, chainId) {
2965
+ if (typeof token === "string" && token.startsWith("0x")) {
2966
+ if (token === "0x0000000000000000000000000000000000000000") {
2967
+ throw new Error("Token address cannot be the zero address");
2968
+ }
2969
+ return token;
2970
+ }
2971
+ const entry = KNOWN_TOKENS[token];
2972
+ if (!entry) {
2973
+ throw new Error(`Unknown token symbol: ${token}`);
2974
+ }
2975
+ const addr = entry.addresses[chainId];
2976
+ if (!addr) {
2977
+ throw new Error(`Token ${token} is not available on chain ${chainId}`);
2978
+ }
2979
+ return addr;
2980
+ }
2981
+ function resolveTokenDecimals(token, chainId) {
2982
+ if (typeof token === "string" && token.startsWith("0x")) {
2983
+ const symbol = getTokenSymbolByAddress(token);
2984
+ if (!symbol) {
2985
+ throw new Error(
2986
+ `Unknown token address ${token} \u2014 cannot determine decimals. Use a bigint amount instead, or pass a known token symbol.`
2987
+ );
2988
+ }
2989
+ const entry2 = KNOWN_TOKENS[symbol];
2990
+ return entry2.decimals;
2991
+ }
2992
+ const entry = KNOWN_TOKENS[token];
2993
+ if (!entry) {
2994
+ throw new Error(
2995
+ `Unknown token symbol "${token}" \u2014 cannot determine decimals. Use a bigint amount instead, or use a known symbol (${Object.keys(KNOWN_TOKENS).join(", ")}).`
2996
+ );
2997
+ }
2998
+ return entry.decimals;
2999
+ }
3000
+ function parseAmount(amount, token, chainId) {
3001
+ if (typeof amount === "bigint") {
3002
+ return amount;
3003
+ }
3004
+ const decimals = resolveTokenDecimals(token);
3005
+ const str = typeof amount === "number" ? amount.toString() : amount;
3006
+ const dotIndex = str.indexOf(".");
3007
+ if (dotIndex !== -1) {
3008
+ const decimalPlaces = str.length - dotIndex - 1;
3009
+ if (decimalPlaces > decimals) {
3010
+ throw new Error(
3011
+ `Amount "${str}" has ${decimalPlaces} decimal places, but ${typeof token === "string" && token.startsWith("0x") ? "this token" : token} only supports ${decimals}. Truncate or round your amount.`
3012
+ );
3013
+ }
3014
+ }
3015
+ return parseUnits(str, decimals);
3016
+ }
3017
+
3018
+ // src/utils.ts
3019
+ function generateUuid() {
3020
+ const bytes = new Uint8Array(16);
3021
+ if (typeof crypto !== "undefined" && crypto.getRandomValues) {
3022
+ crypto.getRandomValues(bytes);
3023
+ } else {
3024
+ const { randomBytes } = __require("crypto");
3025
+ const buf = randomBytes(16);
3026
+ for (let i = 0; i < 16; i++) bytes[i] = buf[i] ?? 0;
3027
+ }
3028
+ bytes[6] = bytes[6] & 15 | 64;
3029
+ bytes[8] = bytes[8] & 63 | 128;
3030
+ const hex = Array.from(bytes).map((b) => b.toString(16).padStart(2, "0")).join("");
3031
+ return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20)}`;
3032
+ }
3033
+
3034
+ // src/x402.ts
3035
+ function parsePaymentRequired(headerValue) {
3036
+ let decoded;
3037
+ try {
3038
+ decoded = atob(headerValue);
3039
+ } catch {
3040
+ decoded = headerValue;
3041
+ }
3042
+ const parsed = JSON.parse(decoded);
3043
+ if (!parsed.accepts || !Array.isArray(parsed.accepts) || parsed.accepts.length === 0) {
3044
+ throw new Error("x402: no payment options in PAYMENT-REQUIRED header");
3045
+ }
3046
+ if (!parsed.resource) {
3047
+ throw new Error("x402: missing resource in PAYMENT-REQUIRED header");
3048
+ }
3049
+ return parsed;
3050
+ }
3051
+ function parseChainId(network) {
3052
+ const parts = network.split(":");
3053
+ if (parts.length !== 2 || parts[0] !== "eip155") {
3054
+ throw new Error(`x402: unsupported network format "${network}" (expected "eip155:<chainId>")`);
3055
+ }
3056
+ const chainId = parseInt(parts[1], 10);
3057
+ if (isNaN(chainId)) {
3058
+ throw new Error(`x402: invalid chain ID in network "${network}"`);
3059
+ }
3060
+ return chainId;
3061
+ }
3062
+ function findMatchingOption(accepts, chainId) {
3063
+ const matchingOptions = [];
3064
+ for (const option of accepts) {
3065
+ try {
3066
+ const optionChainId = parseChainId(option.network);
3067
+ if (optionChainId === chainId) {
3068
+ matchingOptions.push(option);
3069
+ }
3070
+ } catch {
3071
+ continue;
3072
+ }
3073
+ }
3074
+ if (matchingOptions.length === 0) return null;
3075
+ const usdcAddress = USDC[chainId]?.toLowerCase();
3076
+ if (usdcAddress) {
3077
+ const usdcOption = matchingOptions.find((opt) => opt.asset.toLowerCase() === usdcAddress);
3078
+ if (usdcOption) return usdcOption;
3079
+ }
3080
+ return matchingOptions[0] ?? null;
3081
+ }
3082
+ function extractX402Metadata(parsed, selectedOption) {
3083
+ const metadata = {};
3084
+ if (parsed.x402Version !== void 0) {
3085
+ metadata.x402_version = String(parsed.x402Version);
3086
+ }
3087
+ if (selectedOption.scheme) {
3088
+ metadata.x402_scheme = selectedOption.scheme;
3089
+ }
3090
+ if (parsed.resource.mimeType) {
3091
+ metadata.x402_mime_type = parsed.resource.mimeType;
3092
+ }
3093
+ if (selectedOption.payTo) {
3094
+ metadata.x402_merchant = selectedOption.payTo;
3095
+ }
3096
+ if (parsed.resource.description) {
3097
+ metadata.x402_resource_description = parsed.resource.description;
3098
+ }
3099
+ return {
3100
+ resourceUrl: parsed.resource.url,
3101
+ memo: parsed.resource.description ?? null,
3102
+ recipientLabel: selectedOption.payTo ? `${selectedOption.payTo.slice(0, 6)}...${selectedOption.payTo.slice(-4)}` : null,
3103
+ metadata
3104
+ };
3105
+ }
3106
+ function formatPaymentSignature(payload) {
3107
+ const json = JSON.stringify(payload);
3108
+ return btoa(json);
3109
+ }
3110
+ var USDC_EIP712_DOMAIN = {
3111
+ // Base mainnet
3112
+ 8453: { name: "USD Coin", version: "2" },
3113
+ // Base Sepolia
3114
+ 84532: { name: "USDC", version: "2" },
3115
+ // Arbitrum One
3116
+ 42161: { name: "USD Coin", version: "2" },
3117
+ // Arbitrum Sepolia (same as mainnet convention)
3118
+ 421614: { name: "USDC", version: "2" }
3119
+ };
3120
+ var TRANSFER_WITH_AUTHORIZATION_TYPES = {
3121
+ TransferWithAuthorization: [
3122
+ { name: "from", type: "address" },
3123
+ { name: "to", type: "address" },
3124
+ { name: "value", type: "uint256" },
3125
+ { name: "validAfter", type: "uint256" },
3126
+ { name: "validBefore", type: "uint256" },
3127
+ { name: "nonce", type: "bytes32" }
3128
+ ]
3129
+ };
3130
+ function randomNonce() {
3131
+ const bytes = new Uint8Array(32);
3132
+ crypto.getRandomValues(bytes);
3133
+ return `0x${Array.from(bytes).map((b) => b.toString(16).padStart(2, "0")).join("")}`;
3134
+ }
3135
+ async function signTransferWithAuthorization(privateKey, chainId, auth) {
3136
+ const domainConfig = USDC_EIP712_DOMAIN[chainId];
3137
+ if (!domainConfig) {
3138
+ throw new Error(`EIP-3009 not configured for chain ${chainId}`);
3139
+ }
3140
+ const usdcAddress = USDC[chainId];
3141
+ if (!usdcAddress) {
3142
+ throw new Error(`USDC address not known for chain ${chainId}`);
3143
+ }
3144
+ const account = privateKeyToAccount(privateKey);
3145
+ return account.signTypedData({
3146
+ domain: {
3147
+ name: domainConfig.name,
3148
+ version: domainConfig.version,
3149
+ chainId,
3150
+ verifyingContract: usdcAddress
3151
+ },
3152
+ types: TRANSFER_WITH_AUTHORIZATION_TYPES,
3153
+ primaryType: "TransferWithAuthorization",
3154
+ message: {
3155
+ from: auth.from,
3156
+ to: auth.to,
3157
+ value: auth.value,
3158
+ validAfter: auth.validAfter,
3159
+ validBefore: auth.validBefore,
3160
+ nonce: auth.nonce
3161
+ }
3162
+ });
3163
+ }
3164
+ var PERMIT2_ADDRESS = "0x000000000022D473030F116dDEE9F6B43aC78BA3";
3165
+ var X402_PROXY_ADDRESS = "0x4020CD856C882D5fb903D99CE35316A085Bb0001";
3166
+ var WITNESS_TYPE_STRING = "TransferDetails witness)TokenPermissions(address token,uint256 amount)TransferDetails(address to,uint256 requestedAmount)";
3167
+ var PERMIT_WITNESS_TRANSFER_FROM_TYPES = {
3168
+ PermitWitnessTransferFrom: [
3169
+ { name: "permitted", type: "TokenPermissions" },
3170
+ { name: "spender", type: "address" },
3171
+ { name: "nonce", type: "uint256" },
3172
+ { name: "deadline", type: "uint256" },
3173
+ { name: "witness", type: "TransferDetails" }
3174
+ ],
3175
+ TokenPermissions: [
3176
+ { name: "token", type: "address" },
3177
+ { name: "amount", type: "uint256" }
3178
+ ],
3179
+ TransferDetails: [
3180
+ { name: "to", type: "address" },
3181
+ { name: "requestedAmount", type: "uint256" }
3182
+ ]
3183
+ };
3184
+ function randomPermit2Nonce() {
3185
+ const bytes = new Uint8Array(32);
3186
+ crypto.getRandomValues(bytes);
3187
+ let n = 0n;
3188
+ for (const b of bytes) {
3189
+ n = n << 8n | BigInt(b);
3190
+ }
3191
+ return n;
3192
+ }
3193
+ async function signPermit2WitnessTransfer(privateKey, chainId, permit) {
3194
+ const account = privateKeyToAccount(privateKey);
3195
+ return account.signTypedData({
3196
+ domain: {
3197
+ name: "Permit2",
3198
+ chainId,
3199
+ verifyingContract: PERMIT2_ADDRESS
3200
+ },
3201
+ types: PERMIT_WITNESS_TRANSFER_FROM_TYPES,
3202
+ primaryType: "PermitWitnessTransferFrom",
3203
+ message: {
3204
+ permitted: {
3205
+ token: permit.token,
3206
+ amount: permit.amount
3207
+ },
3208
+ spender: permit.spender,
3209
+ nonce: permit.nonce,
3210
+ deadline: permit.deadline,
3211
+ witness: {
3212
+ to: permit.witnessTo,
3213
+ requestedAmount: permit.witnessRequestedAmount
3214
+ }
3215
+ }
3216
+ });
3217
+ }
3218
+
3219
+ // src/client.ts
3220
+ var AxonClient = class {
3221
+ constructor(config) {
3222
+ // ============================================================================
3223
+ // x402 — HTTP 402 Payment Required
3224
+ // ============================================================================
3225
+ /**
3226
+ * x402 utilities for handling HTTP 402 Payment Required responses.
3227
+ *
3228
+ * The x402 flow:
3229
+ * 1. Bot hits an API that returns HTTP 402 + PAYMENT-REQUIRED header
3230
+ * 2. SDK parses the header, finds a matching payment option
3231
+ * 3. SDK funds the bot's EOA from the vault (full Axon pipeline applies)
3232
+ * 4. Bot signs an EIP-3009 or Permit2 authorization
3233
+ * 5. SDK returns a PAYMENT-SIGNATURE header for the bot to retry with
3234
+ *
3235
+ * @example
3236
+ * ```ts
3237
+ * const response = await fetch('https://api.example.com/data');
3238
+ * if (response.status === 402) {
3239
+ * const result = await client.x402.handlePaymentRequired(response.headers);
3240
+ * const data = await fetch('https://api.example.com/data', {
3241
+ * headers: { 'PAYMENT-SIGNATURE': result.paymentSignature },
3242
+ * });
3243
+ * }
3244
+ * ```
3245
+ */
3246
+ this.x402 = {
3247
+ /**
3248
+ * Fund the bot's EOA from the vault for x402 settlement.
3249
+ *
3250
+ * This is a regular Axon payment (to = bot's own address) that goes through
3251
+ * the full pipeline: policy engine, AI scan, human review if needed.
3252
+ *
3253
+ * @param amount - Amount in token base units
3254
+ * @param token - Token address (defaults to USDC on this chain)
3255
+ * @param metadata - Optional metadata for the payment record
3256
+ */
3257
+ fund: async (amount, token, metadata) => {
3258
+ const tokenAddress = token ?? USDC[this.chainId];
3259
+ if (!tokenAddress) {
3260
+ throw new Error(`No default USDC address for chain ${this.chainId}`);
3261
+ }
3262
+ return this.pay({
3263
+ to: this.botAddress,
3264
+ token: tokenAddress,
3265
+ amount,
3266
+ x402Funding: true,
3267
+ ...metadata
3268
+ });
3269
+ },
3270
+ /**
3271
+ * Handle a full x402 flow: parse header, fund bot, sign authorization, return header.
3272
+ *
3273
+ * Supports both EIP-3009 (USDC) and Permit2 (any ERC-20) settlement.
3274
+ * The bot's EOA is funded from the vault first (full Axon pipeline applies).
3275
+ *
3276
+ * @param headers - Response headers from the 402 response (must contain PAYMENT-REQUIRED)
3277
+ * @param maxTimeoutMs - Maximum time to wait for pending_review resolution (default: 120s)
3278
+ * @param pollIntervalMs - Polling interval for pending_review (default: 5s)
3279
+ * @returns Payment signature header value + funding details
3280
+ */
3281
+ handlePaymentRequired: async (headers, maxTimeoutMs = 12e4, pollIntervalMs = 5e3) => {
3282
+ const headerValue = headers instanceof Headers ? headers.get("payment-required") ?? headers.get("PAYMENT-REQUIRED") : headers["payment-required"] ?? headers["PAYMENT-REQUIRED"];
3283
+ if (!headerValue) {
3284
+ throw new Error("x402: no PAYMENT-REQUIRED header found");
3285
+ }
3286
+ const parsed = parsePaymentRequired(headerValue);
3287
+ const option = findMatchingOption(parsed.accepts, this.chainId);
3288
+ if (!option) {
3289
+ throw new Error(
3290
+ `x402: no payment option matches chain ${this.chainId}. Available: ${parsed.accepts.map((a) => a.network).join(", ")}`
3291
+ );
3292
+ }
3293
+ const x402Meta = extractX402Metadata(parsed, option);
3294
+ const amount = BigInt(option.amount);
3295
+ const tokenAddress = option.asset;
3296
+ const payInput = {
3297
+ to: this.botAddress,
3298
+ token: tokenAddress,
3299
+ amount,
3300
+ x402Funding: true,
3301
+ resourceUrl: x402Meta.resourceUrl,
3302
+ metadata: x402Meta.metadata
3303
+ };
3304
+ if (x402Meta.memo) payInput.memo = x402Meta.memo;
3305
+ if (x402Meta.recipientLabel) payInput.recipientLabel = x402Meta.recipientLabel;
3306
+ let fundingResult = await this.pay(payInput);
3307
+ if (fundingResult.status === "pending_review") {
3308
+ const deadline = Date.now() + maxTimeoutMs;
3309
+ while (fundingResult.status === "pending_review" && Date.now() < deadline) {
3310
+ await new Promise((resolve) => setTimeout(resolve, pollIntervalMs));
3311
+ fundingResult = await this.poll(fundingResult.requestId);
3312
+ }
3313
+ if (fundingResult.status === "pending_review") {
3314
+ throw new Error(`x402: funding timed out after ${maxTimeoutMs}ms (still pending_review)`);
3315
+ }
3316
+ }
3317
+ if (fundingResult.status === "rejected") {
3318
+ throw new Error(`x402: funding rejected \u2014 ${fundingResult.reason ?? "unknown reason"}`);
3319
+ }
3320
+ const botPrivateKey = this.botPrivateKey;
3321
+ const payTo = option.payTo;
3322
+ const usdcAddress = USDC[this.chainId]?.toLowerCase();
3323
+ const isUsdc = tokenAddress.toLowerCase() === usdcAddress;
3324
+ let signaturePayload;
3325
+ if (isUsdc && USDC_EIP712_DOMAIN[this.chainId]) {
3326
+ const nonce = randomNonce();
3327
+ const validAfter = 0n;
3328
+ const validBefore = BigInt(Math.floor(Date.now() / 1e3) + 300);
3329
+ const sig = await signTransferWithAuthorization(botPrivateKey, this.chainId, {
3330
+ from: this.botAddress,
3331
+ to: payTo,
3332
+ value: amount,
3333
+ validAfter,
3334
+ validBefore,
3335
+ nonce
3336
+ });
3337
+ signaturePayload = {
3338
+ scheme: "exact",
3339
+ signature: sig,
3340
+ authorization: {
3341
+ from: this.botAddress,
3342
+ to: payTo,
3343
+ value: amount.toString(),
3344
+ validAfter: validAfter.toString(),
3345
+ validBefore: validBefore.toString(),
3346
+ nonce
3347
+ }
3348
+ };
3349
+ } else {
3350
+ const nonce = randomPermit2Nonce();
3351
+ const deadline = BigInt(Math.floor(Date.now() / 1e3) + 300);
3352
+ const sig = await signPermit2WitnessTransfer(botPrivateKey, this.chainId, {
3353
+ token: tokenAddress,
3354
+ amount,
3355
+ spender: X402_PROXY_ADDRESS,
3356
+ nonce,
3357
+ deadline,
3358
+ witnessTo: payTo,
3359
+ witnessRequestedAmount: amount
3360
+ });
3361
+ signaturePayload = {
3362
+ scheme: "permit2",
3363
+ signature: sig,
3364
+ permit: {
3365
+ permitted: { token: tokenAddress, amount: amount.toString() },
3366
+ spender: X402_PROXY_ADDRESS,
3367
+ nonce: nonce.toString(),
3368
+ deadline: deadline.toString()
3369
+ },
3370
+ witness: {
3371
+ to: payTo,
3372
+ requestedAmount: amount.toString()
3373
+ }
3374
+ };
3375
+ }
3376
+ const paymentSignature = formatPaymentSignature(signaturePayload);
3377
+ const handleResult = {
3378
+ paymentSignature,
3379
+ selectedOption: option,
3380
+ fundingResult: {
3381
+ requestId: fundingResult.requestId,
3382
+ status: fundingResult.status
3383
+ }
3384
+ };
3385
+ if (fundingResult.txHash) {
3386
+ handleResult.fundingResult.txHash = fundingResult.txHash;
3387
+ }
3388
+ return handleResult;
3389
+ }
3390
+ };
3391
+ this.vaultAddress = config.vaultAddress;
3392
+ this.chainId = config.chainId;
3393
+ this.relayerUrl = config.relayerUrl ?? "https://relay.axonfi.xyz";
3394
+ if (!config.botPrivateKey) {
3395
+ throw new Error("botPrivateKey is required in AxonClientConfig");
3396
+ }
3397
+ this.botPrivateKey = config.botPrivateKey;
3398
+ this.walletClient = createAxonWalletClient(config.botPrivateKey, config.chainId);
3399
+ }
3400
+ // ============================================================================
3401
+ // Bot address
3402
+ // ============================================================================
3403
+ /** Returns the bot's address derived from the configured private key. */
3404
+ get botAddress() {
3405
+ const account = this.walletClient.account;
3406
+ if (!account) throw new Error("No account on walletClient");
3407
+ return account.address;
3408
+ }
3409
+ // ============================================================================
3410
+ // pay()
3411
+ // ============================================================================
3412
+ /**
3413
+ * Create, sign, and submit a payment intent to the Axon relayer.
3414
+ *
3415
+ * Three possible outcomes (all included in PaymentResult.status):
3416
+ * - `"approved"`: fast path — txHash available immediately
3417
+ * - `"pending_review"`: AI scan or human review in progress — poll for status
3418
+ * - `"rejected"`: payment was rejected — reason field explains why
3419
+ */
3420
+ async pay(input) {
3421
+ const intent = this._buildPaymentIntent(input);
3422
+ const signature = await signPayment(this.walletClient, this.vaultAddress, this.chainId, intent);
3423
+ return this._submitPayment(intent, signature, input);
3424
+ }
3425
+ // ============================================================================
3426
+ // execute()
3427
+ // ============================================================================
3428
+ /**
3429
+ * Sign and submit a DeFi protocol execution to the Axon relayer.
3430
+ *
3431
+ * The vault approves `token` to `protocol`, calls it with `callData`,
3432
+ * then revokes the approval. Tokens stay in the vault or go to the protocol
3433
+ * as specified by the calldata.
3434
+ */
3435
+ async execute(input) {
3436
+ const intent = this._buildExecuteIntent(input);
3437
+ const signature = await signExecuteIntent(this.walletClient, this.vaultAddress, this.chainId, intent);
3438
+ return this._submitExecute(intent, signature, input);
3439
+ }
3440
+ // ============================================================================
3441
+ // swap()
3442
+ // ============================================================================
3443
+ /**
3444
+ * Sign and submit an in-vault token swap to the Axon relayer.
3445
+ *
3446
+ * Swaps tokens within the vault (no external recipient). Useful for
3447
+ * rebalancing vault holdings.
3448
+ */
3449
+ async swap(input) {
3450
+ const intent = this._buildSwapIntent(input);
3451
+ const signature = await signSwapIntent(this.walletClient, this.vaultAddress, this.chainId, intent);
3452
+ return this._submitSwap(intent, signature, input);
3453
+ }
3454
+ // ============================================================================
3455
+ // getBalance() — via relayer
3456
+ // ============================================================================
3457
+ /** Read the vault's ERC-20 balance for a given token (via relayer). */
3458
+ async getBalance(token) {
3459
+ const path = RELAYER_API.vaultBalance(this.vaultAddress, token, this.chainId);
3460
+ const data = await this._get(path);
3461
+ return BigInt(data.balance);
3462
+ }
3463
+ // ============================================================================
3464
+ // getBalances() — via relayer
3465
+ // ============================================================================
3466
+ /**
3467
+ * Read the vault's ERC-20 balances for multiple tokens in a single call (via relayer).
3468
+ * Returns a record mapping token address → balance.
3469
+ */
3470
+ async getBalances(tokens) {
3471
+ const path = RELAYER_API.vaultBalances(this.vaultAddress, this.chainId);
3472
+ const url = `${this.relayerUrl}${path}?chainId=${this.chainId}&tokens=${tokens.join(",")}`;
3473
+ const response = await fetch(url, {
3474
+ method: "GET",
3475
+ headers: { "Content-Type": "application/json" }
3476
+ });
3477
+ if (!response.ok) {
3478
+ const body = await response.text();
3479
+ throw new Error(`Relayer request failed [${response.status}]: ${body}`);
3480
+ }
3481
+ const data = await response.json();
3482
+ const result = {};
3483
+ for (const [addr, val] of Object.entries(data.balances)) {
3484
+ result[addr] = BigInt(val);
3485
+ }
3486
+ return result;
3487
+ }
3488
+ // ============================================================================
3489
+ // isActive() — via relayer
3490
+ // ============================================================================
3491
+ /** Returns whether this bot is registered and active in the vault (via relayer). */
3492
+ async isActive() {
3493
+ const path = RELAYER_API.botStatus(this.vaultAddress, this.botAddress, this.chainId);
3494
+ const data = await this._get(path);
3495
+ return data.isActive;
3496
+ }
3497
+ // ============================================================================
3498
+ // isPaused() — via relayer
3499
+ // ============================================================================
3500
+ /** Returns whether the vault is currently paused (via relayer). */
3501
+ async isPaused() {
3502
+ const path = RELAYER_API.vaultInfo(this.vaultAddress, this.chainId);
3503
+ const data = await this._get(path);
3504
+ return data.paused;
3505
+ }
3506
+ // ============================================================================
3507
+ // getVaultInfo() — via relayer
3508
+ // ============================================================================
3509
+ /** Returns high-level vault info (owner, operator, paused, version) via relayer. */
3510
+ async getVaultInfo() {
3511
+ const path = RELAYER_API.vaultInfo(this.vaultAddress, this.chainId);
3512
+ return this._get(path);
3513
+ }
3514
+ // ============================================================================
3515
+ // canPayTo() — via relayer
3516
+ // ============================================================================
3517
+ /**
3518
+ * Check whether this bot can pay to a given destination address (via relayer).
3519
+ * Checks blacklist → global whitelist → bot whitelist, matching on-chain logic.
3520
+ */
3521
+ async canPayTo(destination) {
3522
+ const path = RELAYER_API.destinationCheck(this.vaultAddress, this.botAddress, destination, this.chainId);
3523
+ return this._get(path);
3524
+ }
3525
+ // ============================================================================
3526
+ // isProtocolApproved() — via relayer
3527
+ // ============================================================================
3528
+ /** Returns whether a protocol address is approved for executeProtocol() calls (via relayer). */
3529
+ async isProtocolApproved(protocol) {
3530
+ const path = RELAYER_API.protocolCheck(this.vaultAddress, protocol, this.chainId);
3531
+ const data = await this._get(path);
3532
+ return data.approved;
3533
+ }
3534
+ // ============================================================================
3535
+ // getRebalanceTokens() — via relayer
3536
+ // ============================================================================
3537
+ /**
3538
+ * Returns the effective rebalance token whitelist for this vault.
3539
+ *
3540
+ * If the owner set tokens on-chain, those override entirely.
3541
+ * If no on-chain whitelist, returns relayer defaults (USDC, WETH, USDT).
3542
+ * Use this before calling swap() to check which output tokens are allowed.
3543
+ */
3544
+ async getRebalanceTokens() {
3545
+ const path = RELAYER_API.rebalanceTokens(this.vaultAddress, this.chainId);
3546
+ return this._get(path);
3547
+ }
3548
+ // ============================================================================
3549
+ // isRebalanceTokenAllowed() — via relayer
3550
+ // ============================================================================
3551
+ /** Check if a specific token is allowed for rebalancing (executeSwap output) on this vault. */
3552
+ async isRebalanceTokenAllowed(token) {
3553
+ const path = RELAYER_API.rebalanceTokenCheck(this.vaultAddress, token, this.chainId);
3554
+ return this._get(path);
3555
+ }
3556
+ // ============================================================================
3557
+ // TOS (Terms of Service)
3558
+ // ============================================================================
3559
+ /** Check if a wallet has accepted the current TOS version. */
3560
+ async getTosStatus(wallet) {
3561
+ return this._get(RELAYER_API.tosStatus(wallet));
3562
+ }
3563
+ /**
3564
+ * Sign and submit TOS acceptance. Uses the owner's wallet (not the bot key).
3565
+ *
3566
+ * @param signer - Object with a `signMessage` method (e.g. a viem WalletClient
3567
+ * or ethers Signer). This should be the vault owner's wallet, not the bot key.
3568
+ * @param wallet - The owner's wallet address (must match the signer).
3569
+ */
3570
+ async acceptTos(signer, wallet) {
3571
+ const { tosVersion } = await this.getTosStatus(wallet);
3572
+ const timestamp = Math.floor(Date.now() / 1e3);
3573
+ const message = `I accept the Axon Terms of Service (${tosVersion}).
3574
+ Wallet: ${wallet}
3575
+ Timestamp: ${timestamp}`;
3576
+ const signature = await signer.signMessage({ message });
3577
+ const url = `${this.relayerUrl}${RELAYER_API.TOS_ACCEPT}`;
3578
+ const response = await fetch(url, {
3579
+ method: "POST",
3580
+ headers: { "Content-Type": "application/json" },
3581
+ body: JSON.stringify({ wallet, signature, tosVersion, timestamp })
3582
+ });
3583
+ if (!response.ok) {
3584
+ const body = await response.text();
3585
+ throw new Error(`TOS acceptance failed [${response.status}]: ${body}`);
3586
+ }
3587
+ return response.json();
3588
+ }
3589
+ // ============================================================================
3590
+ // poll() / pollExecute() / pollSwap()
3591
+ // ============================================================================
3592
+ /**
3593
+ * Poll the relayer for the status of an async payment.
3594
+ *
3595
+ * Use this when pay() returns `status: "pending_review"`. Poll until
3596
+ * status is `"approved"` or `"rejected"`.
3597
+ *
3598
+ * Recommended polling interval: 5–10 seconds.
3599
+ */
3600
+ async poll(requestId) {
3601
+ return this._get(RELAYER_API.payment(requestId));
3602
+ }
3603
+ /** Poll the relayer for the status of an async protocol execution. */
3604
+ async pollExecute(requestId) {
3605
+ return this._get(RELAYER_API.execute(requestId));
3606
+ }
3607
+ /** Poll the relayer for the status of an async swap. */
3608
+ async pollSwap(requestId) {
3609
+ return this._get(RELAYER_API.swap(requestId));
3610
+ }
3611
+ // ============================================================================
3612
+ // signPayment() — low-level access
3613
+ // ============================================================================
3614
+ /**
3615
+ * Sign a PaymentIntent directly without submitting to the relayer.
3616
+ *
3617
+ * Use this if you want to build the intent yourself and pass the signature
3618
+ * to another system (e.g. a custom relayer integration).
3619
+ */
3620
+ async signPayment(intent) {
3621
+ return signPayment(this.walletClient, this.vaultAddress, this.chainId, intent);
3622
+ }
3623
+ // ============================================================================
3624
+ // Internal helpers
3625
+ // ============================================================================
3626
+ async _get(path) {
3627
+ const url = `${this.relayerUrl}${path}`;
3628
+ const response = await fetch(url, {
3629
+ method: "GET",
3630
+ headers: { "Content-Type": "application/json" }
3631
+ });
3632
+ if (!response.ok) {
3633
+ const body = await response.text();
3634
+ throw new Error(`Relayer request failed [${response.status}]: ${body}`);
3635
+ }
3636
+ return response.json();
3637
+ }
3638
+ _defaultDeadline() {
3639
+ return BigInt(Math.floor(Date.now() / 1e3) + DEFAULT_DEADLINE_SECONDS);
3640
+ }
3641
+ _resolveRef(memo, ref) {
3642
+ if (ref) return ref;
3643
+ if (memo) return encodeRef(memo);
3644
+ return "0x0000000000000000000000000000000000000000000000000000000000000000";
3645
+ }
3646
+ _buildPaymentIntent(input) {
3647
+ if (input.to === "0x0000000000000000000000000000000000000000") {
3648
+ throw new Error("Payment recipient cannot be the zero address");
3649
+ }
3650
+ return {
3651
+ bot: this.botAddress,
3652
+ to: input.to,
3653
+ token: resolveToken(input.token, this.chainId),
3654
+ amount: parseAmount(input.amount, input.token, this.chainId),
3655
+ deadline: input.deadline ?? this._defaultDeadline(),
3656
+ ref: this._resolveRef(input.memo, input.ref)
3657
+ };
3658
+ }
3659
+ _buildExecuteIntent(input) {
3660
+ return {
3661
+ bot: this.botAddress,
3662
+ protocol: input.protocol,
3663
+ calldataHash: keccak256(input.callData),
3664
+ token: resolveToken(input.token, this.chainId),
3665
+ amount: parseAmount(input.amount, input.token, this.chainId),
3666
+ deadline: input.deadline ?? this._defaultDeadline(),
3667
+ ref: this._resolveRef(input.memo, input.ref)
3668
+ };
3669
+ }
3670
+ _buildSwapIntent(input) {
3671
+ return {
3672
+ bot: this.botAddress,
3673
+ toToken: resolveToken(input.toToken, this.chainId),
3674
+ minToAmount: parseAmount(input.minToAmount, input.toToken, this.chainId),
3675
+ deadline: input.deadline ?? this._defaultDeadline(),
3676
+ ref: this._resolveRef(input.memo, input.ref)
3677
+ };
3678
+ }
3679
+ async _submitPayment(intent, signature, input) {
3680
+ const idempotencyKey = input.idempotencyKey ?? generateUuid();
3681
+ const body = {
3682
+ // Routing
3683
+ chainId: this.chainId,
3684
+ vaultAddress: this.vaultAddress,
3685
+ // Flat intent fields (matches relayer DTO)
3686
+ bot: intent.bot,
3687
+ to: intent.to,
3688
+ token: intent.token,
3689
+ amount: intent.amount.toString(),
3690
+ deadline: intent.deadline.toString(),
3691
+ ref: intent.ref,
3692
+ signature,
3693
+ // Off-chain metadata
3694
+ idempotencyKey,
3695
+ ...input.memo !== void 0 && { memo: input.memo },
3696
+ ...input.resourceUrl !== void 0 && { resourceUrl: input.resourceUrl },
3697
+ ...input.invoiceId !== void 0 && { invoiceId: input.invoiceId },
3698
+ ...input.orderId !== void 0 && { orderId: input.orderId },
3699
+ ...input.recipientLabel !== void 0 && { recipientLabel: input.recipientLabel },
3700
+ ...input.metadata !== void 0 && { metadata: input.metadata },
3701
+ ...input.x402Funding !== void 0 && { x402Funding: input.x402Funding }
3702
+ };
3703
+ return this._post(RELAYER_API.PAYMENTS, idempotencyKey, body);
3704
+ }
3705
+ async _submitExecute(intent, signature, input) {
3706
+ const idempotencyKey = input.idempotencyKey ?? generateUuid();
3707
+ const fromToken = input.fromToken !== void 0 ? resolveToken(input.fromToken, this.chainId) : void 0;
3708
+ const maxFromAmount = input.maxFromAmount !== void 0 ? parseAmount(input.maxFromAmount, input.fromToken ?? input.token, this.chainId) : void 0;
3709
+ const body = {
3710
+ chainId: this.chainId,
3711
+ vaultAddress: this.vaultAddress,
3712
+ // Flat intent fields
3713
+ bot: intent.bot,
3714
+ protocol: intent.protocol,
3715
+ calldataHash: intent.calldataHash,
3716
+ token: intent.token,
3717
+ amount: intent.amount.toString(),
3718
+ deadline: intent.deadline.toString(),
3719
+ ref: intent.ref,
3720
+ signature,
3721
+ // Protocol calldata
3722
+ callData: input.callData,
3723
+ // Optional pre-swap
3724
+ ...fromToken !== void 0 && { fromToken },
3725
+ ...maxFromAmount !== void 0 && { maxFromAmount: maxFromAmount.toString() },
3726
+ // Off-chain metadata
3727
+ idempotencyKey,
3728
+ ...input.memo !== void 0 && { memo: input.memo },
3729
+ ...input.protocolName !== void 0 && { protocolName: input.protocolName },
3730
+ ...input.metadata !== void 0 && { metadata: input.metadata }
3731
+ };
3732
+ return this._post(RELAYER_API.EXECUTE, idempotencyKey, body);
3733
+ }
3734
+ async _submitSwap(intent, signature, input) {
3735
+ const idempotencyKey = input.idempotencyKey ?? generateUuid();
3736
+ const fromToken = input.fromToken !== void 0 ? resolveToken(input.fromToken, this.chainId) : void 0;
3737
+ const maxFromAmount = input.maxFromAmount !== void 0 ? parseAmount(input.maxFromAmount, input.fromToken ?? input.toToken, this.chainId) : void 0;
3738
+ const body = {
3739
+ chainId: this.chainId,
3740
+ vaultAddress: this.vaultAddress,
3741
+ // Flat intent fields
3742
+ bot: intent.bot,
3743
+ toToken: intent.toToken,
3744
+ minToAmount: intent.minToAmount.toString(),
3745
+ deadline: intent.deadline.toString(),
3746
+ ref: intent.ref,
3747
+ signature,
3748
+ // Optional source token
3749
+ ...fromToken !== void 0 && { fromToken },
3750
+ ...maxFromAmount !== void 0 && { maxFromAmount: maxFromAmount.toString() },
3751
+ // Off-chain metadata
3752
+ idempotencyKey,
3753
+ ...input.memo !== void 0 && { memo: input.memo }
3754
+ };
3755
+ return this._post(RELAYER_API.SWAP, idempotencyKey, body);
3756
+ }
3757
+ async _post(path, idempotencyKey, body) {
3758
+ const url = `${this.relayerUrl}${path}`;
3759
+ const response = await fetch(url, {
3760
+ method: "POST",
3761
+ headers: {
3762
+ "Content-Type": "application/json",
3763
+ "Idempotency-Key": idempotencyKey
3764
+ },
3765
+ body: JSON.stringify(body)
3766
+ });
3767
+ if (!response.ok) {
3768
+ const responseBody = await response.text();
3769
+ throw new Error(`Relayer request failed [${response.status}]: ${responseBody}`);
3770
+ }
3771
+ return response.json();
3772
+ }
3773
+ };
3774
+ var SCRYPT_N = 262144;
3775
+ var SCRYPT_R = 8;
3776
+ var SCRYPT_P = 1;
3777
+ var SCRYPT_DKLEN = 32;
3778
+ function getRandomBytes(length) {
3779
+ const bytes = new Uint8Array(length);
3780
+ if (typeof crypto !== "undefined" && crypto.getRandomValues) {
3781
+ crypto.getRandomValues(bytes);
3782
+ } else {
3783
+ const { randomBytes } = __require("crypto");
3784
+ const buf = randomBytes(length);
3785
+ for (let i = 0; i < length; i++) bytes[i] = buf[i] ?? 0;
3786
+ }
3787
+ return bytes;
3788
+ }
3789
+ function hexToBytes(hex) {
3790
+ const clean = hex.startsWith("0x") ? hex.slice(2) : hex;
3791
+ const bytes = new Uint8Array(clean.length / 2);
3792
+ for (let i = 0; i < bytes.length; i++) {
3793
+ bytes[i] = parseInt(clean.slice(i * 2, i * 2 + 2), 16);
3794
+ }
3795
+ return bytes;
3796
+ }
3797
+ function bytesToHex(bytes) {
3798
+ return Array.from(bytes).map((b) => b.toString(16).padStart(2, "0")).join("");
3799
+ }
3800
+ async function encryptKeystore(privateKey, passphrase) {
3801
+ if (!passphrase) throw new Error("Passphrase must not be empty");
3802
+ const keyBytes = hexToBytes(privateKey);
3803
+ const account = privateKeyToAccount(privateKey);
3804
+ const address = account.address.slice(2).toLowerCase();
3805
+ const salt = getRandomBytes(32);
3806
+ const iv = getRandomBytes(16);
3807
+ const derivedKey = await scryptAsync(new TextEncoder().encode(passphrase), salt, {
3808
+ N: SCRYPT_N,
3809
+ r: SCRYPT_R,
3810
+ p: SCRYPT_P,
3811
+ dkLen: SCRYPT_DKLEN
3812
+ });
3813
+ const encryptionKey = derivedKey.slice(0, 16);
3814
+ const cipher = ctr(encryptionKey, iv);
3815
+ const ciphertext = cipher.encrypt(keyBytes);
3816
+ const macInput = new Uint8Array(16 + ciphertext.length);
3817
+ macInput.set(derivedKey.slice(16, 32), 0);
3818
+ macInput.set(ciphertext, 16);
3819
+ const mac = keccak_256(macInput);
3820
+ return {
3821
+ version: 3,
3822
+ id: generateUuid(),
3823
+ address,
3824
+ crypto: {
3825
+ ciphertext: bytesToHex(ciphertext),
3826
+ cipherparams: { iv: bytesToHex(iv) },
3827
+ cipher: "aes-128-ctr",
3828
+ kdf: "scrypt",
3829
+ kdfparams: {
3830
+ dklen: SCRYPT_DKLEN,
3831
+ salt: bytesToHex(salt),
3832
+ n: SCRYPT_N,
3833
+ r: SCRYPT_R,
3834
+ p: SCRYPT_P
3835
+ },
3836
+ mac: bytesToHex(mac)
3837
+ }
3838
+ };
3839
+ }
3840
+ async function decryptKeystore(keystore, passphrase) {
3841
+ let ks;
3842
+ if (typeof keystore === "string") {
3843
+ try {
3844
+ ks = JSON.parse(keystore);
3845
+ } catch {
3846
+ throw new Error("Invalid keystore: could not parse JSON");
3847
+ }
3848
+ } else {
3849
+ ks = keystore;
3850
+ }
3851
+ if (ks.version !== 3) throw new Error(`Unsupported keystore version: ${ks.version}`);
3852
+ if (!ks.crypto) throw new Error("Invalid keystore: missing crypto field");
3853
+ if (ks.crypto.kdf !== "scrypt") throw new Error(`Unsupported KDF: ${ks.crypto.kdf}`);
3854
+ if (ks.crypto.cipher !== "aes-128-ctr") throw new Error(`Unsupported cipher: ${ks.crypto.cipher}`);
3855
+ const { kdfparams, ciphertext: ctHex, cipherparams, mac: expectedMacHex } = ks.crypto;
3856
+ const salt = hexToBytes(kdfparams.salt);
3857
+ const derivedKey = await scryptAsync(new TextEncoder().encode(passphrase), salt, {
3858
+ N: kdfparams.n,
3859
+ r: kdfparams.r,
3860
+ p: kdfparams.p,
3861
+ dkLen: kdfparams.dklen
3862
+ });
3863
+ const ciphertextBytes = hexToBytes(ctHex);
3864
+ const macInput = new Uint8Array(16 + ciphertextBytes.length);
3865
+ macInput.set(derivedKey.slice(16, 32), 0);
3866
+ macInput.set(ciphertextBytes, 16);
3867
+ const computedMac = bytesToHex(keccak_256(macInput));
3868
+ if (computedMac !== expectedMacHex) {
3869
+ throw new Error("Wrong passphrase: MAC mismatch");
3870
+ }
3871
+ const iv = hexToBytes(cipherparams.iv);
3872
+ const encryptionKey = derivedKey.slice(0, 16);
3873
+ const cipher = ctr(encryptionKey, iv);
3874
+ const plaintext = cipher.decrypt(ciphertextBytes);
3875
+ return `0x${bytesToHex(plaintext)}`;
3876
+ }
3877
+
3878
+ // src/abis/AxonRegistry.ts
3879
+ var AxonRegistryAbi = [
3880
+ {
3881
+ "type": "constructor",
3882
+ "inputs": [
3883
+ {
3884
+ "name": "initialOwner",
3885
+ "type": "address",
3886
+ "internalType": "address"
3887
+ }
3888
+ ],
3889
+ "stateMutability": "nonpayable"
3890
+ },
3891
+ {
3892
+ "type": "function",
3893
+ "name": "acceptOwnership",
3894
+ "inputs": [],
3895
+ "outputs": [],
3896
+ "stateMutability": "nonpayable"
3897
+ },
3898
+ {
3899
+ "type": "function",
3900
+ "name": "addRelayer",
3901
+ "inputs": [
3902
+ {
3903
+ "name": "relayer",
3904
+ "type": "address",
3905
+ "internalType": "address"
3906
+ }
3907
+ ],
3908
+ "outputs": [],
3909
+ "stateMutability": "nonpayable"
3910
+ },
3911
+ {
3912
+ "type": "function",
3913
+ "name": "addSwapRouter",
3914
+ "inputs": [
3915
+ {
3916
+ "name": "router",
3917
+ "type": "address",
3918
+ "internalType": "address"
3919
+ }
3920
+ ],
3921
+ "outputs": [],
3922
+ "stateMutability": "nonpayable"
3923
+ },
3924
+ {
3925
+ "type": "function",
3926
+ "name": "isApprovedSwapRouter",
3927
+ "inputs": [
3928
+ {
3929
+ "name": "router",
3930
+ "type": "address",
3931
+ "internalType": "address"
3932
+ }
3933
+ ],
3934
+ "outputs": [
3935
+ {
3936
+ "name": "",
3937
+ "type": "bool",
3938
+ "internalType": "bool"
3939
+ }
3940
+ ],
3941
+ "stateMutability": "view"
3942
+ },
3943
+ {
3944
+ "type": "function",
3945
+ "name": "isAuthorized",
3946
+ "inputs": [
3947
+ {
3948
+ "name": "relayer",
3949
+ "type": "address",
3950
+ "internalType": "address"
3951
+ }
3952
+ ],
3953
+ "outputs": [
3954
+ {
3955
+ "name": "",
3956
+ "type": "bool",
3957
+ "internalType": "bool"
3958
+ }
3959
+ ],
3960
+ "stateMutability": "view"
3961
+ },
3962
+ {
3963
+ "type": "function",
3964
+ "name": "owner",
3965
+ "inputs": [],
3966
+ "outputs": [
3967
+ {
3968
+ "name": "",
3969
+ "type": "address",
3970
+ "internalType": "address"
3971
+ }
3972
+ ],
3973
+ "stateMutability": "view"
3974
+ },
3975
+ {
3976
+ "type": "function",
3977
+ "name": "pendingOwner",
3978
+ "inputs": [],
3979
+ "outputs": [
3980
+ {
3981
+ "name": "",
3982
+ "type": "address",
3983
+ "internalType": "address"
3984
+ }
3985
+ ],
3986
+ "stateMutability": "view"
3987
+ },
3988
+ {
3989
+ "type": "function",
3990
+ "name": "removeRelayer",
3991
+ "inputs": [
3992
+ {
3993
+ "name": "relayer",
3994
+ "type": "address",
3995
+ "internalType": "address"
3996
+ }
3997
+ ],
3998
+ "outputs": [],
3999
+ "stateMutability": "nonpayable"
4000
+ },
4001
+ {
4002
+ "type": "function",
4003
+ "name": "removeSwapRouter",
4004
+ "inputs": [
4005
+ {
4006
+ "name": "router",
4007
+ "type": "address",
4008
+ "internalType": "address"
4009
+ }
4010
+ ],
4011
+ "outputs": [],
4012
+ "stateMutability": "nonpayable"
4013
+ },
4014
+ {
4015
+ "type": "function",
4016
+ "name": "renounceOwnership",
4017
+ "inputs": [],
4018
+ "outputs": [],
4019
+ "stateMutability": "nonpayable"
4020
+ },
4021
+ {
4022
+ "type": "function",
4023
+ "name": "setOracleConfig",
4024
+ "inputs": [
4025
+ {
4026
+ "name": "uniV3Factory",
4027
+ "type": "address",
4028
+ "internalType": "address"
4029
+ },
4030
+ {
4031
+ "name": "usdc",
4032
+ "type": "address",
4033
+ "internalType": "address"
4034
+ },
4035
+ {
4036
+ "name": "weth",
4037
+ "type": "address",
4038
+ "internalType": "address"
4039
+ }
4040
+ ],
4041
+ "outputs": [],
4042
+ "stateMutability": "nonpayable"
4043
+ },
4044
+ {
4045
+ "type": "function",
4046
+ "name": "transferOwnership",
4047
+ "inputs": [
4048
+ {
4049
+ "name": "newOwner",
4050
+ "type": "address",
4051
+ "internalType": "address"
4052
+ }
4053
+ ],
4054
+ "outputs": [],
4055
+ "stateMutability": "nonpayable"
4056
+ },
4057
+ {
4058
+ "type": "function",
4059
+ "name": "uniswapV3Factory",
4060
+ "inputs": [],
4061
+ "outputs": [
4062
+ {
4063
+ "name": "",
4064
+ "type": "address",
4065
+ "internalType": "address"
4066
+ }
4067
+ ],
4068
+ "stateMutability": "view"
4069
+ },
4070
+ {
4071
+ "type": "function",
4072
+ "name": "usdcAddress",
4073
+ "inputs": [],
4074
+ "outputs": [
4075
+ {
4076
+ "name": "",
4077
+ "type": "address",
4078
+ "internalType": "address"
4079
+ }
4080
+ ],
4081
+ "stateMutability": "view"
4082
+ },
4083
+ {
4084
+ "type": "function",
4085
+ "name": "wethAddress",
4086
+ "inputs": [],
4087
+ "outputs": [
4088
+ {
4089
+ "name": "",
4090
+ "type": "address",
4091
+ "internalType": "address"
4092
+ }
4093
+ ],
4094
+ "stateMutability": "view"
4095
+ },
4096
+ {
4097
+ "type": "event",
4098
+ "name": "OracleConfigUpdated",
4099
+ "inputs": [
4100
+ {
4101
+ "name": "uniswapV3Factory",
4102
+ "type": "address",
4103
+ "indexed": false,
4104
+ "internalType": "address"
4105
+ },
4106
+ {
4107
+ "name": "usdc",
4108
+ "type": "address",
4109
+ "indexed": false,
4110
+ "internalType": "address"
4111
+ },
4112
+ {
4113
+ "name": "weth",
4114
+ "type": "address",
4115
+ "indexed": false,
4116
+ "internalType": "address"
4117
+ }
4118
+ ],
4119
+ "anonymous": false
4120
+ },
4121
+ {
4122
+ "type": "event",
4123
+ "name": "OwnershipTransferStarted",
4124
+ "inputs": [
4125
+ {
4126
+ "name": "previousOwner",
4127
+ "type": "address",
4128
+ "indexed": true,
4129
+ "internalType": "address"
4130
+ },
4131
+ {
4132
+ "name": "newOwner",
4133
+ "type": "address",
4134
+ "indexed": true,
4135
+ "internalType": "address"
4136
+ }
4137
+ ],
4138
+ "anonymous": false
4139
+ },
4140
+ {
4141
+ "type": "event",
4142
+ "name": "OwnershipTransferred",
4143
+ "inputs": [
4144
+ {
4145
+ "name": "previousOwner",
4146
+ "type": "address",
4147
+ "indexed": true,
4148
+ "internalType": "address"
4149
+ },
4150
+ {
4151
+ "name": "newOwner",
4152
+ "type": "address",
4153
+ "indexed": true,
4154
+ "internalType": "address"
4155
+ }
4156
+ ],
4157
+ "anonymous": false
4158
+ },
4159
+ {
4160
+ "type": "event",
4161
+ "name": "RelayerAdded",
4162
+ "inputs": [
4163
+ {
4164
+ "name": "relayer",
4165
+ "type": "address",
4166
+ "indexed": true,
4167
+ "internalType": "address"
4168
+ }
4169
+ ],
4170
+ "anonymous": false
4171
+ },
4172
+ {
4173
+ "type": "event",
4174
+ "name": "RelayerRemoved",
4175
+ "inputs": [
4176
+ {
4177
+ "name": "relayer",
4178
+ "type": "address",
4179
+ "indexed": true,
4180
+ "internalType": "address"
4181
+ }
4182
+ ],
4183
+ "anonymous": false
4184
+ },
4185
+ {
4186
+ "type": "event",
4187
+ "name": "SwapRouterAdded",
4188
+ "inputs": [
4189
+ {
4190
+ "name": "router",
4191
+ "type": "address",
4192
+ "indexed": true,
4193
+ "internalType": "address"
4194
+ }
4195
+ ],
4196
+ "anonymous": false
4197
+ },
4198
+ {
4199
+ "type": "event",
4200
+ "name": "SwapRouterRemoved",
4201
+ "inputs": [
4202
+ {
4203
+ "name": "router",
4204
+ "type": "address",
4205
+ "indexed": true,
4206
+ "internalType": "address"
4207
+ }
4208
+ ],
4209
+ "anonymous": false
4210
+ },
4211
+ {
4212
+ "type": "error",
4213
+ "name": "AlreadyApproved",
4214
+ "inputs": []
4215
+ },
4216
+ {
4217
+ "type": "error",
4218
+ "name": "AlreadyAuthorized",
4219
+ "inputs": []
4220
+ },
4221
+ {
4222
+ "type": "error",
4223
+ "name": "NotApproved",
4224
+ "inputs": []
4225
+ },
4226
+ {
4227
+ "type": "error",
4228
+ "name": "NotAuthorized",
4229
+ "inputs": []
4230
+ },
4231
+ {
4232
+ "type": "error",
4233
+ "name": "OwnableInvalidOwner",
4234
+ "inputs": [
4235
+ {
4236
+ "name": "owner",
4237
+ "type": "address",
4238
+ "internalType": "address"
4239
+ }
4240
+ ]
4241
+ },
4242
+ {
4243
+ "type": "error",
4244
+ "name": "OwnableUnauthorizedAccount",
4245
+ "inputs": [
4246
+ {
4247
+ "name": "account",
4248
+ "type": "address",
4249
+ "internalType": "address"
4250
+ }
4251
+ ]
4252
+ },
4253
+ {
4254
+ "type": "error",
4255
+ "name": "ZeroAddress",
4256
+ "inputs": []
4257
+ }
4258
+ ];
4259
+
4260
+ export { AxonClient, AxonRegistryAbi, AxonVaultAbi, AxonVaultFactoryAbi, CHAIN_NAMES, Chain, DEFAULT_DEADLINE_SECONDS, EIP712_DOMAIN_NAME, EIP712_DOMAIN_VERSION, EXECUTE_INTENT_TYPEHASH, EXPLORER_ADDR, EXPLORER_TX, KNOWN_TOKENS, NATIVE_ETH, PAYMENT_INTENT_TYPEHASH, PERMIT2_ADDRESS, PaymentErrorCode, RELAYER_API, SUPPORTED_CHAIN_IDS, SWAP_INTENT_TYPEHASH, Token, USDC, USDC_EIP712_DOMAIN, WINDOW, WITNESS_TYPE_STRING, X402_PROXY_ADDRESS, createAxonPublicClient, createAxonWalletClient, decryptKeystore, deployVault, encodeRef, encryptKeystore, extractX402Metadata, findMatchingOption, formatPaymentSignature, getBotConfig, getChain, getDomainSeparator, getKnownTokensForChain, getOperatorCeilings, getRebalanceTokenCount, getTokenSymbolByAddress, getVaultOperator, getVaultOwner, getVaultVersion, isBotActive, isDestinationAllowed, isRebalanceTokenWhitelisted, isVaultPaused, operatorMaxDrainPerDay, parseAmount, parseChainId, parsePaymentRequired, randomNonce, randomPermit2Nonce, resolveToken, resolveTokenDecimals, signExecuteIntent, signPayment, signPermit2WitnessTransfer, signSwapIntent, signTransferWithAuthorization };
4261
+ //# sourceMappingURL=index.js.map
28
4262
  //# sourceMappingURL=index.js.map