@axonfi/sdk 0.3.2 → 0.3.4
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/README.md +7 -7
- package/dist/index.cjs +16 -42
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +9 -33
- package/dist/index.d.ts +9 -33
- package/dist/index.js +17 -42
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -176,13 +176,13 @@ Payments resolve through one of three paths:
|
|
|
176
176
|
|
|
177
177
|
## Chains
|
|
178
178
|
|
|
179
|
-
| Chain | ID | Status
|
|
180
|
-
| ------------ | ----- |
|
|
181
|
-
| Base
|
|
182
|
-
|
|
|
183
|
-
|
|
|
184
|
-
|
|
|
185
|
-
|
|
|
179
|
+
| Chain | ID | Status |
|
|
180
|
+
| ------------ | ----- | ----------- |
|
|
181
|
+
| Base Sepolia | 84532 | Live |
|
|
182
|
+
| Base | 8453 | Coming soon |
|
|
183
|
+
| Arbitrum One | 42161 | Coming soon |
|
|
184
|
+
| Optimism | 10 | Coming soon |
|
|
185
|
+
| Polygon PoS | 137 | Coming soon |
|
|
186
186
|
|
|
187
187
|
## Documentation
|
|
188
188
|
|
package/dist/index.cjs
CHANGED
|
@@ -264,11 +264,6 @@ var AxonVaultAbi = [
|
|
|
264
264
|
"name": "_axonRegistry",
|
|
265
265
|
"type": "address",
|
|
266
266
|
"internalType": "address"
|
|
267
|
-
},
|
|
268
|
-
{
|
|
269
|
-
"name": "_trackUsedIntents",
|
|
270
|
-
"type": "bool",
|
|
271
|
-
"internalType": "bool"
|
|
272
267
|
}
|
|
273
268
|
],
|
|
274
269
|
"stateMutability": "nonpayable"
|
|
@@ -1330,19 +1325,6 @@ var AxonVaultAbi = [
|
|
|
1330
1325
|
"outputs": [],
|
|
1331
1326
|
"stateMutability": "nonpayable"
|
|
1332
1327
|
},
|
|
1333
|
-
{
|
|
1334
|
-
"type": "function",
|
|
1335
|
-
"name": "trackUsedIntents",
|
|
1336
|
-
"inputs": [],
|
|
1337
|
-
"outputs": [
|
|
1338
|
-
{
|
|
1339
|
-
"name": "",
|
|
1340
|
-
"type": "bool",
|
|
1341
|
-
"internalType": "bool"
|
|
1342
|
-
}
|
|
1343
|
-
],
|
|
1344
|
-
"stateMutability": "view"
|
|
1345
|
-
},
|
|
1346
1328
|
{
|
|
1347
1329
|
"type": "function",
|
|
1348
1330
|
"name": "transferOwnership",
|
|
@@ -2242,6 +2224,11 @@ var AxonVaultAbi = [
|
|
|
2242
2224
|
}
|
|
2243
2225
|
]
|
|
2244
2226
|
},
|
|
2227
|
+
{
|
|
2228
|
+
"type": "error",
|
|
2229
|
+
"name": "SameTokenSwap",
|
|
2230
|
+
"inputs": []
|
|
2231
|
+
},
|
|
2245
2232
|
{
|
|
2246
2233
|
"type": "error",
|
|
2247
2234
|
"name": "SelfPayment",
|
|
@@ -2350,13 +2337,7 @@ var AxonVaultFactoryAbi = [
|
|
|
2350
2337
|
{
|
|
2351
2338
|
"type": "function",
|
|
2352
2339
|
"name": "deployVault",
|
|
2353
|
-
"inputs": [
|
|
2354
|
-
{
|
|
2355
|
-
"name": "trackUsedIntents",
|
|
2356
|
-
"type": "bool",
|
|
2357
|
-
"internalType": "bool"
|
|
2358
|
-
}
|
|
2359
|
-
],
|
|
2340
|
+
"inputs": [],
|
|
2360
2341
|
"outputs": [
|
|
2361
2342
|
{
|
|
2362
2343
|
"name": "vault",
|
|
@@ -2533,12 +2514,6 @@ var AxonVaultFactoryAbi = [
|
|
|
2533
2514
|
"type": "address",
|
|
2534
2515
|
"indexed": false,
|
|
2535
2516
|
"internalType": "address"
|
|
2536
|
-
},
|
|
2537
|
-
{
|
|
2538
|
-
"name": "trackUsedIntents",
|
|
2539
|
-
"type": "bool",
|
|
2540
|
-
"indexed": false,
|
|
2541
|
-
"internalType": "bool"
|
|
2542
2517
|
}
|
|
2543
2518
|
],
|
|
2544
2519
|
"anonymous": false
|
|
@@ -2691,13 +2666,6 @@ async function getVaultOperator(publicClient, vaultAddress) {
|
|
|
2691
2666
|
functionName: "operator"
|
|
2692
2667
|
});
|
|
2693
2668
|
}
|
|
2694
|
-
async function getTrackUsedIntents(publicClient, vaultAddress) {
|
|
2695
|
-
return publicClient.readContract({
|
|
2696
|
-
address: vaultAddress,
|
|
2697
|
-
abi: AxonVaultAbi,
|
|
2698
|
-
functionName: "trackUsedIntents"
|
|
2699
|
-
});
|
|
2700
|
-
}
|
|
2701
2669
|
async function isDestinationAllowed(publicClient, vaultAddress, botAddress, destination) {
|
|
2702
2670
|
const isBlacklisted = await publicClient.readContract({
|
|
2703
2671
|
address: vaultAddress,
|
|
@@ -2759,7 +2727,7 @@ async function isRebalanceTokenWhitelisted(publicClient, vaultAddress, token) {
|
|
|
2759
2727
|
args: [token]
|
|
2760
2728
|
});
|
|
2761
2729
|
}
|
|
2762
|
-
async function deployVault(walletClient, publicClient, factoryAddress
|
|
2730
|
+
async function deployVault(walletClient, publicClient, factoryAddress) {
|
|
2763
2731
|
if (!walletClient.account) {
|
|
2764
2732
|
throw new Error("walletClient has no account attached");
|
|
2765
2733
|
}
|
|
@@ -2767,7 +2735,7 @@ async function deployVault(walletClient, publicClient, factoryAddress, trackUsed
|
|
|
2767
2735
|
address: factoryAddress,
|
|
2768
2736
|
abi: AxonVaultFactoryAbi,
|
|
2769
2737
|
functionName: "deployVault",
|
|
2770
|
-
args: [
|
|
2738
|
+
args: [],
|
|
2771
2739
|
account: walletClient.account,
|
|
2772
2740
|
chain: walletClient.chain ?? null
|
|
2773
2741
|
});
|
|
@@ -2825,6 +2793,7 @@ var KNOWN_TOKENS = {
|
|
|
2825
2793
|
decimals: 6,
|
|
2826
2794
|
addresses: {
|
|
2827
2795
|
8453: "0xfde4C96c8593536E31F229EA8f37b2ADa2699bb2",
|
|
2796
|
+
84532: "0x323e78f944A9a1FcF3a10efcC5319DBb0bB6e673",
|
|
2828
2797
|
42161: "0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9"
|
|
2829
2798
|
}
|
|
2830
2799
|
},
|
|
@@ -2995,6 +2964,9 @@ function getTokenSymbolByAddress(address) {
|
|
|
2995
2964
|
}
|
|
2996
2965
|
function resolveToken(token, chainId) {
|
|
2997
2966
|
if (typeof token === "string" && token.startsWith("0x")) {
|
|
2967
|
+
if (token === "0x0000000000000000000000000000000000000000") {
|
|
2968
|
+
throw new Error("Token address cannot be the zero address");
|
|
2969
|
+
}
|
|
2998
2970
|
return token;
|
|
2999
2971
|
}
|
|
3000
2972
|
const entry = KNOWN_TOKENS[token];
|
|
@@ -3178,7 +3150,7 @@ var AxonClient = class {
|
|
|
3178
3150
|
// ============================================================================
|
|
3179
3151
|
// getVaultInfo() — via relayer
|
|
3180
3152
|
// ============================================================================
|
|
3181
|
-
/** Returns high-level vault info (owner, operator, paused, version
|
|
3153
|
+
/** Returns high-level vault info (owner, operator, paused, version) via relayer. */
|
|
3182
3154
|
async getVaultInfo() {
|
|
3183
3155
|
const path = RELAYER_API.vaultInfo(this.vaultAddress, this.chainId);
|
|
3184
3156
|
return this._get(path);
|
|
@@ -3316,6 +3288,9 @@ Timestamp: ${timestamp}`;
|
|
|
3316
3288
|
return "0x0000000000000000000000000000000000000000000000000000000000000000";
|
|
3317
3289
|
}
|
|
3318
3290
|
_buildPaymentIntent(input) {
|
|
3291
|
+
if (input.to === "0x0000000000000000000000000000000000000000") {
|
|
3292
|
+
throw new Error("Payment recipient cannot be the zero address");
|
|
3293
|
+
}
|
|
3319
3294
|
return {
|
|
3320
3295
|
bot: this.botAddress,
|
|
3321
3296
|
to: input.to,
|
|
@@ -3960,7 +3935,6 @@ exports.getKnownTokensForChain = getKnownTokensForChain;
|
|
|
3960
3935
|
exports.getOperatorCeilings = getOperatorCeilings;
|
|
3961
3936
|
exports.getRebalanceTokenCount = getRebalanceTokenCount;
|
|
3962
3937
|
exports.getTokenSymbolByAddress = getTokenSymbolByAddress;
|
|
3963
|
-
exports.getTrackUsedIntents = getTrackUsedIntents;
|
|
3964
3938
|
exports.getVaultOperator = getVaultOperator;
|
|
3965
3939
|
exports.getVaultOwner = getVaultOwner;
|
|
3966
3940
|
exports.getVaultVersion = getVaultVersion;
|