@paraspell/swap 14.3.6 → 14.4.2

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.
Files changed (2) hide show
  1. package/dist/index.mjs +40 -23
  2. package/package.json +15 -15
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, Parents, isSymbolMatch, getParaId, UnableToComputeError, findNativeAssetInfoOrThrow, InvalidCurrencyError, findAssetInfoOrThrow, findAssetInfoByLoc, isSymbolSpecifier, findBestMatches, findAssetInfoBySymbol, getSupportedAssetsImpl, isAssetEqual, findAssetInfoOnDestImpl, normalizeExchange, EXCHANGE_CHAINS, deepEqual, reverseTransformLocation, getAssetsImpl, ScenarioNotSupportedError, applyDecimalAbstraction, findAssetInfo, Builder, isChainEvm, convertBuilderConfig, handleSwapExecuteTransfer, getXcmFee, getOriginXcmFee as getOriginXcmFee$1, InvalidAddressError, MissingParameterError, BatchMode, createChainClient as createChainClient$2, getExistentialDepositOrThrow, buildHopInfo, getRelayChainSymbol, aggregateHopFees, buildDestInfo, buildOriginInfo } from '@paraspell/sdk-core';
2
+ import { UnsupportedOperationError, assertCurrencyCore, dryRun, getDryRunError, DryRunFailedError, isConfig, getNativeAssets, RoutingResolutionError, findAssetInfoById, getOtherAssets, getChainProviders, parseUnits, getNativeAssetSymbol, padValueBy, formatUnits as formatUnits$1, AmountTooLowError, getBalance, localizeLocation, getAssets, Parents, isSymbolMatch, getParaId, UnableToComputeError, findNativeAssetInfoOrThrow, InvalidCurrencyError, findAssetInfoOrThrow, findAssetInfoByLoc, isSymbolSpecifier, findBestMatches, findAssetInfoBySymbol, getSupportedAssetsImpl, isAssetEqual, findAssetInfoOnDestImpl, normalizeExchange, EXCHANGE_CHAINS, deepEqual, reverseTransformLocation, getAssetsImpl, ScenarioNotSupportedError, applyDecimalAbstraction, findAssetInfo, Builder, isChainEvm, convertBuilderConfig, handleSwapExecuteTransfer, getXcmFee, getOriginXcmFee as getOriginXcmFee$1, InvalidAddressError, MissingParameterError, BatchMode, createChainClient as createChainClient$2, 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';
@@ -806,6 +806,22 @@ var AssetHubPolkadot = {
806
806
  ]
807
807
  }
808
808
  },
809
+ {
810
+ parents: 1,
811
+ interior: {
812
+ X3: [
813
+ {
814
+ Parachain: 1000
815
+ },
816
+ {
817
+ PalletInstance: 50
818
+ },
819
+ {
820
+ GeneralIndex: 31337
821
+ }
822
+ ]
823
+ }
824
+ },
809
825
  {
810
826
  parents: 1,
811
827
  interior: {
@@ -838,6 +854,22 @@ var AssetHubPolkadot = {
838
854
  ]
839
855
  }
840
856
  },
857
+ {
858
+ parents: 1,
859
+ interior: {
860
+ X3: [
861
+ {
862
+ Parachain: 1000
863
+ },
864
+ {
865
+ PalletInstance: 50
866
+ },
867
+ {
868
+ GeneralIndex: 22222012
869
+ }
870
+ ]
871
+ }
872
+ },
841
873
  {
842
874
  parents: 2,
843
875
  interior: {
@@ -1928,22 +1960,6 @@ var Hydration = {
1928
1960
  ]
1929
1961
  }
1930
1962
  },
1931
- {
1932
- parents: 1,
1933
- interior: {
1934
- X2: [
1935
- {
1936
- Parachain: 2034
1937
- },
1938
- {
1939
- AccountKey20: {
1940
- network: null,
1941
- key: "0xc09cf2f85367f3c2ab66e094283de3a499cb9108"
1942
- }
1943
- }
1944
- ]
1945
- }
1946
- },
1947
1963
  {
1948
1964
  parents: 1,
1949
1965
  interior: {
@@ -7932,11 +7948,11 @@ var AcalaExchange = /*#__PURE__*/function (_ExchangeChain) {
7932
7948
  key: "swapCurrency",
7933
7949
  value: function () {
7934
7950
  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;
7951
+ 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
7952
  return _regenerator().w(function (_context) {
7937
7953
  while (1) switch (_context.n) {
7938
7954
  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;
7955
+ 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
7956
  wallet = new Wallet(apiPjs);
7941
7957
  _context.n = 1;
7942
7958
  return wallet.isReady;
@@ -7988,7 +8004,8 @@ var AcalaExchange = /*#__PURE__*/function (_ExchangeChain) {
7988
8004
  path: [fromToken, toToken],
7989
8005
  source: 'aggregate',
7990
8006
  mode: 'EXACT_INPUT',
7991
- input: new FixedPointNumber(formatUnits$1(amountWithoutFee, fromToken.decimals), fromToken.decimals)
8007
+ input: new FixedPointNumber(formatUnits$1(amountWithoutFee, fromToken.decimals), fromToken.decimals),
8008
+ acceptiveSlippage: Number(slippagePct) / 100
7992
8009
  }));
7993
8010
  case 6:
7994
8011
  tradeResult = _context.v;
@@ -9167,7 +9184,7 @@ var HydrationExchange = /*#__PURE__*/function (_ExchangeChain) {
9167
9184
  throw new UnableToComputeError('Price not found');
9168
9185
  case 14:
9169
9186
  currencyToPrice = priceInfo.amount;
9170
- feeInCurrencyTo = toDestTransactionFee * pow10n(priceInfo.decimals + currencyToInfo.decimals) * BigInt(FEE_BUFFER_PCT) / (currencyToPrice * pow10n(nativeCurrencyDecimals) * 100n);
9187
+ feeInCurrencyTo = padValueBy(toDestTransactionFee * pow10n(priceInfo.decimals + currencyToInfo.decimals) / (currencyToPrice * pow10n(nativeCurrencyDecimals)), FEE_BUFFER_PCT);
9171
9188
  Logger.log('Amount out fee', feeInCurrencyTo, nativeCurrencyInfo.symbol);
9172
9189
  amountOutModified = amountOut - feeInCurrencyTo;
9173
9190
  if (!(amountOutModified <= 0n)) {
@@ -11038,7 +11055,7 @@ var computeExchangeMinAmount = /*#__PURE__*/function () {
11038
11055
  while (1) switch (_context.n) {
11039
11056
  case 0:
11040
11057
  exchange = options.exchange;
11041
- existentialDeposit = getExistentialDepositOrThrow(exchange.chain, {
11058
+ existentialDeposit = getExistentialDeposit(exchange.chain, {
11042
11059
  location: exchange.assetFrom.location
11043
11060
  });
11044
11061
  nativeSymbol = getNativeAssetSymbol(exchange.chain);
@@ -11119,7 +11136,7 @@ var computeLocalTransferableAmount = /*#__PURE__*/function () {
11119
11136
  });
11120
11137
  case 1:
11121
11138
  balance = _context.v;
11122
- existentialDeposit = getExistentialDepositOrThrow(exchange.chain, currency);
11139
+ existentialDeposit = getExistentialDeposit(exchange.chain, currency);
11123
11140
  swapFee = 0n;
11124
11141
  nativeSymbol = getNativeAssetSymbol(exchange.chain);
11125
11142
  if (!(exchange.assetFrom.symbol === nativeSymbol)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paraspell/swap",
3
- "version": "14.3.6",
3
+ "version": "14.4.2",
4
4
  "description": "Tool for XCM cross-chain asset exchanging across Polkadot and Kusama ecosystems",
5
5
  "repository": {
6
6
  "type": "git",
@@ -36,20 +36,20 @@
36
36
  "@crypto-dex-sdk/math": "^0.1.5",
37
37
  "@crypto-dex-sdk/parachains-bifrost": "^0.1.5",
38
38
  "@crypto-dex-sdk/token-lists": "^0.1.4",
39
- "@galacticcouncil/descriptors": "^2.7.0",
40
- "@galacticcouncil/sdk-next": "^2.1.0",
41
- "@paraspell/sdk": "14.3.6",
42
- "@paraspell/sdk-common": "14.3.6",
43
- "@paraspell/sdk-core": "14.3.6",
44
- "@paraspell/sdk-pjs": "14.3.6",
45
- "@polkadot/api": "^16.5.6",
46
- "@polkadot/types": "^16.5.6",
39
+ "@galacticcouncil/descriptors": "^2.9.0",
40
+ "@galacticcouncil/sdk-next": "^2.3.2",
41
+ "@paraspell/sdk": "14.4.2",
42
+ "@paraspell/sdk-common": "14.4.2",
43
+ "@paraspell/sdk-core": "14.4.2",
44
+ "@paraspell/sdk-pjs": "14.4.2",
45
+ "@polkadot/api": "^17.0.1",
46
+ "@polkadot/types": "^17.0.1",
47
47
  "@polkadot/util": "^14.0.3",
48
48
  "@zenlink-types/bifrost": "^1.7.7",
49
49
  "ethers": "^5.8.0",
50
50
  "ethers-v6": "npm:ethers@6.17.0",
51
- "polkadot-api": "^3.0.0",
52
- "react": "^19.2.8",
51
+ "polkadot-api": "^3.2.0",
52
+ "react": "^19.3.0",
53
53
  "rxjs": "^7.8.2"
54
54
  },
55
55
  "devDependencies": {
@@ -59,11 +59,11 @@
59
59
  "@rollup/plugin-babel": "^7.1.0",
60
60
  "@rollup/plugin-json": "^6.1.0",
61
61
  "@rollup/plugin-typescript": "^12.3.0",
62
- "@vitest/coverage-v8": "^4.1.11",
63
- "dotenv": "^17.4.2",
64
- "rollup": "^4.62.5",
62
+ "@vitest/coverage-v8": "^5.0.2",
63
+ "dotenv": "^18.0.4",
64
+ "rollup": "^4.63.5",
65
65
  "rollup-plugin-dts": "^6.5.1",
66
- "tsx": "^4.23.12"
66
+ "tsx": "^4.23.15"
67
67
  },
68
68
  "scripts": {
69
69
  "compile": "tsc --noEmit",