@paraspell/swap 14.5.2 → 14.5.3
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 -7
- package/dist/index.mjs +197 -251
- package/package.json +5 -5
package/dist/index.d.ts
CHANGED
|
@@ -47,14 +47,10 @@ type TPjsGetAmountOutOptions<TApi, TRes, TSigner, TCustomChain extends string =
|
|
|
47
47
|
type TPapiGetAmountOutOptions<TApi, TRes, TSigner, TCustomChain extends string = never> = TGetAmountOutOptionsFor<TApi, TRes, TSigner, 'PAPI', TCustomChain>;
|
|
48
48
|
type TGenericGetAmountOutOptions<TApi, TRes, TSigner, TCustomChain extends string = never> = TGetAmountOutOptionsFor<TApi, TRes, TSigner, 'GENERIC', TCustomChain>;
|
|
49
49
|
type TExtrinsic<TRes> = Extrinsic | TPapiTransaction | TRes;
|
|
50
|
-
type
|
|
50
|
+
type TSwapResult<TRes> = {
|
|
51
51
|
tx: TExtrinsic<TRes>;
|
|
52
52
|
amountOut: bigint;
|
|
53
53
|
};
|
|
54
|
-
type TMultiSwapResult<TRes> = {
|
|
55
|
-
txs: TExtrinsic<TRes>[];
|
|
56
|
-
amountOut: bigint;
|
|
57
|
-
};
|
|
58
54
|
/**
|
|
59
55
|
* The options for an XCM Router transfer.
|
|
60
56
|
*/
|
|
@@ -199,7 +195,7 @@ type TExecuteRouterPlanOptions<TApi, TRes, TSigner, TCustomChain extends string
|
|
|
199
195
|
};
|
|
200
196
|
type TPreparedExtrinsics<TRes> = {
|
|
201
197
|
toExchangeTx?: TRes;
|
|
202
|
-
|
|
198
|
+
swapTx: TRes;
|
|
203
199
|
isExecute?: boolean;
|
|
204
200
|
toDestTx?: TRes;
|
|
205
201
|
amountOut: bigint;
|
|
@@ -337,4 +333,4 @@ declare const FALLBACK_FEE_CALC_ADDRESS = "5EtHZF4E8QagNCz6naobCkCAUT52SbcEqaXiD
|
|
|
337
333
|
declare const FALLBACK_FEE_CALC_EVM_ADDRESS = "0x1501C1413e4178c38567Ada8945A80351F7B8496";
|
|
338
334
|
|
|
339
335
|
export { DEST_FEE_BUFFER_PCT, FALLBACK_FEE_CALC_ADDRESS, FALLBACK_FEE_CALC_EVM_ADDRESS, FEE_BUFFER_PCT, SwapBuilder, SwapBuilderCore, getExchangeAssets, getExchangeConfig, getExchangePairs, getSupportedAssetsFrom, getSupportedAssetsFromImpl, getSupportedAssetsTo, getSupportedAssetsToImpl, getSupportedFeeAssets, getSupportedFeeAssetsImpl };
|
|
340
|
-
export type { TAdditionalTransferOptions, TAssetsRecord, TBuildFromExchangeTxOptions, TBuildSwapExecuteOverrides, TBuildToExchangeTxOptions, TBuildTransactionsBaseOptions, TBuildTransactionsOptions, TCallDexAmountOutOverrides, TCommonRouterOptions, TDestinationInfo, TDexConfig, TDexConfigBase, TDexConfigStored, TExchangeApiType, TExchangeApiVariant, TExchangeInfo, TExchangeInfoFor, TExecuteRouterPlanOptions, TExtrinsic, TGenericExchangeInfo, TGenericGetAmountOutOptions, TGenericSwapOptions, TGetAmountOutOptions, TGetAmountOutOptionsFor, TGetBestAmountOutBaseOptions, TGetBestAmountOutOptions, TGetBestAmountOutResult, TGetDexConfigApi,
|
|
336
|
+
export type { TAdditionalTransferOptions, TAssetsRecord, TBuildFromExchangeTxOptions, TBuildSwapExecuteOverrides, TBuildToExchangeTxOptions, TBuildTransactionsBaseOptions, TBuildTransactionsOptions, TCallDexAmountOutOverrides, TCommonRouterOptions, TDestinationInfo, TDexConfig, TDexConfigBase, TDexConfigStored, TExchangeApiType, TExchangeApiVariant, TExchangeInfo, TExchangeInfoFor, TExecuteRouterPlanOptions, TExtrinsic, TGenericExchangeInfo, TGenericGetAmountOutOptions, TGenericSwapOptions, TGetAmountOutOptions, TGetAmountOutOptionsFor, TGetBestAmountOutBaseOptions, TGetBestAmountOutOptions, TGetBestAmountOutResult, TGetDexConfigApi, TOriginInfo, TPairs, TPapiExchangeInfo, TPapiGetAmountOutOptions, TPapiSwapOptions, TPjsExchangeInfo, TPjsGetAmountOutOptions, TPjsSwapOptions, TPreparedExtrinsics, TRouterPlan, TSwapAndTransferTransaction, TSwapOptions, TSwapOptionsFor, TSwapResult, TSwapTransaction, TSwapTransformedOptions, TTransaction, TTransferBaseOptions, TTransferOptions, TTransformedOptions };
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
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,
|
|
2
|
+
import { UnsupportedOperationError, assertCurrencyCore, dryRun, getDryRunError, DryRunFailedError, isConfig, getNativeAssets, RoutingResolutionError, findAssetInfoById, getOtherAssets, getChainProviders, parseUnits, getNativeAssetSymbol, padValueBy, formatUnits as formatUnits$1, AmountTooLowError, getBalance, localizeLocation, getAssets, isAssetEqual, findNativeAssetInfoOrThrow, isSymbolMatch, getParaId, UnableToComputeError, InvalidCurrencyError, findAssetInfoOrThrow, findAssetInfoByLoc, isSymbolSpecifier, findBestMatches, findAssetInfoBySymbol, getSupportedAssetsImpl, findAssetInfoOnDestImpl, normalizeExchange, EXCHANGE_CHAINS, deepEqual, reverseTransformLocation, getAssetsImpl, ScenarioNotSupportedError, applyDecimalAbstraction, findAssetInfo, replaceBigInt, Builder, isChainEvm, convertBuilderConfig, handleSwapExecuteTransfer, getXcmFee, getOriginXcmFee as getOriginXcmFee$1, InvalidAddressError, MissingParameterError, BatchMode, createChainClient as createChainClient$2, getExistentialDeposit, 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';
|
|
@@ -2110,6 +2110,22 @@ var Hydration = {
|
|
|
2110
2110
|
]
|
|
2111
2111
|
}
|
|
2112
2112
|
},
|
|
2113
|
+
{
|
|
2114
|
+
parents: 1,
|
|
2115
|
+
interior: {
|
|
2116
|
+
X2: [
|
|
2117
|
+
{
|
|
2118
|
+
Parachain: 2034
|
|
2119
|
+
},
|
|
2120
|
+
{
|
|
2121
|
+
AccountKey20: {
|
|
2122
|
+
network: null,
|
|
2123
|
+
key: "0xb94025f14fdc01f8e3b0c34311bcbae0febd1a4a"
|
|
2124
|
+
}
|
|
2125
|
+
}
|
|
2126
|
+
]
|
|
2127
|
+
}
|
|
2128
|
+
},
|
|
2113
2129
|
{
|
|
2114
2130
|
parents: 1,
|
|
2115
2131
|
interior: {
|
|
@@ -2126,6 +2142,22 @@ var Hydration = {
|
|
|
2126
2142
|
]
|
|
2127
2143
|
}
|
|
2128
2144
|
},
|
|
2145
|
+
{
|
|
2146
|
+
parents: 1,
|
|
2147
|
+
interior: {
|
|
2148
|
+
X2: [
|
|
2149
|
+
{
|
|
2150
|
+
Parachain: 2034
|
|
2151
|
+
},
|
|
2152
|
+
{
|
|
2153
|
+
AccountKey20: {
|
|
2154
|
+
network: null,
|
|
2155
|
+
key: "0x3a31ff0a1e07da4158677ce861980cdf2e316b78"
|
|
2156
|
+
}
|
|
2157
|
+
}
|
|
2158
|
+
]
|
|
2159
|
+
}
|
|
2160
|
+
},
|
|
2129
2161
|
{
|
|
2130
2162
|
parents: 2,
|
|
2131
2163
|
interior: {
|
|
@@ -2691,6 +2723,31 @@ var Hydration = {
|
|
|
2691
2723
|
]
|
|
2692
2724
|
}
|
|
2693
2725
|
},
|
|
2726
|
+
{
|
|
2727
|
+
parents: 1,
|
|
2728
|
+
interior: {
|
|
2729
|
+
X4: [
|
|
2730
|
+
{
|
|
2731
|
+
Parachain: 2034
|
|
2732
|
+
},
|
|
2733
|
+
{
|
|
2734
|
+
GeneralKey: {
|
|
2735
|
+
length: 2,
|
|
2736
|
+
data: "0x7768000000000000000000000000000000000000000000000000000000000000"
|
|
2737
|
+
}
|
|
2738
|
+
},
|
|
2739
|
+
{
|
|
2740
|
+
GeneralIndex: 15
|
|
2741
|
+
},
|
|
2742
|
+
{
|
|
2743
|
+
GeneralKey: {
|
|
2744
|
+
length: 32,
|
|
2745
|
+
data: "0xb55c490bafb82aeb4b950fa479341c1b5fbfa814f8253b6acdf8426b7cd9d3c0"
|
|
2746
|
+
}
|
|
2747
|
+
}
|
|
2748
|
+
]
|
|
2749
|
+
}
|
|
2750
|
+
},
|
|
2694
2751
|
{
|
|
2695
2752
|
parents: 2,
|
|
2696
2753
|
interior: {
|
|
@@ -7862,41 +7919,17 @@ var ExchangeChain = /*#__PURE__*/function () {
|
|
|
7862
7919
|
return this._chain;
|
|
7863
7920
|
}
|
|
7864
7921
|
}, {
|
|
7865
|
-
key: "
|
|
7922
|
+
key: "createApiInstance",
|
|
7866
7923
|
value: function () {
|
|
7867
|
-
var
|
|
7868
|
-
var singleSwapResult;
|
|
7924
|
+
var _createApiInstance = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(builderOptions) {
|
|
7869
7925
|
return _regenerator().w(function (_context) {
|
|
7870
7926
|
while (1) switch (_context.n) {
|
|
7871
7927
|
case 0:
|
|
7872
|
-
_context.
|
|
7873
|
-
return this.swapCurrency(options, toDestTransactionFee);
|
|
7874
|
-
case 1:
|
|
7875
|
-
singleSwapResult = _context.v;
|
|
7876
|
-
return _context.a(2, {
|
|
7877
|
-
txs: [singleSwapResult.tx],
|
|
7878
|
-
amountOut: singleSwapResult.amountOut
|
|
7879
|
-
});
|
|
7928
|
+
return _context.a(2, createChainClient(this.chain, builderOptions));
|
|
7880
7929
|
}
|
|
7881
7930
|
}, _callee, this);
|
|
7882
7931
|
}));
|
|
7883
|
-
function
|
|
7884
|
-
return _handleMultiSwap.apply(this, arguments);
|
|
7885
|
-
}
|
|
7886
|
-
return handleMultiSwap;
|
|
7887
|
-
}()
|
|
7888
|
-
}, {
|
|
7889
|
-
key: "createApiInstance",
|
|
7890
|
-
value: function () {
|
|
7891
|
-
var _createApiInstance = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(builderOptions) {
|
|
7892
|
-
return _regenerator().w(function (_context2) {
|
|
7893
|
-
while (1) switch (_context2.n) {
|
|
7894
|
-
case 0:
|
|
7895
|
-
return _context2.a(2, createChainClient(this.chain, builderOptions));
|
|
7896
|
-
}
|
|
7897
|
-
}, _callee2, this);
|
|
7898
|
-
}));
|
|
7899
|
-
function createApiInstance(_x3) {
|
|
7932
|
+
function createApiInstance(_x) {
|
|
7900
7933
|
return _createApiInstance.apply(this, arguments);
|
|
7901
7934
|
}
|
|
7902
7935
|
return createApiInstance;
|
|
@@ -7904,15 +7937,15 @@ var ExchangeChain = /*#__PURE__*/function () {
|
|
|
7904
7937
|
}, {
|
|
7905
7938
|
key: "createApiInstancePapi",
|
|
7906
7939
|
value: function () {
|
|
7907
|
-
var _createApiInstancePapi = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
7908
|
-
return _regenerator().w(function (
|
|
7909
|
-
while (1) switch (
|
|
7940
|
+
var _createApiInstancePapi = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(builderOptions) {
|
|
7941
|
+
return _regenerator().w(function (_context2) {
|
|
7942
|
+
while (1) switch (_context2.n) {
|
|
7910
7943
|
case 0:
|
|
7911
|
-
return
|
|
7944
|
+
return _context2.a(2, createChainClient$1(this.chain, builderOptions));
|
|
7912
7945
|
}
|
|
7913
|
-
},
|
|
7946
|
+
}, _callee2, this);
|
|
7914
7947
|
}));
|
|
7915
|
-
function createApiInstancePapi(
|
|
7948
|
+
function createApiInstancePapi(_x2) {
|
|
7916
7949
|
return _createApiInstancePapi.apply(this, arguments);
|
|
7917
7950
|
}
|
|
7918
7951
|
return createApiInstancePapi;
|
|
@@ -8188,7 +8221,7 @@ var AcalaExchange = /*#__PURE__*/function (_ExchangeChain) {
|
|
|
8188
8221
|
_context.n = 7;
|
|
8189
8222
|
break;
|
|
8190
8223
|
}
|
|
8191
|
-
amountOutWithFee =
|
|
8224
|
+
amountOutWithFee = amountOut - padValueBy(toDestTransactionFee, FEE_BUFFER_PCT);
|
|
8192
8225
|
Logger.log('Amount out with fee:', amountOutWithFee);
|
|
8193
8226
|
Logger.log('Amount out decimals', toToken.decimals);
|
|
8194
8227
|
return _context.a(2, {
|
|
@@ -8430,225 +8463,148 @@ var AssetHubExchange = /*#__PURE__*/function (_ExchangeChain) {
|
|
|
8430
8463
|
return quoteOrThrow;
|
|
8431
8464
|
}()
|
|
8432
8465
|
}, {
|
|
8433
|
-
key: "
|
|
8466
|
+
key: "quoteSwapOrThrow",
|
|
8434
8467
|
value: function () {
|
|
8435
|
-
var
|
|
8436
|
-
var
|
|
8468
|
+
var _quoteSwapOrThrow = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(api, assetFrom, assetTo, nativeAsset, amount) {
|
|
8469
|
+
var from, to, _native, nativeAmountOut, _t2, _t3, _t4, _t5;
|
|
8437
8470
|
return _regenerator().w(function (_context2) {
|
|
8438
8471
|
while (1) switch (_context2.n) {
|
|
8439
8472
|
case 0:
|
|
8440
|
-
|
|
8441
|
-
|
|
8442
|
-
|
|
8443
|
-
|
|
8444
|
-
|
|
8445
|
-
_context2.n = 1;
|
|
8446
|
-
return this.quoteOrThrow(api, localizedFrom, localizedTo, amountWithoutFee);
|
|
8473
|
+
if (!isAssetEqual(assetFrom, assetTo)) {
|
|
8474
|
+
_context2.n = 1;
|
|
8475
|
+
break;
|
|
8476
|
+
}
|
|
8477
|
+
throw new RoutingResolutionError('Cannot swap asset to itself.');
|
|
8447
8478
|
case 1:
|
|
8448
|
-
|
|
8449
|
-
|
|
8450
|
-
|
|
8451
|
-
|
|
8452
|
-
module: 'AssetConversion',
|
|
8453
|
-
method: 'swap_exact_tokens_for_tokens',
|
|
8454
|
-
params: {
|
|
8455
|
-
path: [localizedFrom, localizedTo],
|
|
8456
|
-
amount_in: amountWithoutFee,
|
|
8457
|
-
amount_out_min: minAmountOut,
|
|
8458
|
-
send_to: sender,
|
|
8459
|
-
keep_alive: !!assetFrom.isNative
|
|
8460
|
-
}
|
|
8461
|
-
});
|
|
8462
|
-
if (!(toDestTxFee === 0n || assetTo.symbol == getNativeAssetSymbol(this.chain))) {
|
|
8463
|
-
_context2.n = 2;
|
|
8479
|
+
from = localizeLocation(this.chain, assetFrom.location);
|
|
8480
|
+
to = localizeLocation(this.chain, assetTo.location);
|
|
8481
|
+
if (!(isAssetEqual(assetFrom, nativeAsset) || isAssetEqual(assetTo, nativeAsset))) {
|
|
8482
|
+
_context2.n = 3;
|
|
8464
8483
|
break;
|
|
8465
8484
|
}
|
|
8466
|
-
_t2 =
|
|
8467
|
-
_context2.n =
|
|
8468
|
-
|
|
8485
|
+
_t2 = [from, to];
|
|
8486
|
+
_context2.n = 2;
|
|
8487
|
+
return this.quoteOrThrow(api, from, to, amount);
|
|
8469
8488
|
case 2:
|
|
8470
|
-
|
|
8471
|
-
return
|
|
8472
|
-
|
|
8473
|
-
|
|
8474
|
-
|
|
8475
|
-
}
|
|
8476
|
-
}, localizedTo, toDestTxFee, true);
|
|
8489
|
+
_t3 = _context2.v;
|
|
8490
|
+
return _context2.a(2, {
|
|
8491
|
+
path: _t2,
|
|
8492
|
+
amountOut: _t3
|
|
8493
|
+
});
|
|
8477
8494
|
case 3:
|
|
8478
|
-
|
|
8495
|
+
_native = localizeLocation(this.chain, nativeAsset.location);
|
|
8496
|
+
_context2.n = 4;
|
|
8497
|
+
return this.quoteOrThrow(api, from, _native, amount);
|
|
8479
8498
|
case 4:
|
|
8480
|
-
|
|
8481
|
-
|
|
8482
|
-
if (!(finalAmountOut <= 0n)) {
|
|
8499
|
+
nativeAmountOut = _context2.v;
|
|
8500
|
+
if (!(nativeAmountOut <= 0n)) {
|
|
8483
8501
|
_context2.n = 5;
|
|
8484
8502
|
break;
|
|
8485
8503
|
}
|
|
8486
|
-
throw new AmountTooLowError();
|
|
8504
|
+
throw new AmountTooLowError("First hop (".concat(assetFrom.symbol, " -> ").concat(nativeAsset.symbol, ") resulted in zero or negative output."));
|
|
8487
8505
|
case 5:
|
|
8506
|
+
_t4 = [from, _native, to];
|
|
8507
|
+
_context2.n = 6;
|
|
8508
|
+
return this.quoteOrThrow(api, _native, to, nativeAmountOut);
|
|
8509
|
+
case 6:
|
|
8510
|
+
_t5 = _context2.v;
|
|
8488
8511
|
return _context2.a(2, {
|
|
8489
|
-
|
|
8490
|
-
amountOut:
|
|
8512
|
+
path: _t4,
|
|
8513
|
+
amountOut: _t5
|
|
8491
8514
|
});
|
|
8492
8515
|
}
|
|
8493
8516
|
}, _callee2, this);
|
|
8494
8517
|
}));
|
|
8495
|
-
function
|
|
8496
|
-
return
|
|
8518
|
+
function quoteSwapOrThrow(_x5, _x6, _x7, _x8, _x9) {
|
|
8519
|
+
return _quoteSwapOrThrow.apply(this, arguments);
|
|
8497
8520
|
}
|
|
8498
|
-
return
|
|
8521
|
+
return quoteSwapOrThrow;
|
|
8499
8522
|
}()
|
|
8500
8523
|
}, {
|
|
8501
|
-
key: "
|
|
8524
|
+
key: "swapCurrency",
|
|
8502
8525
|
value: function () {
|
|
8503
|
-
var
|
|
8504
|
-
var assetFrom, assetTo, nativeAsset,
|
|
8526
|
+
var _swapCurrency = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(options, toDestTxFee) {
|
|
8527
|
+
var api, assetFrom, assetTo, amount, sender, slippagePct, origin, nativeAsset, pctDestFee, amountWithoutFee, _yield$this$quoteSwap, path, amountOut, slippageMultiplier, minAmountOut, tx, toDestFeeCurrencyTo, finalAmountOut, _t6;
|
|
8505
8528
|
return _regenerator().w(function (_context3) {
|
|
8506
8529
|
while (1) switch (_context3.n) {
|
|
8507
8530
|
case 0:
|
|
8508
|
-
assetFrom = options.assetFrom, assetTo = options.assetTo;
|
|
8509
|
-
nativeAsset =
|
|
8510
|
-
|
|
8511
|
-
|
|
8512
|
-
|
|
8513
|
-
|
|
8514
|
-
break;
|
|
8515
|
-
}
|
|
8516
|
-
throw new RoutingResolutionError('Native asset not found for this exchange chain.');
|
|
8531
|
+
api = options.api, assetFrom = options.assetFrom, assetTo = options.assetTo, amount = options.amount, sender = options.sender, slippagePct = options.slippagePct, origin = options.origin;
|
|
8532
|
+
nativeAsset = findNativeAssetInfoOrThrow(this.chain);
|
|
8533
|
+
pctDestFee = origin ? DEST_FEE_BUFFER_PCT : 0;
|
|
8534
|
+
amountWithoutFee = padValueBy(amount, pctDestFee);
|
|
8535
|
+
_context3.n = 1;
|
|
8536
|
+
return this.quoteSwapOrThrow(api, assetFrom, assetTo, nativeAsset, amountWithoutFee);
|
|
8517
8537
|
case 1:
|
|
8518
|
-
|
|
8519
|
-
|
|
8520
|
-
|
|
8538
|
+
_yield$this$quoteSwap = _context3.v;
|
|
8539
|
+
path = _yield$this$quoteSwap.path;
|
|
8540
|
+
amountOut = _yield$this$quoteSwap.amountOut;
|
|
8541
|
+
slippageMultiplier = Number(slippagePct);
|
|
8542
|
+
minAmountOut = padValueBy(amountOut, -slippageMultiplier);
|
|
8543
|
+
tx = api.deserializeExtrinsics({
|
|
8544
|
+
module: 'AssetConversion',
|
|
8545
|
+
method: 'swap_exact_tokens_for_tokens',
|
|
8546
|
+
params: {
|
|
8547
|
+
path: path,
|
|
8548
|
+
amount_in: amountWithoutFee,
|
|
8549
|
+
amount_out_min: minAmountOut,
|
|
8550
|
+
send_to: sender,
|
|
8551
|
+
keep_alive: !!assetFrom.isNative
|
|
8552
|
+
}
|
|
8553
|
+
});
|
|
8554
|
+
if (!(toDestTxFee === 0n || isAssetEqual(assetTo, nativeAsset))) {
|
|
8521
8555
|
_context3.n = 2;
|
|
8522
8556
|
break;
|
|
8523
8557
|
}
|
|
8524
|
-
|
|
8558
|
+
_t6 = toDestTxFee;
|
|
8559
|
+
_context3.n = 4;
|
|
8560
|
+
break;
|
|
8525
8561
|
case 2:
|
|
8526
|
-
if (!(isAssetFromNative || isAssetToNative)) {
|
|
8527
|
-
_context3.n = 4;
|
|
8528
|
-
break;
|
|
8529
|
-
}
|
|
8530
8562
|
_context3.n = 3;
|
|
8531
|
-
return this.
|
|
8563
|
+
return this.quoteOrThrow(api, localizeLocation(this.chain, nativeAsset.location), localizeLocation(this.chain, assetTo.location), toDestTxFee, true);
|
|
8532
8564
|
case 3:
|
|
8533
|
-
|
|
8534
|
-
return _context3.a(2, {
|
|
8535
|
-
txs: [singleSwapResult.tx],
|
|
8536
|
-
amountOut: singleSwapResult.amountOut
|
|
8537
|
-
});
|
|
8565
|
+
_t6 = _context3.v;
|
|
8538
8566
|
case 4:
|
|
8539
|
-
|
|
8540
|
-
|
|
8541
|
-
|
|
8542
|
-
|
|
8543
|
-
_context3.n = 5;
|
|
8544
|
-
return this.swapCurrency(optionsHop1, 0n);
|
|
8545
|
-
case 5:
|
|
8546
|
-
resultHop1 = _context3.v;
|
|
8547
|
-
if (!(resultHop1.amountOut <= 0n)) {
|
|
8548
|
-
_context3.n = 6;
|
|
8549
|
-
break;
|
|
8550
|
-
}
|
|
8551
|
-
throw new AmountTooLowError("First hop (".concat(assetFrom.symbol, " -> ").concat(nativeAsset.symbol, ") resulted in zero or negative output."));
|
|
8552
|
-
case 6:
|
|
8553
|
-
hop1Received = resultHop1.amountOut;
|
|
8554
|
-
assumedInputForHop2 = padValueBy(hop1Received, -2);
|
|
8555
|
-
optionsHop2 = {
|
|
8556
|
-
apiType: 'GENERIC',
|
|
8557
|
-
api: options.api,
|
|
8558
|
-
slippagePct: options.slippagePct,
|
|
8559
|
-
sender: options.sender,
|
|
8560
|
-
origin: undefined,
|
|
8561
|
-
assetFrom: nativeAsset,
|
|
8562
|
-
assetTo: assetTo,
|
|
8563
|
-
amount: assumedInputForHop2,
|
|
8564
|
-
feeCalcAddress: options.feeCalcAddress
|
|
8565
|
-
};
|
|
8566
|
-
_context3.n = 7;
|
|
8567
|
-
return this.swapCurrency(optionsHop2, toDestTransactionFee);
|
|
8568
|
-
case 7:
|
|
8569
|
-
resultHop2 = _context3.v;
|
|
8570
|
-
if (!(resultHop2.amountOut <= 0n)) {
|
|
8571
|
-
_context3.n = 8;
|
|
8567
|
+
toDestFeeCurrencyTo = _t6;
|
|
8568
|
+
finalAmountOut = amountOut - padValueBy(toDestFeeCurrencyTo, FEE_BUFFER_PCT);
|
|
8569
|
+
if (!(finalAmountOut <= 0n)) {
|
|
8570
|
+
_context3.n = 5;
|
|
8572
8571
|
break;
|
|
8573
8572
|
}
|
|
8574
|
-
throw new AmountTooLowError(
|
|
8575
|
-
case
|
|
8573
|
+
throw new AmountTooLowError();
|
|
8574
|
+
case 5:
|
|
8576
8575
|
return _context3.a(2, {
|
|
8577
|
-
|
|
8578
|
-
amountOut:
|
|
8576
|
+
tx: tx,
|
|
8577
|
+
amountOut: finalAmountOut
|
|
8579
8578
|
});
|
|
8580
|
-
case 9:
|
|
8581
|
-
return _context3.a(2);
|
|
8582
8579
|
}
|
|
8583
8580
|
}, _callee3, this);
|
|
8584
8581
|
}));
|
|
8585
|
-
function
|
|
8586
|
-
return
|
|
8582
|
+
function swapCurrency(_x0, _x1) {
|
|
8583
|
+
return _swapCurrency.apply(this, arguments);
|
|
8587
8584
|
}
|
|
8588
|
-
return
|
|
8585
|
+
return swapCurrency;
|
|
8589
8586
|
}()
|
|
8590
8587
|
}, {
|
|
8591
8588
|
key: "getAmountOut",
|
|
8592
8589
|
value: function () {
|
|
8593
8590
|
var _getAmountOut = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(options) {
|
|
8594
|
-
var api, assetFrom, assetTo, amount, origin,
|
|
8591
|
+
var api, assetFrom, assetTo, amount, origin, pctDestFee, amountWithoutFee, _yield$this$quoteSwap2, amountOut;
|
|
8595
8592
|
return _regenerator().w(function (_context4) {
|
|
8596
8593
|
while (1) switch (_context4.n) {
|
|
8597
8594
|
case 0:
|
|
8598
8595
|
api = options.api, assetFrom = options.assetFrom, assetTo = options.assetTo, amount = options.amount, origin = options.origin;
|
|
8599
|
-
nativeAsset = getExchangeAsset(this.chain, {
|
|
8600
|
-
symbol: getNativeAssetSymbol(this.chain)
|
|
8601
|
-
});
|
|
8602
|
-
if (nativeAsset) {
|
|
8603
|
-
_context4.n = 1;
|
|
8604
|
-
break;
|
|
8605
|
-
}
|
|
8606
|
-
throw new RoutingResolutionError('Native asset not found for this exchange chain.');
|
|
8607
|
-
case 1:
|
|
8608
|
-
isAssetFromNative = assetFrom.symbol === nativeAsset.symbol;
|
|
8609
|
-
isAssetToNative = assetTo.symbol === nativeAsset.symbol;
|
|
8610
|
-
if (!(isAssetFromNative && isAssetToNative)) {
|
|
8611
|
-
_context4.n = 2;
|
|
8612
|
-
break;
|
|
8613
|
-
}
|
|
8614
|
-
throw new RoutingResolutionError('Cannot swap native asset to itself.');
|
|
8615
|
-
case 2:
|
|
8616
8596
|
pctDestFee = origin ? DEST_FEE_BUFFER_PCT : 0;
|
|
8617
8597
|
amountWithoutFee = padValueBy(amount, pctDestFee);
|
|
8618
|
-
|
|
8619
|
-
|
|
8620
|
-
|
|
8621
|
-
|
|
8622
|
-
|
|
8623
|
-
|
|
8624
|
-
_context4.n = 4;
|
|
8625
|
-
return this.quoteOrThrow(api, localizeLocation(this.chain, assetFrom.location), localizeLocation(this.chain, nativeAsset.location), amountWithoutFee);
|
|
8626
|
-
case 4:
|
|
8627
|
-
hop1AmountOut = _context4.v;
|
|
8628
|
-
if (!(hop1AmountOut <= 0n)) {
|
|
8629
|
-
_context4.n = 5;
|
|
8630
|
-
break;
|
|
8631
|
-
}
|
|
8632
|
-
throw new AmountTooLowError("First hop (".concat(assetFrom.symbol, " -> ").concat(nativeAsset.symbol, ") resulted in zero or negative output."));
|
|
8633
|
-
case 5:
|
|
8634
|
-
assumedInputForHop2 = padValueBy(hop1AmountOut, -2);
|
|
8635
|
-
_context4.n = 6;
|
|
8636
|
-
return this.quoteOrThrow(api, localizeLocation(this.chain, nativeAsset.location), localizeLocation(this.chain, assetTo.location), assumedInputForHop2);
|
|
8637
|
-
case 6:
|
|
8638
|
-
finalAmountOut = _context4.v;
|
|
8639
|
-
if (!(finalAmountOut <= 0n)) {
|
|
8640
|
-
_context4.n = 7;
|
|
8641
|
-
break;
|
|
8642
|
-
}
|
|
8643
|
-
throw new AmountTooLowError("Second hop (".concat(nativeAsset.symbol, " -> ").concat(assetTo.symbol, ") resulted in zero or negative output."));
|
|
8644
|
-
case 7:
|
|
8645
|
-
return _context4.a(2, finalAmountOut);
|
|
8646
|
-
case 8:
|
|
8647
|
-
return _context4.a(2);
|
|
8598
|
+
_context4.n = 1;
|
|
8599
|
+
return this.quoteSwapOrThrow(api, assetFrom, assetTo, findNativeAssetInfoOrThrow(this.chain), amountWithoutFee);
|
|
8600
|
+
case 1:
|
|
8601
|
+
_yield$this$quoteSwap2 = _context4.v;
|
|
8602
|
+
amountOut = _yield$this$quoteSwap2.amountOut;
|
|
8603
|
+
return _context4.a(2, amountOut);
|
|
8648
8604
|
}
|
|
8649
8605
|
}, _callee4, this);
|
|
8650
8606
|
}));
|
|
8651
|
-
function getAmountOut(
|
|
8607
|
+
function getAmountOut(_x10) {
|
|
8652
8608
|
return _getAmountOut.apply(this, arguments);
|
|
8653
8609
|
}
|
|
8654
8610
|
return getAmountOut;
|
|
@@ -8664,7 +8620,7 @@ var AssetHubExchange = /*#__PURE__*/function (_ExchangeChain) {
|
|
|
8664
8620
|
}
|
|
8665
8621
|
}, _callee5, this);
|
|
8666
8622
|
}));
|
|
8667
|
-
function getDexConfig(
|
|
8623
|
+
function getDexConfig(_x11) {
|
|
8668
8624
|
return _getDexConfig2.apply(this, arguments);
|
|
8669
8625
|
}
|
|
8670
8626
|
return getDexConfig;
|
|
@@ -10035,7 +9991,7 @@ var selectBestExchange = /*#__PURE__*/function () {
|
|
|
10035
9991
|
exchangeConfig = convertBuilderConfig(api.config);
|
|
10036
9992
|
return _context2.a(2, selectBestExchangeCommon(options, originApi, /*#__PURE__*/function () {
|
|
10037
9993
|
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(dex, assetFromExchange, assetTo, options, parsedAmount) {
|
|
10038
|
-
var exchangeInfo, modifiedOptions, toDestTxFee, _yield$dex$
|
|
9994
|
+
var exchangeInfo, modifiedOptions, toDestTxFee, _yield$dex$swapCurren, amountOut, _t, _t2, _t3, _t4, _t5, _t6, _t7, _t8, _t9;
|
|
10039
9995
|
return _regenerator().w(function (_context) {
|
|
10040
9996
|
while (1) switch (_context.n) {
|
|
10041
9997
|
case 0:
|
|
@@ -10070,15 +10026,15 @@ var selectBestExchange = /*#__PURE__*/function () {
|
|
|
10070
10026
|
case 3:
|
|
10071
10027
|
toDestTxFee = _context.v;
|
|
10072
10028
|
_context.n = 4;
|
|
10073
|
-
return dex.
|
|
10029
|
+
return dex.swapCurrency(_objectSpread2(_objectSpread2(_objectSpread2({}, modifiedOptions), pickExchangeApiVariant(modifiedOptions.exchange)), {}, {
|
|
10074
10030
|
api: modifiedOptions.exchange.api,
|
|
10075
10031
|
assetFrom: modifiedOptions.exchange.assetFrom,
|
|
10076
10032
|
assetTo: modifiedOptions.exchange.assetTo,
|
|
10077
10033
|
isForFeeEstimation: isForFeeEstimation
|
|
10078
10034
|
}), toDestTxFee);
|
|
10079
10035
|
case 4:
|
|
10080
|
-
_yield$dex$
|
|
10081
|
-
amountOut = _yield$dex$
|
|
10036
|
+
_yield$dex$swapCurren = _context.v;
|
|
10037
|
+
amountOut = _yield$dex$swapCurren.amountOut;
|
|
10082
10038
|
return _context.a(2, amountOut);
|
|
10083
10039
|
}
|
|
10084
10040
|
}, _callee);
|
|
@@ -10566,9 +10522,12 @@ var createSwapTx = /*#__PURE__*/function () {
|
|
|
10566
10522
|
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(exchange, options) {
|
|
10567
10523
|
var isForFeeEstimation,
|
|
10568
10524
|
toDestTxFee,
|
|
10569
|
-
|
|
10570
|
-
|
|
10571
|
-
|
|
10525
|
+
_yield$exchange$swapC,
|
|
10526
|
+
tx,
|
|
10527
|
+
amountOut,
|
|
10528
|
+
_args2 = arguments,
|
|
10529
|
+
_t,
|
|
10530
|
+
_t2;
|
|
10572
10531
|
return _regenerator().w(function (_context2) {
|
|
10573
10532
|
while (1) switch (_context2.n) {
|
|
10574
10533
|
case 0:
|
|
@@ -10578,23 +10537,24 @@ var createSwapTx = /*#__PURE__*/function () {
|
|
|
10578
10537
|
case 1:
|
|
10579
10538
|
toDestTxFee = _context2.v;
|
|
10580
10539
|
_context2.n = 2;
|
|
10581
|
-
return exchange.
|
|
10540
|
+
return exchange.swapCurrency(_objectSpread2(_objectSpread2(_objectSpread2({}, options), pickExchangeApiVariant(options.exchange)), {}, {
|
|
10582
10541
|
api: options.exchange.api,
|
|
10583
10542
|
assetFrom: options.exchange.assetFrom,
|
|
10584
10543
|
assetTo: options.exchange.assetTo,
|
|
10585
10544
|
isForFeeEstimation: isForFeeEstimation
|
|
10586
10545
|
}), toDestTxFee);
|
|
10587
10546
|
case 2:
|
|
10588
|
-
|
|
10547
|
+
_yield$exchange$swapC = _context2.v;
|
|
10548
|
+
tx = _yield$exchange$swapC.tx;
|
|
10549
|
+
amountOut = _yield$exchange$swapC.amountOut;
|
|
10589
10550
|
_context2.n = 3;
|
|
10590
|
-
return
|
|
10591
|
-
return convertTxToTarget(tx, options.exchange.api);
|
|
10592
|
-
}));
|
|
10551
|
+
return convertTxToTarget(tx, options.exchange.api);
|
|
10593
10552
|
case 3:
|
|
10594
|
-
|
|
10553
|
+
_t = _context2.v;
|
|
10554
|
+
_t2 = amountOut;
|
|
10595
10555
|
return _context2.a(2, {
|
|
10596
|
-
|
|
10597
|
-
amountOut:
|
|
10556
|
+
tx: _t,
|
|
10557
|
+
amountOut: _t2
|
|
10598
10558
|
});
|
|
10599
10559
|
}
|
|
10600
10560
|
}, _callee2);
|
|
@@ -10606,7 +10566,7 @@ var createSwapTx = /*#__PURE__*/function () {
|
|
|
10606
10566
|
|
|
10607
10567
|
var prepareExtrinsics = /*#__PURE__*/function () {
|
|
10608
10568
|
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(dex, options) {
|
|
10609
|
-
var api, origin, exchange, destination, sender, _yield$buildSwapExecu, tx, _amountOut, toExchangeTx, _yield$createSwapTx,
|
|
10569
|
+
var api, origin, exchange, destination, sender, _yield$buildSwapExecu, tx, _amountOut, toExchangeTx, _yield$createSwapTx, swapTx, amountOut, toDestTx, _t, _t2, _t3;
|
|
10610
10570
|
return _regenerator().w(function (_context) {
|
|
10611
10571
|
while (1) switch (_context.p = _context.n) {
|
|
10612
10572
|
case 0:
|
|
@@ -10623,7 +10583,7 @@ var prepareExtrinsics = /*#__PURE__*/function () {
|
|
|
10623
10583
|
tx = _yield$buildSwapExecu.tx;
|
|
10624
10584
|
_amountOut = _yield$buildSwapExecu.amountOut;
|
|
10625
10585
|
return _context.a(2, {
|
|
10626
|
-
|
|
10586
|
+
swapTx: tx,
|
|
10627
10587
|
isExecute: true,
|
|
10628
10588
|
amountOut: _amountOut
|
|
10629
10589
|
});
|
|
@@ -10658,7 +10618,7 @@ var prepareExtrinsics = /*#__PURE__*/function () {
|
|
|
10658
10618
|
return createSwapTx(dex, options);
|
|
10659
10619
|
case 8:
|
|
10660
10620
|
_yield$createSwapTx = _context.v;
|
|
10661
|
-
|
|
10621
|
+
swapTx = _yield$createSwapTx.tx;
|
|
10662
10622
|
amountOut = _yield$createSwapTx.amountOut;
|
|
10663
10623
|
if (!(destination && destination.chain !== exchange.chain)) {
|
|
10664
10624
|
_context.n = 10;
|
|
@@ -10682,7 +10642,7 @@ var prepareExtrinsics = /*#__PURE__*/function () {
|
|
|
10682
10642
|
toDestTx = _t3;
|
|
10683
10643
|
return _context.a(2, {
|
|
10684
10644
|
toExchangeTx: toExchangeTx,
|
|
10685
|
-
|
|
10645
|
+
swapTx: swapTx,
|
|
10686
10646
|
toDestTx: toDestTx,
|
|
10687
10647
|
amountOut: BigInt(amountOut)
|
|
10688
10648
|
});
|
|
@@ -10696,7 +10656,7 @@ var prepareExtrinsics = /*#__PURE__*/function () {
|
|
|
10696
10656
|
|
|
10697
10657
|
var buildTransactions = /*#__PURE__*/function () {
|
|
10698
10658
|
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(dex, options) {
|
|
10699
|
-
var origin, exchange, destination, _yield$prepareExtrins, toExchangeTx,
|
|
10659
|
+
var origin, exchange, destination, _yield$prepareExtrins, toExchangeTx, swapTx, toDestTx, amountOut, isExecute, transactions, batchedTx, _origin$api, _origin$chain;
|
|
10700
10660
|
return _regenerator().w(function (_context) {
|
|
10701
10661
|
while (1) switch (_context.n) {
|
|
10702
10662
|
case 0:
|
|
@@ -10706,7 +10666,7 @@ var buildTransactions = /*#__PURE__*/function () {
|
|
|
10706
10666
|
case 1:
|
|
10707
10667
|
_yield$prepareExtrins = _context.v;
|
|
10708
10668
|
toExchangeTx = _yield$prepareExtrins.toExchangeTx;
|
|
10709
|
-
|
|
10669
|
+
swapTx = _yield$prepareExtrins.swapTx;
|
|
10710
10670
|
toDestTx = _yield$prepareExtrins.toDestTx;
|
|
10711
10671
|
amountOut = _yield$prepareExtrins.amountOut;
|
|
10712
10672
|
isExecute = _yield$prepareExtrins.isExecute;
|
|
@@ -10721,7 +10681,7 @@ var buildTransactions = /*#__PURE__*/function () {
|
|
|
10721
10681
|
});
|
|
10722
10682
|
}
|
|
10723
10683
|
if (toDestTx) {
|
|
10724
|
-
batchedTx = exchange.api.callBatchMethod([
|
|
10684
|
+
batchedTx = exchange.api.callBatchMethod([swapTx, toDestTx], BatchMode.BATCH_ALL);
|
|
10725
10685
|
transactions.push({
|
|
10726
10686
|
api: exchange.api.api,
|
|
10727
10687
|
chain: dex.chain,
|
|
@@ -10731,24 +10691,13 @@ var buildTransactions = /*#__PURE__*/function () {
|
|
|
10731
10691
|
amountOut: amountOut
|
|
10732
10692
|
});
|
|
10733
10693
|
} else {
|
|
10734
|
-
|
|
10735
|
-
|
|
10736
|
-
|
|
10737
|
-
|
|
10738
|
-
|
|
10739
|
-
|
|
10740
|
-
|
|
10741
|
-
});
|
|
10742
|
-
} else {
|
|
10743
|
-
batchedSwapTx = exchange.api.callBatchMethod(swapTxs, BatchMode.BATCH_ALL);
|
|
10744
|
-
transactions.push({
|
|
10745
|
-
api: exchange.api.api,
|
|
10746
|
-
chain: dex.chain,
|
|
10747
|
-
tx: batchedSwapTx,
|
|
10748
|
-
amountOut: amountOut,
|
|
10749
|
-
type: 'SWAP'
|
|
10750
|
-
});
|
|
10751
|
-
}
|
|
10694
|
+
transactions.push({
|
|
10695
|
+
api: isExecute ? (_origin$api = origin === null || origin === void 0 ? void 0 : origin.api) !== null && _origin$api !== void 0 ? _origin$api : exchange.api.api : exchange.api.api,
|
|
10696
|
+
chain: isExecute ? (_origin$chain = origin === null || origin === void 0 ? void 0 : origin.chain) !== null && _origin$chain !== void 0 ? _origin$chain : dex.chain : dex.chain,
|
|
10697
|
+
tx: swapTx,
|
|
10698
|
+
amountOut: amountOut,
|
|
10699
|
+
type: 'SWAP'
|
|
10700
|
+
});
|
|
10752
10701
|
}
|
|
10753
10702
|
return _context.a(2, transactions);
|
|
10754
10703
|
}
|
|
@@ -10862,7 +10811,7 @@ var getOriginXcmFee = /*#__PURE__*/function () {
|
|
|
10862
10811
|
var getSwapFee = /*#__PURE__*/function () {
|
|
10863
10812
|
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(exchange, options, disableFallback) {
|
|
10864
10813
|
var _result$fee;
|
|
10865
|
-
var sender, _options$exchange, assetFrom, api, amount,
|
|
10814
|
+
var sender, _options$exchange, assetFrom, api, amount, amountOut, isForFeeEstimation, _yield$createSwapTx, buildTx, result, _t;
|
|
10866
10815
|
return _regenerator().w(function (_context2) {
|
|
10867
10816
|
while (1) switch (_context2.p = _context2.n) {
|
|
10868
10817
|
case 0:
|
|
@@ -10872,9 +10821,8 @@ var getSwapFee = /*#__PURE__*/function () {
|
|
|
10872
10821
|
_context2.n = 2;
|
|
10873
10822
|
return createSwapTx(exchange, options, isForFeeEstimation);
|
|
10874
10823
|
case 2:
|
|
10875
|
-
|
|
10876
|
-
|
|
10877
|
-
amountOut = swapResult.amountOut;
|
|
10824
|
+
_yield$createSwapTx = _context2.v;
|
|
10825
|
+
amountOut = _yield$createSwapTx.amountOut;
|
|
10878
10826
|
_context2.n = 5;
|
|
10879
10827
|
break;
|
|
10880
10828
|
case 3:
|
|
@@ -10886,12 +10834,11 @@ var getSwapFee = /*#__PURE__*/function () {
|
|
|
10886
10834
|
}
|
|
10887
10835
|
throw _t;
|
|
10888
10836
|
case 4:
|
|
10889
|
-
txs = [null];
|
|
10890
10837
|
amountOut = 0n;
|
|
10891
10838
|
case 5:
|
|
10892
10839
|
buildTx = /*#__PURE__*/function () {
|
|
10893
10840
|
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(overrideAmount) {
|
|
10894
|
-
var txOptions, _yield$
|
|
10841
|
+
var txOptions, _yield$createSwapTx2, tx;
|
|
10895
10842
|
return _regenerator().w(function (_context) {
|
|
10896
10843
|
while (1) switch (_context.n) {
|
|
10897
10844
|
case 0:
|
|
@@ -10901,9 +10848,9 @@ var getSwapFee = /*#__PURE__*/function () {
|
|
|
10901
10848
|
_context.n = 1;
|
|
10902
10849
|
return createSwapTx(exchange, txOptions, isForFeeEstimation);
|
|
10903
10850
|
case 1:
|
|
10904
|
-
_yield$
|
|
10905
|
-
|
|
10906
|
-
return _context.a(2,
|
|
10851
|
+
_yield$createSwapTx2 = _context.v;
|
|
10852
|
+
tx = _yield$createSwapTx2.tx;
|
|
10853
|
+
return _context.a(2, tx);
|
|
10907
10854
|
}
|
|
10908
10855
|
}, _callee);
|
|
10909
10856
|
}));
|
|
@@ -10926,10 +10873,9 @@ var getSwapFee = /*#__PURE__*/function () {
|
|
|
10926
10873
|
});
|
|
10927
10874
|
case 6:
|
|
10928
10875
|
result = _context2.v;
|
|
10929
|
-
finalFee = ((_result$fee = result.fee) !== null && _result$fee !== void 0 ? _result$fee : 0n) * BigInt(txs.length);
|
|
10930
10876
|
return _context2.a(2, {
|
|
10931
10877
|
result: _objectSpread2(_objectSpread2({}, result), {}, {
|
|
10932
|
-
fee:
|
|
10878
|
+
fee: (_result$fee = result.fee) !== null && _result$fee !== void 0 ? _result$fee : 0n
|
|
10933
10879
|
}),
|
|
10934
10880
|
amountOut: amountOut
|
|
10935
10881
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@paraspell/swap",
|
|
3
|
-
"version": "14.5.
|
|
3
|
+
"version": "14.5.3",
|
|
4
4
|
"description": "Tool for XCM cross-chain asset exchanging across Polkadot and Kusama ecosystems",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -38,10 +38,10 @@
|
|
|
38
38
|
"@crypto-dex-sdk/token-lists": "^0.1.4",
|
|
39
39
|
"@galacticcouncil/descriptors": "^2.9.0",
|
|
40
40
|
"@galacticcouncil/sdk-next": "^2.5.0",
|
|
41
|
-
"@paraspell/sdk": "14.5.
|
|
42
|
-
"@paraspell/sdk-common": "14.5.
|
|
43
|
-
"@paraspell/sdk-core": "14.5.
|
|
44
|
-
"@paraspell/sdk-pjs": "14.5.
|
|
41
|
+
"@paraspell/sdk": "14.5.3",
|
|
42
|
+
"@paraspell/sdk-common": "14.5.3",
|
|
43
|
+
"@paraspell/sdk-core": "14.5.3",
|
|
44
|
+
"@paraspell/sdk-pjs": "14.5.3",
|
|
45
45
|
"@polkadot/api": "^17.0.2",
|
|
46
46
|
"@polkadot/types": "^17.0.2",
|
|
47
47
|
"@polkadot/util": "^14.0.3",
|