@axonfi/sdk 0.3.6 → 0.4.0

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 +40 -0
  2. package/dist/abis/AxonRegistry.d.ts +294 -0
  3. package/dist/abis/AxonRegistry.d.ts.map +1 -0
  4. package/dist/abis/AxonRegistry.js +381 -0
  5. package/dist/abis/AxonRegistry.js.map +1 -0
  6. package/dist/abis/AxonVault.d.ts +1577 -0
  7. package/dist/abis/AxonVault.d.ts.map +1 -0
  8. package/dist/abis/AxonVault.js +2026 -0
  9. package/dist/abis/AxonVault.js.map +1 -0
  10. package/dist/abis/AxonVaultFactory.d.ts +207 -0
  11. package/dist/abis/AxonVaultFactory.d.ts.map +1 -0
  12. package/dist/abis/AxonVaultFactory.js +269 -0
  13. package/dist/abis/AxonVaultFactory.js.map +1 -0
  14. package/dist/amounts.d.ts +37 -0
  15. package/dist/amounts.d.ts.map +1 -0
  16. package/dist/amounts.js +72 -0
  17. package/dist/amounts.js.map +1 -0
  18. package/dist/amounts.spec.d.ts +2 -0
  19. package/dist/amounts.spec.d.ts.map +1 -0
  20. package/dist/amounts.spec.js +92 -0
  21. package/dist/amounts.spec.js.map +1 -0
  22. package/dist/client.d.ts +196 -0
  23. package/dist/client.d.ts.map +1 -0
  24. package/dist/client.js +621 -0
  25. package/dist/client.js.map +1 -0
  26. package/dist/client.spec.d.ts +2 -0
  27. package/dist/client.spec.d.ts.map +1 -0
  28. package/dist/client.spec.js +437 -0
  29. package/dist/client.spec.js.map +1 -0
  30. package/dist/constants.d.ts +110 -0
  31. package/dist/constants.d.ts.map +1 -0
  32. package/dist/constants.js +172 -0
  33. package/dist/constants.js.map +1 -0
  34. package/dist/constants.spec.d.ts +2 -0
  35. package/dist/constants.spec.d.ts.map +1 -0
  36. package/dist/constants.spec.js +95 -0
  37. package/dist/constants.spec.js.map +1 -0
  38. package/dist/eip3009.d.ts +45 -0
  39. package/dist/eip3009.d.ts.map +1 -0
  40. package/dist/eip3009.js +85 -0
  41. package/dist/eip3009.js.map +1 -0
  42. package/dist/index.d.ts +21 -3020
  43. package/dist/index.d.ts.map +1 -0
  44. package/dist/index.js +27 -3903
  45. package/dist/index.js.map +1 -1
  46. package/dist/keystore.d.ts +60 -0
  47. package/dist/keystore.d.ts.map +1 -0
  48. package/dist/keystore.js +182 -0
  49. package/dist/keystore.js.map +1 -0
  50. package/dist/keystore.spec.d.ts +2 -0
  51. package/dist/keystore.spec.d.ts.map +1 -0
  52. package/dist/keystore.spec.js +71 -0
  53. package/dist/keystore.spec.js.map +1 -0
  54. package/dist/permit2.d.ts +45 -0
  55. package/dist/permit2.d.ts.map +1 -0
  56. package/dist/permit2.js +81 -0
  57. package/dist/permit2.js.map +1 -0
  58. package/dist/signer.d.ts +35 -0
  59. package/dist/signer.d.ts.map +1 -0
  60. package/dist/signer.js +132 -0
  61. package/dist/signer.js.map +1 -0
  62. package/dist/signer.spec.d.ts +2 -0
  63. package/dist/signer.spec.d.ts.map +1 -0
  64. package/dist/signer.spec.js +94 -0
  65. package/dist/signer.spec.js.map +1 -0
  66. package/dist/tokens.d.ts +215 -0
  67. package/dist/tokens.d.ts.map +1 -0
  68. package/dist/tokens.js +247 -0
  69. package/dist/tokens.js.map +1 -0
  70. package/dist/types.d.ts +302 -0
  71. package/dist/types.d.ts.map +1 -0
  72. package/dist/types.js +2 -0
  73. package/dist/types.js.map +1 -0
  74. package/dist/utils.d.ts +8 -0
  75. package/dist/utils.d.ts.map +1 -0
  76. package/dist/utils.js +29 -0
  77. package/dist/utils.js.map +1 -0
  78. package/dist/vault.d.ts +60 -0
  79. package/dist/vault.d.ts.map +1 -0
  80. package/dist/vault.js +267 -0
  81. package/dist/vault.js.map +1 -0
  82. package/dist/vault.spec.d.ts +2 -0
  83. package/dist/vault.spec.d.ts.map +1 -0
  84. package/dist/vault.spec.js +162 -0
  85. package/dist/vault.spec.js.map +1 -0
  86. package/dist/x402.d.ts +88 -0
  87. package/dist/x402.d.ts.map +1 -0
  88. package/dist/x402.js +124 -0
  89. package/dist/x402.js.map +1 -0
  90. package/dist/x402.spec.d.ts +2 -0
  91. package/dist/x402.spec.d.ts.map +1 -0
  92. package/dist/x402.spec.js +411 -0
  93. package/dist/x402.spec.js.map +1 -0
  94. package/package.json +1 -1
  95. package/dist/index.cjs +0 -3954
  96. package/dist/index.cjs.map +0 -1
  97. package/dist/index.d.cts +0 -3020
package/dist/index.js CHANGED
@@ -1,3904 +1,28 @@
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
- var AxonClient = class {
3034
- constructor(config) {
3035
- this.vaultAddress = config.vaultAddress;
3036
- this.chainId = config.chainId;
3037
- this.relayerUrl = "https://relay.axonfi.xyz";
3038
- if (!config.botPrivateKey) {
3039
- throw new Error("botPrivateKey is required in AxonClientConfig");
3040
- }
3041
- this.walletClient = createAxonWalletClient(config.botPrivateKey, config.chainId);
3042
- }
3043
- // ============================================================================
3044
- // Bot address
3045
- // ============================================================================
3046
- /** Returns the bot's address derived from the configured private key. */
3047
- get botAddress() {
3048
- const account = this.walletClient.account;
3049
- if (!account) throw new Error("No account on walletClient");
3050
- return account.address;
3051
- }
3052
- // ============================================================================
3053
- // pay()
3054
- // ============================================================================
3055
- /**
3056
- * Create, sign, and submit a payment intent to the Axon relayer.
3057
- *
3058
- * Three possible outcomes (all included in PaymentResult.status):
3059
- * - `"approved"`: fast path — txHash available immediately
3060
- * - `"pending_review"`: AI scan or human review in progress — poll for status
3061
- * - `"rejected"`: payment was rejected — reason field explains why
3062
- */
3063
- async pay(input) {
3064
- const intent = this._buildPaymentIntent(input);
3065
- const signature = await signPayment(this.walletClient, this.vaultAddress, this.chainId, intent);
3066
- return this._submitPayment(intent, signature, input);
3067
- }
3068
- // ============================================================================
3069
- // execute()
3070
- // ============================================================================
3071
- /**
3072
- * Sign and submit a DeFi protocol execution to the Axon relayer.
3073
- *
3074
- * The vault approves `token` to `protocol`, calls it with `callData`,
3075
- * then revokes the approval. Tokens stay in the vault or go to the protocol
3076
- * as specified by the calldata.
3077
- */
3078
- async execute(input) {
3079
- const intent = this._buildExecuteIntent(input);
3080
- const signature = await signExecuteIntent(this.walletClient, this.vaultAddress, this.chainId, intent);
3081
- return this._submitExecute(intent, signature, input);
3082
- }
3083
- // ============================================================================
3084
- // swap()
3085
- // ============================================================================
3086
- /**
3087
- * Sign and submit an in-vault token swap to the Axon relayer.
3088
- *
3089
- * Swaps tokens within the vault (no external recipient). Useful for
3090
- * rebalancing vault holdings.
3091
- */
3092
- async swap(input) {
3093
- const intent = this._buildSwapIntent(input);
3094
- const signature = await signSwapIntent(this.walletClient, this.vaultAddress, this.chainId, intent);
3095
- return this._submitSwap(intent, signature, input);
3096
- }
3097
- // ============================================================================
3098
- // getBalance() — via relayer
3099
- // ============================================================================
3100
- /** Read the vault's ERC-20 balance for a given token (via relayer). */
3101
- async getBalance(token) {
3102
- const path = RELAYER_API.vaultBalance(this.vaultAddress, token, this.chainId);
3103
- const data = await this._get(path);
3104
- return BigInt(data.balance);
3105
- }
3106
- // ============================================================================
3107
- // getBalances() — via relayer
3108
- // ============================================================================
3109
- /**
3110
- * Read the vault's ERC-20 balances for multiple tokens in a single call (via relayer).
3111
- * Returns a record mapping token address → balance.
3112
- */
3113
- async getBalances(tokens) {
3114
- const path = RELAYER_API.vaultBalances(this.vaultAddress, this.chainId);
3115
- const url = `${this.relayerUrl}${path}?chainId=${this.chainId}&tokens=${tokens.join(",")}`;
3116
- const response = await fetch(url, {
3117
- method: "GET",
3118
- headers: { "Content-Type": "application/json" }
3119
- });
3120
- if (!response.ok) {
3121
- const body = await response.text();
3122
- throw new Error(`Relayer request failed [${response.status}]: ${body}`);
3123
- }
3124
- const data = await response.json();
3125
- const result = {};
3126
- for (const [addr, val] of Object.entries(data.balances)) {
3127
- result[addr] = BigInt(val);
3128
- }
3129
- return result;
3130
- }
3131
- // ============================================================================
3132
- // isActive() — via relayer
3133
- // ============================================================================
3134
- /** Returns whether this bot is registered and active in the vault (via relayer). */
3135
- async isActive() {
3136
- const path = RELAYER_API.botStatus(this.vaultAddress, this.botAddress, this.chainId);
3137
- const data = await this._get(path);
3138
- return data.isActive;
3139
- }
3140
- // ============================================================================
3141
- // isPaused() — via relayer
3142
- // ============================================================================
3143
- /** Returns whether the vault is currently paused (via relayer). */
3144
- async isPaused() {
3145
- const path = RELAYER_API.vaultInfo(this.vaultAddress, this.chainId);
3146
- const data = await this._get(path);
3147
- return data.paused;
3148
- }
3149
- // ============================================================================
3150
- // getVaultInfo() — via relayer
3151
- // ============================================================================
3152
- /** Returns high-level vault info (owner, operator, paused, version) via relayer. */
3153
- async getVaultInfo() {
3154
- const path = RELAYER_API.vaultInfo(this.vaultAddress, this.chainId);
3155
- return this._get(path);
3156
- }
3157
- // ============================================================================
3158
- // canPayTo() — via relayer
3159
- // ============================================================================
3160
- /**
3161
- * Check whether this bot can pay to a given destination address (via relayer).
3162
- * Checks blacklist → global whitelist → bot whitelist, matching on-chain logic.
3163
- */
3164
- async canPayTo(destination) {
3165
- const path = RELAYER_API.destinationCheck(this.vaultAddress, this.botAddress, destination, this.chainId);
3166
- return this._get(path);
3167
- }
3168
- // ============================================================================
3169
- // isProtocolApproved() — via relayer
3170
- // ============================================================================
3171
- /** Returns whether a protocol address is approved for executeProtocol() calls (via relayer). */
3172
- async isProtocolApproved(protocol) {
3173
- const path = RELAYER_API.protocolCheck(this.vaultAddress, protocol, this.chainId);
3174
- const data = await this._get(path);
3175
- return data.approved;
3176
- }
3177
- // ============================================================================
3178
- // getRebalanceTokens() — via relayer
3179
- // ============================================================================
3180
- /**
3181
- * Returns the effective rebalance token whitelist for this vault.
3182
- *
3183
- * If the owner set tokens on-chain, those override entirely.
3184
- * If no on-chain whitelist, returns relayer defaults (USDC, WETH, USDT).
3185
- * Use this before calling swap() to check which output tokens are allowed.
3186
- */
3187
- async getRebalanceTokens() {
3188
- const path = RELAYER_API.rebalanceTokens(this.vaultAddress, this.chainId);
3189
- return this._get(path);
3190
- }
3191
- // ============================================================================
3192
- // isRebalanceTokenAllowed() — via relayer
3193
- // ============================================================================
3194
- /** Check if a specific token is allowed for rebalancing (executeSwap output) on this vault. */
3195
- async isRebalanceTokenAllowed(token) {
3196
- const path = RELAYER_API.rebalanceTokenCheck(this.vaultAddress, token, this.chainId);
3197
- return this._get(path);
3198
- }
3199
- // ============================================================================
3200
- // TOS (Terms of Service)
3201
- // ============================================================================
3202
- /** Check if a wallet has accepted the current TOS version. */
3203
- async getTosStatus(wallet) {
3204
- return this._get(RELAYER_API.tosStatus(wallet));
3205
- }
3206
- /**
3207
- * Sign and submit TOS acceptance. Uses the owner's wallet (not the bot key).
3208
- *
3209
- * @param signer - Object with a `signMessage` method (e.g. a viem WalletClient
3210
- * or ethers Signer). This should be the vault owner's wallet, not the bot key.
3211
- * @param wallet - The owner's wallet address (must match the signer).
3212
- */
3213
- async acceptTos(signer, wallet) {
3214
- const { tosVersion } = await this.getTosStatus(wallet);
3215
- const timestamp = Math.floor(Date.now() / 1e3);
3216
- const message = `I accept the Axon Terms of Service (${tosVersion}).
3217
- Wallet: ${wallet}
3218
- Timestamp: ${timestamp}`;
3219
- const signature = await signer.signMessage({ message });
3220
- const url = `${this.relayerUrl}${RELAYER_API.TOS_ACCEPT}`;
3221
- const response = await fetch(url, {
3222
- method: "POST",
3223
- headers: { "Content-Type": "application/json" },
3224
- body: JSON.stringify({ wallet, signature, tosVersion, timestamp })
3225
- });
3226
- if (!response.ok) {
3227
- const body = await response.text();
3228
- throw new Error(`TOS acceptance failed [${response.status}]: ${body}`);
3229
- }
3230
- return response.json();
3231
- }
3232
- // ============================================================================
3233
- // poll() / pollExecute() / pollSwap()
3234
- // ============================================================================
3235
- /**
3236
- * Poll the relayer for the status of an async payment.
3237
- *
3238
- * Use this when pay() returns `status: "pending_review"`. Poll until
3239
- * status is `"approved"` or `"rejected"`.
3240
- *
3241
- * Recommended polling interval: 5–10 seconds.
3242
- */
3243
- async poll(requestId) {
3244
- return this._get(RELAYER_API.payment(requestId));
3245
- }
3246
- /** Poll the relayer for the status of an async protocol execution. */
3247
- async pollExecute(requestId) {
3248
- return this._get(RELAYER_API.execute(requestId));
3249
- }
3250
- /** Poll the relayer for the status of an async swap. */
3251
- async pollSwap(requestId) {
3252
- return this._get(RELAYER_API.swap(requestId));
3253
- }
3254
- // ============================================================================
3255
- // signPayment() — low-level access
3256
- // ============================================================================
3257
- /**
3258
- * Sign a PaymentIntent directly without submitting to the relayer.
3259
- *
3260
- * Use this if you want to build the intent yourself and pass the signature
3261
- * to another system (e.g. a custom relayer integration).
3262
- */
3263
- async signPayment(intent) {
3264
- return signPayment(this.walletClient, this.vaultAddress, this.chainId, intent);
3265
- }
3266
- // ============================================================================
3267
- // Internal helpers
3268
- // ============================================================================
3269
- async _get(path) {
3270
- const url = `${this.relayerUrl}${path}`;
3271
- const response = await fetch(url, {
3272
- method: "GET",
3273
- headers: { "Content-Type": "application/json" }
3274
- });
3275
- if (!response.ok) {
3276
- const body = await response.text();
3277
- throw new Error(`Relayer request failed [${response.status}]: ${body}`);
3278
- }
3279
- return response.json();
3280
- }
3281
- _defaultDeadline() {
3282
- return BigInt(Math.floor(Date.now() / 1e3) + DEFAULT_DEADLINE_SECONDS);
3283
- }
3284
- _resolveRef(memo, ref) {
3285
- if (ref) return ref;
3286
- if (memo) return encodeRef(memo);
3287
- return "0x0000000000000000000000000000000000000000000000000000000000000000";
3288
- }
3289
- _buildPaymentIntent(input) {
3290
- if (input.to === "0x0000000000000000000000000000000000000000") {
3291
- throw new Error("Payment recipient cannot be the zero address");
3292
- }
3293
- return {
3294
- bot: this.botAddress,
3295
- to: input.to,
3296
- token: resolveToken(input.token, this.chainId),
3297
- amount: parseAmount(input.amount, input.token, this.chainId),
3298
- deadline: input.deadline ?? this._defaultDeadline(),
3299
- ref: this._resolveRef(input.memo, input.ref)
3300
- };
3301
- }
3302
- _buildExecuteIntent(input) {
3303
- return {
3304
- bot: this.botAddress,
3305
- protocol: input.protocol,
3306
- calldataHash: keccak256(input.callData),
3307
- token: resolveToken(input.token, this.chainId),
3308
- amount: parseAmount(input.amount, input.token, this.chainId),
3309
- deadline: input.deadline ?? this._defaultDeadline(),
3310
- ref: this._resolveRef(input.memo, input.ref)
3311
- };
3312
- }
3313
- _buildSwapIntent(input) {
3314
- return {
3315
- bot: this.botAddress,
3316
- toToken: resolveToken(input.toToken, this.chainId),
3317
- minToAmount: parseAmount(input.minToAmount, input.toToken, this.chainId),
3318
- deadline: input.deadline ?? this._defaultDeadline(),
3319
- ref: this._resolveRef(input.memo, input.ref)
3320
- };
3321
- }
3322
- async _submitPayment(intent, signature, input) {
3323
- const idempotencyKey = input.idempotencyKey ?? generateUuid();
3324
- const body = {
3325
- // Routing
3326
- chainId: this.chainId,
3327
- vaultAddress: this.vaultAddress,
3328
- // Flat intent fields (matches relayer DTO)
3329
- bot: intent.bot,
3330
- to: intent.to,
3331
- token: intent.token,
3332
- amount: intent.amount.toString(),
3333
- deadline: intent.deadline.toString(),
3334
- ref: intent.ref,
3335
- signature,
3336
- // Off-chain metadata
3337
- idempotencyKey,
3338
- ...input.memo !== void 0 && { memo: input.memo },
3339
- ...input.resourceUrl !== void 0 && { resourceUrl: input.resourceUrl },
3340
- ...input.invoiceId !== void 0 && { invoiceId: input.invoiceId },
3341
- ...input.orderId !== void 0 && { orderId: input.orderId },
3342
- ...input.recipientLabel !== void 0 && { recipientLabel: input.recipientLabel },
3343
- ...input.metadata !== void 0 && { metadata: input.metadata }
3344
- };
3345
- return this._post(RELAYER_API.PAYMENTS, idempotencyKey, body);
3346
- }
3347
- async _submitExecute(intent, signature, input) {
3348
- const idempotencyKey = input.idempotencyKey ?? generateUuid();
3349
- const fromToken = input.fromToken !== void 0 ? resolveToken(input.fromToken, this.chainId) : void 0;
3350
- const maxFromAmount = input.maxFromAmount !== void 0 ? parseAmount(input.maxFromAmount, input.fromToken ?? input.token, this.chainId) : void 0;
3351
- const body = {
3352
- chainId: this.chainId,
3353
- vaultAddress: this.vaultAddress,
3354
- // Flat intent fields
3355
- bot: intent.bot,
3356
- protocol: intent.protocol,
3357
- calldataHash: intent.calldataHash,
3358
- token: intent.token,
3359
- amount: intent.amount.toString(),
3360
- deadline: intent.deadline.toString(),
3361
- ref: intent.ref,
3362
- signature,
3363
- // Protocol calldata
3364
- callData: input.callData,
3365
- // Optional pre-swap
3366
- ...fromToken !== void 0 && { fromToken },
3367
- ...maxFromAmount !== void 0 && { maxFromAmount: maxFromAmount.toString() },
3368
- // Off-chain metadata
3369
- idempotencyKey,
3370
- ...input.memo !== void 0 && { memo: input.memo },
3371
- ...input.protocolName !== void 0 && { protocolName: input.protocolName },
3372
- ...input.metadata !== void 0 && { metadata: input.metadata }
3373
- };
3374
- return this._post(RELAYER_API.EXECUTE, idempotencyKey, body);
3375
- }
3376
- async _submitSwap(intent, signature, input) {
3377
- const idempotencyKey = input.idempotencyKey ?? generateUuid();
3378
- const fromToken = input.fromToken !== void 0 ? resolveToken(input.fromToken, this.chainId) : void 0;
3379
- const maxFromAmount = input.maxFromAmount !== void 0 ? parseAmount(input.maxFromAmount, input.fromToken ?? input.toToken, this.chainId) : void 0;
3380
- const body = {
3381
- chainId: this.chainId,
3382
- vaultAddress: this.vaultAddress,
3383
- // Flat intent fields
3384
- bot: intent.bot,
3385
- toToken: intent.toToken,
3386
- minToAmount: intent.minToAmount.toString(),
3387
- deadline: intent.deadline.toString(),
3388
- ref: intent.ref,
3389
- signature,
3390
- // Optional source token
3391
- ...fromToken !== void 0 && { fromToken },
3392
- ...maxFromAmount !== void 0 && { maxFromAmount: maxFromAmount.toString() },
3393
- // Off-chain metadata
3394
- idempotencyKey,
3395
- ...input.memo !== void 0 && { memo: input.memo }
3396
- };
3397
- return this._post(RELAYER_API.SWAP, idempotencyKey, body);
3398
- }
3399
- async _post(path, idempotencyKey, body) {
3400
- const url = `${this.relayerUrl}${path}`;
3401
- const response = await fetch(url, {
3402
- method: "POST",
3403
- headers: {
3404
- "Content-Type": "application/json",
3405
- "Idempotency-Key": idempotencyKey
3406
- },
3407
- body: JSON.stringify(body)
3408
- });
3409
- if (!response.ok) {
3410
- const responseBody = await response.text();
3411
- throw new Error(`Relayer request failed [${response.status}]: ${responseBody}`);
3412
- }
3413
- return response.json();
3414
- }
3415
- };
3416
- var SCRYPT_N = 262144;
3417
- var SCRYPT_R = 8;
3418
- var SCRYPT_P = 1;
3419
- var SCRYPT_DKLEN = 32;
3420
- function getRandomBytes(length) {
3421
- const bytes = new Uint8Array(length);
3422
- if (typeof crypto !== "undefined" && crypto.getRandomValues) {
3423
- crypto.getRandomValues(bytes);
3424
- } else {
3425
- const { randomBytes } = __require("crypto");
3426
- const buf = randomBytes(length);
3427
- for (let i = 0; i < length; i++) bytes[i] = buf[i] ?? 0;
3428
- }
3429
- return bytes;
3430
- }
3431
- function hexToBytes(hex) {
3432
- const clean = hex.startsWith("0x") ? hex.slice(2) : hex;
3433
- const bytes = new Uint8Array(clean.length / 2);
3434
- for (let i = 0; i < bytes.length; i++) {
3435
- bytes[i] = parseInt(clean.slice(i * 2, i * 2 + 2), 16);
3436
- }
3437
- return bytes;
3438
- }
3439
- function bytesToHex(bytes) {
3440
- return Array.from(bytes).map((b) => b.toString(16).padStart(2, "0")).join("");
3441
- }
3442
- async function encryptKeystore(privateKey, passphrase) {
3443
- if (!passphrase) throw new Error("Passphrase must not be empty");
3444
- const keyBytes = hexToBytes(privateKey);
3445
- const account = privateKeyToAccount(privateKey);
3446
- const address = account.address.slice(2).toLowerCase();
3447
- const salt = getRandomBytes(32);
3448
- const iv = getRandomBytes(16);
3449
- const derivedKey = await scryptAsync(new TextEncoder().encode(passphrase), salt, {
3450
- N: SCRYPT_N,
3451
- r: SCRYPT_R,
3452
- p: SCRYPT_P,
3453
- dkLen: SCRYPT_DKLEN
3454
- });
3455
- const encryptionKey = derivedKey.slice(0, 16);
3456
- const cipher = ctr(encryptionKey, iv);
3457
- const ciphertext = cipher.encrypt(keyBytes);
3458
- const macInput = new Uint8Array(16 + ciphertext.length);
3459
- macInput.set(derivedKey.slice(16, 32), 0);
3460
- macInput.set(ciphertext, 16);
3461
- const mac = keccak_256(macInput);
3462
- return {
3463
- version: 3,
3464
- id: generateUuid(),
3465
- address,
3466
- crypto: {
3467
- ciphertext: bytesToHex(ciphertext),
3468
- cipherparams: { iv: bytesToHex(iv) },
3469
- cipher: "aes-128-ctr",
3470
- kdf: "scrypt",
3471
- kdfparams: {
3472
- dklen: SCRYPT_DKLEN,
3473
- salt: bytesToHex(salt),
3474
- n: SCRYPT_N,
3475
- r: SCRYPT_R,
3476
- p: SCRYPT_P
3477
- },
3478
- mac: bytesToHex(mac)
3479
- }
3480
- };
3481
- }
3482
- async function decryptKeystore(keystore, passphrase) {
3483
- let ks;
3484
- if (typeof keystore === "string") {
3485
- try {
3486
- ks = JSON.parse(keystore);
3487
- } catch {
3488
- throw new Error("Invalid keystore: could not parse JSON");
3489
- }
3490
- } else {
3491
- ks = keystore;
3492
- }
3493
- if (ks.version !== 3) throw new Error(`Unsupported keystore version: ${ks.version}`);
3494
- if (!ks.crypto) throw new Error("Invalid keystore: missing crypto field");
3495
- if (ks.crypto.kdf !== "scrypt") throw new Error(`Unsupported KDF: ${ks.crypto.kdf}`);
3496
- if (ks.crypto.cipher !== "aes-128-ctr") throw new Error(`Unsupported cipher: ${ks.crypto.cipher}`);
3497
- const { kdfparams, ciphertext: ctHex, cipherparams, mac: expectedMacHex } = ks.crypto;
3498
- const salt = hexToBytes(kdfparams.salt);
3499
- const derivedKey = await scryptAsync(new TextEncoder().encode(passphrase), salt, {
3500
- N: kdfparams.n,
3501
- r: kdfparams.r,
3502
- p: kdfparams.p,
3503
- dkLen: kdfparams.dklen
3504
- });
3505
- const ciphertextBytes = hexToBytes(ctHex);
3506
- const macInput = new Uint8Array(16 + ciphertextBytes.length);
3507
- macInput.set(derivedKey.slice(16, 32), 0);
3508
- macInput.set(ciphertextBytes, 16);
3509
- const computedMac = bytesToHex(keccak_256(macInput));
3510
- if (computedMac !== expectedMacHex) {
3511
- throw new Error("Wrong passphrase: MAC mismatch");
3512
- }
3513
- const iv = hexToBytes(cipherparams.iv);
3514
- const encryptionKey = derivedKey.slice(0, 16);
3515
- const cipher = ctr(encryptionKey, iv);
3516
- const plaintext = cipher.decrypt(ciphertextBytes);
3517
- return `0x${bytesToHex(plaintext)}`;
3518
- }
3519
-
3520
- // src/abis/AxonRegistry.ts
3521
- var AxonRegistryAbi = [
3522
- {
3523
- "type": "constructor",
3524
- "inputs": [
3525
- {
3526
- "name": "initialOwner",
3527
- "type": "address",
3528
- "internalType": "address"
3529
- }
3530
- ],
3531
- "stateMutability": "nonpayable"
3532
- },
3533
- {
3534
- "type": "function",
3535
- "name": "acceptOwnership",
3536
- "inputs": [],
3537
- "outputs": [],
3538
- "stateMutability": "nonpayable"
3539
- },
3540
- {
3541
- "type": "function",
3542
- "name": "addRelayer",
3543
- "inputs": [
3544
- {
3545
- "name": "relayer",
3546
- "type": "address",
3547
- "internalType": "address"
3548
- }
3549
- ],
3550
- "outputs": [],
3551
- "stateMutability": "nonpayable"
3552
- },
3553
- {
3554
- "type": "function",
3555
- "name": "addSwapRouter",
3556
- "inputs": [
3557
- {
3558
- "name": "router",
3559
- "type": "address",
3560
- "internalType": "address"
3561
- }
3562
- ],
3563
- "outputs": [],
3564
- "stateMutability": "nonpayable"
3565
- },
3566
- {
3567
- "type": "function",
3568
- "name": "isApprovedSwapRouter",
3569
- "inputs": [
3570
- {
3571
- "name": "router",
3572
- "type": "address",
3573
- "internalType": "address"
3574
- }
3575
- ],
3576
- "outputs": [
3577
- {
3578
- "name": "",
3579
- "type": "bool",
3580
- "internalType": "bool"
3581
- }
3582
- ],
3583
- "stateMutability": "view"
3584
- },
3585
- {
3586
- "type": "function",
3587
- "name": "isAuthorized",
3588
- "inputs": [
3589
- {
3590
- "name": "relayer",
3591
- "type": "address",
3592
- "internalType": "address"
3593
- }
3594
- ],
3595
- "outputs": [
3596
- {
3597
- "name": "",
3598
- "type": "bool",
3599
- "internalType": "bool"
3600
- }
3601
- ],
3602
- "stateMutability": "view"
3603
- },
3604
- {
3605
- "type": "function",
3606
- "name": "owner",
3607
- "inputs": [],
3608
- "outputs": [
3609
- {
3610
- "name": "",
3611
- "type": "address",
3612
- "internalType": "address"
3613
- }
3614
- ],
3615
- "stateMutability": "view"
3616
- },
3617
- {
3618
- "type": "function",
3619
- "name": "pendingOwner",
3620
- "inputs": [],
3621
- "outputs": [
3622
- {
3623
- "name": "",
3624
- "type": "address",
3625
- "internalType": "address"
3626
- }
3627
- ],
3628
- "stateMutability": "view"
3629
- },
3630
- {
3631
- "type": "function",
3632
- "name": "removeRelayer",
3633
- "inputs": [
3634
- {
3635
- "name": "relayer",
3636
- "type": "address",
3637
- "internalType": "address"
3638
- }
3639
- ],
3640
- "outputs": [],
3641
- "stateMutability": "nonpayable"
3642
- },
3643
- {
3644
- "type": "function",
3645
- "name": "removeSwapRouter",
3646
- "inputs": [
3647
- {
3648
- "name": "router",
3649
- "type": "address",
3650
- "internalType": "address"
3651
- }
3652
- ],
3653
- "outputs": [],
3654
- "stateMutability": "nonpayable"
3655
- },
3656
- {
3657
- "type": "function",
3658
- "name": "renounceOwnership",
3659
- "inputs": [],
3660
- "outputs": [],
3661
- "stateMutability": "nonpayable"
3662
- },
3663
- {
3664
- "type": "function",
3665
- "name": "setOracleConfig",
3666
- "inputs": [
3667
- {
3668
- "name": "uniV3Factory",
3669
- "type": "address",
3670
- "internalType": "address"
3671
- },
3672
- {
3673
- "name": "usdc",
3674
- "type": "address",
3675
- "internalType": "address"
3676
- },
3677
- {
3678
- "name": "weth",
3679
- "type": "address",
3680
- "internalType": "address"
3681
- }
3682
- ],
3683
- "outputs": [],
3684
- "stateMutability": "nonpayable"
3685
- },
3686
- {
3687
- "type": "function",
3688
- "name": "transferOwnership",
3689
- "inputs": [
3690
- {
3691
- "name": "newOwner",
3692
- "type": "address",
3693
- "internalType": "address"
3694
- }
3695
- ],
3696
- "outputs": [],
3697
- "stateMutability": "nonpayable"
3698
- },
3699
- {
3700
- "type": "function",
3701
- "name": "uniswapV3Factory",
3702
- "inputs": [],
3703
- "outputs": [
3704
- {
3705
- "name": "",
3706
- "type": "address",
3707
- "internalType": "address"
3708
- }
3709
- ],
3710
- "stateMutability": "view"
3711
- },
3712
- {
3713
- "type": "function",
3714
- "name": "usdcAddress",
3715
- "inputs": [],
3716
- "outputs": [
3717
- {
3718
- "name": "",
3719
- "type": "address",
3720
- "internalType": "address"
3721
- }
3722
- ],
3723
- "stateMutability": "view"
3724
- },
3725
- {
3726
- "type": "function",
3727
- "name": "wethAddress",
3728
- "inputs": [],
3729
- "outputs": [
3730
- {
3731
- "name": "",
3732
- "type": "address",
3733
- "internalType": "address"
3734
- }
3735
- ],
3736
- "stateMutability": "view"
3737
- },
3738
- {
3739
- "type": "event",
3740
- "name": "OracleConfigUpdated",
3741
- "inputs": [
3742
- {
3743
- "name": "uniswapV3Factory",
3744
- "type": "address",
3745
- "indexed": false,
3746
- "internalType": "address"
3747
- },
3748
- {
3749
- "name": "usdc",
3750
- "type": "address",
3751
- "indexed": false,
3752
- "internalType": "address"
3753
- },
3754
- {
3755
- "name": "weth",
3756
- "type": "address",
3757
- "indexed": false,
3758
- "internalType": "address"
3759
- }
3760
- ],
3761
- "anonymous": false
3762
- },
3763
- {
3764
- "type": "event",
3765
- "name": "OwnershipTransferStarted",
3766
- "inputs": [
3767
- {
3768
- "name": "previousOwner",
3769
- "type": "address",
3770
- "indexed": true,
3771
- "internalType": "address"
3772
- },
3773
- {
3774
- "name": "newOwner",
3775
- "type": "address",
3776
- "indexed": true,
3777
- "internalType": "address"
3778
- }
3779
- ],
3780
- "anonymous": false
3781
- },
3782
- {
3783
- "type": "event",
3784
- "name": "OwnershipTransferred",
3785
- "inputs": [
3786
- {
3787
- "name": "previousOwner",
3788
- "type": "address",
3789
- "indexed": true,
3790
- "internalType": "address"
3791
- },
3792
- {
3793
- "name": "newOwner",
3794
- "type": "address",
3795
- "indexed": true,
3796
- "internalType": "address"
3797
- }
3798
- ],
3799
- "anonymous": false
3800
- },
3801
- {
3802
- "type": "event",
3803
- "name": "RelayerAdded",
3804
- "inputs": [
3805
- {
3806
- "name": "relayer",
3807
- "type": "address",
3808
- "indexed": true,
3809
- "internalType": "address"
3810
- }
3811
- ],
3812
- "anonymous": false
3813
- },
3814
- {
3815
- "type": "event",
3816
- "name": "RelayerRemoved",
3817
- "inputs": [
3818
- {
3819
- "name": "relayer",
3820
- "type": "address",
3821
- "indexed": true,
3822
- "internalType": "address"
3823
- }
3824
- ],
3825
- "anonymous": false
3826
- },
3827
- {
3828
- "type": "event",
3829
- "name": "SwapRouterAdded",
3830
- "inputs": [
3831
- {
3832
- "name": "router",
3833
- "type": "address",
3834
- "indexed": true,
3835
- "internalType": "address"
3836
- }
3837
- ],
3838
- "anonymous": false
3839
- },
3840
- {
3841
- "type": "event",
3842
- "name": "SwapRouterRemoved",
3843
- "inputs": [
3844
- {
3845
- "name": "router",
3846
- "type": "address",
3847
- "indexed": true,
3848
- "internalType": "address"
3849
- }
3850
- ],
3851
- "anonymous": false
3852
- },
3853
- {
3854
- "type": "error",
3855
- "name": "AlreadyApproved",
3856
- "inputs": []
3857
- },
3858
- {
3859
- "type": "error",
3860
- "name": "AlreadyAuthorized",
3861
- "inputs": []
3862
- },
3863
- {
3864
- "type": "error",
3865
- "name": "NotApproved",
3866
- "inputs": []
3867
- },
3868
- {
3869
- "type": "error",
3870
- "name": "NotAuthorized",
3871
- "inputs": []
3872
- },
3873
- {
3874
- "type": "error",
3875
- "name": "OwnableInvalidOwner",
3876
- "inputs": [
3877
- {
3878
- "name": "owner",
3879
- "type": "address",
3880
- "internalType": "address"
3881
- }
3882
- ]
3883
- },
3884
- {
3885
- "type": "error",
3886
- "name": "OwnableUnauthorizedAccount",
3887
- "inputs": [
3888
- {
3889
- "name": "account",
3890
- "type": "address",
3891
- "internalType": "address"
3892
- }
3893
- ]
3894
- },
3895
- {
3896
- "type": "error",
3897
- "name": "ZeroAddress",
3898
- "inputs": []
3899
- }
3900
- ];
3901
-
3902
- 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, PaymentErrorCode, RELAYER_API, SUPPORTED_CHAIN_IDS, SWAP_INTENT_TYPEHASH, Token, USDC, WINDOW, createAxonPublicClient, createAxonWalletClient, decryptKeystore, deployVault, encodeRef, encryptKeystore, getBotConfig, getChain, getDomainSeparator, getKnownTokensForChain, getOperatorCeilings, getRebalanceTokenCount, getTokenSymbolByAddress, getVaultOperator, getVaultOwner, getVaultVersion, isBotActive, isDestinationAllowed, isRebalanceTokenWhitelisted, isVaultPaused, operatorMaxDrainPerDay, parseAmount, resolveToken, resolveTokenDecimals, signExecuteIntent, signPayment, signSwapIntent };
3903
- //# sourceMappingURL=index.js.map
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';
3904
28
  //# sourceMappingURL=index.js.map