@axonfi/sdk 0.7.0 → 0.8.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.d.cts CHANGED
@@ -502,7 +502,7 @@ interface PayInput {
502
502
  * executeProtocol() on-chain. The contract approves `token` to `protocol`,
503
503
  * calls it with `callData`, then revokes the approval.
504
504
  *
505
- * TypeHash: keccak256("ExecuteIntent(address bot,address protocol,bytes32 calldataHash,address token,uint256 amount,uint256 value,uint256 deadline,bytes32 ref)")
505
+ * TypeHash: keccak256("ExecuteIntent(address bot,address protocol,bytes32 calldataHash,address token,uint256 amount,uint256 value,address[] extraTokens,uint256[] extraAmounts,uint256 deadline,bytes32 ref)")
506
506
  */
507
507
  interface ExecuteIntent {
508
508
  /** Bot's own address. Must be registered in the vault. */
@@ -517,6 +517,10 @@ interface ExecuteIntent {
517
517
  amount: bigint;
518
518
  /** Native ETH to send with the protocol call (e.g. WETH.deposit, Lido.submit). 0 = no ETH. */
519
519
  value: bigint;
520
+ /** Additional tokens to approve to the SAME protocol (e.g. WETH for GMX execution fee). Bot-signed. */
521
+ extraTokens: Address[];
522
+ /** Approval amounts for each extra token. Must match extraTokens length. */
523
+ extraAmounts: bigint[];
520
524
  /** Unix timestamp after which this intent is invalid. */
521
525
  deadline: bigint;
522
526
  /** keccak256 of the off-chain memo. Full memo text stored by relayer. */
@@ -557,6 +561,10 @@ interface ExecuteInput {
557
561
  amount: AmountInput;
558
562
  /** Native ETH to send with the call (wei). Optional, defaults to 0. Used for payable functions like WETH.deposit() or Lido.submit(). */
559
563
  value?: bigint;
564
+ /** Additional tokens to approve to the protocol (e.g. WETH for GMX execution fee). Bot signs these. */
565
+ extraTokens?: Address[];
566
+ /** Approval amounts for each extra token (raw base units). Must match extraTokens length. */
567
+ extraAmounts?: bigint[];
560
568
  /** Human-readable description. Gets keccak256-hashed to ref. */
561
569
  memo?: string;
562
570
  /**
@@ -1588,6 +1596,16 @@ declare const AxonVaultAbi: readonly [{
1588
1596
  readonly internalType: "uint256[]";
1589
1597
  }];
1590
1598
  readonly stateMutability: "view";
1599
+ }, {
1600
+ readonly type: "function";
1601
+ readonly name: "erc1271BotsEnabled";
1602
+ readonly inputs: readonly [];
1603
+ readonly outputs: readonly [{
1604
+ readonly name: "";
1605
+ readonly type: "bool";
1606
+ readonly internalType: "bool";
1607
+ }];
1608
+ readonly stateMutability: "view";
1591
1609
  }, {
1592
1610
  readonly type: "function";
1593
1611
  readonly name: "executePayment";
@@ -1674,6 +1692,14 @@ declare const AxonVaultAbi: readonly [{
1674
1692
  readonly name: "value";
1675
1693
  readonly type: "uint256";
1676
1694
  readonly internalType: "uint256";
1695
+ }, {
1696
+ readonly name: "extraTokens";
1697
+ readonly type: "address[]";
1698
+ readonly internalType: "address[]";
1699
+ }, {
1700
+ readonly name: "extraAmounts";
1701
+ readonly type: "uint256[]";
1702
+ readonly internalType: "uint256[]";
1677
1703
  }, {
1678
1704
  readonly name: "deadline";
1679
1705
  readonly type: "uint256";
@@ -1929,26 +1955,6 @@ declare const AxonVaultAbi: readonly [{
1929
1955
  readonly internalType: "bytes4";
1930
1956
  }];
1931
1957
  readonly stateMutability: "view";
1932
- }, {
1933
- readonly type: "function";
1934
- readonly name: "erc1271BotsEnabled";
1935
- readonly inputs: readonly [];
1936
- readonly outputs: readonly [{
1937
- readonly name: "";
1938
- readonly type: "bool";
1939
- readonly internalType: "bool";
1940
- }];
1941
- readonly stateMutability: "view";
1942
- }, {
1943
- readonly type: "function";
1944
- readonly name: "setErc1271Bots";
1945
- readonly inputs: readonly [{
1946
- readonly name: "enabled";
1947
- readonly type: "bool";
1948
- readonly internalType: "bool";
1949
- }];
1950
- readonly outputs: readonly [];
1951
- readonly stateMutability: "nonpayable";
1952
1958
  }, {
1953
1959
  readonly type: "function";
1954
1960
  readonly name: "onERC1155BatchReceived";
@@ -2221,6 +2227,16 @@ declare const AxonVaultAbi: readonly [{
2221
2227
  }];
2222
2228
  readonly outputs: readonly [];
2223
2229
  readonly stateMutability: "nonpayable";
2230
+ }, {
2231
+ readonly type: "function";
2232
+ readonly name: "setErc1271Bots";
2233
+ readonly inputs: readonly [{
2234
+ readonly name: "enabled";
2235
+ readonly type: "bool";
2236
+ readonly internalType: "bool";
2237
+ }];
2238
+ readonly outputs: readonly [];
2239
+ readonly stateMutability: "nonpayable";
2224
2240
  }, {
2225
2241
  readonly type: "function";
2226
2242
  readonly name: "setOperator";
@@ -2412,16 +2428,6 @@ declare const AxonVaultAbi: readonly [{
2412
2428
  }];
2413
2429
  readonly outputs: readonly [];
2414
2430
  readonly stateMutability: "nonpayable";
2415
- }, {
2416
- readonly type: "event";
2417
- readonly name: "ERC1271BotsToggled";
2418
- readonly inputs: readonly [{
2419
- readonly name: "enabled";
2420
- readonly type: "bool";
2421
- readonly indexed: false;
2422
- readonly internalType: "bool";
2423
- }];
2424
- readonly anonymous: false;
2425
2431
  }, {
2426
2432
  readonly type: "event";
2427
2433
  readonly name: "BotAdded";
@@ -2552,6 +2558,16 @@ declare const AxonVaultAbi: readonly [{
2552
2558
  readonly internalType: "address";
2553
2559
  }];
2554
2560
  readonly anonymous: false;
2561
+ }, {
2562
+ readonly type: "event";
2563
+ readonly name: "ERC1271BotsToggled";
2564
+ readonly inputs: readonly [{
2565
+ readonly name: "enabled";
2566
+ readonly type: "bool";
2567
+ readonly indexed: false;
2568
+ readonly internalType: "bool";
2569
+ }];
2570
+ readonly anonymous: false;
2555
2571
  }, {
2556
2572
  readonly type: "event";
2557
2573
  readonly name: "ERC721Withdrawn";
@@ -2926,6 +2942,10 @@ declare const AxonVaultAbi: readonly [{
2926
2942
  readonly type: "error";
2927
2943
  readonly name: "AmountMismatch";
2928
2944
  readonly inputs: readonly [];
2945
+ }, {
2946
+ readonly type: "error";
2947
+ readonly name: "ArrayLengthMismatch";
2948
+ readonly inputs: readonly [];
2929
2949
  }, {
2930
2950
  readonly type: "error";
2931
2951
  readonly name: "BotAlreadyExists";
package/dist/index.d.ts CHANGED
@@ -502,7 +502,7 @@ interface PayInput {
502
502
  * executeProtocol() on-chain. The contract approves `token` to `protocol`,
503
503
  * calls it with `callData`, then revokes the approval.
504
504
  *
505
- * TypeHash: keccak256("ExecuteIntent(address bot,address protocol,bytes32 calldataHash,address token,uint256 amount,uint256 value,uint256 deadline,bytes32 ref)")
505
+ * TypeHash: keccak256("ExecuteIntent(address bot,address protocol,bytes32 calldataHash,address token,uint256 amount,uint256 value,address[] extraTokens,uint256[] extraAmounts,uint256 deadline,bytes32 ref)")
506
506
  */
507
507
  interface ExecuteIntent {
508
508
  /** Bot's own address. Must be registered in the vault. */
@@ -517,6 +517,10 @@ interface ExecuteIntent {
517
517
  amount: bigint;
518
518
  /** Native ETH to send with the protocol call (e.g. WETH.deposit, Lido.submit). 0 = no ETH. */
519
519
  value: bigint;
520
+ /** Additional tokens to approve to the SAME protocol (e.g. WETH for GMX execution fee). Bot-signed. */
521
+ extraTokens: Address[];
522
+ /** Approval amounts for each extra token. Must match extraTokens length. */
523
+ extraAmounts: bigint[];
520
524
  /** Unix timestamp after which this intent is invalid. */
521
525
  deadline: bigint;
522
526
  /** keccak256 of the off-chain memo. Full memo text stored by relayer. */
@@ -557,6 +561,10 @@ interface ExecuteInput {
557
561
  amount: AmountInput;
558
562
  /** Native ETH to send with the call (wei). Optional, defaults to 0. Used for payable functions like WETH.deposit() or Lido.submit(). */
559
563
  value?: bigint;
564
+ /** Additional tokens to approve to the protocol (e.g. WETH for GMX execution fee). Bot signs these. */
565
+ extraTokens?: Address[];
566
+ /** Approval amounts for each extra token (raw base units). Must match extraTokens length. */
567
+ extraAmounts?: bigint[];
560
568
  /** Human-readable description. Gets keccak256-hashed to ref. */
561
569
  memo?: string;
562
570
  /**
@@ -1588,6 +1596,16 @@ declare const AxonVaultAbi: readonly [{
1588
1596
  readonly internalType: "uint256[]";
1589
1597
  }];
1590
1598
  readonly stateMutability: "view";
1599
+ }, {
1600
+ readonly type: "function";
1601
+ readonly name: "erc1271BotsEnabled";
1602
+ readonly inputs: readonly [];
1603
+ readonly outputs: readonly [{
1604
+ readonly name: "";
1605
+ readonly type: "bool";
1606
+ readonly internalType: "bool";
1607
+ }];
1608
+ readonly stateMutability: "view";
1591
1609
  }, {
1592
1610
  readonly type: "function";
1593
1611
  readonly name: "executePayment";
@@ -1674,6 +1692,14 @@ declare const AxonVaultAbi: readonly [{
1674
1692
  readonly name: "value";
1675
1693
  readonly type: "uint256";
1676
1694
  readonly internalType: "uint256";
1695
+ }, {
1696
+ readonly name: "extraTokens";
1697
+ readonly type: "address[]";
1698
+ readonly internalType: "address[]";
1699
+ }, {
1700
+ readonly name: "extraAmounts";
1701
+ readonly type: "uint256[]";
1702
+ readonly internalType: "uint256[]";
1677
1703
  }, {
1678
1704
  readonly name: "deadline";
1679
1705
  readonly type: "uint256";
@@ -1929,26 +1955,6 @@ declare const AxonVaultAbi: readonly [{
1929
1955
  readonly internalType: "bytes4";
1930
1956
  }];
1931
1957
  readonly stateMutability: "view";
1932
- }, {
1933
- readonly type: "function";
1934
- readonly name: "erc1271BotsEnabled";
1935
- readonly inputs: readonly [];
1936
- readonly outputs: readonly [{
1937
- readonly name: "";
1938
- readonly type: "bool";
1939
- readonly internalType: "bool";
1940
- }];
1941
- readonly stateMutability: "view";
1942
- }, {
1943
- readonly type: "function";
1944
- readonly name: "setErc1271Bots";
1945
- readonly inputs: readonly [{
1946
- readonly name: "enabled";
1947
- readonly type: "bool";
1948
- readonly internalType: "bool";
1949
- }];
1950
- readonly outputs: readonly [];
1951
- readonly stateMutability: "nonpayable";
1952
1958
  }, {
1953
1959
  readonly type: "function";
1954
1960
  readonly name: "onERC1155BatchReceived";
@@ -2221,6 +2227,16 @@ declare const AxonVaultAbi: readonly [{
2221
2227
  }];
2222
2228
  readonly outputs: readonly [];
2223
2229
  readonly stateMutability: "nonpayable";
2230
+ }, {
2231
+ readonly type: "function";
2232
+ readonly name: "setErc1271Bots";
2233
+ readonly inputs: readonly [{
2234
+ readonly name: "enabled";
2235
+ readonly type: "bool";
2236
+ readonly internalType: "bool";
2237
+ }];
2238
+ readonly outputs: readonly [];
2239
+ readonly stateMutability: "nonpayable";
2224
2240
  }, {
2225
2241
  readonly type: "function";
2226
2242
  readonly name: "setOperator";
@@ -2412,16 +2428,6 @@ declare const AxonVaultAbi: readonly [{
2412
2428
  }];
2413
2429
  readonly outputs: readonly [];
2414
2430
  readonly stateMutability: "nonpayable";
2415
- }, {
2416
- readonly type: "event";
2417
- readonly name: "ERC1271BotsToggled";
2418
- readonly inputs: readonly [{
2419
- readonly name: "enabled";
2420
- readonly type: "bool";
2421
- readonly indexed: false;
2422
- readonly internalType: "bool";
2423
- }];
2424
- readonly anonymous: false;
2425
2431
  }, {
2426
2432
  readonly type: "event";
2427
2433
  readonly name: "BotAdded";
@@ -2552,6 +2558,16 @@ declare const AxonVaultAbi: readonly [{
2552
2558
  readonly internalType: "address";
2553
2559
  }];
2554
2560
  readonly anonymous: false;
2561
+ }, {
2562
+ readonly type: "event";
2563
+ readonly name: "ERC1271BotsToggled";
2564
+ readonly inputs: readonly [{
2565
+ readonly name: "enabled";
2566
+ readonly type: "bool";
2567
+ readonly indexed: false;
2568
+ readonly internalType: "bool";
2569
+ }];
2570
+ readonly anonymous: false;
2555
2571
  }, {
2556
2572
  readonly type: "event";
2557
2573
  readonly name: "ERC721Withdrawn";
@@ -2926,6 +2942,10 @@ declare const AxonVaultAbi: readonly [{
2926
2942
  readonly type: "error";
2927
2943
  readonly name: "AmountMismatch";
2928
2944
  readonly inputs: readonly [];
2945
+ }, {
2946
+ readonly type: "error";
2947
+ readonly name: "ArrayLengthMismatch";
2948
+ readonly inputs: readonly [];
2929
2949
  }, {
2930
2950
  readonly type: "error";
2931
2951
  readonly name: "BotAlreadyExists";
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 value,uint256 deadline,bytes32 ref)"
19
+ "ExecuteIntent(address bot,address protocol,bytes32 calldataHash,address token,uint256 amount,uint256 value,address[] extraTokens,uint256[] extraAmounts,uint256 deadline,bytes32 ref)"
20
20
  )
21
21
  );
22
22
  var SWAP_INTENT_TYPEHASH = keccak256(
@@ -154,6 +154,8 @@ var EXECUTE_INTENT_TYPES = {
154
154
  { name: "token", type: "address" },
155
155
  { name: "amount", type: "uint256" },
156
156
  { name: "value", type: "uint256" },
157
+ { name: "extraTokens", type: "address[]" },
158
+ { name: "extraAmounts", type: "uint256[]" },
157
159
  { name: "deadline", type: "uint256" },
158
160
  { name: "ref", type: "bytes32" }
159
161
  ]
@@ -210,6 +212,8 @@ async function signExecuteIntent(walletClient, vaultAddress, chainId, intent) {
210
212
  token: intent.token,
211
213
  amount: intent.amount,
212
214
  value: intent.value,
215
+ extraTokens: intent.extraTokens,
216
+ extraAmounts: intent.extraAmounts,
213
217
  deadline: intent.deadline,
214
218
  ref: intent.ref
215
219
  }
@@ -612,6 +616,19 @@ var AxonVaultAbi = [
612
616
  ],
613
617
  "stateMutability": "view"
614
618
  },
619
+ {
620
+ "type": "function",
621
+ "name": "erc1271BotsEnabled",
622
+ "inputs": [],
623
+ "outputs": [
624
+ {
625
+ "name": "",
626
+ "type": "bool",
627
+ "internalType": "bool"
628
+ }
629
+ ],
630
+ "stateMutability": "view"
631
+ },
615
632
  {
616
633
  "type": "function",
617
634
  "name": "executePayment",
@@ -721,6 +738,16 @@ var AxonVaultAbi = [
721
738
  "type": "uint256",
722
739
  "internalType": "uint256"
723
740
  },
741
+ {
742
+ "name": "extraTokens",
743
+ "type": "address[]",
744
+ "internalType": "address[]"
745
+ },
746
+ {
747
+ "name": "extraAmounts",
748
+ "type": "uint256[]",
749
+ "internalType": "uint256[]"
750
+ },
724
751
  {
725
752
  "name": "deadline",
726
753
  "type": "uint256",
@@ -1055,32 +1082,6 @@ var AxonVaultAbi = [
1055
1082
  ],
1056
1083
  "stateMutability": "view"
1057
1084
  },
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
- },
1084
1085
  {
1085
1086
  "type": "function",
1086
1087
  "name": "onERC1155BatchReceived",
@@ -1433,6 +1434,19 @@ var AxonVaultAbi = [
1433
1434
  "outputs": [],
1434
1435
  "stateMutability": "nonpayable"
1435
1436
  },
1437
+ {
1438
+ "type": "function",
1439
+ "name": "setErc1271Bots",
1440
+ "inputs": [
1441
+ {
1442
+ "name": "enabled",
1443
+ "type": "bool",
1444
+ "internalType": "bool"
1445
+ }
1446
+ ],
1447
+ "outputs": [],
1448
+ "stateMutability": "nonpayable"
1449
+ },
1436
1450
  {
1437
1451
  "type": "function",
1438
1452
  "name": "setOperator",
@@ -1680,19 +1694,6 @@ var AxonVaultAbi = [
1680
1694
  "outputs": [],
1681
1695
  "stateMutability": "nonpayable"
1682
1696
  },
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
- },
1696
1697
  {
1697
1698
  "type": "event",
1698
1699
  "name": "BotAdded",
@@ -1856,6 +1857,19 @@ var AxonVaultAbi = [
1856
1857
  ],
1857
1858
  "anonymous": false
1858
1859
  },
1860
+ {
1861
+ "type": "event",
1862
+ "name": "ERC1271BotsToggled",
1863
+ "inputs": [
1864
+ {
1865
+ "name": "enabled",
1866
+ "type": "bool",
1867
+ "indexed": false,
1868
+ "internalType": "bool"
1869
+ }
1870
+ ],
1871
+ "anonymous": false
1872
+ },
1859
1873
  {
1860
1874
  "type": "event",
1861
1875
  "name": "ERC721Withdrawn",
@@ -2328,6 +2342,11 @@ var AxonVaultAbi = [
2328
2342
  "name": "AmountMismatch",
2329
2343
  "inputs": []
2330
2344
  },
2345
+ {
2346
+ "type": "error",
2347
+ "name": "ArrayLengthMismatch",
2348
+ "inputs": []
2349
+ },
2331
2350
  {
2332
2351
  "type": "error",
2333
2352
  "name": "BotAlreadyExists",
@@ -4210,6 +4229,8 @@ Timestamp: ${timestamp}`;
4210
4229
  token: resolveToken(input.token, this.chainId),
4211
4230
  amount: parseAmount(input.amount, input.token, this.chainId),
4212
4231
  value: input.value ?? 0n,
4232
+ extraTokens: input.extraTokens ?? [],
4233
+ extraAmounts: input.extraAmounts ?? [],
4213
4234
  deadline: input.deadline ?? this._defaultDeadline(),
4214
4235
  ref: this._resolveRef(input.memo, input.ref)
4215
4236
  };