@paraspell/swap 14.4.0 → 14.4.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.mjs +37 -4
- package/package.json +5 -5
package/dist/index.mjs
CHANGED
|
@@ -790,6 +790,22 @@ var AssetHubPolkadot = {
|
|
|
790
790
|
]
|
|
791
791
|
}
|
|
792
792
|
},
|
|
793
|
+
{
|
|
794
|
+
parents: 1,
|
|
795
|
+
interior: {
|
|
796
|
+
X3: [
|
|
797
|
+
{
|
|
798
|
+
Parachain: 1000
|
|
799
|
+
},
|
|
800
|
+
{
|
|
801
|
+
PalletInstance: 50
|
|
802
|
+
},
|
|
803
|
+
{
|
|
804
|
+
GeneralIndex: 7873
|
|
805
|
+
}
|
|
806
|
+
]
|
|
807
|
+
}
|
|
808
|
+
},
|
|
793
809
|
{
|
|
794
810
|
parents: 1,
|
|
795
811
|
interior: {
|
|
@@ -806,6 +822,22 @@ var AssetHubPolkadot = {
|
|
|
806
822
|
]
|
|
807
823
|
}
|
|
808
824
|
},
|
|
825
|
+
{
|
|
826
|
+
parents: 1,
|
|
827
|
+
interior: {
|
|
828
|
+
X3: [
|
|
829
|
+
{
|
|
830
|
+
Parachain: 1000
|
|
831
|
+
},
|
|
832
|
+
{
|
|
833
|
+
PalletInstance: 50
|
|
834
|
+
},
|
|
835
|
+
{
|
|
836
|
+
GeneralIndex: 31337
|
|
837
|
+
}
|
|
838
|
+
]
|
|
839
|
+
}
|
|
840
|
+
},
|
|
809
841
|
{
|
|
810
842
|
parents: 1,
|
|
811
843
|
interior: {
|
|
@@ -7932,11 +7964,11 @@ var AcalaExchange = /*#__PURE__*/function (_ExchangeChain) {
|
|
|
7932
7964
|
key: "swapCurrency",
|
|
7933
7965
|
value: function () {
|
|
7934
7966
|
var _swapCurrency = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(options, toDestTransactionFee) {
|
|
7935
|
-
var api, apiPjs, assetFrom, assetTo, amount, sender, origin, isForFeeEstimation, wallet, fromToken, toToken, acalaDex, dex, swapFee, totalNativeCurrencyFee, balance, pctDestFee, amountWithoutFee, tradeResult, tx, amountOutRes, amountOut, nativeAssetSymbol, amountOutWithFee;
|
|
7967
|
+
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;
|
|
7936
7968
|
return _regenerator().w(function (_context) {
|
|
7937
7969
|
while (1) switch (_context.n) {
|
|
7938
7970
|
case 0:
|
|
7939
|
-
api = options.api, apiPjs = options.apiPjs, assetFrom = options.assetFrom, assetTo = options.assetTo, amount = options.amount, sender = options.sender, origin = options.origin, isForFeeEstimation = options.isForFeeEstimation;
|
|
7971
|
+
api = options.api, apiPjs = options.apiPjs, assetFrom = options.assetFrom, assetTo = options.assetTo, amount = options.amount, sender = options.sender, origin = options.origin, slippagePct = options.slippagePct, isForFeeEstimation = options.isForFeeEstimation;
|
|
7940
7972
|
wallet = new Wallet(apiPjs);
|
|
7941
7973
|
_context.n = 1;
|
|
7942
7974
|
return wallet.isReady;
|
|
@@ -7988,7 +8020,8 @@ var AcalaExchange = /*#__PURE__*/function (_ExchangeChain) {
|
|
|
7988
8020
|
path: [fromToken, toToken],
|
|
7989
8021
|
source: 'aggregate',
|
|
7990
8022
|
mode: 'EXACT_INPUT',
|
|
7991
|
-
input: new FixedPointNumber(formatUnits$1(amountWithoutFee, fromToken.decimals), fromToken.decimals)
|
|
8023
|
+
input: new FixedPointNumber(formatUnits$1(amountWithoutFee, fromToken.decimals), fromToken.decimals),
|
|
8024
|
+
acceptiveSlippage: Number(slippagePct) / 100
|
|
7992
8025
|
}));
|
|
7993
8026
|
case 6:
|
|
7994
8027
|
tradeResult = _context.v;
|
|
@@ -9167,7 +9200,7 @@ var HydrationExchange = /*#__PURE__*/function (_ExchangeChain) {
|
|
|
9167
9200
|
throw new UnableToComputeError('Price not found');
|
|
9168
9201
|
case 14:
|
|
9169
9202
|
currencyToPrice = priceInfo.amount;
|
|
9170
|
-
feeInCurrencyTo = toDestTransactionFee * pow10n(priceInfo.decimals + currencyToInfo.decimals)
|
|
9203
|
+
feeInCurrencyTo = padValueBy(toDestTransactionFee * pow10n(priceInfo.decimals + currencyToInfo.decimals) / (currencyToPrice * pow10n(nativeCurrencyDecimals)), FEE_BUFFER_PCT);
|
|
9171
9204
|
Logger.log('Amount out fee', feeInCurrencyTo, nativeCurrencyInfo.symbol);
|
|
9172
9205
|
amountOutModified = amountOut - feeInCurrencyTo;
|
|
9173
9206
|
if (!(amountOutModified <= 0n)) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@paraspell/swap",
|
|
3
|
-
"version": "14.4.
|
|
3
|
+
"version": "14.4.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.3.2",
|
|
41
|
-
"@paraspell/sdk": "14.4.
|
|
42
|
-
"@paraspell/sdk-common": "14.4.
|
|
43
|
-
"@paraspell/sdk-core": "14.4.
|
|
44
|
-
"@paraspell/sdk-pjs": "14.4.
|
|
41
|
+
"@paraspell/sdk": "14.4.3",
|
|
42
|
+
"@paraspell/sdk-common": "14.4.3",
|
|
43
|
+
"@paraspell/sdk-core": "14.4.3",
|
|
44
|
+
"@paraspell/sdk-pjs": "14.4.3",
|
|
45
45
|
"@polkadot/api": "^17.0.1",
|
|
46
46
|
"@polkadot/types": "^17.0.1",
|
|
47
47
|
"@polkadot/util": "^14.0.3",
|