@paraspell/swap 14.5.3 → 14.5.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/dist/index.d.ts +3 -0
- package/dist/index.mjs +326 -376
- package/package.json +14 -14
package/dist/index.d.ts
CHANGED
|
@@ -24,6 +24,8 @@ type TSwapOptionsCommon<TApi, TRes, TSigner, TCustomChain extends string = never
|
|
|
24
24
|
amount: bigint;
|
|
25
25
|
slippagePct: string;
|
|
26
26
|
sender: string;
|
|
27
|
+
recipient: string;
|
|
28
|
+
destination?: TDestinationInfo;
|
|
27
29
|
feeCalcAddress: string;
|
|
28
30
|
origin?: TOriginInfo<TApi>;
|
|
29
31
|
isForFeeEstimation?: boolean;
|
|
@@ -151,6 +153,7 @@ type TAdditionalTransferOptions<TApi, TRes, TSigner, TCustomChain extends string
|
|
|
151
153
|
origin?: TOriginInfo<TApi>;
|
|
152
154
|
exchange: TExchangeInfo<TApi, TRes, TSigner, TCustomChain>;
|
|
153
155
|
destination?: TDestinationInfo;
|
|
156
|
+
recipient: string;
|
|
154
157
|
feeCalcAddress: string;
|
|
155
158
|
};
|
|
156
159
|
type TPairs = TLocation[][];
|
package/dist/index.mjs
CHANGED
|
@@ -12,10 +12,8 @@ import { WsProvider, ApiPromise } from '@polkadot/api';
|
|
|
12
12
|
import { lowercaseFirstLetter, snakeToCamel } from '@paraspell/sdk-common';
|
|
13
13
|
import { Amount, Token, getCurrencyCombinations } from '@crypto-dex-sdk/currency';
|
|
14
14
|
import { Percent } from '@crypto-dex-sdk/math';
|
|
15
|
-
import { PAIR_ADDRESSES, isNativeCurrency, addressToNodeCurrency, SwapRouter } from '@crypto-dex-sdk/parachains-bifrost';
|
|
15
|
+
import { getPairs, uniqePairKey, PAIR_ADDRESSES, isNativeCurrency, addressToNodeCurrency, SwapRouter } from '@crypto-dex-sdk/parachains-bifrost';
|
|
16
16
|
import { Trade, Pair } from '@crypto-dex-sdk/amm';
|
|
17
|
-
import { ParachainId } from '@crypto-dex-sdk/chain';
|
|
18
|
-
import { addressToZenlinkAssetId } from '@crypto-dex-sdk/format';
|
|
19
17
|
import { DEFULT_TOKEN_LIST_MAP, WrappedTokenInfo } from '@crypto-dex-sdk/token-lists';
|
|
20
18
|
import { createSdkContext } from '@galacticcouncil/sdk-next';
|
|
21
19
|
import { parseUnits as parseUnits$1, ethers } from 'ethers-v6';
|
|
@@ -7911,6 +7909,7 @@ var Logger = {
|
|
|
7911
7909
|
var ExchangeChain = /*#__PURE__*/function () {
|
|
7912
7910
|
function ExchangeChain(chain) {
|
|
7913
7911
|
_classCallCheck(this, ExchangeChain);
|
|
7912
|
+
this.supportsRecipient = false;
|
|
7914
7913
|
this._chain = chain;
|
|
7915
7914
|
}
|
|
7916
7915
|
return _createClass(ExchangeChain, [{
|
|
@@ -7919,33 +7918,60 @@ var ExchangeChain = /*#__PURE__*/function () {
|
|
|
7919
7918
|
return this._chain;
|
|
7920
7919
|
}
|
|
7921
7920
|
}, {
|
|
7922
|
-
key: "
|
|
7921
|
+
key: "swapCurrency",
|
|
7923
7922
|
value: function () {
|
|
7924
|
-
var
|
|
7923
|
+
var _swapCurrency = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(options, toDestTransactionFee) {
|
|
7924
|
+
var sender, destination, recipient;
|
|
7925
7925
|
return _regenerator().w(function (_context) {
|
|
7926
7926
|
while (1) switch (_context.n) {
|
|
7927
7927
|
case 0:
|
|
7928
|
-
|
|
7928
|
+
sender = options.sender, destination = options.destination;
|
|
7929
|
+
recipient = destination ? sender : options.recipient;
|
|
7930
|
+
if (!(!this.supportsRecipient && recipient !== sender)) {
|
|
7931
|
+
_context.n = 1;
|
|
7932
|
+
break;
|
|
7933
|
+
}
|
|
7934
|
+
throw new UnsupportedOperationError("".concat(this.chain, " cannot deposit swapped tokens to a different recipient."));
|
|
7935
|
+
case 1:
|
|
7936
|
+
return _context.a(2, this.buildSwap(_objectSpread2(_objectSpread2({}, options), {}, {
|
|
7937
|
+
recipient: recipient
|
|
7938
|
+
}), toDestTransactionFee));
|
|
7929
7939
|
}
|
|
7930
7940
|
}, _callee, this);
|
|
7931
7941
|
}));
|
|
7932
|
-
function
|
|
7933
|
-
return
|
|
7942
|
+
function swapCurrency(_x, _x2) {
|
|
7943
|
+
return _swapCurrency.apply(this, arguments);
|
|
7934
7944
|
}
|
|
7935
|
-
return
|
|
7945
|
+
return swapCurrency;
|
|
7936
7946
|
}()
|
|
7937
7947
|
}, {
|
|
7938
|
-
key: "
|
|
7948
|
+
key: "createApiInstance",
|
|
7939
7949
|
value: function () {
|
|
7940
|
-
var
|
|
7950
|
+
var _createApiInstance = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(builderOptions) {
|
|
7941
7951
|
return _regenerator().w(function (_context2) {
|
|
7942
7952
|
while (1) switch (_context2.n) {
|
|
7943
7953
|
case 0:
|
|
7944
|
-
return _context2.a(2, createChainClient
|
|
7954
|
+
return _context2.a(2, createChainClient(this.chain, builderOptions));
|
|
7945
7955
|
}
|
|
7946
7956
|
}, _callee2, this);
|
|
7947
7957
|
}));
|
|
7948
|
-
function
|
|
7958
|
+
function createApiInstance(_x3) {
|
|
7959
|
+
return _createApiInstance.apply(this, arguments);
|
|
7960
|
+
}
|
|
7961
|
+
return createApiInstance;
|
|
7962
|
+
}()
|
|
7963
|
+
}, {
|
|
7964
|
+
key: "createApiInstancePapi",
|
|
7965
|
+
value: function () {
|
|
7966
|
+
var _createApiInstancePapi = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(builderOptions) {
|
|
7967
|
+
return _regenerator().w(function (_context3) {
|
|
7968
|
+
while (1) switch (_context3.n) {
|
|
7969
|
+
case 0:
|
|
7970
|
+
return _context3.a(2, createChainClient$1(this.chain, builderOptions));
|
|
7971
|
+
}
|
|
7972
|
+
}, _callee3, this);
|
|
7973
|
+
}));
|
|
7974
|
+
function createApiInstancePapi(_x4) {
|
|
7949
7975
|
return _createApiInstancePapi.apply(this, arguments);
|
|
7950
7976
|
}
|
|
7951
7977
|
return createApiInstancePapi;
|
|
@@ -8149,9 +8175,9 @@ var AcalaExchange = /*#__PURE__*/function (_ExchangeChain) {
|
|
|
8149
8175
|
}
|
|
8150
8176
|
_inherits(AcalaExchange, _ExchangeChain);
|
|
8151
8177
|
return _createClass(AcalaExchange, [{
|
|
8152
|
-
key: "
|
|
8178
|
+
key: "buildSwap",
|
|
8153
8179
|
value: function () {
|
|
8154
|
-
var
|
|
8180
|
+
var _buildSwap = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(options, toDestTransactionFee) {
|
|
8155
8181
|
var api, apiPjs, assetFrom, assetTo, amount, sender, origin, slippagePct, isForFeeEstimation, wallet, fromToken, toToken, acalaDex, dex, swapFee, totalNativeCurrencyFee, balance, pctDestFee, amountWithoutFee, tradeResult, tx, amountOutRes, amountOut, nativeAssetSymbol, amountOutWithFee;
|
|
8156
8182
|
return _regenerator().w(function (_context) {
|
|
8157
8183
|
while (1) switch (_context.n) {
|
|
@@ -8238,10 +8264,10 @@ var AcalaExchange = /*#__PURE__*/function (_ExchangeChain) {
|
|
|
8238
8264
|
}
|
|
8239
8265
|
}, _callee, this);
|
|
8240
8266
|
}));
|
|
8241
|
-
function
|
|
8242
|
-
return
|
|
8267
|
+
function buildSwap(_x, _x2) {
|
|
8268
|
+
return _buildSwap.apply(this, arguments);
|
|
8243
8269
|
}
|
|
8244
|
-
return
|
|
8270
|
+
return buildSwap;
|
|
8245
8271
|
}()
|
|
8246
8272
|
}, {
|
|
8247
8273
|
key: "getAmountOut",
|
|
@@ -8413,6 +8439,7 @@ var AssetHubExchange = /*#__PURE__*/function (_ExchangeChain) {
|
|
|
8413
8439
|
_classCallCheck(this, AssetHubExchange);
|
|
8414
8440
|
_this = _callSuper(this, AssetHubExchange, arguments);
|
|
8415
8441
|
_this.apiType = 'GENERIC';
|
|
8442
|
+
_this.supportsRecipient = true;
|
|
8416
8443
|
return _this;
|
|
8417
8444
|
}
|
|
8418
8445
|
_inherits(AssetHubExchange, _ExchangeChain);
|
|
@@ -8521,14 +8548,14 @@ var AssetHubExchange = /*#__PURE__*/function (_ExchangeChain) {
|
|
|
8521
8548
|
return quoteSwapOrThrow;
|
|
8522
8549
|
}()
|
|
8523
8550
|
}, {
|
|
8524
|
-
key: "
|
|
8551
|
+
key: "buildSwap",
|
|
8525
8552
|
value: function () {
|
|
8526
|
-
var
|
|
8527
|
-
var api, assetFrom, assetTo, amount,
|
|
8553
|
+
var _buildSwap = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(options, toDestTxFee) {
|
|
8554
|
+
var api, assetFrom, assetTo, amount, recipient, slippagePct, origin, nativeAsset, pctDestFee, amountWithoutFee, _yield$this$quoteSwap, path, amountOut, slippageMultiplier, minAmountOut, tx, toDestFeeCurrencyTo, finalAmountOut, _t6;
|
|
8528
8555
|
return _regenerator().w(function (_context3) {
|
|
8529
8556
|
while (1) switch (_context3.n) {
|
|
8530
8557
|
case 0:
|
|
8531
|
-
api = options.api, assetFrom = options.assetFrom, assetTo = options.assetTo, amount = options.amount,
|
|
8558
|
+
api = options.api, assetFrom = options.assetFrom, assetTo = options.assetTo, amount = options.amount, recipient = options.recipient, slippagePct = options.slippagePct, origin = options.origin;
|
|
8532
8559
|
nativeAsset = findNativeAssetInfoOrThrow(this.chain);
|
|
8533
8560
|
pctDestFee = origin ? DEST_FEE_BUFFER_PCT : 0;
|
|
8534
8561
|
amountWithoutFee = padValueBy(amount, pctDestFee);
|
|
@@ -8547,7 +8574,7 @@ var AssetHubExchange = /*#__PURE__*/function (_ExchangeChain) {
|
|
|
8547
8574
|
path: path,
|
|
8548
8575
|
amount_in: amountWithoutFee,
|
|
8549
8576
|
amount_out_min: minAmountOut,
|
|
8550
|
-
send_to:
|
|
8577
|
+
send_to: recipient,
|
|
8551
8578
|
keep_alive: !!assetFrom.isNative
|
|
8552
8579
|
}
|
|
8553
8580
|
});
|
|
@@ -8579,20 +8606,20 @@ var AssetHubExchange = /*#__PURE__*/function (_ExchangeChain) {
|
|
|
8579
8606
|
}
|
|
8580
8607
|
}, _callee3, this);
|
|
8581
8608
|
}));
|
|
8582
|
-
function
|
|
8583
|
-
return
|
|
8609
|
+
function buildSwap(_x0, _x1) {
|
|
8610
|
+
return _buildSwap.apply(this, arguments);
|
|
8584
8611
|
}
|
|
8585
|
-
return
|
|
8612
|
+
return buildSwap;
|
|
8586
8613
|
}()
|
|
8587
8614
|
}, {
|
|
8588
8615
|
key: "getAmountOut",
|
|
8589
8616
|
value: function () {
|
|
8590
8617
|
var _getAmountOut = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(options) {
|
|
8591
|
-
var api, assetFrom, assetTo, amount, origin, pctDestFee, amountWithoutFee, _yield$this$quoteSwap2, amountOut;
|
|
8618
|
+
var api, assetFrom, assetTo, amount, origin, _options$slippagePct, slippagePct, pctDestFee, amountWithoutFee, _yield$this$quoteSwap2, amountOut;
|
|
8592
8619
|
return _regenerator().w(function (_context4) {
|
|
8593
8620
|
while (1) switch (_context4.n) {
|
|
8594
8621
|
case 0:
|
|
8595
|
-
api = options.api, assetFrom = options.assetFrom, assetTo = options.assetTo, amount = options.amount, origin = options.origin;
|
|
8622
|
+
api = options.api, assetFrom = options.assetFrom, assetTo = options.assetTo, amount = options.amount, origin = options.origin, _options$slippagePct = options.slippagePct, slippagePct = _options$slippagePct === void 0 ? '0' : _options$slippagePct;
|
|
8596
8623
|
pctDestFee = origin ? DEST_FEE_BUFFER_PCT : 0;
|
|
8597
8624
|
amountWithoutFee = padValueBy(amount, pctDestFee);
|
|
8598
8625
|
_context4.n = 1;
|
|
@@ -8600,7 +8627,7 @@ var AssetHubExchange = /*#__PURE__*/function (_ExchangeChain) {
|
|
|
8600
8627
|
case 1:
|
|
8601
8628
|
_yield$this$quoteSwap2 = _context4.v;
|
|
8602
8629
|
amountOut = _yield$this$quoteSwap2.amountOut;
|
|
8603
|
-
return _context4.a(2, amountOut);
|
|
8630
|
+
return _context4.a(2, padValueBy(amountOut, -Number(slippagePct)));
|
|
8604
8631
|
}
|
|
8605
8632
|
}, _callee4, this);
|
|
8606
8633
|
}));
|
|
@@ -8628,328 +8655,241 @@ var AssetHubExchange = /*#__PURE__*/function (_ExchangeChain) {
|
|
|
8628
8655
|
}]);
|
|
8629
8656
|
}(ExchangeChain);
|
|
8630
8657
|
|
|
8631
|
-
var
|
|
8632
|
-
|
|
8633
|
-
|
|
8634
|
-
|
|
8635
|
-
|
|
8636
|
-
|
|
8637
|
-
|
|
8638
|
-
|
|
8639
|
-
|
|
8640
|
-
|
|
8641
|
-
|
|
8642
|
-
|
|
8643
|
-
|
|
8644
|
-
|
|
8645
|
-
return !!c && (!Array.isArray(c) || !!c[0]);
|
|
8646
|
-
});
|
|
8647
|
-
filtered = calls.filter(function (_, index) {
|
|
8648
|
-
return included[index];
|
|
8649
|
-
});
|
|
8650
|
-
if (!(filtered.length > 0)) {
|
|
8651
|
-
_context.n = 5;
|
|
8652
|
-
break;
|
|
8653
|
-
}
|
|
8654
|
-
_context.p = 2;
|
|
8655
|
-
_context.n = 3;
|
|
8656
|
-
return api.queryMulti(filtered);
|
|
8657
|
-
case 3:
|
|
8658
|
-
values = _context.v;
|
|
8659
|
-
transformedValues = options.transform ? options.transform(values, api) : values;
|
|
8660
|
-
return _context.a(2, transformedValues);
|
|
8661
|
-
case 4:
|
|
8662
|
-
_context.p = 4;
|
|
8663
|
-
_t = _context.v;
|
|
8664
|
-
// eslint-disable-next-line no-console
|
|
8665
|
-
console.error(_t);
|
|
8666
|
-
return _context.a(2, options.defaultValue);
|
|
8667
|
-
case 5:
|
|
8668
|
-
return _context.a(2, options.defaultValue);
|
|
8669
|
-
case 6:
|
|
8670
|
-
return _context.a(2);
|
|
8671
|
-
}
|
|
8672
|
-
}, _callee, null, [[2, 4]]);
|
|
8658
|
+
var TOKEN_LIST_NAMES = {
|
|
8659
|
+
BifrostPolkadot: 'bifrost-polkadot',
|
|
8660
|
+
BifrostKusama: 'bifrost-kusama'
|
|
8661
|
+
};
|
|
8662
|
+
var getTokenMap = function getTokenMap(chain, chainId) {
|
|
8663
|
+
var listName = TOKEN_LIST_NAMES[chain];
|
|
8664
|
+
if (!listName) throw new RoutingResolutionError("Bifrost token list not found for ".concat(chain));
|
|
8665
|
+
var list = DEFULT_TOKEN_LIST_MAP[listName];
|
|
8666
|
+
return Object.fromEntries(list.tokens.map(function (info) {
|
|
8667
|
+
return new WrappedTokenInfo(info, list);
|
|
8668
|
+
}).filter(function (token) {
|
|
8669
|
+
return token.chainId === chainId;
|
|
8670
|
+
}).map(function (token) {
|
|
8671
|
+
return [token.address, token];
|
|
8673
8672
|
}));
|
|
8674
|
-
return function fetchCallMulti(_x) {
|
|
8675
|
-
return _ref2.apply(this, arguments);
|
|
8676
|
-
};
|
|
8677
|
-
}();
|
|
8678
|
-
|
|
8679
|
-
var getPairs = function getPairs(chainId, currencies) {
|
|
8680
|
-
return currencies.filter(function (currencies) {
|
|
8681
|
-
var _currencies = _slicedToArray(currencies, 2),
|
|
8682
|
-
currencyA = _currencies[0],
|
|
8683
|
-
currencyB = _currencies[1];
|
|
8684
|
-
return Boolean(chainId && (chainId === ParachainId.BIFROST_KUSAMA || chainId === ParachainId.BIFROST_POLKADOT) && currencyA && currencyB && currencyA.chainId === currencyB.chainId && chainId === currencyA.chainId && !currencyA.wrapped.equals(currencyB.wrapped));
|
|
8685
|
-
}).reduce(function (acc, _ref) {
|
|
8686
|
-
var _ref2 = _slicedToArray(_ref, 2),
|
|
8687
|
-
currencyA = _ref2[0],
|
|
8688
|
-
currencyB = _ref2[1];
|
|
8689
|
-
var _ref3 = currencyA.wrapped.sortsBefore(currencyB.wrapped) ? [currencyA.wrapped, currencyB.wrapped] : [currencyB.wrapped, currencyA.wrapped],
|
|
8690
|
-
_ref4 = _slicedToArray(_ref3, 2),
|
|
8691
|
-
token0 = _ref4[0],
|
|
8692
|
-
token1 = _ref4[1];
|
|
8693
|
-
acc[0].push(token0);
|
|
8694
|
-
acc[1].push(token1);
|
|
8695
|
-
acc[2].push([addressToZenlinkAssetId(token0.address), addressToZenlinkAssetId(token1.address)]);
|
|
8696
|
-
return acc;
|
|
8697
|
-
}, [[], [], []]);
|
|
8698
8673
|
};
|
|
8699
|
-
var
|
|
8700
|
-
return
|
|
8674
|
+
var findToken = function findToken(tokenMap, symbol) {
|
|
8675
|
+
return Object.values(tokenMap).find(function (token) {
|
|
8676
|
+
return isSymbolMatch(token.symbol, symbol);
|
|
8677
|
+
});
|
|
8678
|
+
};
|
|
8679
|
+
var balanceQuery = function balanceQuery(api, account, token) {
|
|
8680
|
+
return isNativeCurrency(token) ? [api.query.system.account, account] : [api.query.tokens.accounts, [account, addressToNodeCurrency(token.address)]];
|
|
8701
8681
|
};
|
|
8702
|
-
var
|
|
8703
|
-
(
|
|
8704
|
-
|
|
8705
|
-
|
|
8706
|
-
|
|
8707
|
-
|
|
8708
|
-
})(PairState || (PairState = {}));
|
|
8709
|
-
var fetchPairs = /*#__PURE__*/function () {
|
|
8710
|
-
var _ref5 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(api, chainId, currencies) {
|
|
8711
|
-
var _getPairs, _getPairs2, tokensA, tokensB, _tokensA$reduce, _tokensA$reduce2, validTokensA, validTokensB, reservesCalls, reserves;
|
|
8682
|
+
var freeBalance = function freeBalance(reserve) {
|
|
8683
|
+
return ('data' in reserve ? reserve.data.free : reserve.free).toString();
|
|
8684
|
+
};
|
|
8685
|
+
var getFilteredPairs = /*#__PURE__*/function () {
|
|
8686
|
+
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(api, chainId, currencies) {
|
|
8687
|
+
var _getPairs, _getPairs2, tokensA, tokensB, pools, poolList, reserves;
|
|
8712
8688
|
return _regenerator().w(function (_context) {
|
|
8713
8689
|
while (1) switch (_context.n) {
|
|
8714
8690
|
case 0:
|
|
8715
8691
|
_getPairs = getPairs(chainId, currencies), _getPairs2 = _slicedToArray(_getPairs, 2), tokensA = _getPairs2[0], tokensB = _getPairs2[1];
|
|
8716
|
-
|
|
8717
|
-
|
|
8692
|
+
pools = new Map();
|
|
8693
|
+
tokensA.forEach(function (tokenA, i) {
|
|
8718
8694
|
var tokenB = tokensB[i];
|
|
8719
|
-
var
|
|
8720
|
-
var
|
|
8721
|
-
if (
|
|
8722
|
-
|
|
8723
|
-
|
|
8724
|
-
|
|
8725
|
-
if (isNativeCurrency(tokenB)) acc[2].push([api.query.system.account, pairAccount]);else acc[2].push([api.query.tokens.accounts, [pairAccount, addressToNodeCurrency(tokenB.address)]]);
|
|
8726
|
-
}
|
|
8727
|
-
return acc;
|
|
8728
|
-
}, [[], [], []]), _tokensA$reduce2 = _slicedToArray(_tokensA$reduce, 3), validTokensA = _tokensA$reduce2[0], validTokensB = _tokensA$reduce2[1], reservesCalls = _tokensA$reduce2[2];
|
|
8729
|
-
_context.n = 1;
|
|
8730
|
-
return fetchCallMulti({
|
|
8731
|
-
api: api,
|
|
8732
|
-
calls: reservesCalls,
|
|
8733
|
-
options: {
|
|
8734
|
-
defaultValue: []
|
|
8735
|
-
}
|
|
8695
|
+
var key = uniqePairKey(tokenA, tokenB);
|
|
8696
|
+
var pool = PAIR_ADDRESSES[key];
|
|
8697
|
+
if (pool) pools.set(key, _objectSpread2({
|
|
8698
|
+
tokenA: tokenA,
|
|
8699
|
+
tokenB: tokenB
|
|
8700
|
+
}, pool));
|
|
8736
8701
|
});
|
|
8737
|
-
|
|
8738
|
-
|
|
8739
|
-
if (!(reservesCalls.length === 0)) {
|
|
8740
|
-
_context.n = 2;
|
|
8741
|
-
break;
|
|
8742
|
-
}
|
|
8743
|
-
return _context.a(2, [[PairState.NOT_EXISTS, null]]);
|
|
8744
|
-
case 2:
|
|
8745
|
-
if (!(!reserves.length || reserves.length !== validTokensA.length * 2)) {
|
|
8746
|
-
_context.n = 3;
|
|
8702
|
+
if (!(pools.size === 0)) {
|
|
8703
|
+
_context.n = 1;
|
|
8747
8704
|
break;
|
|
8748
8705
|
}
|
|
8749
|
-
return _context.a(2,
|
|
8750
|
-
|
|
8706
|
+
return _context.a(2, []);
|
|
8707
|
+
case 1:
|
|
8708
|
+
poolList = Array.from(pools.values());
|
|
8709
|
+
_context.n = 2;
|
|
8710
|
+
return api.queryMulti(poolList.flatMap(function (_ref2) {
|
|
8711
|
+
var tokenA = _ref2.tokenA,
|
|
8712
|
+
tokenB = _ref2.tokenB,
|
|
8713
|
+
account = _ref2.account;
|
|
8714
|
+
return [balanceQuery(api, account, tokenA), balanceQuery(api, account, tokenB)];
|
|
8751
8715
|
}));
|
|
8752
|
-
case
|
|
8753
|
-
|
|
8754
|
-
|
|
8755
|
-
var
|
|
8756
|
-
|
|
8757
|
-
|
|
8758
|
-
var
|
|
8759
|
-
var
|
|
8760
|
-
|
|
8761
|
-
|
|
8762
|
-
return [PairState.EXISTS, new Pair(Amount.fromRawAmount(tokenA, (reserve0.data || reserve0).free.toString()), Amount.fromRawAmount(tokenB, (reserve1.data || reserve1).free.toString()), pairAddress)];
|
|
8716
|
+
case 2:
|
|
8717
|
+
reserves = _context.v;
|
|
8718
|
+
return _context.a(2, poolList.flatMap(function (_ref3, i) {
|
|
8719
|
+
var tokenA = _ref3.tokenA,
|
|
8720
|
+
tokenB = _ref3.tokenB,
|
|
8721
|
+
address = _ref3.address;
|
|
8722
|
+
var reserveA = reserves[i * 2];
|
|
8723
|
+
var reserveB = reserves[i * 2 + 1];
|
|
8724
|
+
if (reserveA.isEmpty || reserveB.isEmpty) return [];
|
|
8725
|
+
return [new Pair(Amount.fromRawAmount(tokenA, freeBalance(reserveA)), Amount.fromRawAmount(tokenB, freeBalance(reserveB)), address)];
|
|
8763
8726
|
}));
|
|
8764
8727
|
}
|
|
8765
8728
|
}, _callee);
|
|
8766
8729
|
}));
|
|
8767
|
-
return function
|
|
8768
|
-
return
|
|
8730
|
+
return function getFilteredPairs(_x, _x2, _x3) {
|
|
8731
|
+
return _ref.apply(this, arguments);
|
|
8769
8732
|
};
|
|
8770
8733
|
}();
|
|
8771
|
-
var
|
|
8772
|
-
var
|
|
8773
|
-
|
|
8774
|
-
|
|
8775
|
-
|
|
8776
|
-
|
|
8777
|
-
|
|
8778
|
-
if (((_map$token$chainId = map[token.chainId]) === null || _map$token$chainId === void 0 ? void 0 : _map$token$chainId[token.address]) !== undefined) {
|
|
8779
|
-
// eslint-disable-next-line no-console
|
|
8780
|
-
console.warn("Duplicate token skipped: ".concat(token.address));
|
|
8781
|
-
return map;
|
|
8782
|
-
}
|
|
8783
|
-
if (!map[token.chainId]) map[token.chainId] = {};
|
|
8784
|
-
map[token.chainId][token.address] = {
|
|
8785
|
-
token: token,
|
|
8786
|
-
list: list
|
|
8787
|
-
};
|
|
8788
|
-
return map;
|
|
8789
|
-
}, {});
|
|
8790
|
-
return map;
|
|
8791
|
-
};
|
|
8792
|
-
var getTokenMap = function getTokenMap(chain, chainId) {
|
|
8793
|
-
var _tokenMap$chainId;
|
|
8794
|
-
var map = DEFULT_TOKEN_LIST_MAP[chain === 'BifrostPolkadot' ? 'bifrost-polkadot' : 'bifrost-kusama'];
|
|
8795
|
-
var tokenMap = tokensToChainTokenMap(map);
|
|
8796
|
-
return Object.keys((_tokenMap$chainId = tokenMap[chainId]) !== null && _tokenMap$chainId !== void 0 ? _tokenMap$chainId : {}).reduce(function (newMap, address) {
|
|
8797
|
-
newMap[address] = tokenMap[chainId][address].token;
|
|
8798
|
-
return newMap;
|
|
8799
|
-
}, {});
|
|
8800
|
-
};
|
|
8801
|
-
var getFilteredPairs = /*#__PURE__*/function () {
|
|
8802
|
-
var _ref7 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(api, chainId, currencies) {
|
|
8803
|
-
var pairs;
|
|
8804
|
-
return _regenerator().w(function (_context2) {
|
|
8805
|
-
while (1) switch (_context2.n) {
|
|
8806
|
-
case 0:
|
|
8807
|
-
_context2.n = 1;
|
|
8808
|
-
return fetchPairs(api, chainId, currencies);
|
|
8809
|
-
case 1:
|
|
8810
|
-
pairs = _context2.v;
|
|
8811
|
-
return _context2.a(2, Object.values(pairs.filter(function (result) {
|
|
8812
|
-
return Boolean(result[0] === PairState.EXISTS && result[1]);
|
|
8813
|
-
}).map(function (_ref8) {
|
|
8814
|
-
var _ref9 = _slicedToArray(_ref8, 2),
|
|
8815
|
-
pair = _ref9[1];
|
|
8816
|
-
return pair;
|
|
8817
|
-
})));
|
|
8818
|
-
}
|
|
8819
|
-
}, _callee2);
|
|
8734
|
+
var selectPairs = function selectPairs(pairs, chainId, currencies) {
|
|
8735
|
+
var _getPairs3 = getPairs(chainId, currencies),
|
|
8736
|
+
_getPairs4 = _slicedToArray(_getPairs3, 2),
|
|
8737
|
+
tokensA = _getPairs4[0],
|
|
8738
|
+
tokensB = _getPairs4[1];
|
|
8739
|
+
var keys = new Set(tokensA.map(function (tokenA, i) {
|
|
8740
|
+
return uniqePairKey(tokenA, tokensB[i]);
|
|
8820
8741
|
}));
|
|
8821
|
-
return function
|
|
8822
|
-
return
|
|
8823
|
-
};
|
|
8824
|
-
}();
|
|
8825
|
-
var getBestTrade = function getBestTrade(chainId, pairs, amountIn, currencyOut) {
|
|
8826
|
-
var trades = Trade.bestTradeExactIn(chainId, pairs, [], amountIn, currencyOut);
|
|
8827
|
-
if (trades.length < 1) {
|
|
8828
|
-
throw new RoutingResolutionError('Trade not found');
|
|
8829
|
-
}
|
|
8830
|
-
return trades[0];
|
|
8742
|
+
return pairs.filter(function (pair) {
|
|
8743
|
+
return keys.has(uniqePairKey(pair.token0, pair.token1));
|
|
8744
|
+
});
|
|
8831
8745
|
};
|
|
8832
|
-
var
|
|
8833
|
-
var
|
|
8834
|
-
|
|
8835
|
-
|
|
8836
|
-
|
|
8746
|
+
var getBestTrade = function getBestTrade(chainId, pairs, amountIn, currencyOut) {
|
|
8747
|
+
var _ref4 = pairs.length ? Trade.bestTradeExactIn(chainId, pairs, [], amountIn, currencyOut) : [],
|
|
8748
|
+
_ref5 = _slicedToArray(_ref4, 1),
|
|
8749
|
+
bestTrade = _ref5[0];
|
|
8750
|
+
if (!bestTrade) throw new RoutingResolutionError('Trade not found');
|
|
8751
|
+
return bestTrade;
|
|
8837
8752
|
};
|
|
8838
8753
|
|
|
8754
|
+
var pairKey = function pairKey(symbolA, symbolB) {
|
|
8755
|
+
return [symbolA, symbolB].map(function (s) {
|
|
8756
|
+
return s.toLowerCase();
|
|
8757
|
+
}).sort().join('-');
|
|
8758
|
+
};
|
|
8839
8759
|
var getDexConfig = /*#__PURE__*/function () {
|
|
8840
8760
|
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(api, chain) {
|
|
8841
|
-
var chainId, tokenMap, sdkAssets, assetsMap, assets,
|
|
8761
|
+
var chainId, tokenMap, tokens, sdkAssets, assetsMap, assets, findTokenByAssetId, pairs, seen, pairEntries, candidates, i, j, a, b, tokenInfoA, tokenInfoB, tokenA, tokenB, pools, syntheticPairs, _i, _candidates, _candidates$_i, _a, _b, _tokenA, _tokenB, combos, key;
|
|
8842
8762
|
return _regenerator().w(function (_context) {
|
|
8843
|
-
while (1) switch (_context.
|
|
8763
|
+
while (1) switch (_context.n) {
|
|
8844
8764
|
case 0:
|
|
8845
8765
|
chainId = getParaId(chain);
|
|
8846
8766
|
tokenMap = getTokenMap(chain, chainId);
|
|
8767
|
+
tokens = Object.values(tokenMap);
|
|
8847
8768
|
sdkAssets = getAssets(chain);
|
|
8848
8769
|
assetsMap = new Map();
|
|
8849
|
-
|
|
8850
|
-
var symbol =
|
|
8851
|
-
if (!symbol) return;
|
|
8770
|
+
tokens.forEach(function (_ref2) {
|
|
8771
|
+
var symbol = _ref2.symbol;
|
|
8852
8772
|
var sdkAsset = sdkAssets.find(function (a) {
|
|
8853
8773
|
return isSymbolMatch(a.symbol, symbol);
|
|
8854
8774
|
});
|
|
8855
|
-
if (
|
|
8856
|
-
assetsMap.set(symbol, sdkAsset);
|
|
8775
|
+
if (sdkAsset) assetsMap.set(symbol, sdkAsset);
|
|
8857
8776
|
});
|
|
8858
8777
|
assets = Array.from(assetsMap.values());
|
|
8778
|
+
findTokenByAssetId = function findTokenByAssetId(_ref3) {
|
|
8779
|
+
var chainId = _ref3.chainId,
|
|
8780
|
+
assetType = _ref3.assetType,
|
|
8781
|
+
assetIndex = _ref3.assetIndex;
|
|
8782
|
+
return tokens.find(function (_ref4) {
|
|
8783
|
+
var tokenInfo = _ref4.tokenInfo;
|
|
8784
|
+
return tokenInfo.parachainId === chainId && tokenInfo.assetType === assetType && tokenInfo.assetIndex === assetIndex;
|
|
8785
|
+
});
|
|
8786
|
+
};
|
|
8787
|
+
pairs = [];
|
|
8788
|
+
seen = new Set();
|
|
8859
8789
|
_context.n = 1;
|
|
8860
8790
|
return api.query.zenlinkProtocol.pairStatuses.entries();
|
|
8861
8791
|
case 1:
|
|
8862
8792
|
pairEntries = _context.v;
|
|
8863
|
-
|
|
8864
|
-
|
|
8865
|
-
|
|
8866
|
-
|
|
8867
|
-
return tokensList.find(function (tok) {
|
|
8868
|
-
var info = tok.wrapped.tokenInfo;
|
|
8869
|
-
return info.parachainId === d.chainId && info.assetType === d.assetType && info.assetIndex === d.assetIndex;
|
|
8870
|
-
});
|
|
8871
|
-
};
|
|
8872
|
-
pairEntries.forEach(function (_ref2) {
|
|
8873
|
-
var _ref3 = _slicedToArray(_ref2, 1),
|
|
8874
|
-
_ref3$0$args = _slicedToArray(_ref3[0].args, 1),
|
|
8875
|
-
keys = _ref3$0$args[0];
|
|
8793
|
+
pairEntries.forEach(function (_ref5) {
|
|
8794
|
+
var _ref6 = _slicedToArray(_ref5, 1),
|
|
8795
|
+
_ref6$0$args = _slicedToArray(_ref6[0].args, 1),
|
|
8796
|
+
keys = _ref6$0$args[0];
|
|
8876
8797
|
var _keys$toJSON = keys.toJSON(),
|
|
8877
8798
|
_keys$toJSON2 = _slicedToArray(_keys$toJSON, 2),
|
|
8878
|
-
|
|
8879
|
-
|
|
8880
|
-
var
|
|
8881
|
-
var
|
|
8882
|
-
if (!
|
|
8883
|
-
var
|
|
8884
|
-
var
|
|
8885
|
-
|
|
8886
|
-
var
|
|
8887
|
-
if (
|
|
8888
|
-
|
|
8889
|
-
|
|
8890
|
-
}).sort().join('-');
|
|
8891
|
-
if (seen.has(dedup)) return;
|
|
8892
|
-
seen.add(dedup);
|
|
8893
|
-
pairs.push([raA.location, raB.location]);
|
|
8799
|
+
assetIdA = _keys$toJSON2[0],
|
|
8800
|
+
assetIdB = _keys$toJSON2[1];
|
|
8801
|
+
var tokenA = findTokenByAssetId(assetIdA);
|
|
8802
|
+
var tokenB = findTokenByAssetId(assetIdB);
|
|
8803
|
+
if (!tokenA || !tokenB) return;
|
|
8804
|
+
var assetA = assetsMap.get(tokenA.symbol);
|
|
8805
|
+
var assetB = assetsMap.get(tokenB.symbol);
|
|
8806
|
+
if (!assetA || !assetB) return;
|
|
8807
|
+
var key = pairKey(tokenA.symbol, tokenB.symbol);
|
|
8808
|
+
if (seen.has(key)) return;
|
|
8809
|
+
seen.add(key);
|
|
8810
|
+
pairs.push([assetA.location, assetB.location]);
|
|
8894
8811
|
});
|
|
8895
|
-
|
|
8812
|
+
candidates = [];
|
|
8896
8813
|
i = 0;
|
|
8897
8814
|
case 2:
|
|
8898
8815
|
if (!(i < assets.length)) {
|
|
8899
|
-
_context.n =
|
|
8816
|
+
_context.n = 8;
|
|
8900
8817
|
break;
|
|
8901
8818
|
}
|
|
8902
8819
|
j = i + 1;
|
|
8903
8820
|
case 3:
|
|
8904
8821
|
if (!(j < assets.length)) {
|
|
8905
|
-
_context.n =
|
|
8822
|
+
_context.n = 7;
|
|
8906
8823
|
break;
|
|
8907
8824
|
}
|
|
8908
8825
|
a = assets[i];
|
|
8909
8826
|
b = assets[j];
|
|
8910
|
-
|
|
8911
|
-
return s.toLowerCase();
|
|
8912
|
-
}).sort().join('-');
|
|
8913
|
-
if (!seen.has(dedup)) {
|
|
8827
|
+
if (!seen.has(pairKey(a.symbol, b.symbol))) {
|
|
8914
8828
|
_context.n = 4;
|
|
8915
8829
|
break;
|
|
8916
8830
|
}
|
|
8917
|
-
return _context.a(3,
|
|
8831
|
+
return _context.a(3, 6);
|
|
8918
8832
|
case 4:
|
|
8919
|
-
|
|
8920
|
-
|
|
8921
|
-
if (!(!
|
|
8833
|
+
tokenInfoA = findToken(tokenMap, a.symbol);
|
|
8834
|
+
tokenInfoB = findToken(tokenMap, b.symbol);
|
|
8835
|
+
if (!(!tokenInfoA || !tokenInfoB)) {
|
|
8922
8836
|
_context.n = 5;
|
|
8923
8837
|
break;
|
|
8924
8838
|
}
|
|
8925
|
-
return _context.a(3,
|
|
8839
|
+
return _context.a(3, 6);
|
|
8926
8840
|
case 5:
|
|
8927
|
-
|
|
8928
|
-
|
|
8929
|
-
|
|
8930
|
-
|
|
8931
|
-
|
|
8932
|
-
|
|
8933
|
-
|
|
8934
|
-
|
|
8935
|
-
|
|
8936
|
-
|
|
8937
|
-
syntheticPairs.push([a.location, b.location]);
|
|
8938
|
-
seen.add(dedup);
|
|
8939
|
-
_context.n = 9;
|
|
8940
|
-
break;
|
|
8941
|
-
case 8:
|
|
8942
|
-
_context.p = 8;
|
|
8943
|
-
_context.v;
|
|
8944
|
-
case 9:
|
|
8841
|
+
tokenA = new Token(tokenInfoA);
|
|
8842
|
+
tokenB = new Token(tokenInfoB);
|
|
8843
|
+
candidates.push({
|
|
8844
|
+
a: a,
|
|
8845
|
+
b: b,
|
|
8846
|
+
tokenA: tokenA,
|
|
8847
|
+
tokenB: tokenB,
|
|
8848
|
+
combos: getCurrencyCombinations(chainId, tokenA, tokenB)
|
|
8849
|
+
});
|
|
8850
|
+
case 6:
|
|
8945
8851
|
j++;
|
|
8946
8852
|
_context.n = 3;
|
|
8947
8853
|
break;
|
|
8948
|
-
case
|
|
8854
|
+
case 7:
|
|
8949
8855
|
i++;
|
|
8950
8856
|
_context.n = 2;
|
|
8951
8857
|
break;
|
|
8858
|
+
case 8:
|
|
8859
|
+
_context.n = 9;
|
|
8860
|
+
return getFilteredPairs(api, chainId, candidates.flatMap(function (_ref7) {
|
|
8861
|
+
var combos = _ref7.combos;
|
|
8862
|
+
return combos;
|
|
8863
|
+
}));
|
|
8864
|
+
case 9:
|
|
8865
|
+
pools = _context.v;
|
|
8866
|
+
syntheticPairs = [];
|
|
8867
|
+
_i = 0, _candidates = candidates;
|
|
8868
|
+
case 10:
|
|
8869
|
+
if (!(_i < _candidates.length)) {
|
|
8870
|
+
_context.n = 13;
|
|
8871
|
+
break;
|
|
8872
|
+
}
|
|
8873
|
+
_candidates$_i = _candidates[_i], _a = _candidates$_i.a, _b = _candidates$_i.b, _tokenA = _candidates$_i.tokenA, _tokenB = _candidates$_i.tokenB, combos = _candidates$_i.combos;
|
|
8874
|
+
key = pairKey(_a.symbol, _b.symbol);
|
|
8875
|
+
if (!seen.has(key)) {
|
|
8876
|
+
_context.n = 11;
|
|
8877
|
+
break;
|
|
8878
|
+
}
|
|
8879
|
+
return _context.a(3, 12);
|
|
8952
8880
|
case 11:
|
|
8881
|
+
try {
|
|
8882
|
+
getBestTrade(chainId, selectPairs(pools, chainId, combos), Amount.fromRawAmount(_tokenA, '1'), _tokenB);
|
|
8883
|
+
syntheticPairs.push([_a.location, _b.location]);
|
|
8884
|
+
seen.add(key);
|
|
8885
|
+
} catch (_unused) {
|
|
8886
|
+
/* no route ⇒ skip */
|
|
8887
|
+
}
|
|
8888
|
+
case 12:
|
|
8889
|
+
_i++;
|
|
8890
|
+
_context.n = 10;
|
|
8891
|
+
break;
|
|
8892
|
+
case 13:
|
|
8953
8893
|
return _context.a(2, {
|
|
8954
8894
|
isOmni: false,
|
|
8955
8895
|
assets: assets.map(function (a) {
|
|
@@ -8958,7 +8898,7 @@ var getDexConfig = /*#__PURE__*/function () {
|
|
|
8958
8898
|
pairs: [].concat(pairs, syntheticPairs)
|
|
8959
8899
|
});
|
|
8960
8900
|
}
|
|
8961
|
-
}, _callee
|
|
8901
|
+
}, _callee);
|
|
8962
8902
|
}));
|
|
8963
8903
|
return function getDexConfig(_x, _x2) {
|
|
8964
8904
|
return _ref.apply(this, arguments);
|
|
@@ -8971,91 +8911,72 @@ var BifrostExchange = /*#__PURE__*/function (_ExchangeChain) {
|
|
|
8971
8911
|
_classCallCheck(this, BifrostExchange);
|
|
8972
8912
|
_this = _callSuper(this, BifrostExchange, arguments);
|
|
8973
8913
|
_this.apiType = 'PJS';
|
|
8914
|
+
_this.supportsRecipient = true;
|
|
8974
8915
|
return _this;
|
|
8975
8916
|
}
|
|
8976
8917
|
_inherits(BifrostExchange, _ExchangeChain);
|
|
8977
8918
|
return _createClass(BifrostExchange, [{
|
|
8978
|
-
key: "
|
|
8919
|
+
key: "buildSwap",
|
|
8979
8920
|
value: function () {
|
|
8980
|
-
var
|
|
8981
|
-
var apiPjs, assetFrom, assetTo, amount,
|
|
8921
|
+
var _buildSwap = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(options, toDestTxFee) {
|
|
8922
|
+
var apiPjs, assetFrom, assetTo, amount, recipient, slippagePct, origin, amountWithoutFee, _yield$this$findBestT, trade, tokenTo, amountOut, allowedSlippage, blockNumber, deadline, _SwapRouter$swapCallP, extrinsic, nativeSymbol, amountOutWithFee;
|
|
8982
8923
|
return _regenerator().w(function (_context) {
|
|
8983
8924
|
while (1) switch (_context.n) {
|
|
8984
8925
|
case 0:
|
|
8985
|
-
apiPjs = options.apiPjs, assetFrom = options.assetFrom, assetTo = options.assetTo, amount = options.amount,
|
|
8986
|
-
chainId = getParaId(this.chain);
|
|
8987
|
-
tokenMap = getTokenMap(this.chain, chainId);
|
|
8988
|
-
tokenWrappedFrom = findToken(tokenMap, assetFrom.symbol);
|
|
8989
|
-
if (!(tokenWrappedFrom === undefined)) {
|
|
8990
|
-
_context.n = 1;
|
|
8991
|
-
break;
|
|
8992
|
-
}
|
|
8993
|
-
throw new RoutingResolutionError('Currency from not found');
|
|
8994
|
-
case 1:
|
|
8995
|
-
tokenWrappedTo = findToken(tokenMap, assetTo.symbol);
|
|
8996
|
-
if (!(tokenWrappedTo === undefined)) {
|
|
8997
|
-
_context.n = 2;
|
|
8998
|
-
break;
|
|
8999
|
-
}
|
|
9000
|
-
throw new RoutingResolutionError('Currency to not found');
|
|
9001
|
-
case 2:
|
|
9002
|
-
tokenFrom = new Token(tokenWrappedFrom.wrapped);
|
|
9003
|
-
tokenTo = new Token(tokenWrappedTo.wrapped);
|
|
9004
|
-
currencyCombinations = getCurrencyCombinations(chainId, tokenFrom, tokenTo);
|
|
9005
|
-
_context.n = 3;
|
|
9006
|
-
return getFilteredPairs(apiPjs, chainId, currencyCombinations);
|
|
9007
|
-
case 3:
|
|
9008
|
-
pairs = _context.v;
|
|
8926
|
+
apiPjs = options.apiPjs, assetFrom = options.assetFrom, assetTo = options.assetTo, amount = options.amount, recipient = options.recipient, slippagePct = options.slippagePct, origin = options.origin;
|
|
9009
8927
|
Logger.log('To dest tx fee in native currency:', toDestTxFee);
|
|
9010
8928
|
Logger.log('Original amount', amount);
|
|
9011
|
-
|
|
9012
|
-
amountWithoutFee = padValueBy(amount, pctDestFee);
|
|
8929
|
+
amountWithoutFee = padValueBy(amount, origin ? DEST_FEE_BUFFER_PCT : 0);
|
|
9013
8930
|
Logger.log('Amount modified', amountWithoutFee);
|
|
9014
8931
|
if (!(amountWithoutFee <= 0n)) {
|
|
9015
|
-
_context.n =
|
|
8932
|
+
_context.n = 1;
|
|
9016
8933
|
break;
|
|
9017
8934
|
}
|
|
9018
8935
|
throw new AmountTooLowError();
|
|
9019
|
-
case
|
|
9020
|
-
|
|
9021
|
-
|
|
8936
|
+
case 1:
|
|
8937
|
+
_context.n = 2;
|
|
8938
|
+
return this.findBestTrade(apiPjs, assetFrom.symbol, assetTo.symbol, amountWithoutFee);
|
|
8939
|
+
case 2:
|
|
8940
|
+
_yield$this$findBestT = _context.v;
|
|
8941
|
+
trade = _yield$this$findBestT.trade;
|
|
8942
|
+
tokenTo = _yield$this$findBestT.tokenTo;
|
|
8943
|
+
amountOut = _yield$this$findBestT.amountOut;
|
|
9022
8944
|
allowedSlippage = new Percent(Number(slippagePct) * 100, 10000);
|
|
9023
|
-
_context.n =
|
|
8945
|
+
_context.n = 3;
|
|
9024
8946
|
return apiPjs.derive.chain.bestNumber();
|
|
9025
|
-
case
|
|
8947
|
+
case 3:
|
|
9026
8948
|
blockNumber = _context.v;
|
|
9027
8949
|
deadline = blockNumber.toNumber() + 20;
|
|
9028
8950
|
_SwapRouter$swapCallP = SwapRouter.swapCallParameters(trade, {
|
|
9029
8951
|
api: apiPjs,
|
|
9030
8952
|
allowedSlippage: allowedSlippage,
|
|
9031
|
-
recipient:
|
|
8953
|
+
recipient: recipient,
|
|
9032
8954
|
deadline: deadline
|
|
9033
8955
|
}), extrinsic = _SwapRouter$swapCallP.extrinsic;
|
|
9034
8956
|
if (!(extrinsic === null)) {
|
|
9035
|
-
_context.n =
|
|
8957
|
+
_context.n = 4;
|
|
9036
8958
|
break;
|
|
9037
8959
|
}
|
|
9038
8960
|
throw new RoutingResolutionError('Extrinsic is null');
|
|
9039
|
-
case
|
|
9040
|
-
amountOut = parseUnits(trade.outputAmount.toFixed(), tokenTo.decimals);
|
|
8961
|
+
case 4:
|
|
9041
8962
|
nativeSymbol = getNativeAssetSymbol(this.chain);
|
|
9042
8963
|
if (!(tokenTo.symbol === nativeSymbol)) {
|
|
9043
|
-
_context.n =
|
|
8964
|
+
_context.n = 6;
|
|
9044
8965
|
break;
|
|
9045
8966
|
}
|
|
9046
8967
|
amountOutWithFee = amountOut - padValueBy(toDestTxFee, FEE_BUFFER_PCT);
|
|
9047
8968
|
if (!(amountOutWithFee <= 0n)) {
|
|
9048
|
-
_context.n =
|
|
8969
|
+
_context.n = 5;
|
|
9049
8970
|
break;
|
|
9050
8971
|
}
|
|
9051
8972
|
throw new AmountTooLowError();
|
|
9052
|
-
case
|
|
8973
|
+
case 5:
|
|
9053
8974
|
Logger.log('Amount out with fee:', amountOutWithFee);
|
|
9054
8975
|
return _context.a(2, {
|
|
9055
8976
|
tx: extrinsic[0],
|
|
9056
8977
|
amountOut: amountOutWithFee
|
|
9057
8978
|
});
|
|
9058
|
-
case
|
|
8979
|
+
case 6:
|
|
9059
8980
|
Logger.log('Calculated amount out:', amountOut);
|
|
9060
8981
|
return _context.a(2, {
|
|
9061
8982
|
tx: extrinsic[0],
|
|
@@ -9064,48 +8985,27 @@ var BifrostExchange = /*#__PURE__*/function (_ExchangeChain) {
|
|
|
9064
8985
|
}
|
|
9065
8986
|
}, _callee, this);
|
|
9066
8987
|
}));
|
|
9067
|
-
function
|
|
9068
|
-
return
|
|
8988
|
+
function buildSwap(_x, _x2) {
|
|
8989
|
+
return _buildSwap.apply(this, arguments);
|
|
9069
8990
|
}
|
|
9070
|
-
return
|
|
8991
|
+
return buildSwap;
|
|
9071
8992
|
}()
|
|
9072
8993
|
}, {
|
|
9073
8994
|
key: "getAmountOut",
|
|
9074
8995
|
value: function () {
|
|
9075
8996
|
var _getAmountOut = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(options) {
|
|
9076
|
-
var apiPjs, assetFrom, assetTo, amount, origin,
|
|
8997
|
+
var apiPjs, assetFrom, assetTo, amount, origin, amountWithoutFee, _yield$this$findBestT2, amountOut;
|
|
9077
8998
|
return _regenerator().w(function (_context2) {
|
|
9078
8999
|
while (1) switch (_context2.n) {
|
|
9079
9000
|
case 0:
|
|
9080
9001
|
apiPjs = options.apiPjs, assetFrom = options.assetFrom, assetTo = options.assetTo, amount = options.amount, origin = options.origin;
|
|
9081
|
-
|
|
9082
|
-
|
|
9083
|
-
|
|
9084
|
-
if (!(tokenWrappedFrom === undefined)) {
|
|
9085
|
-
_context2.n = 1;
|
|
9086
|
-
break;
|
|
9087
|
-
}
|
|
9088
|
-
throw new RoutingResolutionError('Currency from not found');
|
|
9002
|
+
amountWithoutFee = padValueBy(amount, origin ? DEST_FEE_BUFFER_PCT : 0);
|
|
9003
|
+
_context2.n = 1;
|
|
9004
|
+
return this.findBestTrade(apiPjs, assetFrom.symbol, assetTo.symbol, amountWithoutFee);
|
|
9089
9005
|
case 1:
|
|
9090
|
-
|
|
9091
|
-
|
|
9092
|
-
|
|
9093
|
-
break;
|
|
9094
|
-
}
|
|
9095
|
-
throw new RoutingResolutionError('Currency to not found');
|
|
9096
|
-
case 2:
|
|
9097
|
-
tokenFrom = new Token(tokenWrappedFrom.wrapped);
|
|
9098
|
-
tokenTo = new Token(tokenWrappedTo.wrapped);
|
|
9099
|
-
currencyCombinations = getCurrencyCombinations(chainId, tokenFrom, tokenTo);
|
|
9100
|
-
_context2.n = 3;
|
|
9101
|
-
return getFilteredPairs(apiPjs, chainId, currencyCombinations);
|
|
9102
|
-
case 3:
|
|
9103
|
-
pairs = _context2.v;
|
|
9104
|
-
pctDestFee = origin ? DEST_FEE_BUFFER_PCT : 0;
|
|
9105
|
-
amountWithoutFee = padValueBy(amount, pctDestFee);
|
|
9106
|
-
amountIn = Amount.fromRawAmount(tokenFrom, amountWithoutFee.toString());
|
|
9107
|
-
trade = getBestTrade(chainId, pairs, amountIn, tokenTo);
|
|
9108
|
-
return _context2.a(2, parseUnits(trade.outputAmount.toFixed(), tokenTo.decimals));
|
|
9006
|
+
_yield$this$findBestT2 = _context2.v;
|
|
9007
|
+
amountOut = _yield$this$findBestT2.amountOut;
|
|
9008
|
+
return _context2.a(2, amountOut);
|
|
9109
9009
|
}
|
|
9110
9010
|
}, _callee2, this);
|
|
9111
9011
|
}));
|
|
@@ -9130,6 +9030,50 @@ var BifrostExchange = /*#__PURE__*/function (_ExchangeChain) {
|
|
|
9130
9030
|
}
|
|
9131
9031
|
return getDexConfig$1;
|
|
9132
9032
|
}()
|
|
9033
|
+
}, {
|
|
9034
|
+
key: "findBestTrade",
|
|
9035
|
+
value: function () {
|
|
9036
|
+
var _findBestTrade = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(api, symbolFrom, symbolTo, amountIn) {
|
|
9037
|
+
var chainId, tokenMap, tokenInfoFrom, tokenInfoTo, tokenFrom, tokenTo, pairs, trade;
|
|
9038
|
+
return _regenerator().w(function (_context4) {
|
|
9039
|
+
while (1) switch (_context4.n) {
|
|
9040
|
+
case 0:
|
|
9041
|
+
chainId = getParaId(this.chain);
|
|
9042
|
+
tokenMap = getTokenMap(this.chain, chainId);
|
|
9043
|
+
tokenInfoFrom = findToken(tokenMap, symbolFrom);
|
|
9044
|
+
if (tokenInfoFrom) {
|
|
9045
|
+
_context4.n = 1;
|
|
9046
|
+
break;
|
|
9047
|
+
}
|
|
9048
|
+
throw new RoutingResolutionError('Currency from not found');
|
|
9049
|
+
case 1:
|
|
9050
|
+
tokenInfoTo = findToken(tokenMap, symbolTo);
|
|
9051
|
+
if (tokenInfoTo) {
|
|
9052
|
+
_context4.n = 2;
|
|
9053
|
+
break;
|
|
9054
|
+
}
|
|
9055
|
+
throw new RoutingResolutionError('Currency to not found');
|
|
9056
|
+
case 2:
|
|
9057
|
+
tokenFrom = new Token(tokenInfoFrom);
|
|
9058
|
+
tokenTo = new Token(tokenInfoTo);
|
|
9059
|
+
_context4.n = 3;
|
|
9060
|
+
return getFilteredPairs(api, chainId, getCurrencyCombinations(chainId, tokenFrom, tokenTo));
|
|
9061
|
+
case 3:
|
|
9062
|
+
pairs = _context4.v;
|
|
9063
|
+
trade = getBestTrade(chainId, pairs, Amount.fromRawAmount(tokenFrom, amountIn.toString()), tokenTo);
|
|
9064
|
+
return _context4.a(2, {
|
|
9065
|
+
trade: trade,
|
|
9066
|
+
tokenTo: tokenTo,
|
|
9067
|
+
amountOut: parseUnits(trade.outputAmount.toFixed(), tokenTo.decimals)
|
|
9068
|
+
});
|
|
9069
|
+
}
|
|
9070
|
+
}, _callee4, this);
|
|
9071
|
+
}));
|
|
9072
|
+
function findBestTrade(_x5, _x6, _x7, _x8) {
|
|
9073
|
+
return _findBestTrade.apply(this, arguments);
|
|
9074
|
+
}
|
|
9075
|
+
return findBestTrade;
|
|
9076
|
+
}()
|
|
9133
9077
|
}]);
|
|
9134
9078
|
}(ExchangeChain);
|
|
9135
9079
|
|
|
@@ -9223,9 +9167,9 @@ var HydrationExchange = /*#__PURE__*/function (_ExchangeChain) {
|
|
|
9223
9167
|
}
|
|
9224
9168
|
_inherits(HydrationExchange, _ExchangeChain);
|
|
9225
9169
|
return _createClass(HydrationExchange, [{
|
|
9226
|
-
key: "
|
|
9170
|
+
key: "buildSwap",
|
|
9227
9171
|
value: function () {
|
|
9228
|
-
var
|
|
9172
|
+
var _buildSwap = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(options, toDestTransactionFee) {
|
|
9229
9173
|
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;
|
|
9230
9174
|
return _regenerator().w(function (_context) {
|
|
9231
9175
|
while (1) switch (_context.p = _context.n) {
|
|
@@ -9335,10 +9279,10 @@ var HydrationExchange = /*#__PURE__*/function (_ExchangeChain) {
|
|
|
9335
9279
|
}
|
|
9336
9280
|
}, _callee, this, [[2,, 16, 17]]);
|
|
9337
9281
|
}));
|
|
9338
|
-
function
|
|
9339
|
-
return
|
|
9282
|
+
function buildSwap(_x, _x2) {
|
|
9283
|
+
return _buildSwap.apply(this, arguments);
|
|
9340
9284
|
}
|
|
9341
|
-
return
|
|
9285
|
+
return buildSwap;
|
|
9342
9286
|
}()
|
|
9343
9287
|
}, {
|
|
9344
9288
|
key: "getAmountOut",
|
|
@@ -9843,7 +9787,7 @@ var selectBestExchangeCommon = /*#__PURE__*/function () {
|
|
|
9843
9787
|
return _context.a(2, 0);
|
|
9844
9788
|
case 5:
|
|
9845
9789
|
config = api.config;
|
|
9846
|
-
parsedAmount = applyDecimalAbstraction(options.amount, assetFromExchange
|
|
9790
|
+
parsedAmount = applyDecimalAbstraction(options.amount, assetFromExchange.decimals, !(isConfig(config) && config.abstractDecimals === false)).toString();
|
|
9847
9791
|
_context.p = 6;
|
|
9848
9792
|
_context.n = 7;
|
|
9849
9793
|
return computeAmountOut(dex, assetFromExchange, assetTo, options, parsedAmount);
|
|
@@ -10019,6 +9963,9 @@ var selectBestExchange = /*#__PURE__*/function () {
|
|
|
10019
9963
|
modifiedOptions = _objectSpread2(_objectSpread2({}, options), {}, {
|
|
10020
9964
|
amount: BigInt(parsedAmount),
|
|
10021
9965
|
exchange: exchangeInfo,
|
|
9966
|
+
// Recipient does not affect the quote. Use the sender so swapCurrency does not reject
|
|
9967
|
+
// exchanges without supportsRecipient, which may still swap via execute
|
|
9968
|
+
recipient: options.sender,
|
|
10022
9969
|
feeCalcAddress: determineFeeCalcAddress(options.sender, options.recipient)
|
|
10023
9970
|
});
|
|
10024
9971
|
_context.n = 3;
|
|
@@ -10144,7 +10091,8 @@ var prepareTransformedOptions = /*#__PURE__*/function () {
|
|
|
10144
10091
|
_t0,
|
|
10145
10092
|
_t1,
|
|
10146
10093
|
_t10,
|
|
10147
|
-
_t11
|
|
10094
|
+
_t11,
|
|
10095
|
+
_t12;
|
|
10148
10096
|
return _regenerator().w(function (_context) {
|
|
10149
10097
|
while (1) switch (_context.n) {
|
|
10150
10098
|
case 0:
|
|
@@ -10197,7 +10145,7 @@ var prepareTransformedOptions = /*#__PURE__*/function () {
|
|
|
10197
10145
|
_t4 = _objectSpread2({}, options);
|
|
10198
10146
|
_t5 = {};
|
|
10199
10147
|
_t6 = applyDecimalAbstraction(amount, (_assetFromOrigin$deci = assetFromOrigin === null || assetFromOrigin === void 0 ? void 0 : assetFromOrigin.decimals) !== null && _assetFromOrigin$deci !== void 0 ? _assetFromOrigin$deci : assetFromExchange.decimals, (exchangeConfig === null || exchangeConfig === void 0 ? void 0 : exchangeConfig.abstractDecimals) !== false);
|
|
10200
|
-
_t7 = originSpecified && assetFromOrigin
|
|
10148
|
+
_t7 = originSpecified && assetFromOrigin ? {
|
|
10201
10149
|
api: originApi.api,
|
|
10202
10150
|
chain: from,
|
|
10203
10151
|
assetFrom: assetFromOrigin,
|
|
@@ -10220,13 +10168,15 @@ var prepareTransformedOptions = /*#__PURE__*/function () {
|
|
|
10220
10168
|
chain: to,
|
|
10221
10169
|
address: recipient
|
|
10222
10170
|
} : undefined;
|
|
10223
|
-
_t11 =
|
|
10171
|
+
_t11 = recipient !== null && recipient !== void 0 ? recipient : sender;
|
|
10172
|
+
_t12 = determineFeeCalcAddress(sender, recipient);
|
|
10224
10173
|
transformed = _t3(_t4, _t5, {
|
|
10225
10174
|
amount: _t6,
|
|
10226
10175
|
origin: _t7,
|
|
10227
10176
|
exchange: _t1,
|
|
10228
10177
|
destination: _t10,
|
|
10229
|
-
|
|
10178
|
+
recipient: _t11,
|
|
10179
|
+
feeCalcAddress: _t12
|
|
10230
10180
|
});
|
|
10231
10181
|
return _context.a(2, {
|
|
10232
10182
|
dex: dex,
|
|
@@ -10300,10 +10250,11 @@ var buildSwapExecuteTx = /*#__PURE__*/function () {
|
|
|
10300
10250
|
sender: evmSenderAddress !== null && evmSenderAddress !== void 0 ? evmSenderAddress : sender,
|
|
10301
10251
|
recipient: recipient !== null && recipient !== void 0 ? recipient : sender,
|
|
10302
10252
|
calculateMinAmountOut: function calculateMinAmountOut(amountIn, assetTo) {
|
|
10253
|
+
var slippagePct = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : minAmountOutSlippage;
|
|
10303
10254
|
return callDexAmountOut(dex, options, {
|
|
10304
10255
|
amount: amountIn,
|
|
10305
10256
|
assetTo: assetTo,
|
|
10306
|
-
slippagePct:
|
|
10257
|
+
slippagePct: slippagePct
|
|
10307
10258
|
});
|
|
10308
10259
|
}
|
|
10309
10260
|
});
|
|
@@ -10978,7 +10929,7 @@ var getRouterFees = /*#__PURE__*/function () {
|
|
|
10978
10929
|
mergedHops = [].concat(_toConsumableArray((_sendingChain$hops = sendingChain === null || sendingChain === void 0 ? void 0 : sendingChain.hops) !== null && _sendingChain$hops !== void 0 ? _sendingChain$hops : []), _toConsumableArray(sendingChain && receivingChain ? [{
|
|
10979
10930
|
chain: exchange.chain,
|
|
10980
10931
|
result: _objectSpread2(_objectSpread2({}, swapChain), {}, {
|
|
10981
|
-
fee: swapChain.fee + ((_receivingChain$origi = receivingChain
|
|
10932
|
+
fee: swapChain.fee + ((_receivingChain$origi = receivingChain.origin.fee) !== null && _receivingChain$origi !== void 0 ? _receivingChain$origi : 0n),
|
|
10982
10933
|
isExchange: true
|
|
10983
10934
|
})
|
|
10984
10935
|
}] : []), _toConsumableArray((_receivingChain$hops = receivingChain === null || receivingChain === void 0 ? void 0 : receivingChain.hops) !== null && _receivingChain$hops !== void 0 ? _receivingChain$hops : []));
|
|
@@ -11166,7 +11117,6 @@ var getBestAmountOut = /*#__PURE__*/function () {
|
|
|
11166
11117
|
|
|
11167
11118
|
var computeExchangeMinAmount = /*#__PURE__*/function () {
|
|
11168
11119
|
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(dex, options) {
|
|
11169
|
-
var _result$fee;
|
|
11170
11120
|
var exchange, existentialDeposit, nativeSymbol, isNativeAsset, _yield$getSwapFee, result, swapFee;
|
|
11171
11121
|
return _regenerator().w(function (_context) {
|
|
11172
11122
|
while (1) switch (_context.n) {
|
|
@@ -11188,7 +11138,7 @@ var computeExchangeMinAmount = /*#__PURE__*/function () {
|
|
|
11188
11138
|
case 2:
|
|
11189
11139
|
_yield$getSwapFee = _context.v;
|
|
11190
11140
|
result = _yield$getSwapFee.result;
|
|
11191
|
-
swapFee =
|
|
11141
|
+
swapFee = result.fee;
|
|
11192
11142
|
return _context.a(2, existentialDeposit + swapFee + 1n);
|
|
11193
11143
|
}
|
|
11194
11144
|
}, _callee);
|
|
@@ -11236,7 +11186,7 @@ var getMinTransferableAmount = /*#__PURE__*/function () {
|
|
|
11236
11186
|
|
|
11237
11187
|
var computeLocalTransferableAmount = /*#__PURE__*/function () {
|
|
11238
11188
|
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(dex, options) {
|
|
11239
|
-
var exchange, sender, currency, balance, existentialDeposit, swapFee, nativeSymbol,
|
|
11189
|
+
var exchange, sender, currency, balance, existentialDeposit, swapFee, nativeSymbol, _yield$getSwapFee, result, transferable;
|
|
11240
11190
|
return _regenerator().w(function (_context) {
|
|
11241
11191
|
while (1) switch (_context.n) {
|
|
11242
11192
|
case 0:
|
|
@@ -11265,7 +11215,7 @@ var computeLocalTransferableAmount = /*#__PURE__*/function () {
|
|
|
11265
11215
|
case 2:
|
|
11266
11216
|
_yield$getSwapFee = _context.v;
|
|
11267
11217
|
result = _yield$getSwapFee.result;
|
|
11268
|
-
swapFee =
|
|
11218
|
+
swapFee = result.fee;
|
|
11269
11219
|
case 3:
|
|
11270
11220
|
transferable = balance - existentialDeposit - swapFee;
|
|
11271
11221
|
return _context.a(2, transferable > 0n ? transferable : 0n);
|
|
@@ -11653,7 +11603,7 @@ var buildExchangeDestInfo = function buildExchangeDestInfo(exchange, recipient,
|
|
|
11653
11603
|
var getSwapInfo = /*#__PURE__*/function () {
|
|
11654
11604
|
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(initialOptions) {
|
|
11655
11605
|
var _origin$chain, _destination$chain, _sendingInfo$hops, _receivingInfo$hops, _sendingInfo$origin, _receivingInfo$destin;
|
|
11656
|
-
var _yield$prepareTransfo, options, dex, api, origin, exchange, currencyTo, destination, amount, sender, evmSenderAddress, senderAddress, sendingInfo, _yield$getSwapFee, swapChain, amountOut, receivingInfo, originChain, destChain, exchangeHopEntry, hops, finalOrigin, finalDestination, _t, _t2, _t3, _t4, _t5;
|
|
11606
|
+
var _yield$prepareTransfo, options, dex, api, origin, exchange, currencyTo, destination, amount, sender, evmSenderAddress, recipient, senderAddress, sendingInfo, _yield$getSwapFee, swapChain, amountOut, receivingInfo, originChain, destChain, exchangeHopEntry, hops, finalOrigin, finalDestination, _t, _t2, _t3, _t4, _t5;
|
|
11657
11607
|
return _regenerator().w(function (_context2) {
|
|
11658
11608
|
while (1) switch (_context2.p = _context2.n) {
|
|
11659
11609
|
case 0:
|
|
@@ -11683,7 +11633,7 @@ var getSwapInfo = /*#__PURE__*/function () {
|
|
|
11683
11633
|
throw _t;
|
|
11684
11634
|
case 5:
|
|
11685
11635
|
validateRoutedFeeAsset(options);
|
|
11686
|
-
api = options.api, origin = options.origin, exchange = options.exchange, currencyTo = options.currencyTo, destination = options.destination, amount = options.amount, sender = options.sender, evmSenderAddress = options.evmSenderAddress;
|
|
11636
|
+
api = options.api, origin = options.origin, exchange = options.exchange, currencyTo = options.currencyTo, destination = options.destination, amount = options.amount, sender = options.sender, evmSenderAddress = options.evmSenderAddress, recipient = options.recipient;
|
|
11687
11637
|
assertCurrencyCore(currencyTo);
|
|
11688
11638
|
senderAddress = evmSenderAddress !== null && evmSenderAddress !== void 0 ? evmSenderAddress : sender;
|
|
11689
11639
|
if (!(origin && origin.chain !== exchange.chain)) {
|
|
@@ -11770,7 +11720,7 @@ var getSwapInfo = /*#__PURE__*/function () {
|
|
|
11770
11720
|
break;
|
|
11771
11721
|
case 16:
|
|
11772
11722
|
_context2.n = 17;
|
|
11773
|
-
return buildExchangeDestInfo(exchange,
|
|
11723
|
+
return buildExchangeDestInfo(exchange, recipient, amountOut, currencyTo);
|
|
11774
11724
|
case 17:
|
|
11775
11725
|
_t5 = _context2.v;
|
|
11776
11726
|
case 18:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@paraspell/swap",
|
|
3
|
-
"version": "14.5.
|
|
3
|
+
"version": "14.5.4",
|
|
4
4
|
"description": "Tool for XCM cross-chain asset exchanging across Polkadot and Kusama ecosystems",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -29,19 +29,19 @@
|
|
|
29
29
|
"@acala-network/sdk": "4.1.15",
|
|
30
30
|
"@acala-network/sdk-core": "4.1.15",
|
|
31
31
|
"@acala-network/sdk-swap": "4.1.15",
|
|
32
|
-
"@crypto-dex-sdk/amm": "^0.1.
|
|
33
|
-
"@crypto-dex-sdk/chain": "^0.1.
|
|
34
|
-
"@crypto-dex-sdk/currency": "^0.1.
|
|
35
|
-
"@crypto-dex-sdk/format": "^0.1.
|
|
36
|
-
"@crypto-dex-sdk/math": "^0.1.
|
|
37
|
-
"@crypto-dex-sdk/parachains-bifrost": "^0.1.
|
|
38
|
-
"@crypto-dex-sdk/token-lists": "^0.1.
|
|
39
|
-
"@galacticcouncil/descriptors": "^2.
|
|
40
|
-
"@galacticcouncil/sdk-next": "^2.
|
|
41
|
-
"@paraspell/sdk": "14.5.
|
|
42
|
-
"@paraspell/sdk-common": "14.5.
|
|
43
|
-
"@paraspell/sdk-core": "14.5.
|
|
44
|
-
"@paraspell/sdk-pjs": "14.5.
|
|
32
|
+
"@crypto-dex-sdk/amm": "^0.1.7",
|
|
33
|
+
"@crypto-dex-sdk/chain": "^0.1.7",
|
|
34
|
+
"@crypto-dex-sdk/currency": "^0.1.7",
|
|
35
|
+
"@crypto-dex-sdk/format": "^0.1.7",
|
|
36
|
+
"@crypto-dex-sdk/math": "^0.1.7",
|
|
37
|
+
"@crypto-dex-sdk/parachains-bifrost": "^0.1.7",
|
|
38
|
+
"@crypto-dex-sdk/token-lists": "^0.1.7",
|
|
39
|
+
"@galacticcouncil/descriptors": "^2.11.0",
|
|
40
|
+
"@galacticcouncil/sdk-next": "^2.7.0",
|
|
41
|
+
"@paraspell/sdk": "14.5.4",
|
|
42
|
+
"@paraspell/sdk-common": "14.5.4",
|
|
43
|
+
"@paraspell/sdk-core": "14.5.4",
|
|
44
|
+
"@paraspell/sdk-pjs": "14.5.4",
|
|
45
45
|
"@polkadot/api": "^17.0.2",
|
|
46
46
|
"@polkadot/types": "^17.0.2",
|
|
47
47
|
"@polkadot/util": "^14.0.3",
|