@paraspell/swap 13.5.0 → 13.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { TSubstrateChain, TExchangeInput, TChain, TCurrencyInput, TAmount, TStatusChangeCallback, TAssetInfo, PolkadotApi, TExchangeChain, TLocation, WithApi, TSwapBuilder, TGetXcmFeeBuilderOptions, TGetXcmFeeResult, TXcmFeeDetailWithForwardedXcm, TTransferInfo, TTransactionContext, TDryRunResult, TDryRunPreviewOptions } from '@paraspell/sdk-core';
1
+ import { TSubstrateChain, TExchangeInput, TChain, TCurrencyInput, TAmount, TStatusChangeCallback, TAssetInfo, PolkadotApi, TExchangeChain, TLocation, WithApi, TCustomCtx, TSwapBuilder, TGetXcmFeeBuilderOptions, TGetXcmFeeResult, TXcmFeeDetailWithForwardedXcm, TTransferInfo, TTransactionContext, TDryRunResult, TDryRunPreviewOptions } from '@paraspell/sdk-core';
2
2
  import { TPapiApi, TPapiTransaction } from '@paraspell/sdk';
3
3
  import { Extrinsic } from '@paraspell/sdk-pjs';
4
4
  import { ApiPromise } from '@polkadot/api';
@@ -235,6 +235,7 @@ declare const getExchangeAssets: (exchange: TExchangeChain) => TAssetInfo[];
235
235
 
236
236
  declare const getExchangePairs: (exchange: TExchangeInput) => [TAssetInfo, TAssetInfo][];
237
237
 
238
+ declare const getSupportedAssetsFromImpl: <TCustomChain extends string = never>(from: TChain | TCustomChain | undefined, exchangeInput: TExchangeInput, ctx?: TCustomCtx) => TAssetInfo[];
238
239
  /**
239
240
  * Retrieves the list of assets supported for transfer from the origin chain to the exchange chain.
240
241
  *
@@ -244,6 +245,7 @@ declare const getExchangePairs: (exchange: TExchangeInput) => [TAssetInfo, TAsse
244
245
  */
245
246
  declare const getSupportedAssetsFrom: (from: TChain | undefined, exchangeInput: TExchangeInput) => TAssetInfo[];
246
247
 
248
+ declare const getSupportedAssetsToImpl: <TCustomChain extends string = never>(exchangeInput: TExchangeInput, to: TChain | TCustomChain | undefined, ctx?: TCustomCtx) => TAssetInfo[];
247
249
  /**
248
250
  * Retrieves the list of assets supported for transfer to the destination chain.
249
251
  *
@@ -254,6 +256,7 @@ declare const getSupportedAssetsFrom: (from: TChain | undefined, exchangeInput:
254
256
  */
255
257
  declare const getSupportedAssetsTo: (exchangeInput: TExchangeInput, to: TChain | undefined) => TAssetInfo[];
256
258
 
259
+ declare const getSupportedFeeAssetsImpl: <TCustomChain extends string = never>(from: TChain | TCustomChain | undefined, exchangeInput: TExchangeInput, ctx?: TCustomCtx) => TAssetInfo[];
257
260
  /**
258
261
  * Retrieves the list of assets that can be used to pay for fees on the origin chain.
259
262
  *
@@ -334,5 +337,5 @@ declare const DEST_FEE_BUFFER_PCT = -1;
334
337
  declare const FALLBACK_FEE_CALC_ADDRESS = "5EtHZF4E8QagNCz6naobCkCAUT52SbcEqaXiDUu2PjUHxZid";
335
338
  declare const FALLBACK_FEE_CALC_EVM_ADDRESS = "0x1501C1413e4178c38567Ada8945A80351F7B8496";
336
339
 
337
- export { DEST_FEE_BUFFER_PCT, FALLBACK_FEE_CALC_ADDRESS, FALLBACK_FEE_CALC_EVM_ADDRESS, FEE_BUFFER_PCT, SwapBuilder, SwapBuilderCore, getExchangeAssets, getExchangeConfig, getExchangePairs, getSupportedAssetsFrom, getSupportedAssetsTo, getSupportedFeeAssets };
340
+ 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 };
338
341
  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, TMultiSwapResult, TOriginInfo, TPairs, TPapiExchangeInfo, TPapiGetAmountOutOptions, TPapiSwapOptions, TPjsExchangeInfo, TPjsGetAmountOutOptions, TPjsSwapOptions, TPreparedExtrinsics, TRouterPlan, TSingleSwapResult, TSwapAndTransferTransaction, TSwapOptions, TSwapOptionsFor, TSwapTransaction, TSwapTransformedOptions, TTransaction, TTransferBaseOptions, TTransferOptions, TTransformedOptions };
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import { createChainClient as createChainClient$1, registerSwapExtension } from '@paraspell/sdk';
2
- import { UnsupportedOperationError, assertCurrencyCore, dryRun, getFailureInfo, DryRunFailedError, isConfig, getNativeAssets, RoutingResolutionError, findAssetInfoById, getOtherAssets, getChainProviders, parseUnits, getNativeAssetSymbol, padValueBy, formatUnits as formatUnits$1, AmountTooLowError, getBalance, localizeLocation, getAssets, Parents, isSymbolMatch, getParaId, UnableToComputeError, getAssetDecimals, findNativeAssetInfoOrThrow, InvalidCurrencyError, findAssetInfoOrThrow, isOverrideLocationSpecifier, isSymbolSpecifier, findBestMatches, findAssetInfoBySymbol, findAssetInfoByLoc, deepEqual, normalizeExchange, EXCHANGE_CHAINS, reverseTransformLocation, isAssetEqual, isExternalChain, isSystemAsset, TransferToAhNotSupported, ScenarioNotSupportedError, applyDecimalAbstraction, findAssetInfo, getRelayChainOf, hasSupportForAsset, 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, getFailureInfo, DryRunFailedError, isConfig, getNativeAssets, RoutingResolutionError, findAssetInfoById, getOtherAssets, getChainProviders, parseUnits, getNativeAssetSymbol, padValueBy, formatUnits as formatUnits$1, AmountTooLowError, getBalance, localizeLocation, getAssets, Parents, isSymbolMatch, getParaId, UnableToComputeError, getAssetDecimals, findNativeAssetInfoOrThrow, InvalidCurrencyError, findAssetInfoOrThrow, isOverrideLocationSpecifier, isSymbolSpecifier, findBestMatches, findAssetInfoBySymbol, findAssetInfoByLoc, deepEqual, normalizeExchange, EXCHANGE_CHAINS, reverseTransformLocation, getAssetsImpl, isAssetEqual, isExternalChain, isSystemAsset, TransferToAhNotSupported, ScenarioNotSupportedError, applyDecimalAbstraction, findAssetInfo, getRelayChainOf, hasSupportForAsset, Builder, isChainEvm, convertBuilderConfig, handleSwapExecuteTransfer, getXcmFee, getOriginXcmFee as getOriginXcmFee$1, InvalidAddressError, MissingParameterError, BatchMode, createChainClient as createChainClient$2, getExistentialDepositOrThrow, buildHopInfo, getRelayChainSymbol, aggregateHopFees, buildDestInfo, buildOriginInfo } from '@paraspell/sdk-core';
3
3
  import { toHex } from 'polkadot-api/utils';
4
4
  import 'polkadot-api';
5
5
  import { Wallet } from '@acala-network/sdk';
@@ -2519,16 +2519,6 @@ var Hydration = {
2519
2519
  ]
2520
2520
  }
2521
2521
  },
2522
- {
2523
- parents: 1,
2524
- interior: {
2525
- X1: [
2526
- {
2527
- Parachain: 3370
2528
- }
2529
- ]
2530
- }
2531
- },
2532
2522
  {
2533
2523
  parents: 1,
2534
2524
  interior: {
@@ -9732,18 +9722,11 @@ var getExchangePairs = function getExchangePairs(exchange) {
9732
9722
  });
9733
9723
  };
9734
9724
 
9735
- /**
9736
- * Retrieves the list of assets supported for transfer from the origin chain to the exchange chain.
9737
- *
9738
- * @param from - The origin chain.
9739
- * @param exchange - The exchange chain or 'Auto select'.
9740
- * @returns An array of supported assets.
9741
- */
9742
- var getSupportedAssetsFrom = function getSupportedAssetsFrom(from, exchangeInput) {
9725
+ var getSupportedAssetsFromImpl = function getSupportedAssetsFromImpl(from, exchangeInput, ctx) {
9743
9726
  var exchange = normalizeExchange(exchangeInput);
9744
9727
  if (exchange === undefined) {
9745
9728
  if (!from) return [];
9746
- return getAssets(from);
9729
+ return getAssetsImpl(from, ctx);
9747
9730
  }
9748
9731
  var exchangeAssets = Array.isArray(exchange) ? exchange.flatMap(function (exchange) {
9749
9732
  return getExchangeAssets(exchange);
@@ -9751,30 +9734,32 @@ var getSupportedAssetsFrom = function getSupportedAssetsFrom(from, exchangeInput
9751
9734
  if (!from || !Array.isArray(exchange) && from === createExchangeInstance(exchange).chain) {
9752
9735
  return exchangeAssets;
9753
9736
  }
9754
- var fromAssets = getAssets(from);
9737
+ var fromAssets = getAssetsImpl(from, ctx);
9755
9738
  return fromAssets.filter(function (fromAsset) {
9756
9739
  return exchangeAssets.some(function (exchangeAsset) {
9757
9740
  return isAssetEqual(fromAsset, exchangeAsset);
9758
9741
  });
9759
9742
  });
9760
9743
  };
9761
-
9762
9744
  /**
9763
- * Retrieves the list of assets supported for transfer to the destination chain.
9745
+ * Retrieves the list of assets supported for transfer from the origin chain to the exchange chain.
9764
9746
  *
9765
- * @param origin - The origin chain.
9747
+ * @param from - The origin chain.
9766
9748
  * @param exchange - The exchange chain or 'Auto select'.
9767
- * @param to - The destination chain.
9768
9749
  * @returns An array of supported assets.
9769
9750
  */
9770
- var getSupportedAssetsTo = function getSupportedAssetsTo(exchangeInput, to) {
9751
+ var getSupportedAssetsFrom = function getSupportedAssetsFrom(from, exchangeInput) {
9752
+ return getSupportedAssetsFromImpl(from, exchangeInput);
9753
+ };
9754
+
9755
+ var getSupportedAssetsToImpl = function getSupportedAssetsToImpl(exchangeInput, to, ctx) {
9771
9756
  var exchange = normalizeExchange(exchangeInput);
9772
9757
  if (exchange === undefined) {
9773
9758
  var allExchangeAssets = EXCHANGE_CHAINS.map(function (exchangeChain) {
9774
9759
  return getExchangeAssets(exchangeChain);
9775
9760
  }).flat();
9776
9761
  if (to) {
9777
- var toAssets = getAssets(to);
9762
+ var toAssets = getAssetsImpl(to, ctx);
9778
9763
  var filteredExchangeAssets = allExchangeAssets.filter(function (asset) {
9779
9764
  return toAssets.some(function (toAsset) {
9780
9765
  return isAssetEqual(asset, toAsset);
@@ -9793,7 +9778,7 @@ var getSupportedAssetsTo = function getSupportedAssetsTo(exchangeInput, to) {
9793
9778
  return getExchangeAssets(exchange);
9794
9779
  }) : getExchangeAssets(exchange);
9795
9780
  if (to) {
9796
- var _toAssets = getAssets(to);
9781
+ var _toAssets = getAssetsImpl(to, ctx);
9797
9782
  var _filteredExchangeAssets = exchangeAssets.filter(function (asset) {
9798
9783
  return _toAssets.some(function (toAsset) {
9799
9784
  return isAssetEqual(asset, toAsset);
@@ -9808,24 +9793,28 @@ var getSupportedAssetsTo = function getSupportedAssetsTo(exchangeInput, to) {
9808
9793
  }
9809
9794
  return exchangeAssets;
9810
9795
  };
9811
-
9812
9796
  /**
9813
- * Retrieves the list of assets that can be used to pay for fees on the origin chain.
9797
+ * Retrieves the list of assets supported for transfer to the destination chain.
9814
9798
  *
9815
- * @param from - The origin chain.
9799
+ * @param origin - The origin chain.
9816
9800
  * @param exchange - The exchange chain or 'Auto select'.
9817
- * @returns An array of fee-eligible assets.
9801
+ * @param to - The destination chain.
9802
+ * @returns An array of supported assets.
9818
9803
  */
9819
- var getSupportedFeeAssets = function getSupportedFeeAssets(from, exchangeInput) {
9804
+ var getSupportedAssetsTo = function getSupportedAssetsTo(exchangeInput, to) {
9805
+ return getSupportedAssetsToImpl(exchangeInput, to);
9806
+ };
9807
+
9808
+ var getSupportedFeeAssetsImpl = function getSupportedFeeAssetsImpl(from, exchangeInput, ctx) {
9820
9809
  var exchange = normalizeExchange(exchangeInput);
9821
- var supportedAssets = getSupportedAssetsFrom(from, exchange);
9810
+ var supportedAssets = getSupportedAssetsFromImpl(from, exchange, ctx);
9822
9811
  var chains = from ? [from] : (exchange === undefined ? EXCHANGE_CHAINS : Array.isArray(exchange) ? exchange : [exchange]).map(function (ex) {
9823
9812
  return createExchangeInstance(ex).chain;
9824
9813
  }).filter(function (chain, i, arr) {
9825
9814
  return arr.indexOf(chain) === i;
9826
9815
  });
9827
9816
  var chainAssets = chains.flatMap(function (chain) {
9828
- return getAssets(chain);
9817
+ return getAssetsImpl(chain, ctx);
9829
9818
  });
9830
9819
  return supportedAssets.filter(function (asset) {
9831
9820
  return chainAssets.some(function (chainAsset) {
@@ -9833,6 +9822,16 @@ var getSupportedFeeAssets = function getSupportedFeeAssets(from, exchangeInput)
9833
9822
  });
9834
9823
  });
9835
9824
  };
9825
+ /**
9826
+ * Retrieves the list of assets that can be used to pay for fees on the origin chain.
9827
+ *
9828
+ * @param from - The origin chain.
9829
+ * @param exchange - The exchange chain or 'Auto select'.
9830
+ * @returns An array of fee-eligible assets.
9831
+ */
9832
+ var getSupportedFeeAssets = function getSupportedFeeAssets(from, exchangeInput) {
9833
+ return getSupportedFeeAssetsImpl(from, exchangeInput);
9834
+ };
9836
9835
 
9837
9836
  var asArray = function asArray(ex) {
9838
9837
  return ex === undefined ? EXCHANGE_CHAINS : Array.isArray(ex) ? ex : [ex];
@@ -12139,4 +12138,4 @@ registerSwapExtension({
12139
12138
  SwapBuilder: SwapBuilder
12140
12139
  });
12141
12140
 
12142
- export { DEST_FEE_BUFFER_PCT, FALLBACK_FEE_CALC_ADDRESS, FALLBACK_FEE_CALC_EVM_ADDRESS, FEE_BUFFER_PCT, SwapBuilder, SwapBuilderCore, getExchangeAssets, getExchangeConfig, getExchangePairs, getSupportedAssetsFrom, getSupportedAssetsTo, getSupportedFeeAssets };
12141
+ 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 };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paraspell/swap",
3
- "version": "13.5.0",
3
+ "version": "13.6.0",
4
4
  "description": "Tool for XCM cross-chain asset exchanging across Polkadot and Kusama ecosystems",
5
5
  "type": "module",
6
6
  "exports": {
@@ -33,38 +33,39 @@
33
33
  "@crypto-dex-sdk/math": "^0.1.5",
34
34
  "@crypto-dex-sdk/parachains-bifrost": "^0.1.5",
35
35
  "@crypto-dex-sdk/token-lists": "^0.1.4",
36
- "@galacticcouncil/sdk-next": "^1.0.1",
36
+ "@galacticcouncil/descriptors": "^2.3.0",
37
+ "@galacticcouncil/sdk-next": "^1.3.0",
37
38
  "@polkadot/api": "^16.5.6",
38
39
  "@polkadot/api-base": "^16.5.6",
39
40
  "@polkadot/types": "^16.5.6",
40
41
  "@polkadot/types-codec": "^16.5.6",
41
42
  "@polkadot/util": "^14.0.3",
42
43
  "@zenlink-types/bifrost": "^1.7.7",
43
- "axios": "^1.15.2",
44
+ "axios": "^1.16.1",
44
45
  "ethers": "^5.8.0",
45
46
  "ethers-v6": "npm:ethers@^6.16.0",
46
47
  "jsbi": "^4.3.2",
47
48
  "lodash-es": "^4.18.1",
48
- "polkadot-api": "^2.1.1",
49
- "postcss": "^8.5.12",
50
- "react": "^19.2.5",
49
+ "polkadot-api": "^2.1.4",
50
+ "postcss": "^8.5.15",
51
+ "react": "^19.2.6",
51
52
  "rxjs": "^7.8.2",
52
- "@paraspell/sdk": "13.5.0",
53
- "@paraspell/sdk-core": "13.5.0",
54
- "@paraspell/sdk-pjs": "13.5.0"
53
+ "@paraspell/sdk": "13.6.0",
54
+ "@paraspell/sdk-pjs": "13.6.0",
55
+ "@paraspell/sdk-core": "13.6.0"
55
56
  },
56
57
  "devDependencies": {
57
- "@babel/core": "^7.29.0",
58
- "@babel/plugin-syntax-import-attributes": "^7.28.6",
59
- "@babel/preset-env": "^7.29.2",
58
+ "@babel/core": "^7.29.7",
59
+ "@babel/plugin-syntax-import-attributes": "^7.29.7",
60
+ "@babel/preset-env": "^7.29.7",
60
61
  "@codecov/rollup-plugin": "^2.0.1",
61
62
  "@rollup/plugin-babel": "^7.0.0",
62
63
  "@rollup/plugin-json": "^6.1.0",
63
64
  "@rollup/plugin-typescript": "^12.3.0",
64
65
  "@types/lodash-es": "^4.17.12",
65
- "@vitest/coverage-v8": "^4.1.5",
66
+ "@vitest/coverage-v8": "^4.1.7",
66
67
  "dotenv": "^17.4.2",
67
- "rollup": "^4.60.2",
68
+ "rollup": "^4.60.4",
68
69
  "rollup-plugin-dts": "^6.4.1",
69
70
  "ts-node": "^10.9.2",
70
71
  "tslib": "^2.8.1"