@axonfi/sdk 0.5.4 → 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 +473 -31
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +361 -23
- package/dist/index.d.ts +361 -23
- package/dist/index.js +473 -32
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
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,142 @@ 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": "onERC1155BatchReceived",
|
|
1061
|
+
"inputs": [
|
|
1062
|
+
{
|
|
1063
|
+
"name": "",
|
|
1064
|
+
"type": "address",
|
|
1065
|
+
"internalType": "address"
|
|
1066
|
+
},
|
|
1067
|
+
{
|
|
1068
|
+
"name": "",
|
|
1069
|
+
"type": "address",
|
|
1070
|
+
"internalType": "address"
|
|
1071
|
+
},
|
|
1072
|
+
{
|
|
1073
|
+
"name": "",
|
|
1074
|
+
"type": "uint256[]",
|
|
1075
|
+
"internalType": "uint256[]"
|
|
1076
|
+
},
|
|
1077
|
+
{
|
|
1078
|
+
"name": "",
|
|
1079
|
+
"type": "uint256[]",
|
|
1080
|
+
"internalType": "uint256[]"
|
|
1081
|
+
},
|
|
1082
|
+
{
|
|
1083
|
+
"name": "",
|
|
1084
|
+
"type": "bytes",
|
|
1085
|
+
"internalType": "bytes"
|
|
1086
|
+
}
|
|
1087
|
+
],
|
|
1088
|
+
"outputs": [
|
|
1089
|
+
{
|
|
1090
|
+
"name": "",
|
|
1091
|
+
"type": "bytes4",
|
|
1092
|
+
"internalType": "bytes4"
|
|
1093
|
+
}
|
|
1094
|
+
],
|
|
1095
|
+
"stateMutability": "pure"
|
|
1096
|
+
},
|
|
1097
|
+
{
|
|
1098
|
+
"type": "function",
|
|
1099
|
+
"name": "onERC1155Received",
|
|
1100
|
+
"inputs": [
|
|
1101
|
+
{
|
|
1102
|
+
"name": "",
|
|
1103
|
+
"type": "address",
|
|
1104
|
+
"internalType": "address"
|
|
1105
|
+
},
|
|
1106
|
+
{
|
|
1107
|
+
"name": "",
|
|
1108
|
+
"type": "address",
|
|
1109
|
+
"internalType": "address"
|
|
1110
|
+
},
|
|
1111
|
+
{
|
|
1112
|
+
"name": "",
|
|
1113
|
+
"type": "uint256",
|
|
1114
|
+
"internalType": "uint256"
|
|
1115
|
+
},
|
|
1116
|
+
{
|
|
1117
|
+
"name": "",
|
|
1118
|
+
"type": "uint256",
|
|
1119
|
+
"internalType": "uint256"
|
|
1120
|
+
},
|
|
1121
|
+
{
|
|
1122
|
+
"name": "",
|
|
1123
|
+
"type": "bytes",
|
|
1124
|
+
"internalType": "bytes"
|
|
1125
|
+
}
|
|
1126
|
+
],
|
|
1127
|
+
"outputs": [
|
|
1128
|
+
{
|
|
1129
|
+
"name": "",
|
|
1130
|
+
"type": "bytes4",
|
|
1131
|
+
"internalType": "bytes4"
|
|
1132
|
+
}
|
|
1133
|
+
],
|
|
1134
|
+
"stateMutability": "pure"
|
|
1135
|
+
},
|
|
1136
|
+
{
|
|
1137
|
+
"type": "function",
|
|
1138
|
+
"name": "onERC721Received",
|
|
1139
|
+
"inputs": [
|
|
1140
|
+
{
|
|
1141
|
+
"name": "",
|
|
1142
|
+
"type": "address",
|
|
1143
|
+
"internalType": "address"
|
|
1144
|
+
},
|
|
1145
|
+
{
|
|
1146
|
+
"name": "",
|
|
1147
|
+
"type": "address",
|
|
1148
|
+
"internalType": "address"
|
|
1149
|
+
},
|
|
1150
|
+
{
|
|
1151
|
+
"name": "",
|
|
1152
|
+
"type": "uint256",
|
|
1153
|
+
"internalType": "uint256"
|
|
1154
|
+
},
|
|
1155
|
+
{
|
|
1156
|
+
"name": "",
|
|
1157
|
+
"type": "bytes",
|
|
1158
|
+
"internalType": "bytes"
|
|
1159
|
+
}
|
|
1160
|
+
],
|
|
1161
|
+
"outputs": [
|
|
1162
|
+
{
|
|
1163
|
+
"name": "",
|
|
1164
|
+
"type": "bytes4",
|
|
1165
|
+
"internalType": "bytes4"
|
|
1166
|
+
}
|
|
1167
|
+
],
|
|
1168
|
+
"stateMutability": "pure"
|
|
1169
|
+
},
|
|
1020
1170
|
{
|
|
1021
1171
|
"type": "function",
|
|
1022
1172
|
"name": "operator",
|
|
@@ -1242,7 +1392,7 @@ var AxonVaultAbi = [
|
|
|
1242
1392
|
"name": "renounceOwnership",
|
|
1243
1393
|
"inputs": [],
|
|
1244
1394
|
"outputs": [],
|
|
1245
|
-
"stateMutability": "
|
|
1395
|
+
"stateMutability": "pure"
|
|
1246
1396
|
},
|
|
1247
1397
|
{
|
|
1248
1398
|
"type": "function",
|
|
@@ -1310,6 +1460,25 @@ var AxonVaultAbi = [
|
|
|
1310
1460
|
"outputs": [],
|
|
1311
1461
|
"stateMutability": "nonpayable"
|
|
1312
1462
|
},
|
|
1463
|
+
{
|
|
1464
|
+
"type": "function",
|
|
1465
|
+
"name": "supportsInterface",
|
|
1466
|
+
"inputs": [
|
|
1467
|
+
{
|
|
1468
|
+
"name": "interfaceId",
|
|
1469
|
+
"type": "bytes4",
|
|
1470
|
+
"internalType": "bytes4"
|
|
1471
|
+
}
|
|
1472
|
+
],
|
|
1473
|
+
"outputs": [
|
|
1474
|
+
{
|
|
1475
|
+
"name": "",
|
|
1476
|
+
"type": "bool",
|
|
1477
|
+
"internalType": "bool"
|
|
1478
|
+
}
|
|
1479
|
+
],
|
|
1480
|
+
"stateMutability": "view"
|
|
1481
|
+
},
|
|
1313
1482
|
{
|
|
1314
1483
|
"type": "function",
|
|
1315
1484
|
"name": "transferOwnership",
|
|
@@ -1434,6 +1603,57 @@ var AxonVaultAbi = [
|
|
|
1434
1603
|
"outputs": [],
|
|
1435
1604
|
"stateMutability": "nonpayable"
|
|
1436
1605
|
},
|
|
1606
|
+
{
|
|
1607
|
+
"type": "function",
|
|
1608
|
+
"name": "withdrawERC1155",
|
|
1609
|
+
"inputs": [
|
|
1610
|
+
{
|
|
1611
|
+
"name": "token",
|
|
1612
|
+
"type": "address",
|
|
1613
|
+
"internalType": "address"
|
|
1614
|
+
},
|
|
1615
|
+
{
|
|
1616
|
+
"name": "id",
|
|
1617
|
+
"type": "uint256",
|
|
1618
|
+
"internalType": "uint256"
|
|
1619
|
+
},
|
|
1620
|
+
{
|
|
1621
|
+
"name": "amount",
|
|
1622
|
+
"type": "uint256",
|
|
1623
|
+
"internalType": "uint256"
|
|
1624
|
+
},
|
|
1625
|
+
{
|
|
1626
|
+
"name": "to",
|
|
1627
|
+
"type": "address",
|
|
1628
|
+
"internalType": "address"
|
|
1629
|
+
}
|
|
1630
|
+
],
|
|
1631
|
+
"outputs": [],
|
|
1632
|
+
"stateMutability": "nonpayable"
|
|
1633
|
+
},
|
|
1634
|
+
{
|
|
1635
|
+
"type": "function",
|
|
1636
|
+
"name": "withdrawERC721",
|
|
1637
|
+
"inputs": [
|
|
1638
|
+
{
|
|
1639
|
+
"name": "nft",
|
|
1640
|
+
"type": "address",
|
|
1641
|
+
"internalType": "address"
|
|
1642
|
+
},
|
|
1643
|
+
{
|
|
1644
|
+
"name": "tokenId",
|
|
1645
|
+
"type": "uint256",
|
|
1646
|
+
"internalType": "uint256"
|
|
1647
|
+
},
|
|
1648
|
+
{
|
|
1649
|
+
"name": "to",
|
|
1650
|
+
"type": "address",
|
|
1651
|
+
"internalType": "address"
|
|
1652
|
+
}
|
|
1653
|
+
],
|
|
1654
|
+
"outputs": [],
|
|
1655
|
+
"stateMutability": "nonpayable"
|
|
1656
|
+
},
|
|
1437
1657
|
{
|
|
1438
1658
|
"type": "event",
|
|
1439
1659
|
"name": "BotAdded",
|
|
@@ -1566,6 +1786,62 @@ var AxonVaultAbi = [
|
|
|
1566
1786
|
"inputs": [],
|
|
1567
1787
|
"anonymous": false
|
|
1568
1788
|
},
|
|
1789
|
+
{
|
|
1790
|
+
"type": "event",
|
|
1791
|
+
"name": "ERC1155Withdrawn",
|
|
1792
|
+
"inputs": [
|
|
1793
|
+
{
|
|
1794
|
+
"name": "token",
|
|
1795
|
+
"type": "address",
|
|
1796
|
+
"indexed": true,
|
|
1797
|
+
"internalType": "address"
|
|
1798
|
+
},
|
|
1799
|
+
{
|
|
1800
|
+
"name": "id",
|
|
1801
|
+
"type": "uint256",
|
|
1802
|
+
"indexed": true,
|
|
1803
|
+
"internalType": "uint256"
|
|
1804
|
+
},
|
|
1805
|
+
{
|
|
1806
|
+
"name": "amount",
|
|
1807
|
+
"type": "uint256",
|
|
1808
|
+
"indexed": false,
|
|
1809
|
+
"internalType": "uint256"
|
|
1810
|
+
},
|
|
1811
|
+
{
|
|
1812
|
+
"name": "to",
|
|
1813
|
+
"type": "address",
|
|
1814
|
+
"indexed": true,
|
|
1815
|
+
"internalType": "address"
|
|
1816
|
+
}
|
|
1817
|
+
],
|
|
1818
|
+
"anonymous": false
|
|
1819
|
+
},
|
|
1820
|
+
{
|
|
1821
|
+
"type": "event",
|
|
1822
|
+
"name": "ERC721Withdrawn",
|
|
1823
|
+
"inputs": [
|
|
1824
|
+
{
|
|
1825
|
+
"name": "nft",
|
|
1826
|
+
"type": "address",
|
|
1827
|
+
"indexed": true,
|
|
1828
|
+
"internalType": "address"
|
|
1829
|
+
},
|
|
1830
|
+
{
|
|
1831
|
+
"name": "tokenId",
|
|
1832
|
+
"type": "uint256",
|
|
1833
|
+
"indexed": true,
|
|
1834
|
+
"internalType": "uint256"
|
|
1835
|
+
},
|
|
1836
|
+
{
|
|
1837
|
+
"name": "to",
|
|
1838
|
+
"type": "address",
|
|
1839
|
+
"indexed": true,
|
|
1840
|
+
"internalType": "address"
|
|
1841
|
+
}
|
|
1842
|
+
],
|
|
1843
|
+
"anonymous": false
|
|
1844
|
+
},
|
|
1569
1845
|
{
|
|
1570
1846
|
"type": "event",
|
|
1571
1847
|
"name": "GlobalBlacklistAdded",
|
|
@@ -1618,6 +1894,19 @@ var AxonVaultAbi = [
|
|
|
1618
1894
|
],
|
|
1619
1895
|
"anonymous": false
|
|
1620
1896
|
},
|
|
1897
|
+
{
|
|
1898
|
+
"type": "event",
|
|
1899
|
+
"name": "Initialized",
|
|
1900
|
+
"inputs": [
|
|
1901
|
+
{
|
|
1902
|
+
"name": "version",
|
|
1903
|
+
"type": "uint64",
|
|
1904
|
+
"indexed": false,
|
|
1905
|
+
"internalType": "uint64"
|
|
1906
|
+
}
|
|
1907
|
+
],
|
|
1908
|
+
"anonymous": false
|
|
1909
|
+
},
|
|
1621
1910
|
{
|
|
1622
1911
|
"type": "event",
|
|
1623
1912
|
"name": "OperatorCeilingsUpdated",
|
|
@@ -2024,6 +2313,11 @@ var AxonVaultAbi = [
|
|
|
2024
2313
|
"name": "DeadlineExpired",
|
|
2025
2314
|
"inputs": []
|
|
2026
2315
|
},
|
|
2316
|
+
{
|
|
2317
|
+
"type": "error",
|
|
2318
|
+
"name": "DefaultTokenCallRestricted",
|
|
2319
|
+
"inputs": []
|
|
2320
|
+
},
|
|
2027
2321
|
{
|
|
2028
2322
|
"type": "error",
|
|
2029
2323
|
"name": "DestinationBlacklisted",
|
|
@@ -2088,7 +2382,7 @@ var AxonVaultAbi = [
|
|
|
2088
2382
|
},
|
|
2089
2383
|
{
|
|
2090
2384
|
"type": "error",
|
|
2091
|
-
"name": "
|
|
2385
|
+
"name": "InvalidInitialization",
|
|
2092
2386
|
"inputs": []
|
|
2093
2387
|
},
|
|
2094
2388
|
{
|
|
@@ -2121,6 +2415,11 @@ var AxonVaultAbi = [
|
|
|
2121
2415
|
"name": "NotAuthorizedRelayer",
|
|
2122
2416
|
"inputs": []
|
|
2123
2417
|
},
|
|
2418
|
+
{
|
|
2419
|
+
"type": "error",
|
|
2420
|
+
"name": "NotInitializing",
|
|
2421
|
+
"inputs": []
|
|
2422
|
+
},
|
|
2124
2423
|
{
|
|
2125
2424
|
"type": "error",
|
|
2126
2425
|
"name": "OperatorBotLimitReached",
|
|
@@ -2219,17 +2518,6 @@ var AxonVaultAbi = [
|
|
|
2219
2518
|
"name": "SelfPayment",
|
|
2220
2519
|
"inputs": []
|
|
2221
2520
|
},
|
|
2222
|
-
{
|
|
2223
|
-
"type": "error",
|
|
2224
|
-
"name": "StringTooLong",
|
|
2225
|
-
"inputs": [
|
|
2226
|
-
{
|
|
2227
|
-
"name": "str",
|
|
2228
|
-
"type": "string",
|
|
2229
|
-
"internalType": "string"
|
|
2230
|
-
}
|
|
2231
|
-
]
|
|
2232
|
-
},
|
|
2233
2521
|
{
|
|
2234
2522
|
"type": "error",
|
|
2235
2523
|
"name": "SwapFailed",
|
|
@@ -2332,6 +2620,19 @@ var AxonVaultFactoryAbi = [
|
|
|
2332
2620
|
],
|
|
2333
2621
|
"stateMutability": "nonpayable"
|
|
2334
2622
|
},
|
|
2623
|
+
{
|
|
2624
|
+
"type": "function",
|
|
2625
|
+
"name": "implementation",
|
|
2626
|
+
"inputs": [],
|
|
2627
|
+
"outputs": [
|
|
2628
|
+
{
|
|
2629
|
+
"name": "",
|
|
2630
|
+
"type": "address",
|
|
2631
|
+
"internalType": "address"
|
|
2632
|
+
}
|
|
2633
|
+
],
|
|
2634
|
+
"stateMutability": "view"
|
|
2635
|
+
},
|
|
2335
2636
|
{
|
|
2336
2637
|
"type": "function",
|
|
2337
2638
|
"name": "owner",
|
|
@@ -2401,12 +2702,36 @@ var AxonVaultFactoryAbi = [
|
|
|
2401
2702
|
],
|
|
2402
2703
|
"stateMutability": "view"
|
|
2403
2704
|
},
|
|
2705
|
+
{
|
|
2706
|
+
"type": "function",
|
|
2707
|
+
"name": "predictVaultAddress",
|
|
2708
|
+
"inputs": [
|
|
2709
|
+
{
|
|
2710
|
+
"name": "owner",
|
|
2711
|
+
"type": "address",
|
|
2712
|
+
"internalType": "address"
|
|
2713
|
+
},
|
|
2714
|
+
{
|
|
2715
|
+
"name": "nonce",
|
|
2716
|
+
"type": "uint256",
|
|
2717
|
+
"internalType": "uint256"
|
|
2718
|
+
}
|
|
2719
|
+
],
|
|
2720
|
+
"outputs": [
|
|
2721
|
+
{
|
|
2722
|
+
"name": "",
|
|
2723
|
+
"type": "address",
|
|
2724
|
+
"internalType": "address"
|
|
2725
|
+
}
|
|
2726
|
+
],
|
|
2727
|
+
"stateMutability": "view"
|
|
2728
|
+
},
|
|
2404
2729
|
{
|
|
2405
2730
|
"type": "function",
|
|
2406
2731
|
"name": "renounceOwnership",
|
|
2407
2732
|
"inputs": [],
|
|
2408
2733
|
"outputs": [],
|
|
2409
|
-
"stateMutability": "
|
|
2734
|
+
"stateMutability": "pure"
|
|
2410
2735
|
},
|
|
2411
2736
|
{
|
|
2412
2737
|
"type": "function",
|
|
@@ -2503,6 +2828,27 @@ var AxonVaultFactoryAbi = [
|
|
|
2503
2828
|
],
|
|
2504
2829
|
"anonymous": false
|
|
2505
2830
|
},
|
|
2831
|
+
{
|
|
2832
|
+
"type": "error",
|
|
2833
|
+
"name": "FailedDeployment",
|
|
2834
|
+
"inputs": []
|
|
2835
|
+
},
|
|
2836
|
+
{
|
|
2837
|
+
"type": "error",
|
|
2838
|
+
"name": "InsufficientBalance",
|
|
2839
|
+
"inputs": [
|
|
2840
|
+
{
|
|
2841
|
+
"name": "balance",
|
|
2842
|
+
"type": "uint256",
|
|
2843
|
+
"internalType": "uint256"
|
|
2844
|
+
},
|
|
2845
|
+
{
|
|
2846
|
+
"name": "needed",
|
|
2847
|
+
"type": "uint256",
|
|
2848
|
+
"internalType": "uint256"
|
|
2849
|
+
}
|
|
2850
|
+
]
|
|
2851
|
+
},
|
|
2506
2852
|
{
|
|
2507
2853
|
"type": "error",
|
|
2508
2854
|
"name": "OwnableInvalidOwner",
|
|
@@ -3046,6 +3392,16 @@ async function deployVault(walletClient, publicClient, relayerUrl) {
|
|
|
3046
3392
|
}
|
|
3047
3393
|
throw new Error("VaultDeployed event not found in transaction receipt");
|
|
3048
3394
|
}
|
|
3395
|
+
async function predictVaultAddress(publicClient, owner, nonce, relayerUrl) {
|
|
3396
|
+
const chainId = await publicClient.getChainId();
|
|
3397
|
+
const factoryAddress = await getFactoryAddress(chainId, relayerUrl);
|
|
3398
|
+
return publicClient.readContract({
|
|
3399
|
+
address: factoryAddress,
|
|
3400
|
+
abi: AxonVaultFactoryAbi,
|
|
3401
|
+
functionName: "predictVaultAddress",
|
|
3402
|
+
args: [owner, BigInt(nonce)]
|
|
3403
|
+
});
|
|
3404
|
+
}
|
|
3049
3405
|
async function addBot(walletClient, publicClient, vaultAddress, botAddress, config) {
|
|
3050
3406
|
if (!walletClient.account) {
|
|
3051
3407
|
throw new Error("walletClient has no account attached");
|
|
@@ -3343,6 +3699,19 @@ async function signPermit2WitnessTransfer(privateKey, chainId, permit) {
|
|
|
3343
3699
|
}
|
|
3344
3700
|
|
|
3345
3701
|
// src/client.ts
|
|
3702
|
+
var BURN_ADDRESSES = /* @__PURE__ */ new Set([
|
|
3703
|
+
"0x0000000000000000000000000000000000000000",
|
|
3704
|
+
"0x0000000000000000000000000000000000000001",
|
|
3705
|
+
"0x000000000000000000000000000000000000dead",
|
|
3706
|
+
"0xdead000000000000000000000000000000000000",
|
|
3707
|
+
"0xdeaddeaddeaddeaddeaddeaddeaddeaddead0000",
|
|
3708
|
+
"0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee"
|
|
3709
|
+
]);
|
|
3710
|
+
function _rejectBurnAddress(address, label) {
|
|
3711
|
+
if (BURN_ADDRESSES.has(address.toLowerCase())) {
|
|
3712
|
+
throw new Error(`${label} cannot be a burn/dead address (${address})`);
|
|
3713
|
+
}
|
|
3714
|
+
}
|
|
3346
3715
|
var AxonClient = class {
|
|
3347
3716
|
constructor(config) {
|
|
3348
3717
|
// ============================================================================
|
|
@@ -3770,9 +4139,7 @@ Timestamp: ${timestamp}`;
|
|
|
3770
4139
|
return "0x0000000000000000000000000000000000000000000000000000000000000000";
|
|
3771
4140
|
}
|
|
3772
4141
|
_buildPaymentIntent(input) {
|
|
3773
|
-
|
|
3774
|
-
throw new Error("Payment recipient cannot be the zero address");
|
|
3775
|
-
}
|
|
4142
|
+
_rejectBurnAddress(input.to, "Payment recipient");
|
|
3776
4143
|
return {
|
|
3777
4144
|
bot: this.botAddress,
|
|
3778
4145
|
to: input.to,
|
|
@@ -3783,12 +4150,14 @@ Timestamp: ${timestamp}`;
|
|
|
3783
4150
|
};
|
|
3784
4151
|
}
|
|
3785
4152
|
_buildExecuteIntent(input) {
|
|
4153
|
+
_rejectBurnAddress(input.protocol, "Protocol address");
|
|
3786
4154
|
return {
|
|
3787
4155
|
bot: this.botAddress,
|
|
3788
4156
|
protocol: input.protocol,
|
|
3789
4157
|
calldataHash: keccak256(input.callData),
|
|
3790
4158
|
token: resolveToken(input.token, this.chainId),
|
|
3791
4159
|
amount: parseAmount(input.amount, input.token, this.chainId),
|
|
4160
|
+
value: input.value ?? 0n,
|
|
3792
4161
|
deadline: input.deadline ?? this._defaultDeadline(),
|
|
3793
4162
|
ref: this._resolveRef(input.memo, input.ref)
|
|
3794
4163
|
};
|
|
@@ -3841,6 +4210,7 @@ Timestamp: ${timestamp}`;
|
|
|
3841
4210
|
calldataHash: intent.calldataHash,
|
|
3842
4211
|
token: intent.token,
|
|
3843
4212
|
amount: intent.amount.toString(),
|
|
4213
|
+
value: intent.value.toString(),
|
|
3844
4214
|
deadline: intent.deadline.toString(),
|
|
3845
4215
|
ref: intent.ref,
|
|
3846
4216
|
signature,
|
|
@@ -4073,6 +4443,38 @@ var AxonRegistryAbi = [
|
|
|
4073
4443
|
"outputs": [],
|
|
4074
4444
|
"stateMutability": "nonpayable"
|
|
4075
4445
|
},
|
|
4446
|
+
{
|
|
4447
|
+
"type": "function",
|
|
4448
|
+
"name": "approveProtocol",
|
|
4449
|
+
"inputs": [
|
|
4450
|
+
{
|
|
4451
|
+
"name": "protocol",
|
|
4452
|
+
"type": "address",
|
|
4453
|
+
"internalType": "address"
|
|
4454
|
+
}
|
|
4455
|
+
],
|
|
4456
|
+
"outputs": [],
|
|
4457
|
+
"stateMutability": "nonpayable"
|
|
4458
|
+
},
|
|
4459
|
+
{
|
|
4460
|
+
"type": "function",
|
|
4461
|
+
"name": "isApprovedProtocol",
|
|
4462
|
+
"inputs": [
|
|
4463
|
+
{
|
|
4464
|
+
"name": "protocol",
|
|
4465
|
+
"type": "address",
|
|
4466
|
+
"internalType": "address"
|
|
4467
|
+
}
|
|
4468
|
+
],
|
|
4469
|
+
"outputs": [
|
|
4470
|
+
{
|
|
4471
|
+
"name": "",
|
|
4472
|
+
"type": "bool",
|
|
4473
|
+
"internalType": "bool"
|
|
4474
|
+
}
|
|
4475
|
+
],
|
|
4476
|
+
"stateMutability": "view"
|
|
4477
|
+
},
|
|
4076
4478
|
{
|
|
4077
4479
|
"type": "function",
|
|
4078
4480
|
"name": "isApprovedSwapRouter",
|
|
@@ -4187,7 +4589,7 @@ var AxonRegistryAbi = [
|
|
|
4187
4589
|
"name": "renounceOwnership",
|
|
4188
4590
|
"inputs": [],
|
|
4189
4591
|
"outputs": [],
|
|
4190
|
-
"stateMutability": "
|
|
4592
|
+
"stateMutability": "pure"
|
|
4191
4593
|
},
|
|
4192
4594
|
{
|
|
4193
4595
|
"type": "function",
|
|
@@ -4202,6 +4604,19 @@ var AxonRegistryAbi = [
|
|
|
4202
4604
|
"outputs": [],
|
|
4203
4605
|
"stateMutability": "nonpayable"
|
|
4204
4606
|
},
|
|
4607
|
+
{
|
|
4608
|
+
"type": "function",
|
|
4609
|
+
"name": "revokeProtocol",
|
|
4610
|
+
"inputs": [
|
|
4611
|
+
{
|
|
4612
|
+
"name": "protocol",
|
|
4613
|
+
"type": "address",
|
|
4614
|
+
"internalType": "address"
|
|
4615
|
+
}
|
|
4616
|
+
],
|
|
4617
|
+
"outputs": [],
|
|
4618
|
+
"stateMutability": "nonpayable"
|
|
4619
|
+
},
|
|
4205
4620
|
{
|
|
4206
4621
|
"type": "function",
|
|
4207
4622
|
"name": "setOracleConfig",
|
|
@@ -4366,6 +4781,32 @@ var AxonRegistryAbi = [
|
|
|
4366
4781
|
],
|
|
4367
4782
|
"anonymous": false
|
|
4368
4783
|
},
|
|
4784
|
+
{
|
|
4785
|
+
"type": "event",
|
|
4786
|
+
"name": "ProtocolApproved",
|
|
4787
|
+
"inputs": [
|
|
4788
|
+
{
|
|
4789
|
+
"name": "protocol",
|
|
4790
|
+
"type": "address",
|
|
4791
|
+
"indexed": true,
|
|
4792
|
+
"internalType": "address"
|
|
4793
|
+
}
|
|
4794
|
+
],
|
|
4795
|
+
"anonymous": false
|
|
4796
|
+
},
|
|
4797
|
+
{
|
|
4798
|
+
"type": "event",
|
|
4799
|
+
"name": "ProtocolRevoked",
|
|
4800
|
+
"inputs": [
|
|
4801
|
+
{
|
|
4802
|
+
"name": "protocol",
|
|
4803
|
+
"type": "address",
|
|
4804
|
+
"indexed": true,
|
|
4805
|
+
"internalType": "address"
|
|
4806
|
+
}
|
|
4807
|
+
],
|
|
4808
|
+
"anonymous": false
|
|
4809
|
+
},
|
|
4369
4810
|
{
|
|
4370
4811
|
"type": "event",
|
|
4371
4812
|
"name": "RelayerAdded",
|
|
@@ -4467,6 +4908,6 @@ var AxonRegistryAbi = [
|
|
|
4467
4908
|
}
|
|
4468
4909
|
];
|
|
4469
4910
|
|
|
4470
|
-
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 };
|
|
4911
|
+
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, predictVaultAddress, randomNonce, randomPermit2Nonce, removeBot, resolveToken, resolveTokenDecimals, signExecuteIntent, signPayment, signPermit2WitnessTransfer, signSwapIntent, signTransferWithAuthorization, toBotConfigParams, updateBotConfig };
|
|
4471
4912
|
//# sourceMappingURL=index.js.map
|
|
4472
4913
|
//# sourceMappingURL=index.js.map
|