@axonfi/sdk 0.5.5 → 0.7.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.js CHANGED
@@ -16,7 +16,7 @@ var PAYMENT_INTENT_TYPEHASH = keccak256(
16
16
  );
17
17
  var EXECUTE_INTENT_TYPEHASH = keccak256(
18
18
  stringToBytes(
19
- "ExecuteIntent(address bot,address protocol,bytes32 calldataHash,address token,uint256 amount,uint256 deadline,bytes32 ref)"
19
+ "ExecuteIntent(address bot,address protocol,bytes32 calldataHash,address token,uint256 amount,uint256 value,uint256 deadline,bytes32 ref)"
20
20
  )
21
21
  );
22
22
  var SWAP_INTENT_TYPEHASH = keccak256(
@@ -153,6 +153,7 @@ var EXECUTE_INTENT_TYPES = {
153
153
  { name: "calldataHash", type: "bytes32" },
154
154
  { name: "token", type: "address" },
155
155
  { name: "amount", type: "uint256" },
156
+ { name: "value", type: "uint256" },
156
157
  { name: "deadline", type: "uint256" },
157
158
  { name: "ref", type: "bytes32" }
158
159
  ]
@@ -208,6 +209,7 @@ async function signExecuteIntent(walletClient, vaultAddress, chainId, intent) {
208
209
  calldataHash: intent.calldataHash,
209
210
  token: intent.token,
210
211
  amount: intent.amount,
212
+ value: intent.value,
211
213
  deadline: intent.deadline,
212
214
  ref: intent.ref
213
215
  }
@@ -239,18 +241,7 @@ function encodeRef(memo) {
239
241
  var AxonVaultAbi = [
240
242
  {
241
243
  "type": "constructor",
242
- "inputs": [
243
- {
244
- "name": "_owner",
245
- "type": "address",
246
- "internalType": "address"
247
- },
248
- {
249
- "name": "_axonRegistry",
250
- "type": "address",
251
- "internalType": "address"
252
- }
253
- ],
244
+ "inputs": [],
254
245
  "stateMutability": "nonpayable"
255
246
  },
256
247
  {
@@ -725,6 +716,11 @@ var AxonVaultAbi = [
725
716
  "type": "uint256",
726
717
  "internalType": "uint256"
727
718
  },
719
+ {
720
+ "name": "value",
721
+ "type": "uint256",
722
+ "internalType": "uint256"
723
+ },
728
724
  {
729
725
  "name": "deadline",
730
726
  "type": "uint256",
@@ -979,6 +975,24 @@ var AxonVaultAbi = [
979
975
  ],
980
976
  "stateMutability": "view"
981
977
  },
978
+ {
979
+ "type": "function",
980
+ "name": "initialize",
981
+ "inputs": [
982
+ {
983
+ "name": "_owner",
984
+ "type": "address",
985
+ "internalType": "address"
986
+ },
987
+ {
988
+ "name": "_axonRegistry",
989
+ "type": "address",
990
+ "internalType": "address"
991
+ }
992
+ ],
993
+ "outputs": [],
994
+ "stateMutability": "nonpayable"
995
+ },
982
996
  {
983
997
  "type": "function",
984
998
  "name": "isBotActive",
@@ -1017,6 +1031,56 @@ var AxonVaultAbi = [
1017
1031
  ],
1018
1032
  "stateMutability": "view"
1019
1033
  },
1034
+ {
1035
+ "type": "function",
1036
+ "name": "isValidSignature",
1037
+ "inputs": [
1038
+ {
1039
+ "name": "hash",
1040
+ "type": "bytes32",
1041
+ "internalType": "bytes32"
1042
+ },
1043
+ {
1044
+ "name": "signature",
1045
+ "type": "bytes",
1046
+ "internalType": "bytes"
1047
+ }
1048
+ ],
1049
+ "outputs": [
1050
+ {
1051
+ "name": "",
1052
+ "type": "bytes4",
1053
+ "internalType": "bytes4"
1054
+ }
1055
+ ],
1056
+ "stateMutability": "view"
1057
+ },
1058
+ {
1059
+ "type": "function",
1060
+ "name": "erc1271BotsEnabled",
1061
+ "inputs": [],
1062
+ "outputs": [
1063
+ {
1064
+ "name": "",
1065
+ "type": "bool",
1066
+ "internalType": "bool"
1067
+ }
1068
+ ],
1069
+ "stateMutability": "view"
1070
+ },
1071
+ {
1072
+ "type": "function",
1073
+ "name": "setErc1271Bots",
1074
+ "inputs": [
1075
+ {
1076
+ "name": "enabled",
1077
+ "type": "bool",
1078
+ "internalType": "bool"
1079
+ }
1080
+ ],
1081
+ "outputs": [],
1082
+ "stateMutability": "nonpayable"
1083
+ },
1020
1084
  {
1021
1085
  "type": "function",
1022
1086
  "name": "onERC1155BatchReceived",
@@ -1616,6 +1680,19 @@ var AxonVaultAbi = [
1616
1680
  "outputs": [],
1617
1681
  "stateMutability": "nonpayable"
1618
1682
  },
1683
+ {
1684
+ "type": "event",
1685
+ "name": "ERC1271BotsToggled",
1686
+ "inputs": [
1687
+ {
1688
+ "name": "enabled",
1689
+ "type": "bool",
1690
+ "indexed": false,
1691
+ "internalType": "bool"
1692
+ }
1693
+ ],
1694
+ "anonymous": false
1695
+ },
1619
1696
  {
1620
1697
  "type": "event",
1621
1698
  "name": "BotAdded",
@@ -1856,6 +1933,19 @@ var AxonVaultAbi = [
1856
1933
  ],
1857
1934
  "anonymous": false
1858
1935
  },
1936
+ {
1937
+ "type": "event",
1938
+ "name": "Initialized",
1939
+ "inputs": [
1940
+ {
1941
+ "name": "version",
1942
+ "type": "uint64",
1943
+ "indexed": false,
1944
+ "internalType": "uint64"
1945
+ }
1946
+ ],
1947
+ "anonymous": false
1948
+ },
1859
1949
  {
1860
1950
  "type": "event",
1861
1951
  "name": "OperatorCeilingsUpdated",
@@ -2044,6 +2134,12 @@ var AxonVaultAbi = [
2044
2134
  "indexed": false,
2045
2135
  "internalType": "uint256"
2046
2136
  },
2137
+ {
2138
+ "name": "value",
2139
+ "type": "uint256",
2140
+ "indexed": false,
2141
+ "internalType": "uint256"
2142
+ },
2047
2143
  {
2048
2144
  "name": "ref",
2049
2145
  "type": "bytes32",
@@ -2331,7 +2427,7 @@ var AxonVaultAbi = [
2331
2427
  },
2332
2428
  {
2333
2429
  "type": "error",
2334
- "name": "InvalidShortString",
2430
+ "name": "InvalidInitialization",
2335
2431
  "inputs": []
2336
2432
  },
2337
2433
  {
@@ -2364,6 +2460,11 @@ var AxonVaultAbi = [
2364
2460
  "name": "NotAuthorizedRelayer",
2365
2461
  "inputs": []
2366
2462
  },
2463
+ {
2464
+ "type": "error",
2465
+ "name": "NotInitializing",
2466
+ "inputs": []
2467
+ },
2367
2468
  {
2368
2469
  "type": "error",
2369
2470
  "name": "OperatorBotLimitReached",
@@ -2462,17 +2563,6 @@ var AxonVaultAbi = [
2462
2563
  "name": "SelfPayment",
2463
2564
  "inputs": []
2464
2565
  },
2465
- {
2466
- "type": "error",
2467
- "name": "StringTooLong",
2468
- "inputs": [
2469
- {
2470
- "name": "str",
2471
- "type": "string",
2472
- "internalType": "string"
2473
- }
2474
- ]
2475
- },
2476
2566
  {
2477
2567
  "type": "error",
2478
2568
  "name": "SwapFailed",
@@ -2575,6 +2665,19 @@ var AxonVaultFactoryAbi = [
2575
2665
  ],
2576
2666
  "stateMutability": "nonpayable"
2577
2667
  },
2668
+ {
2669
+ "type": "function",
2670
+ "name": "implementation",
2671
+ "inputs": [],
2672
+ "outputs": [
2673
+ {
2674
+ "name": "",
2675
+ "type": "address",
2676
+ "internalType": "address"
2677
+ }
2678
+ ],
2679
+ "stateMutability": "view"
2680
+ },
2578
2681
  {
2579
2682
  "type": "function",
2580
2683
  "name": "owner",
@@ -2644,6 +2747,30 @@ var AxonVaultFactoryAbi = [
2644
2747
  ],
2645
2748
  "stateMutability": "view"
2646
2749
  },
2750
+ {
2751
+ "type": "function",
2752
+ "name": "predictVaultAddress",
2753
+ "inputs": [
2754
+ {
2755
+ "name": "owner",
2756
+ "type": "address",
2757
+ "internalType": "address"
2758
+ },
2759
+ {
2760
+ "name": "nonce",
2761
+ "type": "uint256",
2762
+ "internalType": "uint256"
2763
+ }
2764
+ ],
2765
+ "outputs": [
2766
+ {
2767
+ "name": "",
2768
+ "type": "address",
2769
+ "internalType": "address"
2770
+ }
2771
+ ],
2772
+ "stateMutability": "view"
2773
+ },
2647
2774
  {
2648
2775
  "type": "function",
2649
2776
  "name": "renounceOwnership",
@@ -2746,6 +2873,27 @@ var AxonVaultFactoryAbi = [
2746
2873
  ],
2747
2874
  "anonymous": false
2748
2875
  },
2876
+ {
2877
+ "type": "error",
2878
+ "name": "FailedDeployment",
2879
+ "inputs": []
2880
+ },
2881
+ {
2882
+ "type": "error",
2883
+ "name": "InsufficientBalance",
2884
+ "inputs": [
2885
+ {
2886
+ "name": "balance",
2887
+ "type": "uint256",
2888
+ "internalType": "uint256"
2889
+ },
2890
+ {
2891
+ "name": "needed",
2892
+ "type": "uint256",
2893
+ "internalType": "uint256"
2894
+ }
2895
+ ]
2896
+ },
2749
2897
  {
2750
2898
  "type": "error",
2751
2899
  "name": "OwnableInvalidOwner",
@@ -3165,6 +3313,13 @@ async function operatorMaxDrainPerDay(publicClient, vaultAddress) {
3165
3313
  functionName: "operatorMaxDrainPerDay"
3166
3314
  });
3167
3315
  }
3316
+ async function isErc1271BotsEnabled(publicClient, vaultAddress) {
3317
+ return publicClient.readContract({
3318
+ address: vaultAddress,
3319
+ abi: AxonVaultAbi,
3320
+ functionName: "erc1271BotsEnabled"
3321
+ });
3322
+ }
3168
3323
  async function isVaultPaused(publicClient, vaultAddress) {
3169
3324
  return publicClient.readContract({
3170
3325
  address: vaultAddress,
@@ -3289,6 +3444,16 @@ async function deployVault(walletClient, publicClient, relayerUrl) {
3289
3444
  }
3290
3445
  throw new Error("VaultDeployed event not found in transaction receipt");
3291
3446
  }
3447
+ async function predictVaultAddress(publicClient, owner, nonce, relayerUrl) {
3448
+ const chainId = await publicClient.getChainId();
3449
+ const factoryAddress = await getFactoryAddress(chainId, relayerUrl);
3450
+ return publicClient.readContract({
3451
+ address: factoryAddress,
3452
+ abi: AxonVaultFactoryAbi,
3453
+ functionName: "predictVaultAddress",
3454
+ args: [owner, BigInt(nonce)]
3455
+ });
3456
+ }
3292
3457
  async function addBot(walletClient, publicClient, vaultAddress, botAddress, config) {
3293
3458
  if (!walletClient.account) {
3294
3459
  throw new Error("walletClient has no account attached");
@@ -4044,6 +4209,7 @@ Timestamp: ${timestamp}`;
4044
4209
  calldataHash: keccak256(input.callData),
4045
4210
  token: resolveToken(input.token, this.chainId),
4046
4211
  amount: parseAmount(input.amount, input.token, this.chainId),
4212
+ value: input.value ?? 0n,
4047
4213
  deadline: input.deadline ?? this._defaultDeadline(),
4048
4214
  ref: this._resolveRef(input.memo, input.ref)
4049
4215
  };
@@ -4096,6 +4262,7 @@ Timestamp: ${timestamp}`;
4096
4262
  calldataHash: intent.calldataHash,
4097
4263
  token: intent.token,
4098
4264
  amount: intent.amount.toString(),
4265
+ value: intent.value.toString(),
4099
4266
  deadline: intent.deadline.toString(),
4100
4267
  ref: intent.ref,
4101
4268
  signature,
@@ -4328,6 +4495,38 @@ var AxonRegistryAbi = [
4328
4495
  "outputs": [],
4329
4496
  "stateMutability": "nonpayable"
4330
4497
  },
4498
+ {
4499
+ "type": "function",
4500
+ "name": "approveProtocol",
4501
+ "inputs": [
4502
+ {
4503
+ "name": "protocol",
4504
+ "type": "address",
4505
+ "internalType": "address"
4506
+ }
4507
+ ],
4508
+ "outputs": [],
4509
+ "stateMutability": "nonpayable"
4510
+ },
4511
+ {
4512
+ "type": "function",
4513
+ "name": "isApprovedProtocol",
4514
+ "inputs": [
4515
+ {
4516
+ "name": "protocol",
4517
+ "type": "address",
4518
+ "internalType": "address"
4519
+ }
4520
+ ],
4521
+ "outputs": [
4522
+ {
4523
+ "name": "",
4524
+ "type": "bool",
4525
+ "internalType": "bool"
4526
+ }
4527
+ ],
4528
+ "stateMutability": "view"
4529
+ },
4331
4530
  {
4332
4531
  "type": "function",
4333
4532
  "name": "isApprovedSwapRouter",
@@ -4457,6 +4656,19 @@ var AxonRegistryAbi = [
4457
4656
  "outputs": [],
4458
4657
  "stateMutability": "nonpayable"
4459
4658
  },
4659
+ {
4660
+ "type": "function",
4661
+ "name": "revokeProtocol",
4662
+ "inputs": [
4663
+ {
4664
+ "name": "protocol",
4665
+ "type": "address",
4666
+ "internalType": "address"
4667
+ }
4668
+ ],
4669
+ "outputs": [],
4670
+ "stateMutability": "nonpayable"
4671
+ },
4460
4672
  {
4461
4673
  "type": "function",
4462
4674
  "name": "setOracleConfig",
@@ -4621,6 +4833,32 @@ var AxonRegistryAbi = [
4621
4833
  ],
4622
4834
  "anonymous": false
4623
4835
  },
4836
+ {
4837
+ "type": "event",
4838
+ "name": "ProtocolApproved",
4839
+ "inputs": [
4840
+ {
4841
+ "name": "protocol",
4842
+ "type": "address",
4843
+ "indexed": true,
4844
+ "internalType": "address"
4845
+ }
4846
+ ],
4847
+ "anonymous": false
4848
+ },
4849
+ {
4850
+ "type": "event",
4851
+ "name": "ProtocolRevoked",
4852
+ "inputs": [
4853
+ {
4854
+ "name": "protocol",
4855
+ "type": "address",
4856
+ "indexed": true,
4857
+ "internalType": "address"
4858
+ }
4859
+ ],
4860
+ "anonymous": false
4861
+ },
4624
4862
  {
4625
4863
  "type": "event",
4626
4864
  "name": "RelayerAdded",
@@ -4722,6 +4960,6 @@ var AxonRegistryAbi = [
4722
4960
  }
4723
4961
  ];
4724
4962
 
4725
- export { AxonClient, AxonRegistryAbi, AxonVaultAbi, AxonVaultFactoryAbi, CHAIN_NAMES, Chain, DEFAULT_APPROVED_TOKENS, DEFAULT_DEADLINE_SECONDS, EIP712_DOMAIN_NAME, EIP712_DOMAIN_VERSION, EXECUTE_INTENT_TYPEHASH, EXPLORER_ADDR, EXPLORER_TX, KNOWN_TOKENS, NATIVE_ETH, PAYMENT_INTENT_TYPEHASH, PERMIT2_ADDRESS, PaymentErrorCode, RELAYER_API, SUPPORTED_CHAIN_IDS, SWAP_INTENT_TYPEHASH, Token, USDC, USDC_EIP712_DOMAIN, WINDOW, WITNESS_TYPE_STRING, X402_PROXY_ADDRESS, addBot, createAxonPublicClient, createAxonWalletClient, decryptKeystore, deployVault, deposit, encodeRef, encryptKeystore, extractX402Metadata, findMatchingOption, formatPaymentSignature, getBotConfig, getChain, getDefaultApprovedTokens, getDomainSeparator, getKnownTokensForChain, getOperatorCeilings, getRebalanceTokenCount, getTokenSymbolByAddress, getVaultOperator, getVaultOwner, getVaultVersion, isBotActive, isDestinationAllowed, isRebalanceTokenWhitelisted, isVaultPaused, operatorMaxDrainPerDay, parseAmount, parseChainId, parsePaymentRequired, randomNonce, randomPermit2Nonce, removeBot, resolveToken, resolveTokenDecimals, signExecuteIntent, signPayment, signPermit2WitnessTransfer, signSwapIntent, signTransferWithAuthorization, toBotConfigParams, updateBotConfig };
4963
+ export { AxonClient, AxonRegistryAbi, AxonVaultAbi, AxonVaultFactoryAbi, CHAIN_NAMES, Chain, DEFAULT_APPROVED_TOKENS, DEFAULT_DEADLINE_SECONDS, EIP712_DOMAIN_NAME, EIP712_DOMAIN_VERSION, EXECUTE_INTENT_TYPEHASH, EXPLORER_ADDR, EXPLORER_TX, KNOWN_TOKENS, NATIVE_ETH, PAYMENT_INTENT_TYPEHASH, PERMIT2_ADDRESS, PaymentErrorCode, RELAYER_API, SUPPORTED_CHAIN_IDS, SWAP_INTENT_TYPEHASH, Token, USDC, USDC_EIP712_DOMAIN, WINDOW, WITNESS_TYPE_STRING, X402_PROXY_ADDRESS, addBot, createAxonPublicClient, createAxonWalletClient, decryptKeystore, deployVault, deposit, encodeRef, encryptKeystore, extractX402Metadata, findMatchingOption, formatPaymentSignature, getBotConfig, getChain, getDefaultApprovedTokens, getDomainSeparator, getKnownTokensForChain, getOperatorCeilings, getRebalanceTokenCount, getTokenSymbolByAddress, getVaultOperator, getVaultOwner, getVaultVersion, isBotActive, isDestinationAllowed, isErc1271BotsEnabled, isRebalanceTokenWhitelisted, isVaultPaused, operatorMaxDrainPerDay, parseAmount, parseChainId, parsePaymentRequired, predictVaultAddress, randomNonce, randomPermit2Nonce, removeBot, resolveToken, resolveTokenDecimals, signExecuteIntent, signPayment, signPermit2WitnessTransfer, signSwapIntent, signTransferWithAuthorization, toBotConfigParams, updateBotConfig };
4726
4964
  //# sourceMappingURL=index.js.map
4727
4965
  //# sourceMappingURL=index.js.map