@axonfi/sdk 0.5.5 → 0.6.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.
package/dist/index.cjs CHANGED
@@ -18,7 +18,7 @@ var PAYMENT_INTENT_TYPEHASH = viem.keccak256(
18
18
  );
19
19
  var EXECUTE_INTENT_TYPEHASH = viem.keccak256(
20
20
  viem.stringToBytes(
21
- "ExecuteIntent(address bot,address protocol,bytes32 calldataHash,address token,uint256 amount,uint256 deadline,bytes32 ref)"
21
+ "ExecuteIntent(address bot,address protocol,bytes32 calldataHash,address token,uint256 amount,uint256 value,uint256 deadline,bytes32 ref)"
22
22
  )
23
23
  );
24
24
  var SWAP_INTENT_TYPEHASH = viem.keccak256(
@@ -155,6 +155,7 @@ var EXECUTE_INTENT_TYPES = {
155
155
  { name: "calldataHash", type: "bytes32" },
156
156
  { name: "token", type: "address" },
157
157
  { name: "amount", type: "uint256" },
158
+ { name: "value", type: "uint256" },
158
159
  { name: "deadline", type: "uint256" },
159
160
  { name: "ref", type: "bytes32" }
160
161
  ]
@@ -210,6 +211,7 @@ async function signExecuteIntent(walletClient, vaultAddress, chainId, intent) {
210
211
  calldataHash: intent.calldataHash,
211
212
  token: intent.token,
212
213
  amount: intent.amount,
214
+ value: intent.value,
213
215
  deadline: intent.deadline,
214
216
  ref: intent.ref
215
217
  }
@@ -241,18 +243,7 @@ function encodeRef(memo) {
241
243
  var AxonVaultAbi = [
242
244
  {
243
245
  "type": "constructor",
244
- "inputs": [
245
- {
246
- "name": "_owner",
247
- "type": "address",
248
- "internalType": "address"
249
- },
250
- {
251
- "name": "_axonRegistry",
252
- "type": "address",
253
- "internalType": "address"
254
- }
255
- ],
246
+ "inputs": [],
256
247
  "stateMutability": "nonpayable"
257
248
  },
258
249
  {
@@ -727,6 +718,11 @@ var AxonVaultAbi = [
727
718
  "type": "uint256",
728
719
  "internalType": "uint256"
729
720
  },
721
+ {
722
+ "name": "value",
723
+ "type": "uint256",
724
+ "internalType": "uint256"
725
+ },
730
726
  {
731
727
  "name": "deadline",
732
728
  "type": "uint256",
@@ -981,6 +977,24 @@ var AxonVaultAbi = [
981
977
  ],
982
978
  "stateMutability": "view"
983
979
  },
980
+ {
981
+ "type": "function",
982
+ "name": "initialize",
983
+ "inputs": [
984
+ {
985
+ "name": "_owner",
986
+ "type": "address",
987
+ "internalType": "address"
988
+ },
989
+ {
990
+ "name": "_axonRegistry",
991
+ "type": "address",
992
+ "internalType": "address"
993
+ }
994
+ ],
995
+ "outputs": [],
996
+ "stateMutability": "nonpayable"
997
+ },
984
998
  {
985
999
  "type": "function",
986
1000
  "name": "isBotActive",
@@ -1019,6 +1033,30 @@ var AxonVaultAbi = [
1019
1033
  ],
1020
1034
  "stateMutability": "view"
1021
1035
  },
1036
+ {
1037
+ "type": "function",
1038
+ "name": "isValidSignature",
1039
+ "inputs": [
1040
+ {
1041
+ "name": "hash",
1042
+ "type": "bytes32",
1043
+ "internalType": "bytes32"
1044
+ },
1045
+ {
1046
+ "name": "signature",
1047
+ "type": "bytes",
1048
+ "internalType": "bytes"
1049
+ }
1050
+ ],
1051
+ "outputs": [
1052
+ {
1053
+ "name": "",
1054
+ "type": "bytes4",
1055
+ "internalType": "bytes4"
1056
+ }
1057
+ ],
1058
+ "stateMutability": "view"
1059
+ },
1022
1060
  {
1023
1061
  "type": "function",
1024
1062
  "name": "onERC1155BatchReceived",
@@ -1858,6 +1896,19 @@ var AxonVaultAbi = [
1858
1896
  ],
1859
1897
  "anonymous": false
1860
1898
  },
1899
+ {
1900
+ "type": "event",
1901
+ "name": "Initialized",
1902
+ "inputs": [
1903
+ {
1904
+ "name": "version",
1905
+ "type": "uint64",
1906
+ "indexed": false,
1907
+ "internalType": "uint64"
1908
+ }
1909
+ ],
1910
+ "anonymous": false
1911
+ },
1861
1912
  {
1862
1913
  "type": "event",
1863
1914
  "name": "OperatorCeilingsUpdated",
@@ -2333,7 +2384,7 @@ var AxonVaultAbi = [
2333
2384
  },
2334
2385
  {
2335
2386
  "type": "error",
2336
- "name": "InvalidShortString",
2387
+ "name": "InvalidInitialization",
2337
2388
  "inputs": []
2338
2389
  },
2339
2390
  {
@@ -2366,6 +2417,11 @@ var AxonVaultAbi = [
2366
2417
  "name": "NotAuthorizedRelayer",
2367
2418
  "inputs": []
2368
2419
  },
2420
+ {
2421
+ "type": "error",
2422
+ "name": "NotInitializing",
2423
+ "inputs": []
2424
+ },
2369
2425
  {
2370
2426
  "type": "error",
2371
2427
  "name": "OperatorBotLimitReached",
@@ -2464,17 +2520,6 @@ var AxonVaultAbi = [
2464
2520
  "name": "SelfPayment",
2465
2521
  "inputs": []
2466
2522
  },
2467
- {
2468
- "type": "error",
2469
- "name": "StringTooLong",
2470
- "inputs": [
2471
- {
2472
- "name": "str",
2473
- "type": "string",
2474
- "internalType": "string"
2475
- }
2476
- ]
2477
- },
2478
2523
  {
2479
2524
  "type": "error",
2480
2525
  "name": "SwapFailed",
@@ -2577,6 +2622,19 @@ var AxonVaultFactoryAbi = [
2577
2622
  ],
2578
2623
  "stateMutability": "nonpayable"
2579
2624
  },
2625
+ {
2626
+ "type": "function",
2627
+ "name": "implementation",
2628
+ "inputs": [],
2629
+ "outputs": [
2630
+ {
2631
+ "name": "",
2632
+ "type": "address",
2633
+ "internalType": "address"
2634
+ }
2635
+ ],
2636
+ "stateMutability": "view"
2637
+ },
2580
2638
  {
2581
2639
  "type": "function",
2582
2640
  "name": "owner",
@@ -2646,6 +2704,30 @@ var AxonVaultFactoryAbi = [
2646
2704
  ],
2647
2705
  "stateMutability": "view"
2648
2706
  },
2707
+ {
2708
+ "type": "function",
2709
+ "name": "predictVaultAddress",
2710
+ "inputs": [
2711
+ {
2712
+ "name": "owner",
2713
+ "type": "address",
2714
+ "internalType": "address"
2715
+ },
2716
+ {
2717
+ "name": "nonce",
2718
+ "type": "uint256",
2719
+ "internalType": "uint256"
2720
+ }
2721
+ ],
2722
+ "outputs": [
2723
+ {
2724
+ "name": "",
2725
+ "type": "address",
2726
+ "internalType": "address"
2727
+ }
2728
+ ],
2729
+ "stateMutability": "view"
2730
+ },
2649
2731
  {
2650
2732
  "type": "function",
2651
2733
  "name": "renounceOwnership",
@@ -2748,6 +2830,27 @@ var AxonVaultFactoryAbi = [
2748
2830
  ],
2749
2831
  "anonymous": false
2750
2832
  },
2833
+ {
2834
+ "type": "error",
2835
+ "name": "FailedDeployment",
2836
+ "inputs": []
2837
+ },
2838
+ {
2839
+ "type": "error",
2840
+ "name": "InsufficientBalance",
2841
+ "inputs": [
2842
+ {
2843
+ "name": "balance",
2844
+ "type": "uint256",
2845
+ "internalType": "uint256"
2846
+ },
2847
+ {
2848
+ "name": "needed",
2849
+ "type": "uint256",
2850
+ "internalType": "uint256"
2851
+ }
2852
+ ]
2853
+ },
2751
2854
  {
2752
2855
  "type": "error",
2753
2856
  "name": "OwnableInvalidOwner",
@@ -3291,6 +3394,16 @@ async function deployVault(walletClient, publicClient, relayerUrl) {
3291
3394
  }
3292
3395
  throw new Error("VaultDeployed event not found in transaction receipt");
3293
3396
  }
3397
+ async function predictVaultAddress(publicClient, owner, nonce, relayerUrl) {
3398
+ const chainId = await publicClient.getChainId();
3399
+ const factoryAddress = await getFactoryAddress(chainId, relayerUrl);
3400
+ return publicClient.readContract({
3401
+ address: factoryAddress,
3402
+ abi: AxonVaultFactoryAbi,
3403
+ functionName: "predictVaultAddress",
3404
+ args: [owner, BigInt(nonce)]
3405
+ });
3406
+ }
3294
3407
  async function addBot(walletClient, publicClient, vaultAddress, botAddress, config) {
3295
3408
  if (!walletClient.account) {
3296
3409
  throw new Error("walletClient has no account attached");
@@ -4046,6 +4159,7 @@ Timestamp: ${timestamp}`;
4046
4159
  calldataHash: viem.keccak256(input.callData),
4047
4160
  token: resolveToken(input.token, this.chainId),
4048
4161
  amount: parseAmount(input.amount, input.token, this.chainId),
4162
+ value: input.value ?? 0n,
4049
4163
  deadline: input.deadline ?? this._defaultDeadline(),
4050
4164
  ref: this._resolveRef(input.memo, input.ref)
4051
4165
  };
@@ -4098,6 +4212,7 @@ Timestamp: ${timestamp}`;
4098
4212
  calldataHash: intent.calldataHash,
4099
4213
  token: intent.token,
4100
4214
  amount: intent.amount.toString(),
4215
+ value: intent.value.toString(),
4101
4216
  deadline: intent.deadline.toString(),
4102
4217
  ref: intent.ref,
4103
4218
  signature,
@@ -4330,6 +4445,38 @@ var AxonRegistryAbi = [
4330
4445
  "outputs": [],
4331
4446
  "stateMutability": "nonpayable"
4332
4447
  },
4448
+ {
4449
+ "type": "function",
4450
+ "name": "approveProtocol",
4451
+ "inputs": [
4452
+ {
4453
+ "name": "protocol",
4454
+ "type": "address",
4455
+ "internalType": "address"
4456
+ }
4457
+ ],
4458
+ "outputs": [],
4459
+ "stateMutability": "nonpayable"
4460
+ },
4461
+ {
4462
+ "type": "function",
4463
+ "name": "isApprovedProtocol",
4464
+ "inputs": [
4465
+ {
4466
+ "name": "protocol",
4467
+ "type": "address",
4468
+ "internalType": "address"
4469
+ }
4470
+ ],
4471
+ "outputs": [
4472
+ {
4473
+ "name": "",
4474
+ "type": "bool",
4475
+ "internalType": "bool"
4476
+ }
4477
+ ],
4478
+ "stateMutability": "view"
4479
+ },
4333
4480
  {
4334
4481
  "type": "function",
4335
4482
  "name": "isApprovedSwapRouter",
@@ -4459,6 +4606,19 @@ var AxonRegistryAbi = [
4459
4606
  "outputs": [],
4460
4607
  "stateMutability": "nonpayable"
4461
4608
  },
4609
+ {
4610
+ "type": "function",
4611
+ "name": "revokeProtocol",
4612
+ "inputs": [
4613
+ {
4614
+ "name": "protocol",
4615
+ "type": "address",
4616
+ "internalType": "address"
4617
+ }
4618
+ ],
4619
+ "outputs": [],
4620
+ "stateMutability": "nonpayable"
4621
+ },
4462
4622
  {
4463
4623
  "type": "function",
4464
4624
  "name": "setOracleConfig",
@@ -4623,6 +4783,32 @@ var AxonRegistryAbi = [
4623
4783
  ],
4624
4784
  "anonymous": false
4625
4785
  },
4786
+ {
4787
+ "type": "event",
4788
+ "name": "ProtocolApproved",
4789
+ "inputs": [
4790
+ {
4791
+ "name": "protocol",
4792
+ "type": "address",
4793
+ "indexed": true,
4794
+ "internalType": "address"
4795
+ }
4796
+ ],
4797
+ "anonymous": false
4798
+ },
4799
+ {
4800
+ "type": "event",
4801
+ "name": "ProtocolRevoked",
4802
+ "inputs": [
4803
+ {
4804
+ "name": "protocol",
4805
+ "type": "address",
4806
+ "indexed": true,
4807
+ "internalType": "address"
4808
+ }
4809
+ ],
4810
+ "anonymous": false
4811
+ },
4626
4812
  {
4627
4813
  "type": "event",
4628
4814
  "name": "RelayerAdded",
@@ -4781,6 +4967,7 @@ exports.operatorMaxDrainPerDay = operatorMaxDrainPerDay;
4781
4967
  exports.parseAmount = parseAmount;
4782
4968
  exports.parseChainId = parseChainId;
4783
4969
  exports.parsePaymentRequired = parsePaymentRequired;
4970
+ exports.predictVaultAddress = predictVaultAddress;
4784
4971
  exports.randomNonce = randomNonce;
4785
4972
  exports.randomPermit2Nonce = randomPermit2Nonce;
4786
4973
  exports.removeBot = removeBot;