@paraspell/swap 14.2.2 → 14.3.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.ts +3 -4
- package/dist/index.mjs +269 -647
- package/package.json +14 -14
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { createChainClient as createChainClient$1, registerSwapExtension } from '@paraspell/sdk';
|
|
2
|
-
import { UnsupportedOperationError, assertCurrencyCore, dryRun, getDryRunError, DryRunFailedError, isConfig, getNativeAssets, RoutingResolutionError, findAssetInfoById, getOtherAssets, getChainProviders, parseUnits, getNativeAssetSymbol, padValueBy, formatUnits as formatUnits$1, AmountTooLowError, getBalance, localizeLocation, getAssets, Parents, isSymbolMatch, getParaId, UnableToComputeError, findNativeAssetInfoOrThrow, InvalidCurrencyError, findAssetInfoOrThrow, findAssetInfoByLoc, isSymbolSpecifier, findBestMatches, findAssetInfoBySymbol,
|
|
1
|
+
import { createChainClient as createChainClient$1, getPaymentInfo, registerSwapExtension } from '@paraspell/sdk';
|
|
2
|
+
import { UnsupportedOperationError, assertCurrencyCore, dryRun, getDryRunError, DryRunFailedError, isConfig, getNativeAssets, RoutingResolutionError, findAssetInfoById, getOtherAssets, getChainProviders, parseUnits, getNativeAssetSymbol, padValueBy, formatUnits as formatUnits$1, AmountTooLowError, getBalance, localizeLocation, getAssets, Parents, isSymbolMatch, getParaId, UnableToComputeError, findNativeAssetInfoOrThrow, InvalidCurrencyError, findAssetInfoOrThrow, findAssetInfoByLoc, isSymbolSpecifier, findBestMatches, findAssetInfoBySymbol, getSupportedAssetsImpl, isAssetEqual, findAssetInfoOnDestImpl, normalizeExchange, EXCHANGE_CHAINS, deepEqual, reverseTransformLocation, getAssetsImpl, ScenarioNotSupportedError, applyDecimalAbstraction, findAssetInfo, Builder, isChainEvm, convertBuilderConfig, handleSwapExecuteTransfer, getXcmFee, getOriginXcmFee as getOriginXcmFee$1, InvalidAddressError, MissingParameterError, BatchMode, createChainClient as createChainClient$2, getExistentialDepositOrThrow, buildHopInfo, getRelayChainSymbol, aggregateHopFees, buildDestInfo, buildOriginInfo } from '@paraspell/sdk-core';
|
|
3
3
|
import { toHex } from 'polkadot-api/utils';
|
|
4
4
|
import 'polkadot-api';
|
|
5
5
|
import { Wallet } from '@acala-network/sdk';
|
|
@@ -328,6 +328,23 @@ function _regeneratorDefine(e, r, n, t) {
|
|
|
328
328
|
}) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2));
|
|
329
329
|
}, _regeneratorDefine(e, r, n, t);
|
|
330
330
|
}
|
|
331
|
+
function _regeneratorValues(e) {
|
|
332
|
+
if (null != e) {
|
|
333
|
+
var t = e["function" == typeof Symbol && Symbol.iterator || "@@iterator"],
|
|
334
|
+
r = 0;
|
|
335
|
+
if (t) return t.call(e);
|
|
336
|
+
if ("function" == typeof e.next) return e;
|
|
337
|
+
if (!isNaN(e.length)) return {
|
|
338
|
+
next: function () {
|
|
339
|
+
return e && r >= e.length && (e = void 0), {
|
|
340
|
+
value: e && e[r++],
|
|
341
|
+
done: !e
|
|
342
|
+
};
|
|
343
|
+
}
|
|
344
|
+
};
|
|
345
|
+
}
|
|
346
|
+
throw new TypeError(typeof e + " is not iterable");
|
|
347
|
+
}
|
|
331
348
|
function _setPrototypeOf(t, e) {
|
|
332
349
|
return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) {
|
|
333
350
|
return t.__proto__ = e, t;
|
|
@@ -451,7 +468,7 @@ var calculateTxFeePjs = /*#__PURE__*/function () {
|
|
|
451
468
|
}();
|
|
452
469
|
|
|
453
470
|
var isPapiTransaction = function isPapiTransaction(tx) {
|
|
454
|
-
return _typeof(tx) === 'object' && tx !== null && 'getEncodedData' in tx && typeof tx.getEncodedData === 'function' && '
|
|
471
|
+
return _typeof(tx) === 'object' && tx !== null && 'getEncodedData' in tx && typeof tx.getEncodedData === 'function' && 'createSubmitAndWatch' in tx && typeof tx.createSubmitAndWatch === 'function';
|
|
455
472
|
};
|
|
456
473
|
|
|
457
474
|
var isPjsExtrinsic = function isPjsExtrinsic(tx) {
|
|
@@ -1763,22 +1780,6 @@ var Hydration = {
|
|
|
1763
1780
|
]
|
|
1764
1781
|
}
|
|
1765
1782
|
},
|
|
1766
|
-
{
|
|
1767
|
-
parents: 1,
|
|
1768
|
-
interior: {
|
|
1769
|
-
X2: [
|
|
1770
|
-
{
|
|
1771
|
-
Parachain: 2000
|
|
1772
|
-
},
|
|
1773
|
-
{
|
|
1774
|
-
GeneralKey: {
|
|
1775
|
-
length: 21,
|
|
1776
|
-
data: "0x025a4d6acdc4e3e5ab15717f407afe957f7a2425780000000000000000000000"
|
|
1777
|
-
}
|
|
1778
|
-
}
|
|
1779
|
-
]
|
|
1780
|
-
}
|
|
1781
|
-
},
|
|
1782
1783
|
{
|
|
1783
1784
|
parents: 1,
|
|
1784
1785
|
interior: {
|
|
@@ -1804,32 +1805,6 @@ var Hydration = {
|
|
|
1804
1805
|
]
|
|
1805
1806
|
}
|
|
1806
1807
|
},
|
|
1807
|
-
{
|
|
1808
|
-
parents: 1,
|
|
1809
|
-
interior: {
|
|
1810
|
-
X1: [
|
|
1811
|
-
{
|
|
1812
|
-
Parachain: 2086
|
|
1813
|
-
}
|
|
1814
|
-
]
|
|
1815
|
-
}
|
|
1816
|
-
},
|
|
1817
|
-
{
|
|
1818
|
-
parents: 1,
|
|
1819
|
-
interior: {
|
|
1820
|
-
X2: [
|
|
1821
|
-
{
|
|
1822
|
-
Parachain: 2034
|
|
1823
|
-
},
|
|
1824
|
-
{
|
|
1825
|
-
AccountKey20: {
|
|
1826
|
-
network: null,
|
|
1827
|
-
key: "0x6b9ac524ec8f08c49ec80176b138d16eb461c3d8"
|
|
1828
|
-
}
|
|
1829
|
-
}
|
|
1830
|
-
]
|
|
1831
|
-
}
|
|
1832
|
-
},
|
|
1833
1808
|
{
|
|
1834
1809
|
parents: 1,
|
|
1835
1810
|
interior: {
|
|
@@ -1855,22 +1830,6 @@ var Hydration = {
|
|
|
1855
1830
|
]
|
|
1856
1831
|
}
|
|
1857
1832
|
},
|
|
1858
|
-
{
|
|
1859
|
-
parents: 1,
|
|
1860
|
-
interior: {
|
|
1861
|
-
X3: [
|
|
1862
|
-
{
|
|
1863
|
-
Parachain: 2094
|
|
1864
|
-
},
|
|
1865
|
-
{
|
|
1866
|
-
PalletInstance: 53
|
|
1867
|
-
},
|
|
1868
|
-
{
|
|
1869
|
-
GeneralIndex: 2
|
|
1870
|
-
}
|
|
1871
|
-
]
|
|
1872
|
-
}
|
|
1873
|
-
},
|
|
1874
1833
|
{
|
|
1875
1834
|
parents: 1,
|
|
1876
1835
|
interior: {
|
|
@@ -1955,19 +1914,6 @@ var Hydration = {
|
|
|
1955
1914
|
]
|
|
1956
1915
|
}
|
|
1957
1916
|
},
|
|
1958
|
-
{
|
|
1959
|
-
parents: 1,
|
|
1960
|
-
interior: {
|
|
1961
|
-
X2: [
|
|
1962
|
-
{
|
|
1963
|
-
Parachain: 2004
|
|
1964
|
-
},
|
|
1965
|
-
{
|
|
1966
|
-
PalletInstance: 10
|
|
1967
|
-
}
|
|
1968
|
-
]
|
|
1969
|
-
}
|
|
1970
|
-
},
|
|
1971
1917
|
{
|
|
1972
1918
|
parents: 1,
|
|
1973
1919
|
interior: {
|
|
@@ -2052,22 +1998,6 @@ var Hydration = {
|
|
|
2052
1998
|
]
|
|
2053
1999
|
}
|
|
2054
2000
|
},
|
|
2055
|
-
{
|
|
2056
|
-
parents: 1,
|
|
2057
|
-
interior: {
|
|
2058
|
-
X2: [
|
|
2059
|
-
{
|
|
2060
|
-
Parachain: 2030
|
|
2061
|
-
},
|
|
2062
|
-
{
|
|
2063
|
-
GeneralKey: {
|
|
2064
|
-
length: 2,
|
|
2065
|
-
data: "0x0001000000000000000000000000000000000000000000000000000000000000"
|
|
2066
|
-
}
|
|
2067
|
-
}
|
|
2068
|
-
]
|
|
2069
|
-
}
|
|
2070
|
-
},
|
|
2071
2001
|
{
|
|
2072
2002
|
parents: 1,
|
|
2073
2003
|
interior: {
|
|
@@ -2084,22 +2014,6 @@ var Hydration = {
|
|
|
2084
2014
|
]
|
|
2085
2015
|
}
|
|
2086
2016
|
},
|
|
2087
|
-
{
|
|
2088
|
-
parents: 1,
|
|
2089
|
-
interior: {
|
|
2090
|
-
X2: [
|
|
2091
|
-
{
|
|
2092
|
-
Parachain: 2000
|
|
2093
|
-
},
|
|
2094
|
-
{
|
|
2095
|
-
GeneralKey: {
|
|
2096
|
-
length: 21,
|
|
2097
|
-
data: "0x02f4c723e61709d90f89939c1852f516e373d418a80000000000000000000000"
|
|
2098
|
-
}
|
|
2099
|
-
}
|
|
2100
|
-
]
|
|
2101
|
-
}
|
|
2102
|
-
},
|
|
2103
2017
|
{
|
|
2104
2018
|
parents: 2,
|
|
2105
2019
|
interior: {
|
|
@@ -2214,19 +2128,6 @@ var Hydration = {
|
|
|
2214
2128
|
]
|
|
2215
2129
|
}
|
|
2216
2130
|
},
|
|
2217
|
-
{
|
|
2218
|
-
parents: 1,
|
|
2219
|
-
interior: {
|
|
2220
|
-
X2: [
|
|
2221
|
-
{
|
|
2222
|
-
Parachain: 2046
|
|
2223
|
-
},
|
|
2224
|
-
{
|
|
2225
|
-
PalletInstance: 5
|
|
2226
|
-
}
|
|
2227
|
-
]
|
|
2228
|
-
}
|
|
2229
|
-
},
|
|
2230
2131
|
{
|
|
2231
2132
|
parents: 1,
|
|
2232
2133
|
interior: {
|
|
@@ -2243,26 +2144,6 @@ var Hydration = {
|
|
|
2243
2144
|
]
|
|
2244
2145
|
}
|
|
2245
2146
|
},
|
|
2246
|
-
{
|
|
2247
|
-
parents: 2,
|
|
2248
|
-
interior: {
|
|
2249
|
-
X2: [
|
|
2250
|
-
{
|
|
2251
|
-
GlobalConsensus: {
|
|
2252
|
-
Ethereum: {
|
|
2253
|
-
chainId: 1
|
|
2254
|
-
}
|
|
2255
|
-
}
|
|
2256
|
-
},
|
|
2257
|
-
{
|
|
2258
|
-
AccountKey20: {
|
|
2259
|
-
network: null,
|
|
2260
|
-
key: "0xcccccccccc33d538dbc2ee4feab0a7a1ff4e8a94"
|
|
2261
|
-
}
|
|
2262
|
-
}
|
|
2263
|
-
]
|
|
2264
|
-
}
|
|
2265
|
-
},
|
|
2266
2147
|
{
|
|
2267
2148
|
parents: 1,
|
|
2268
2149
|
interior: {
|
|
@@ -2365,35 +2246,6 @@ var Hydration = {
|
|
|
2365
2246
|
]
|
|
2366
2247
|
}
|
|
2367
2248
|
},
|
|
2368
|
-
{
|
|
2369
|
-
parents: 1,
|
|
2370
|
-
interior: {
|
|
2371
|
-
X2: [
|
|
2372
|
-
{
|
|
2373
|
-
Parachain: 2000
|
|
2374
|
-
},
|
|
2375
|
-
{
|
|
2376
|
-
GeneralKey: {
|
|
2377
|
-
length: 21,
|
|
2378
|
-
data: "0x0254a37a01cd75b616d63e0ab665bffdb0143c52ae0000000000000000000000"
|
|
2379
|
-
}
|
|
2380
|
-
}
|
|
2381
|
-
]
|
|
2382
|
-
}
|
|
2383
|
-
},
|
|
2384
|
-
{
|
|
2385
|
-
parents: 1,
|
|
2386
|
-
interior: {
|
|
2387
|
-
X2: [
|
|
2388
|
-
{
|
|
2389
|
-
Parachain: 3417
|
|
2390
|
-
},
|
|
2391
|
-
{
|
|
2392
|
-
GeneralIndex: 0
|
|
2393
|
-
}
|
|
2394
|
-
]
|
|
2395
|
-
}
|
|
2396
|
-
},
|
|
2397
2249
|
{
|
|
2398
2250
|
parents: 1,
|
|
2399
2251
|
interior: {
|
|
@@ -2497,52 +2349,6 @@ var Hydration = {
|
|
|
2497
2349
|
]
|
|
2498
2350
|
}
|
|
2499
2351
|
},
|
|
2500
|
-
{
|
|
2501
|
-
parents: 1,
|
|
2502
|
-
interior: {
|
|
2503
|
-
X2: [
|
|
2504
|
-
{
|
|
2505
|
-
Parachain: 2034
|
|
2506
|
-
},
|
|
2507
|
-
{
|
|
2508
|
-
AccountKey20: {
|
|
2509
|
-
network: null,
|
|
2510
|
-
key: "0x6a21891db0940491603f3cca0a9f4dba4c6e810c"
|
|
2511
|
-
}
|
|
2512
|
-
}
|
|
2513
|
-
]
|
|
2514
|
-
}
|
|
2515
|
-
},
|
|
2516
|
-
{
|
|
2517
|
-
parents: 1,
|
|
2518
|
-
interior: {
|
|
2519
|
-
X1: [
|
|
2520
|
-
{
|
|
2521
|
-
Parachain: 3344
|
|
2522
|
-
}
|
|
2523
|
-
]
|
|
2524
|
-
}
|
|
2525
|
-
},
|
|
2526
|
-
{
|
|
2527
|
-
parents: 2,
|
|
2528
|
-
interior: {
|
|
2529
|
-
X2: [
|
|
2530
|
-
{
|
|
2531
|
-
GlobalConsensus: {
|
|
2532
|
-
Ethereum: {
|
|
2533
|
-
chainId: 1
|
|
2534
|
-
}
|
|
2535
|
-
}
|
|
2536
|
-
},
|
|
2537
|
-
{
|
|
2538
|
-
AccountKey20: {
|
|
2539
|
-
network: null,
|
|
2540
|
-
key: "0x1abaea1f7c830bd89acc67ec4af516284b1bc33c"
|
|
2541
|
-
}
|
|
2542
|
-
}
|
|
2543
|
-
]
|
|
2544
|
-
}
|
|
2545
|
-
},
|
|
2546
2352
|
{
|
|
2547
2353
|
parents: 1,
|
|
2548
2354
|
interior: {
|
|
@@ -2624,22 +2430,6 @@ var Hydration = {
|
|
|
2624
2430
|
]
|
|
2625
2431
|
}
|
|
2626
2432
|
},
|
|
2627
|
-
{
|
|
2628
|
-
parents: 1,
|
|
2629
|
-
interior: {
|
|
2630
|
-
X2: [
|
|
2631
|
-
{
|
|
2632
|
-
Parachain: 2000
|
|
2633
|
-
},
|
|
2634
|
-
{
|
|
2635
|
-
GeneralKey: {
|
|
2636
|
-
length: 21,
|
|
2637
|
-
data: "0x0207df96d1341a7d16ba1ad431e2c847d978bc2bce0000000000000000000000"
|
|
2638
|
-
}
|
|
2639
|
-
}
|
|
2640
|
-
]
|
|
2641
|
-
}
|
|
2642
|
-
},
|
|
2643
2433
|
{
|
|
2644
2434
|
parents: 2,
|
|
2645
2435
|
interior: {
|
|
@@ -2715,26 +2505,6 @@ var Hydration = {
|
|
|
2715
2505
|
]
|
|
2716
2506
|
}
|
|
2717
2507
|
},
|
|
2718
|
-
{
|
|
2719
|
-
parents: 2,
|
|
2720
|
-
interior: {
|
|
2721
|
-
X2: [
|
|
2722
|
-
{
|
|
2723
|
-
GlobalConsensus: {
|
|
2724
|
-
Ethereum: {
|
|
2725
|
-
chainId: 1
|
|
2726
|
-
}
|
|
2727
|
-
}
|
|
2728
|
-
},
|
|
2729
|
-
{
|
|
2730
|
-
AccountKey20: {
|
|
2731
|
-
network: null,
|
|
2732
|
-
key: "0x2260fac5e5542a773aa44fbcfedf7c193bc2c599"
|
|
2733
|
-
}
|
|
2734
|
-
}
|
|
2735
|
-
]
|
|
2736
|
-
}
|
|
2737
|
-
},
|
|
2738
2508
|
{
|
|
2739
2509
|
parents: 1,
|
|
2740
2510
|
interior: {
|
|
@@ -2793,56 +2563,6 @@ var Hydration = {
|
|
|
2793
2563
|
]
|
|
2794
2564
|
}
|
|
2795
2565
|
},
|
|
2796
|
-
{
|
|
2797
|
-
parents: 2,
|
|
2798
|
-
interior: {
|
|
2799
|
-
X2: [
|
|
2800
|
-
{
|
|
2801
|
-
GlobalConsensus: {
|
|
2802
|
-
Ethereum: {
|
|
2803
|
-
chainId: 1
|
|
2804
|
-
}
|
|
2805
|
-
}
|
|
2806
|
-
},
|
|
2807
|
-
{
|
|
2808
|
-
AccountKey20: {
|
|
2809
|
-
network: null,
|
|
2810
|
-
key: "0xa3931d71877c0e7a3148cb7eb4463524fec27fbd"
|
|
2811
|
-
}
|
|
2812
|
-
}
|
|
2813
|
-
]
|
|
2814
|
-
}
|
|
2815
|
-
},
|
|
2816
|
-
{
|
|
2817
|
-
parents: 1,
|
|
2818
|
-
interior: {
|
|
2819
|
-
X1: [
|
|
2820
|
-
{
|
|
2821
|
-
Parachain: 2035
|
|
2822
|
-
}
|
|
2823
|
-
]
|
|
2824
|
-
}
|
|
2825
|
-
},
|
|
2826
|
-
{
|
|
2827
|
-
parents: 2,
|
|
2828
|
-
interior: {
|
|
2829
|
-
X2: [
|
|
2830
|
-
{
|
|
2831
|
-
GlobalConsensus: {
|
|
2832
|
-
Ethereum: {
|
|
2833
|
-
chainId: 1
|
|
2834
|
-
}
|
|
2835
|
-
}
|
|
2836
|
-
},
|
|
2837
|
-
{
|
|
2838
|
-
AccountKey20: {
|
|
2839
|
-
network: null,
|
|
2840
|
-
key: "0xd166337499e176bbc38a1fbd113ab144e5bd2df7"
|
|
2841
|
-
}
|
|
2842
|
-
}
|
|
2843
|
-
]
|
|
2844
|
-
}
|
|
2845
|
-
},
|
|
2846
2566
|
{
|
|
2847
2567
|
parents: 2,
|
|
2848
2568
|
interior: {
|
|
@@ -2879,22 +2599,6 @@ var Hydration = {
|
|
|
2879
2599
|
]
|
|
2880
2600
|
}
|
|
2881
2601
|
},
|
|
2882
|
-
{
|
|
2883
|
-
parents: 1,
|
|
2884
|
-
interior: {
|
|
2885
|
-
X2: [
|
|
2886
|
-
{
|
|
2887
|
-
Parachain: 2000
|
|
2888
|
-
},
|
|
2889
|
-
{
|
|
2890
|
-
GeneralKey: {
|
|
2891
|
-
length: 2,
|
|
2892
|
-
data: "0x0003000000000000000000000000000000000000000000000000000000000000"
|
|
2893
|
-
}
|
|
2894
|
-
}
|
|
2895
|
-
]
|
|
2896
|
-
}
|
|
2897
|
-
},
|
|
2898
2602
|
{
|
|
2899
2603
|
parents: 1,
|
|
2900
2604
|
interior: {
|
|
@@ -2925,53 +2629,27 @@ var Hydration = {
|
|
|
2925
2629
|
{
|
|
2926
2630
|
AccountKey20: {
|
|
2927
2631
|
network: null,
|
|
2928
|
-
key: "0xdac17f958d2ee523a2206206994597c13d831ec7"
|
|
2929
|
-
}
|
|
2930
|
-
}
|
|
2931
|
-
]
|
|
2932
|
-
}
|
|
2933
|
-
},
|
|
2934
|
-
{
|
|
2935
|
-
parents: 2,
|
|
2936
|
-
interior: {
|
|
2937
|
-
X2: [
|
|
2938
|
-
{
|
|
2939
|
-
GlobalConsensus: {
|
|
2940
|
-
Ethereum: {
|
|
2941
|
-
chainId: 1
|
|
2942
|
-
}
|
|
2943
|
-
}
|
|
2944
|
-
},
|
|
2945
|
-
{
|
|
2946
|
-
AccountKey20: {
|
|
2947
|
-
network: null,
|
|
2948
|
-
key: "0x18084fba666a33d37592fa2633fd49a74dd93a88"
|
|
2949
|
-
}
|
|
2950
|
-
}
|
|
2951
|
-
]
|
|
2952
|
-
}
|
|
2953
|
-
},
|
|
2954
|
-
{
|
|
2955
|
-
parents: 1,
|
|
2956
|
-
interior: {
|
|
2957
|
-
X1: [
|
|
2958
|
-
{
|
|
2959
|
-
Parachain: 3345
|
|
2632
|
+
key: "0xdac17f958d2ee523a2206206994597c13d831ec7"
|
|
2633
|
+
}
|
|
2960
2634
|
}
|
|
2961
2635
|
]
|
|
2962
2636
|
}
|
|
2963
2637
|
},
|
|
2964
2638
|
{
|
|
2965
|
-
parents:
|
|
2639
|
+
parents: 2,
|
|
2966
2640
|
interior: {
|
|
2967
2641
|
X2: [
|
|
2968
2642
|
{
|
|
2969
|
-
|
|
2643
|
+
GlobalConsensus: {
|
|
2644
|
+
Ethereum: {
|
|
2645
|
+
chainId: 1
|
|
2646
|
+
}
|
|
2647
|
+
}
|
|
2970
2648
|
},
|
|
2971
2649
|
{
|
|
2972
|
-
|
|
2973
|
-
|
|
2974
|
-
|
|
2650
|
+
AccountKey20: {
|
|
2651
|
+
network: null,
|
|
2652
|
+
key: "0x18084fba666a33d37592fa2633fd49a74dd93a88"
|
|
2975
2653
|
}
|
|
2976
2654
|
}
|
|
2977
2655
|
]
|
|
@@ -2980,12 +2658,9 @@ var Hydration = {
|
|
|
2980
2658
|
{
|
|
2981
2659
|
parents: 1,
|
|
2982
2660
|
interior: {
|
|
2983
|
-
|
|
2984
|
-
{
|
|
2985
|
-
Parachain: 2094
|
|
2986
|
-
},
|
|
2661
|
+
X1: [
|
|
2987
2662
|
{
|
|
2988
|
-
|
|
2663
|
+
Parachain: 3345
|
|
2989
2664
|
}
|
|
2990
2665
|
]
|
|
2991
2666
|
}
|
|
@@ -2995,13 +2670,10 @@ var Hydration = {
|
|
|
2995
2670
|
interior: {
|
|
2996
2671
|
X2: [
|
|
2997
2672
|
{
|
|
2998
|
-
Parachain:
|
|
2673
|
+
Parachain: 2094
|
|
2999
2674
|
},
|
|
3000
2675
|
{
|
|
3001
|
-
|
|
3002
|
-
length: 21,
|
|
3003
|
-
data: "0x02c80084af223c8b598536178d9361dc55bfda68180000000000000000000000"
|
|
3004
|
-
}
|
|
2676
|
+
PalletInstance: 10
|
|
3005
2677
|
}
|
|
3006
2678
|
]
|
|
3007
2679
|
}
|
|
@@ -3048,34 +2720,6 @@ var Hydration = {
|
|
|
3048
2720
|
]
|
|
3049
2721
|
}
|
|
3050
2722
|
},
|
|
3051
|
-
{
|
|
3052
|
-
parents: 1,
|
|
3053
|
-
interior: {
|
|
3054
|
-
X5: [
|
|
3055
|
-
{
|
|
3056
|
-
Parachain: 2094
|
|
3057
|
-
},
|
|
3058
|
-
{
|
|
3059
|
-
PalletInstance: 53
|
|
3060
|
-
},
|
|
3061
|
-
{
|
|
3062
|
-
GeneralIndex: 2
|
|
3063
|
-
},
|
|
3064
|
-
{
|
|
3065
|
-
GeneralKey: {
|
|
3066
|
-
length: 4,
|
|
3067
|
-
data: "0x4555524300000000000000000000000000000000000000000000000000000000"
|
|
3068
|
-
}
|
|
3069
|
-
},
|
|
3070
|
-
{
|
|
3071
|
-
GeneralKey: {
|
|
3072
|
-
length: 32,
|
|
3073
|
-
data: "0xcf4f5a26e2090bb3adcf02c7a9d73dbfe6659cc690461475b86437fa49c71136"
|
|
3074
|
-
}
|
|
3075
|
-
}
|
|
3076
|
-
]
|
|
3077
|
-
}
|
|
3078
|
-
},
|
|
3079
2723
|
{
|
|
3080
2724
|
parents: 1,
|
|
3081
2725
|
interior: {
|
|
@@ -3117,42 +2761,6 @@ var Hydration = {
|
|
|
3117
2761
|
]
|
|
3118
2762
|
}
|
|
3119
2763
|
},
|
|
3120
|
-
{
|
|
3121
|
-
parents: 1,
|
|
3122
|
-
interior: {
|
|
3123
|
-
X2: [
|
|
3124
|
-
{
|
|
3125
|
-
Parachain: 2004
|
|
3126
|
-
},
|
|
3127
|
-
{
|
|
3128
|
-
AccountKey20: {
|
|
3129
|
-
network: null,
|
|
3130
|
-
key: "0x9c4c6eaad9b926ba09f702f4ad880ef71998ef18"
|
|
3131
|
-
}
|
|
3132
|
-
}
|
|
3133
|
-
]
|
|
3134
|
-
}
|
|
3135
|
-
},
|
|
3136
|
-
{
|
|
3137
|
-
parents: 2,
|
|
3138
|
-
interior: {
|
|
3139
|
-
X2: [
|
|
3140
|
-
{
|
|
3141
|
-
GlobalConsensus: {
|
|
3142
|
-
Ethereum: {
|
|
3143
|
-
chainId: 1
|
|
3144
|
-
}
|
|
3145
|
-
}
|
|
3146
|
-
},
|
|
3147
|
-
{
|
|
3148
|
-
AccountKey20: {
|
|
3149
|
-
network: null,
|
|
3150
|
-
key: "0x8236a87084f8b84306f72007f36f2618a5634494"
|
|
3151
|
-
}
|
|
3152
|
-
}
|
|
3153
|
-
]
|
|
3154
|
-
}
|
|
3155
|
-
},
|
|
3156
2764
|
{
|
|
3157
2765
|
parents: 1,
|
|
3158
2766
|
interior: {
|
|
@@ -3219,26 +2827,6 @@ var Hydration = {
|
|
|
3219
2827
|
}
|
|
3220
2828
|
]
|
|
3221
2829
|
}
|
|
3222
|
-
},
|
|
3223
|
-
{
|
|
3224
|
-
parents: 2,
|
|
3225
|
-
interior: {
|
|
3226
|
-
X2: [
|
|
3227
|
-
{
|
|
3228
|
-
GlobalConsensus: {
|
|
3229
|
-
Ethereum: {
|
|
3230
|
-
chainId: 1
|
|
3231
|
-
}
|
|
3232
|
-
}
|
|
3233
|
-
},
|
|
3234
|
-
{
|
|
3235
|
-
AccountKey20: {
|
|
3236
|
-
network: null,
|
|
3237
|
-
key: "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"
|
|
3238
|
-
}
|
|
3239
|
-
}
|
|
3240
|
-
]
|
|
3241
|
-
}
|
|
3242
2830
|
}
|
|
3243
2831
|
],
|
|
3244
2832
|
pairs: [
|
|
@@ -9456,7 +9044,7 @@ var BifrostExchange = /*#__PURE__*/function (_ExchangeChain) {
|
|
|
9456
9044
|
|
|
9457
9045
|
var calculateFee = /*#__PURE__*/function () {
|
|
9458
9046
|
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(_ref, tradeRouter, txBuilderFactory, currencyFromInfo, currencyToInfo, currencyFromDecimals, chain, toDestTransactionFee) {
|
|
9459
|
-
var amount, slippagePct, feeCalcAddress, sender, trade, nativeAsset, substrateTx, tx, _yield$
|
|
9047
|
+
var amount, slippagePct, feeCalcAddress, sender, trade, nativeAsset, substrateTx, tx, _yield$getPaymentInfo, swapFee, feeNative, currencyFromPriceInfo, currencyFromPrice, feeInCurrencyFrom, finalFee;
|
|
9460
9048
|
return _regenerator().w(function (_context) {
|
|
9461
9049
|
while (1) switch (_context.n) {
|
|
9462
9050
|
case 0:
|
|
@@ -9472,10 +9060,10 @@ var calculateFee = /*#__PURE__*/function () {
|
|
|
9472
9060
|
substrateTx = _context.v;
|
|
9473
9061
|
tx = substrateTx.get();
|
|
9474
9062
|
_context.n = 3;
|
|
9475
|
-
return
|
|
9063
|
+
return getPaymentInfo(tx, feeCalcAddress);
|
|
9476
9064
|
case 3:
|
|
9477
|
-
_yield$
|
|
9478
|
-
swapFee = _yield$
|
|
9065
|
+
_yield$getPaymentInfo = _context.v;
|
|
9066
|
+
swapFee = _yield$getPaymentInfo.partial_fee;
|
|
9479
9067
|
feeNative = swapFee + toDestTransactionFee + toDestTransactionFee;
|
|
9480
9068
|
Logger.log('XCM to exch. fee:', toDestTransactionFee, nativeAsset.symbol);
|
|
9481
9069
|
Logger.log('XCM to dest. fee:', toDestTransactionFee, nativeAsset.symbol);
|
|
@@ -9547,78 +9135,77 @@ var HydrationExchange = /*#__PURE__*/function (_ExchangeChain) {
|
|
|
9547
9135
|
key: "swapCurrency",
|
|
9548
9136
|
value: function () {
|
|
9549
9137
|
var _swapCurrency = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(options, toDestTransactionFee) {
|
|
9550
|
-
var apiPapi, origin, assetFrom, assetTo, sender, slippagePct, amount,
|
|
9138
|
+
var apiPapi, origin, assetFrom, assetTo, sender, slippagePct, amount, sdk, tradeRouter, assetClient, txBuilderFactory, currencyFromInfo, currencyToInfo, tradeFee, amountWithoutFee, amountNormalized, trade, substrateTx, tx, amountOut, nativeCurrencyInfo, _findNativeAssetInfoO, nativeCurrencyDecimals, priceInfo, currencyToPrice, feeInCurrencyTo, amountOutModified;
|
|
9551
9139
|
return _regenerator().w(function (_context) {
|
|
9552
|
-
while (1) switch (_context.n) {
|
|
9140
|
+
while (1) switch (_context.p = _context.n) {
|
|
9553
9141
|
case 0:
|
|
9554
9142
|
apiPapi = options.apiPapi, origin = options.origin, assetFrom = options.assetFrom, assetTo = options.assetTo, sender = options.sender, slippagePct = options.slippagePct, amount = options.amount;
|
|
9555
9143
|
_context.n = 1;
|
|
9556
9144
|
return createSdkContext(apiPapi);
|
|
9557
9145
|
case 1:
|
|
9558
|
-
|
|
9559
|
-
tradeRouter =
|
|
9560
|
-
|
|
9561
|
-
|
|
9562
|
-
_context.n = 2;
|
|
9146
|
+
sdk = _context.v;
|
|
9147
|
+
tradeRouter = sdk.api.router, assetClient = sdk.client.asset, txBuilderFactory = sdk.tx;
|
|
9148
|
+
_context.p = 2;
|
|
9149
|
+
_context.n = 3;
|
|
9563
9150
|
return getAssetInfo(assetClient, assetFrom);
|
|
9564
|
-
case
|
|
9151
|
+
case 3:
|
|
9565
9152
|
currencyFromInfo = _context.v;
|
|
9566
|
-
_context.n =
|
|
9153
|
+
_context.n = 4;
|
|
9567
9154
|
return getAssetInfo(assetClient, assetTo);
|
|
9568
|
-
case
|
|
9155
|
+
case 4:
|
|
9569
9156
|
currencyToInfo = _context.v;
|
|
9570
9157
|
if (!(currencyFromInfo === undefined)) {
|
|
9571
|
-
_context.n =
|
|
9158
|
+
_context.n = 5;
|
|
9572
9159
|
break;
|
|
9573
9160
|
}
|
|
9574
9161
|
throw new InvalidCurrencyError("Currency from doesn't exist");
|
|
9575
|
-
case
|
|
9162
|
+
case 5:
|
|
9576
9163
|
if (!(currencyToInfo === undefined)) {
|
|
9577
|
-
_context.n =
|
|
9164
|
+
_context.n = 6;
|
|
9578
9165
|
break;
|
|
9579
9166
|
}
|
|
9580
9167
|
throw new InvalidCurrencyError("Currency to doesn't exist");
|
|
9581
|
-
case 5:
|
|
9582
|
-
_context.n = 6;
|
|
9583
|
-
return calculateFee(options, tradeRouter, txBuilderFactory, currencyFromInfo, currencyToInfo, currencyFromInfo.decimals, this.chain, toDestTransactionFee);
|
|
9584
9168
|
case 6:
|
|
9169
|
+
_context.n = 7;
|
|
9170
|
+
return calculateFee(options, tradeRouter, txBuilderFactory, currencyFromInfo, currencyToInfo, currencyFromInfo.decimals, this.chain, toDestTransactionFee);
|
|
9171
|
+
case 7:
|
|
9585
9172
|
tradeFee = _context.v;
|
|
9586
9173
|
amountWithoutFee = origin ? amount - tradeFee : amount;
|
|
9587
9174
|
if (!(amountWithoutFee <= 0n)) {
|
|
9588
|
-
_context.n =
|
|
9175
|
+
_context.n = 8;
|
|
9589
9176
|
break;
|
|
9590
9177
|
}
|
|
9591
9178
|
throw new AmountTooLowError();
|
|
9592
|
-
case
|
|
9179
|
+
case 8:
|
|
9593
9180
|
amountNormalized = formatUnits$1(amountWithoutFee, currencyFromInfo.decimals);
|
|
9594
9181
|
Logger.log('Original amount', amount);
|
|
9595
9182
|
Logger.log('Amount modified', amountWithoutFee);
|
|
9596
|
-
_context.n =
|
|
9183
|
+
_context.n = 9;
|
|
9597
9184
|
return tradeRouter.getBestSell(currencyFromInfo.id, currencyToInfo.id, amountNormalized);
|
|
9598
|
-
case
|
|
9185
|
+
case 9:
|
|
9599
9186
|
trade = _context.v;
|
|
9600
|
-
_context.n =
|
|
9187
|
+
_context.n = 10;
|
|
9601
9188
|
return txBuilderFactory.trade(trade).withSlippage(Number(slippagePct)).withBeneficiary(sender).build();
|
|
9602
|
-
case
|
|
9189
|
+
case 10:
|
|
9603
9190
|
substrateTx = _context.v;
|
|
9604
9191
|
tx = substrateTx.get();
|
|
9605
9192
|
amountOut = trade.amountOut;
|
|
9606
|
-
_context.n =
|
|
9193
|
+
_context.n = 11;
|
|
9607
9194
|
return getAssetInfo(assetClient, {
|
|
9608
9195
|
symbol: getNativeAssetSymbol(this.chain)
|
|
9609
9196
|
});
|
|
9610
|
-
case
|
|
9197
|
+
case 11:
|
|
9611
9198
|
nativeCurrencyInfo = _context.v;
|
|
9612
9199
|
if (!(nativeCurrencyInfo === undefined)) {
|
|
9613
|
-
_context.n =
|
|
9200
|
+
_context.n = 12;
|
|
9614
9201
|
break;
|
|
9615
9202
|
}
|
|
9616
9203
|
throw new InvalidCurrencyError('Native currency not found');
|
|
9617
|
-
case
|
|
9204
|
+
case 12:
|
|
9618
9205
|
_findNativeAssetInfoO = findNativeAssetInfoOrThrow(this.chain), nativeCurrencyDecimals = _findNativeAssetInfoO.decimals;
|
|
9619
|
-
_context.n =
|
|
9206
|
+
_context.n = 13;
|
|
9620
9207
|
return tradeRouter.getSpotPrice(currencyToInfo.id, nativeCurrencyInfo.id);
|
|
9621
|
-
case
|
|
9208
|
+
case 13:
|
|
9622
9209
|
priceInfo = _context.v;
|
|
9623
9210
|
if (currencyToInfo.id === nativeCurrencyInfo.id) {
|
|
9624
9211
|
priceInfo = {
|
|
@@ -9627,29 +9214,35 @@ var HydrationExchange = /*#__PURE__*/function (_ExchangeChain) {
|
|
|
9627
9214
|
};
|
|
9628
9215
|
}
|
|
9629
9216
|
if (!(priceInfo === undefined)) {
|
|
9630
|
-
_context.n =
|
|
9217
|
+
_context.n = 14;
|
|
9631
9218
|
break;
|
|
9632
9219
|
}
|
|
9633
9220
|
throw new UnableToComputeError('Price not found');
|
|
9634
|
-
case
|
|
9221
|
+
case 14:
|
|
9635
9222
|
currencyToPrice = priceInfo.amount;
|
|
9636
9223
|
feeInCurrencyTo = toDestTransactionFee * pow10n(priceInfo.decimals + currencyToInfo.decimals) * BigInt(FEE_BUFFER_PCT) / (currencyToPrice * pow10n(nativeCurrencyDecimals) * 100n);
|
|
9637
9224
|
Logger.log('Amount out fee', feeInCurrencyTo, nativeCurrencyInfo.symbol);
|
|
9638
9225
|
amountOutModified = amountOut - feeInCurrencyTo;
|
|
9639
9226
|
if (!(amountOutModified <= 0n)) {
|
|
9640
|
-
_context.n =
|
|
9227
|
+
_context.n = 15;
|
|
9641
9228
|
break;
|
|
9642
9229
|
}
|
|
9643
9230
|
throw new AmountTooLowError();
|
|
9644
|
-
case
|
|
9231
|
+
case 15:
|
|
9645
9232
|
Logger.log('Amount out original', amountOut);
|
|
9646
9233
|
Logger.log('Amount out modified', amountOutModified);
|
|
9647
9234
|
return _context.a(2, {
|
|
9648
9235
|
tx: tx,
|
|
9649
9236
|
amountOut: amountOutModified
|
|
9650
9237
|
});
|
|
9238
|
+
case 16:
|
|
9239
|
+
_context.p = 16;
|
|
9240
|
+
sdk.destroy();
|
|
9241
|
+
return _context.f(16);
|
|
9242
|
+
case 17:
|
|
9243
|
+
return _context.a(2);
|
|
9651
9244
|
}
|
|
9652
|
-
}, _callee, this);
|
|
9245
|
+
}, _callee, this, [[2,, 16, 17]]);
|
|
9653
9246
|
}));
|
|
9654
9247
|
function swapCurrency(_x, _x2) {
|
|
9655
9248
|
return _swapCurrency.apply(this, arguments);
|
|
@@ -9660,49 +9253,55 @@ var HydrationExchange = /*#__PURE__*/function (_ExchangeChain) {
|
|
|
9660
9253
|
key: "getAmountOut",
|
|
9661
9254
|
value: function () {
|
|
9662
9255
|
var _getAmountOut = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(options) {
|
|
9663
|
-
var apiPapi, assetFrom, assetTo, amount, origin, _options$slippagePct, slippagePct,
|
|
9256
|
+
var apiPapi, assetFrom, assetTo, amount, origin, _options$slippagePct, slippagePct, sdk, tradeRouter, assetClient, currencyFromInfo, currencyToInfo, pctDestFee, amountWithoutFee, amountNormalized, trade, amountOut, slippageMultiplier;
|
|
9664
9257
|
return _regenerator().w(function (_context2) {
|
|
9665
|
-
while (1) switch (_context2.n) {
|
|
9258
|
+
while (1) switch (_context2.p = _context2.n) {
|
|
9666
9259
|
case 0:
|
|
9667
9260
|
apiPapi = options.apiPapi, assetFrom = options.assetFrom, assetTo = options.assetTo, amount = options.amount, origin = options.origin, _options$slippagePct = options.slippagePct, slippagePct = _options$slippagePct === void 0 ? '0' : _options$slippagePct;
|
|
9668
9261
|
_context2.n = 1;
|
|
9669
9262
|
return createSdkContext(apiPapi);
|
|
9670
9263
|
case 1:
|
|
9671
|
-
|
|
9672
|
-
tradeRouter =
|
|
9673
|
-
|
|
9674
|
-
_context2.n =
|
|
9264
|
+
sdk = _context2.v;
|
|
9265
|
+
tradeRouter = sdk.api.router, assetClient = sdk.client.asset;
|
|
9266
|
+
_context2.p = 2;
|
|
9267
|
+
_context2.n = 3;
|
|
9675
9268
|
return getAssetInfo(assetClient, assetFrom);
|
|
9676
|
-
case
|
|
9269
|
+
case 3:
|
|
9677
9270
|
currencyFromInfo = _context2.v;
|
|
9678
|
-
_context2.n =
|
|
9271
|
+
_context2.n = 4;
|
|
9679
9272
|
return getAssetInfo(assetClient, assetTo);
|
|
9680
|
-
case
|
|
9273
|
+
case 4:
|
|
9681
9274
|
currencyToInfo = _context2.v;
|
|
9682
9275
|
if (!(currencyFromInfo === undefined)) {
|
|
9683
|
-
_context2.n =
|
|
9276
|
+
_context2.n = 5;
|
|
9684
9277
|
break;
|
|
9685
9278
|
}
|
|
9686
9279
|
throw new InvalidCurrencyError("Currency from doesn't exist");
|
|
9687
|
-
case
|
|
9280
|
+
case 5:
|
|
9688
9281
|
if (!(currencyToInfo === undefined)) {
|
|
9689
|
-
_context2.n =
|
|
9282
|
+
_context2.n = 6;
|
|
9690
9283
|
break;
|
|
9691
9284
|
}
|
|
9692
9285
|
throw new InvalidCurrencyError("Currency to doesn't exist");
|
|
9693
|
-
case
|
|
9286
|
+
case 6:
|
|
9694
9287
|
pctDestFee = origin ? DEST_FEE_BUFFER_PCT : 0;
|
|
9695
9288
|
amountWithoutFee = padValueBy(amount, pctDestFee);
|
|
9696
9289
|
amountNormalized = formatUnits$1(amountWithoutFee, currencyFromInfo.decimals);
|
|
9697
|
-
_context2.n =
|
|
9290
|
+
_context2.n = 7;
|
|
9698
9291
|
return tradeRouter.getBestSell(currencyFromInfo.id, currencyToInfo.id, amountNormalized);
|
|
9699
|
-
case
|
|
9292
|
+
case 7:
|
|
9700
9293
|
trade = _context2.v;
|
|
9701
9294
|
amountOut = trade.amountOut;
|
|
9702
9295
|
slippageMultiplier = Number(slippagePct);
|
|
9703
9296
|
return _context2.a(2, padValueBy(amountOut, -slippageMultiplier));
|
|
9297
|
+
case 8:
|
|
9298
|
+
_context2.p = 8;
|
|
9299
|
+
sdk.destroy();
|
|
9300
|
+
return _context2.f(8);
|
|
9301
|
+
case 9:
|
|
9302
|
+
return _context2.a(2);
|
|
9704
9303
|
}
|
|
9705
|
-
}, _callee2);
|
|
9304
|
+
}, _callee2, null, [[2,, 8, 9]]);
|
|
9706
9305
|
}));
|
|
9707
9306
|
function getAmountOut(_x3) {
|
|
9708
9307
|
return _getAmountOut.apply(this, arguments);
|
|
@@ -9713,7 +9312,7 @@ var HydrationExchange = /*#__PURE__*/function (_ExchangeChain) {
|
|
|
9713
9312
|
key: "getDexConfig",
|
|
9714
9313
|
value: function () {
|
|
9715
9314
|
var _getDexConfig = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(api) {
|
|
9716
|
-
var sdk, assets, sdkAssets, transformedAssets;
|
|
9315
|
+
var sdk, _yield$Promise$all, _yield$Promise$all2, assets, pools, sdkAssets, poolAssetIds, transformedAssets;
|
|
9717
9316
|
return _regenerator().w(function (_context3) {
|
|
9718
9317
|
while (1) switch (_context3.p = _context3.n) {
|
|
9719
9318
|
case 0:
|
|
@@ -9723,14 +9322,27 @@ var HydrationExchange = /*#__PURE__*/function (_ExchangeChain) {
|
|
|
9723
9322
|
sdk = _context3.v;
|
|
9724
9323
|
_context3.p = 2;
|
|
9725
9324
|
_context3.n = 3;
|
|
9726
|
-
return sdk.client.asset.getSupported();
|
|
9325
|
+
return Promise.all([sdk.client.asset.getSupported(), sdk.api.router.getPools()]);
|
|
9727
9326
|
case 3:
|
|
9728
|
-
|
|
9327
|
+
_yield$Promise$all = _context3.v;
|
|
9328
|
+
_yield$Promise$all2 = _slicedToArray(_yield$Promise$all, 2);
|
|
9329
|
+
assets = _yield$Promise$all2[0];
|
|
9330
|
+
pools = _yield$Promise$all2[1];
|
|
9729
9331
|
sdkAssets = getAssets(this.chain);
|
|
9730
|
-
|
|
9332
|
+
poolAssetIds = new Set(pools.flatMap(function (_ref) {
|
|
9333
|
+
var tokens = _ref.tokens;
|
|
9334
|
+
return tokens.map(function (_ref2) {
|
|
9335
|
+
var id = _ref2.id;
|
|
9336
|
+
return id.toString();
|
|
9337
|
+
});
|
|
9338
|
+
}));
|
|
9339
|
+
transformedAssets = assets.filter(function (_ref3) {
|
|
9340
|
+
var id = _ref3.id;
|
|
9341
|
+
return poolAssetIds.has(id.toString());
|
|
9342
|
+
}).map(function (_ref4) {
|
|
9731
9343
|
var _sdkAssets$find;
|
|
9732
|
-
var symbol =
|
|
9733
|
-
id =
|
|
9344
|
+
var symbol = _ref4.symbol,
|
|
9345
|
+
id = _ref4.id;
|
|
9734
9346
|
var asset = (_sdkAssets$find = sdkAssets.find(function (a) {
|
|
9735
9347
|
return !a.isNative && a.assetId === id.toString();
|
|
9736
9348
|
})) !== null && _sdkAssets$find !== void 0 ? _sdkAssets$find : sdkAssets.find(function (a) {
|
|
@@ -9834,11 +9446,19 @@ var getExchangeAsset = function getExchangeAsset(exchange, currency) {
|
|
|
9834
9446
|
return null;
|
|
9835
9447
|
};
|
|
9836
9448
|
|
|
9837
|
-
var
|
|
9838
|
-
|
|
9839
|
-
|
|
9840
|
-
|
|
9841
|
-
|
|
9449
|
+
var resolveOriginAssetOnExchange = function resolveOriginAssetOnExchange(origin, exchange, transferableAssets, originAsset, ctx) {
|
|
9450
|
+
if (!transferableAssets.some(function (asset) {
|
|
9451
|
+
return isAssetEqual(asset, originAsset);
|
|
9452
|
+
})) return null;
|
|
9453
|
+
return findAssetInfoOnDestImpl(origin, exchange, {
|
|
9454
|
+
location: originAsset.location
|
|
9455
|
+
}, originAsset, ctx);
|
|
9456
|
+
};
|
|
9457
|
+
var getExchangeAssetByOriginAsset = function getExchangeAssetByOriginAsset(origin, exchange, originAsset, ctx) {
|
|
9458
|
+
var assetOnExchange = resolveOriginAssetOnExchange(origin, exchange, getSupportedAssetsImpl(origin, exchange, ctx), originAsset, ctx);
|
|
9459
|
+
if (!assetOnExchange) return undefined;
|
|
9460
|
+
return getExchangeAssets(exchange).find(function (asset) {
|
|
9461
|
+
return isAssetEqual(asset, assetOnExchange);
|
|
9842
9462
|
});
|
|
9843
9463
|
};
|
|
9844
9464
|
|
|
@@ -9888,16 +9508,34 @@ var getSupportedAssetsFromImpl = function getSupportedAssetsFromImpl(from, excha
|
|
|
9888
9508
|
if (!from) return [];
|
|
9889
9509
|
return getAssetsImpl(from, ctx);
|
|
9890
9510
|
}
|
|
9891
|
-
var
|
|
9892
|
-
|
|
9893
|
-
|
|
9894
|
-
|
|
9895
|
-
|
|
9511
|
+
var exchanges = Array.isArray(exchange) ? exchange : [exchange];
|
|
9512
|
+
if (!from || !Array.isArray(exchange) && from === exchange) {
|
|
9513
|
+
return exchanges.flatMap(function (ex) {
|
|
9514
|
+
return getExchangeAssets(ex);
|
|
9515
|
+
});
|
|
9896
9516
|
}
|
|
9517
|
+
var entries = exchanges.map(function (ex) {
|
|
9518
|
+
return {
|
|
9519
|
+
exchange: ex,
|
|
9520
|
+
exchangeAssets: getExchangeAssets(ex),
|
|
9521
|
+
transferableAssets: from === ex ? undefined : getSupportedAssetsImpl(from, ex, ctx)
|
|
9522
|
+
};
|
|
9523
|
+
});
|
|
9897
9524
|
var fromAssets = getAssetsImpl(from, ctx);
|
|
9898
9525
|
return fromAssets.filter(function (fromAsset) {
|
|
9899
|
-
return
|
|
9900
|
-
|
|
9526
|
+
return entries.some(function (_ref) {
|
|
9527
|
+
var ex = _ref.exchange,
|
|
9528
|
+
exchangeAssets = _ref.exchangeAssets,
|
|
9529
|
+
transferableAssets = _ref.transferableAssets;
|
|
9530
|
+
if (transferableAssets === undefined) {
|
|
9531
|
+
return exchangeAssets.some(function (exchangeAsset) {
|
|
9532
|
+
return isAssetEqual(exchangeAsset, fromAsset);
|
|
9533
|
+
});
|
|
9534
|
+
}
|
|
9535
|
+
var assetOnExchange = resolveOriginAssetOnExchange(from, ex, transferableAssets, fromAsset, ctx);
|
|
9536
|
+
return assetOnExchange !== null && exchangeAssets.some(function (exchangeAsset) {
|
|
9537
|
+
return isAssetEqual(exchangeAsset, assetOnExchange);
|
|
9538
|
+
});
|
|
9901
9539
|
});
|
|
9902
9540
|
});
|
|
9903
9541
|
};
|
|
@@ -9905,7 +9543,7 @@ var getSupportedAssetsFromImpl = function getSupportedAssetsFromImpl(from, excha
|
|
|
9905
9543
|
* Retrieves the list of assets supported for transfer from the origin chain to the exchange chain.
|
|
9906
9544
|
*
|
|
9907
9545
|
* @param from - The origin chain.
|
|
9908
|
-
* @param
|
|
9546
|
+
* @param exchangeInput - The exchange chain or 'Auto select'.
|
|
9909
9547
|
* @returns An array of supported assets.
|
|
9910
9548
|
*/
|
|
9911
9549
|
var getSupportedAssetsFrom = function getSupportedAssetsFrom(from, exchangeInput) {
|
|
@@ -9914,50 +9552,22 @@ var getSupportedAssetsFrom = function getSupportedAssetsFrom(from, exchangeInput
|
|
|
9914
9552
|
|
|
9915
9553
|
var getSupportedAssetsToImpl = function getSupportedAssetsToImpl(exchangeInput, to, ctx) {
|
|
9916
9554
|
var exchange = normalizeExchange(exchangeInput);
|
|
9917
|
-
|
|
9918
|
-
|
|
9919
|
-
|
|
9920
|
-
|
|
9921
|
-
|
|
9922
|
-
|
|
9923
|
-
|
|
9924
|
-
return
|
|
9925
|
-
return isAssetEqual(asset, toAsset);
|
|
9926
|
-
});
|
|
9927
|
-
});
|
|
9928
|
-
if (isExternalChain(to)) {
|
|
9929
|
-
filteredExchangeAssets.push.apply(filteredExchangeAssets, _toConsumableArray(allExchangeAssets.filter(function (asset) {
|
|
9930
|
-
return isSystemAsset(asset);
|
|
9931
|
-
})));
|
|
9932
|
-
}
|
|
9933
|
-
return filteredExchangeAssets;
|
|
9934
|
-
}
|
|
9935
|
-
return allExchangeAssets;
|
|
9936
|
-
}
|
|
9937
|
-
var exchangeAssets = Array.isArray(exchange) ? exchange.flatMap(function (exchange) {
|
|
9938
|
-
return getExchangeAssets(exchange);
|
|
9939
|
-
}) : getExchangeAssets(exchange);
|
|
9940
|
-
if (to) {
|
|
9941
|
-
var _toAssets = getAssetsImpl(to, ctx);
|
|
9942
|
-
var _filteredExchangeAssets = exchangeAssets.filter(function (asset) {
|
|
9943
|
-
return _toAssets.some(function (toAsset) {
|
|
9944
|
-
return isAssetEqual(asset, toAsset);
|
|
9555
|
+
var exchanges = exchange === undefined ? EXCHANGE_CHAINS : Array.isArray(exchange) ? exchange : [exchange];
|
|
9556
|
+
return exchanges.flatMap(function (ex) {
|
|
9557
|
+
var exchangeAssets = getExchangeAssets(ex);
|
|
9558
|
+
if (!to || to === ex) return exchangeAssets;
|
|
9559
|
+
var transferableAssets = getSupportedAssetsImpl(ex, to, ctx);
|
|
9560
|
+
return exchangeAssets.filter(function (asset) {
|
|
9561
|
+
return transferableAssets.some(function (transferable) {
|
|
9562
|
+
return isAssetEqual(transferable, asset);
|
|
9945
9563
|
});
|
|
9946
9564
|
});
|
|
9947
|
-
|
|
9948
|
-
_filteredExchangeAssets.push.apply(_filteredExchangeAssets, _toConsumableArray(exchangeAssets.filter(function (asset) {
|
|
9949
|
-
return isSystemAsset(asset);
|
|
9950
|
-
})));
|
|
9951
|
-
}
|
|
9952
|
-
return _filteredExchangeAssets;
|
|
9953
|
-
}
|
|
9954
|
-
return exchangeAssets;
|
|
9565
|
+
});
|
|
9955
9566
|
};
|
|
9956
9567
|
/**
|
|
9957
|
-
* Retrieves the list of assets supported for transfer to the destination chain.
|
|
9568
|
+
* Retrieves the list of assets supported for transfer from the exchange chain to the destination chain.
|
|
9958
9569
|
*
|
|
9959
|
-
* @param
|
|
9960
|
-
* @param exchange - The exchange chain or 'Auto select'.
|
|
9570
|
+
* @param exchangeInput - The exchange chain or 'Auto select'.
|
|
9961
9571
|
* @param to - The destination chain.
|
|
9962
9572
|
* @returns An array of supported assets.
|
|
9963
9573
|
*/
|
|
@@ -10084,20 +9694,20 @@ var canBuildToExchangeTx = /*#__PURE__*/function () {
|
|
|
10084
9694
|
|
|
10085
9695
|
var selectBestExchangeCommon = /*#__PURE__*/function () {
|
|
10086
9696
|
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(options, originApi, computeAmountOut) {
|
|
10087
|
-
var api, from, exchange, to, currencyFrom, currencyTo, assetFromOrigin, filteredExchangeChains, bestExchange, maxAmountOut, errors, triedAnyExchange, _iterator, _step,
|
|
10088
|
-
return _regenerator().w(function (
|
|
10089
|
-
while (1) switch (
|
|
9697
|
+
var api, from, exchange, to, currencyFrom, currencyTo, assetFromOrigin, filteredExchangeChains, bestExchange, maxAmountOut, errors, triedAnyExchange, _iterator, _step, _loop, _ret, _t2;
|
|
9698
|
+
return _regenerator().w(function (_context2) {
|
|
9699
|
+
while (1) switch (_context2.p = _context2.n) {
|
|
10090
9700
|
case 0:
|
|
10091
9701
|
api = options.api, from = options.from, exchange = options.exchange, to = options.to, currencyFrom = options.currencyFrom, currencyTo = options.currencyTo;
|
|
10092
9702
|
assetFromOrigin = from ? findAssetInfo(from, currencyFrom) : undefined;
|
|
10093
9703
|
if (!(from && !assetFromOrigin)) {
|
|
10094
|
-
|
|
9704
|
+
_context2.n = 1;
|
|
10095
9705
|
break;
|
|
10096
9706
|
}
|
|
10097
9707
|
throw new RoutingResolutionError("Currency from ".concat(JSON.stringify(options.currencyFrom), " not found in ").concat(options.from, "."));
|
|
10098
9708
|
case 1:
|
|
10099
9709
|
if (!('id' in currencyTo)) {
|
|
10100
|
-
|
|
9710
|
+
_context2.n = 2;
|
|
10101
9711
|
break;
|
|
10102
9712
|
}
|
|
10103
9713
|
throw new UnsupportedOperationError('Cannot select currencyTo by ID when auto-selecting is enabled. Please specify currencyTo by symbol or location.');
|
|
@@ -10108,114 +9718,126 @@ var selectBestExchangeCommon = /*#__PURE__*/function () {
|
|
|
10108
9718
|
errors = new Map();
|
|
10109
9719
|
triedAnyExchange = false;
|
|
10110
9720
|
_iterator = _createForOfIteratorHelper(filteredExchangeChains);
|
|
10111
|
-
|
|
9721
|
+
_context2.p = 3;
|
|
9722
|
+
_loop = /*#__PURE__*/_regenerator().m(function _loop() {
|
|
9723
|
+
var exchangeChain, dex, originSpecified, destinationSpecified, assetFromExchange, assetTo, res, config, parsedAmount, amountOut, _t;
|
|
9724
|
+
return _regenerator().w(function (_context) {
|
|
9725
|
+
while (1) switch (_context.p = _context.n) {
|
|
9726
|
+
case 0:
|
|
9727
|
+
exchangeChain = _step.value;
|
|
9728
|
+
dex = createExchangeInstance(exchangeChain);
|
|
9729
|
+
originSpecified = from && from !== dex.chain;
|
|
9730
|
+
destinationSpecified = to && to !== dex.chain;
|
|
9731
|
+
assetFromExchange = originSpecified && assetFromOrigin ? getExchangeAssetByOriginAsset(from, dex.chain, assetFromOrigin) : getExchangeAsset(dex.chain, currencyFrom);
|
|
9732
|
+
if (assetFromExchange) {
|
|
9733
|
+
_context.n = 1;
|
|
9734
|
+
break;
|
|
9735
|
+
}
|
|
9736
|
+
return _context.a(2, 0);
|
|
9737
|
+
case 1:
|
|
9738
|
+
assetTo = getExchangeAsset(dex.chain, currencyTo, true);
|
|
9739
|
+
if (assetTo) {
|
|
9740
|
+
_context.n = 2;
|
|
9741
|
+
break;
|
|
9742
|
+
}
|
|
9743
|
+
return _context.a(2, 0);
|
|
9744
|
+
case 2:
|
|
9745
|
+
if (!(destinationSpecified && !getSupportedAssetsImpl(dex.chain, to).some(function (asset) {
|
|
9746
|
+
return isAssetEqual(asset, assetTo);
|
|
9747
|
+
}))) {
|
|
9748
|
+
_context.n = 3;
|
|
9749
|
+
break;
|
|
9750
|
+
}
|
|
9751
|
+
return _context.a(2, 0);
|
|
9752
|
+
case 3:
|
|
9753
|
+
triedAnyExchange = true;
|
|
9754
|
+
Logger.log("Checking ".concat(exchangeChain, "..."));
|
|
9755
|
+
_context.n = 4;
|
|
9756
|
+
return canBuildToExchangeTx(options, dex.chain, originApi, assetFromOrigin);
|
|
9757
|
+
case 4:
|
|
9758
|
+
res = _context.v;
|
|
9759
|
+
if (res.success) {
|
|
9760
|
+
_context.n = 5;
|
|
9761
|
+
break;
|
|
9762
|
+
}
|
|
9763
|
+
errors.set(dex.chain, res.error);
|
|
9764
|
+
return _context.a(2, 0);
|
|
9765
|
+
case 5:
|
|
9766
|
+
config = api.config;
|
|
9767
|
+
parsedAmount = applyDecimalAbstraction(options.amount, assetFromExchange === null || assetFromExchange === void 0 ? void 0 : assetFromExchange.decimals, !(isConfig(config) && config.abstractDecimals === false)).toString();
|
|
9768
|
+
_context.p = 6;
|
|
9769
|
+
_context.n = 7;
|
|
9770
|
+
return computeAmountOut(dex, assetFromExchange, assetTo, options, parsedAmount);
|
|
9771
|
+
case 7:
|
|
9772
|
+
amountOut = _context.v;
|
|
9773
|
+
if (amountOut > maxAmountOut) {
|
|
9774
|
+
bestExchange = dex;
|
|
9775
|
+
maxAmountOut = amountOut;
|
|
9776
|
+
}
|
|
9777
|
+
_context.n = 9;
|
|
9778
|
+
break;
|
|
9779
|
+
case 8:
|
|
9780
|
+
_context.p = 8;
|
|
9781
|
+
_t = _context.v;
|
|
9782
|
+
if (_t instanceof Error) {
|
|
9783
|
+
errors.set(dex.chain, _t);
|
|
9784
|
+
}
|
|
9785
|
+
return _context.a(2, 0);
|
|
9786
|
+
case 9:
|
|
9787
|
+
return _context.a(2);
|
|
9788
|
+
}
|
|
9789
|
+
}, _loop, null, [[6, 8]]);
|
|
9790
|
+
});
|
|
10112
9791
|
_iterator.s();
|
|
10113
9792
|
case 4:
|
|
10114
9793
|
if ((_step = _iterator.n()).done) {
|
|
10115
|
-
|
|
10116
|
-
break;
|
|
10117
|
-
}
|
|
10118
|
-
exchangeChain = _step.value;
|
|
10119
|
-
dex = createExchangeInstance(exchangeChain);
|
|
10120
|
-
originSpecified = from && from !== dex.chain;
|
|
10121
|
-
destinationSpecified = to && to !== dex.chain;
|
|
10122
|
-
assetFromExchange = originSpecified && assetFromOrigin ? getExchangeAssetByOriginAsset(dex.chain, assetFromOrigin) : getExchangeAsset(dex.chain, currencyFrom);
|
|
10123
|
-
if (assetFromExchange) {
|
|
10124
|
-
_context.n = 5;
|
|
9794
|
+
_context2.n = 7;
|
|
10125
9795
|
break;
|
|
10126
9796
|
}
|
|
10127
|
-
return
|
|
9797
|
+
return _context2.d(_regeneratorValues(_loop()), 5);
|
|
10128
9798
|
case 5:
|
|
10129
|
-
|
|
10130
|
-
if (
|
|
10131
|
-
|
|
9799
|
+
_ret = _context2.v;
|
|
9800
|
+
if (!(_ret === 0)) {
|
|
9801
|
+
_context2.n = 6;
|
|
10132
9802
|
break;
|
|
10133
9803
|
}
|
|
10134
|
-
return
|
|
9804
|
+
return _context2.a(3, 6);
|
|
10135
9805
|
case 6:
|
|
10136
|
-
|
|
10137
|
-
location: assetTo.location
|
|
10138
|
-
}))) {
|
|
10139
|
-
_context.n = 7;
|
|
10140
|
-
break;
|
|
10141
|
-
}
|
|
10142
|
-
return _context.a(3, 14);
|
|
10143
|
-
case 7:
|
|
10144
|
-
if (!(from && getRelayChainOf(from) !== getRelayChainOf(dex.chain))) {
|
|
10145
|
-
_context.n = 8;
|
|
10146
|
-
break;
|
|
10147
|
-
}
|
|
10148
|
-
return _context.a(3, 14);
|
|
10149
|
-
case 8:
|
|
10150
|
-
triedAnyExchange = true;
|
|
10151
|
-
Logger.log("Checking ".concat(exchangeChain, "..."));
|
|
10152
|
-
_context.n = 9;
|
|
10153
|
-
return canBuildToExchangeTx(options, dex.chain, originApi, assetFromOrigin);
|
|
10154
|
-
case 9:
|
|
10155
|
-
res = _context.v;
|
|
10156
|
-
if (res.success) {
|
|
10157
|
-
_context.n = 10;
|
|
10158
|
-
break;
|
|
10159
|
-
}
|
|
10160
|
-
errors.set(dex.chain, res.error);
|
|
10161
|
-
return _context.a(3, 14);
|
|
10162
|
-
case 10:
|
|
10163
|
-
config = api.config;
|
|
10164
|
-
parsedAmount = applyDecimalAbstraction(options.amount, assetFromExchange === null || assetFromExchange === void 0 ? void 0 : assetFromExchange.decimals, !(isConfig(config) && config.abstractDecimals === false)).toString();
|
|
10165
|
-
_context.p = 11;
|
|
10166
|
-
_context.n = 12;
|
|
10167
|
-
return computeAmountOut(dex, assetFromExchange, assetTo, options, parsedAmount);
|
|
10168
|
-
case 12:
|
|
10169
|
-
amountOut = _context.v;
|
|
10170
|
-
if (amountOut > maxAmountOut) {
|
|
10171
|
-
bestExchange = dex;
|
|
10172
|
-
maxAmountOut = amountOut;
|
|
10173
|
-
}
|
|
10174
|
-
_context.n = 14;
|
|
10175
|
-
break;
|
|
10176
|
-
case 13:
|
|
10177
|
-
_context.p = 13;
|
|
10178
|
-
_t = _context.v;
|
|
10179
|
-
if (_t instanceof Error) {
|
|
10180
|
-
errors.set(dex.chain, _t);
|
|
10181
|
-
}
|
|
10182
|
-
return _context.a(3, 14);
|
|
10183
|
-
case 14:
|
|
10184
|
-
_context.n = 4;
|
|
9806
|
+
_context2.n = 4;
|
|
10185
9807
|
break;
|
|
10186
|
-
case
|
|
10187
|
-
|
|
9808
|
+
case 7:
|
|
9809
|
+
_context2.n = 9;
|
|
10188
9810
|
break;
|
|
10189
|
-
case
|
|
10190
|
-
|
|
10191
|
-
_t2 =
|
|
9811
|
+
case 8:
|
|
9812
|
+
_context2.p = 8;
|
|
9813
|
+
_t2 = _context2.v;
|
|
10192
9814
|
_iterator.e(_t2);
|
|
10193
|
-
case
|
|
10194
|
-
|
|
9815
|
+
case 9:
|
|
9816
|
+
_context2.p = 9;
|
|
10195
9817
|
_iterator.f();
|
|
10196
|
-
return
|
|
10197
|
-
case
|
|
9818
|
+
return _context2.f(9);
|
|
9819
|
+
case 10:
|
|
10198
9820
|
if (!(bestExchange === undefined)) {
|
|
10199
|
-
|
|
9821
|
+
_context2.n = 12;
|
|
10200
9822
|
break;
|
|
10201
9823
|
}
|
|
10202
9824
|
if (!(!triedAnyExchange && errors.size === 0)) {
|
|
10203
|
-
|
|
9825
|
+
_context2.n = 11;
|
|
10204
9826
|
break;
|
|
10205
9827
|
}
|
|
10206
9828
|
throw new RoutingResolutionError("No exchange found that supports asset pair: " + "".concat(JSON.stringify(assetFromOrigin === null || assetFromOrigin === void 0 ? void 0 : assetFromOrigin.symbol), " -> ").concat(JSON.stringify('symbol' in currencyTo ? currencyTo.symbol : ''), "."));
|
|
10207
|
-
case
|
|
9829
|
+
case 11:
|
|
10208
9830
|
throw new RoutingResolutionError("Could not select best exchange automatically. Please specify one manually. Errors: \n\n".concat(Array.from(errors.entries()).map(function (_ref2) {
|
|
10209
9831
|
var _ref3 = _slicedToArray(_ref2, 2),
|
|
10210
9832
|
key = _ref3[0],
|
|
10211
9833
|
value = _ref3[1];
|
|
10212
9834
|
return "".concat(key, ": ").concat(value.message);
|
|
10213
9835
|
}).join('\n\n')));
|
|
10214
|
-
case
|
|
9836
|
+
case 12:
|
|
10215
9837
|
Logger.log("Selected exchange: ".concat(bestExchange.chain));
|
|
10216
|
-
return
|
|
9838
|
+
return _context2.a(2, bestExchange);
|
|
10217
9839
|
}
|
|
10218
|
-
}, _callee, null, [[
|
|
9840
|
+
}, _callee, null, [[3, 8, 9, 10]]);
|
|
10219
9841
|
}));
|
|
10220
9842
|
return function selectBestExchangeCommon(_x, _x2, _x3) {
|
|
10221
9843
|
return _ref.apply(this, arguments);
|
|
@@ -10363,7 +9985,7 @@ var resolveAssets = function resolveAssets(dex, _ref) {
|
|
|
10363
9985
|
if (originSpecified && !assetFromOrigin) {
|
|
10364
9986
|
throw new RoutingResolutionError("Currency from ".concat(JSON.stringify(currencyFrom), " not found in ").concat(from, "."));
|
|
10365
9987
|
}
|
|
10366
|
-
var assetFromExchange = originSpecified && assetFromOrigin ? getExchangeAssetByOriginAsset(dex.chain, assetFromOrigin) : getExchangeAsset(dex.chain, currencyFrom);
|
|
9988
|
+
var assetFromExchange = originSpecified && assetFromOrigin ? getExchangeAssetByOriginAsset(from, dex.chain, assetFromOrigin) : getExchangeAsset(dex.chain, currencyFrom);
|
|
10367
9989
|
if (!assetFromExchange) {
|
|
10368
9990
|
if (!originSpecified && findAssetInfo(dex.chain, currencyFrom)) {
|
|
10369
9991
|
throw new RoutingResolutionError("Currency from ".concat(JSON.stringify(currencyFrom), " exists in ").concat(dex.chain, " but is not swappable on ").concat(dex.chain, "."));
|
|
@@ -10374,8 +9996,8 @@ var resolveAssets = function resolveAssets(dex, _ref) {
|
|
|
10374
9996
|
if (!assetTo) {
|
|
10375
9997
|
throw new RoutingResolutionError("Currency to ".concat(JSON.stringify(currencyTo), " not found in ").concat(dex.chain, "."));
|
|
10376
9998
|
}
|
|
10377
|
-
if (destinationSpecified && !
|
|
10378
|
-
|
|
9999
|
+
if (destinationSpecified && !getSupportedAssetsImpl(dex.chain, to).some(function (asset) {
|
|
10000
|
+
return isAssetEqual(asset, assetTo);
|
|
10379
10001
|
})) {
|
|
10380
10002
|
throw new RoutingResolutionError("Currency to ".concat(JSON.stringify(currencyTo), " not supported by ").concat(to, "."));
|
|
10381
10003
|
}
|
|
@@ -10383,7 +10005,7 @@ var resolveAssets = function resolveAssets(dex, _ref) {
|
|
|
10383
10005
|
if (feeAsset && originSpecified && !feeAssetFromOrigin) {
|
|
10384
10006
|
throw new RoutingResolutionError("Fee asset ".concat(JSON.stringify(feeAsset), " not found in ").concat(from, "."));
|
|
10385
10007
|
}
|
|
10386
|
-
var feeAssetFromExchange = feeAsset ? feeAssetFromOrigin ? getExchangeAssetByOriginAsset(dex.chain, feeAssetFromOrigin) : (_getExchangeAsset = getExchangeAsset(dex.chain, feeAsset)) !== null && _getExchangeAsset !== void 0 ? _getExchangeAsset : undefined : undefined;
|
|
10008
|
+
var feeAssetFromExchange = feeAsset ? from && feeAssetFromOrigin ? getExchangeAssetByOriginAsset(from, dex.chain, feeAssetFromOrigin) : (_getExchangeAsset = getExchangeAsset(dex.chain, feeAsset)) !== null && _getExchangeAsset !== void 0 ? _getExchangeAsset : undefined : undefined;
|
|
10387
10009
|
var resolvedFeeAssetLocation = (_feeAssetFromOrigin$l = feeAssetFromOrigin === null || feeAssetFromOrigin === void 0 ? void 0 : feeAssetFromOrigin.location) !== null && _feeAssetFromOrigin$l !== void 0 ? _feeAssetFromOrigin$l : feeAssetFromExchange === null || feeAssetFromExchange === void 0 ? void 0 : feeAssetFromExchange.location;
|
|
10388
10010
|
if (feeAsset && resolvedFeeAssetLocation) {
|
|
10389
10011
|
var sdkAsset = findAssetInfoOrThrow(from !== null && from !== void 0 ? from : dex.chain, {
|