@paraspell/swap 13.11.0 → 14.0.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
@@ -314,7 +314,7 @@ declare class SwapBuilderCore<TApi, TRes, TSigner, T extends Partial<TTransferBa
314
314
  }, TCustomChain>;
315
315
  getXcmFees<TDisableFallback extends boolean = false>(this: SwapBuilderCore<TApi, TRes, TSigner, TBuildTransactionsBaseOptions<TApi, TRes, TSigner>, TCustomChain>, options?: TGetXcmFeeBuilderOptions & {
316
316
  disableFallback: TDisableFallback;
317
- }): Promise<TGetXcmFeeResult<TDisableFallback>>;
317
+ }): Promise<TGetXcmFeeResult<TDisableFallback, TCustomChain>>;
318
318
  getOriginXcmFee<TDisableFallback extends boolean = false>(this: SwapBuilderCore<TApi, TRes, TSigner, TBuildTransactionsBaseOptions<TApi, TRes, TSigner>, TCustomChain>, options?: TGetXcmFeeBuilderOptions & {
319
319
  disableFallback: TDisableFallback;
320
320
  }): Promise<TXcmFeeDetailWithForwardedXcm<TDisableFallback>>;
@@ -323,14 +323,14 @@ declare class SwapBuilderCore<TApi, TRes, TSigner, T extends Partial<TTransferBa
323
323
  getMinTransferableAmount(this: SwapBuilderCore<TApi, TRes, TSigner, TBuildTransactionsBaseOptions<TApi, TRes, TSigner>, TCustomChain>): Promise<bigint>;
324
324
  signAndSubmit(this: SwapBuilderCore<TApi, TRes, TSigner, TTransferBaseOptions<TApi, TRes, TSigner>, TCustomChain>): Promise<string[]>;
325
325
  build(this: SwapBuilderCore<TApi, TRes, TSigner, TBuildTransactionsBaseOptions<TApi, TRes, TSigner>, TCustomChain>): Promise<TTransactionContext<TApi, TRes>[]>;
326
- dryRun(this: SwapBuilderCore<TApi, TRes, TSigner, TBuildTransactionsBaseOptions<TApi, TRes, TSigner>, TCustomChain>): Promise<TDryRunResult>;
327
- dryRunPreview(this: SwapBuilderCore<TApi, TRes, TSigner, TBuildTransactionsBaseOptions<TApi, TRes, TSigner>, TCustomChain>, previewOptions?: TDryRunPreviewOptions): Promise<TDryRunResult>;
326
+ dryRun(this: SwapBuilderCore<TApi, TRes, TSigner, TBuildTransactionsBaseOptions<TApi, TRes, TSigner>, TCustomChain>): Promise<TDryRunResult<TCustomChain>>;
327
+ dryRunPreview(this: SwapBuilderCore<TApi, TRes, TSigner, TBuildTransactionsBaseOptions<TApi, TRes, TSigner>, TCustomChain>, previewOptions?: TDryRunPreviewOptions): Promise<TDryRunResult<TCustomChain>>;
328
328
  getBestAmountOut(this: SwapBuilderCore<TApi, TRes, TSigner, TGetBestAmountOutBaseOptions<TApi, TRes, TSigner>, TCustomChain>): Promise<{
329
329
  exchange: TExchangeChain;
330
330
  amountOut: bigint;
331
331
  }>;
332
332
  }
333
- declare const SwapBuilder: <TApi, TRes, TSigner, TCustomChain extends string = never>(api: PolkadotApi<TApi, TRes, TSigner, TCustomChain>) => TSwapBuilder<TApi, TRes, TSigner>;
333
+ declare const SwapBuilder: <TApi, TRes, TSigner, TCustomChain extends string = never>(api: PolkadotApi<TApi, TRes, TSigner, TCustomChain>) => TSwapBuilder<TApi, TRes, TSigner, TCustomChain>;
334
334
 
335
335
  declare const FEE_BUFFER_PCT = 10;
336
336
  declare const DEST_FEE_BUFFER_PCT = -1;
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, findAssetInfoByLoc, isSymbolSpecifier, findBestMatches, findAssetInfoBySymbol, deepEqual, normalizeExchange, EXCHANGE_CHAINS, reverseTransformLocation, getAssetsImpl, isAssetEqual, isExternalChain, isSystemAsset, 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, 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, deepEqual, normalizeExchange, EXCHANGE_CHAINS, reverseTransformLocation, getAssetsImpl, isAssetEqual, isExternalChain, isSystemAsset, ScenarioNotSupportedError, applyDecimalAbstraction, findAssetInfo, getRelayChainOf, 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';
@@ -592,7 +592,8 @@ var dryRunTransaction = /*#__PURE__*/function () {
592
592
  };
593
593
  }();
594
594
  var mergeDryRunResults = function mergeDryRunResults(options, originResult, exchangeResult) {
595
- var exchange = options.exchange,
595
+ var origin = options.origin,
596
+ exchange = options.exchange,
596
597
  destination = options.destination;
597
598
  var result = {
598
599
  origin: originResult.origin,
@@ -602,12 +603,26 @@ var mergeDryRunResults = function mergeDryRunResults(options, originResult, exch
602
603
  result: exchangeResult.origin
603
604
  }] : []), _toConsumableArray(exchangeResult.hops))
604
605
  };
605
- return _objectSpread2(_objectSpread2({}, getFailureInfo(result)), result);
606
+ var dryRunError = getDryRunError({
607
+ origin: {
608
+ chain: origin ? origin.chain : exchange.chain,
609
+ result: result.origin
610
+ },
611
+ destination: result.destination ? {
612
+ chain: destination ? destination.chain : exchange.chain,
613
+ result: result.destination
614
+ } : undefined,
615
+ hops: result.hops
616
+ });
617
+ return _objectSpread2({
618
+ success: !dryRunError,
619
+ dryRunError: dryRunError
620
+ }, result);
606
621
  };
607
622
  var dryRun2Transactions = /*#__PURE__*/function () {
608
623
  var _ref3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(options, transactions, originBypass, exchangeBypass) {
609
624
  var _originBypass$mintFee;
610
- var exchange, _transactions, firstTx, secondTx, firstRes, _getFailureInfo, failureReason, exchangeBypassOptions, secondRes;
625
+ var exchange, _transactions, firstTx, secondTx, firstRes, exchangeBypassOptions, secondRes;
611
626
  return _regenerator().w(function (_context2) {
612
627
  while (1) switch (_context2.n) {
613
628
  case 0:
@@ -617,8 +632,7 @@ var dryRun2Transactions = /*#__PURE__*/function () {
617
632
  return dryRunTransaction(options, firstTx, exchange.chain, originBypass);
618
633
  case 1:
619
634
  firstRes = _context2.v;
620
- _getFailureInfo = getFailureInfo(firstRes), failureReason = _getFailureInfo.failureReason;
621
- exchangeBypassOptions = exchangeBypass !== null && exchangeBypass !== void 0 ? exchangeBypass : !failureReason ? {
635
+ exchangeBypassOptions = exchangeBypass !== null && exchangeBypass !== void 0 ? exchangeBypass : firstRes.success ? {
622
636
  sentAssetMintMode: 'preview',
623
637
  mintFeeAssets: (_originBypass$mintFee = originBypass === null || originBypass === void 0 ? void 0 : originBypass.mintFeeAssets) !== null && _originBypass$mintFee !== void 0 ? _originBypass$mintFee : false
624
638
  } : undefined;
@@ -702,11 +716,11 @@ var maybePerformXcmFormatCheck = /*#__PURE__*/function () {
702
716
  return dryRunTransactions(routerPlan, options, BYPASS, BYPASS);
703
717
  case 2:
704
718
  result = _context.v;
705
- if (!result.failureReason) {
719
+ if (!result.dryRunError) {
706
720
  _context.n = 3;
707
721
  break;
708
722
  }
709
- throw new DryRunFailedError(result.failureReason, result.failureChain, 'XCM format check failed.');
723
+ throw new DryRunFailedError(result.dryRunError, 'XCM format check failed.');
710
724
  case 3:
711
725
  return _context.a(2);
712
726
  }
@@ -1771,6 +1785,22 @@ var Hydration = {
1771
1785
  ]
1772
1786
  }
1773
1787
  },
1788
+ {
1789
+ parents: 1,
1790
+ interior: {
1791
+ X2: [
1792
+ {
1793
+ Parachain: 2034
1794
+ },
1795
+ {
1796
+ AccountKey20: {
1797
+ network: null,
1798
+ key: "0x6b9ac524ec8f08c49ec80176b138d16eb461c3d8"
1799
+ }
1800
+ }
1801
+ ]
1802
+ }
1803
+ },
1774
1804
  {
1775
1805
  parents: 1,
1776
1806
  interior: {
@@ -6580,40 +6610,6 @@ var Acala = {
6580
6610
  }
6581
6611
  }
6582
6612
  ],
6583
- [
6584
- {
6585
- parents: 1,
6586
- interior: {
6587
- X3: [
6588
- {
6589
- Parachain: 1000
6590
- },
6591
- {
6592
- PalletInstance: 50
6593
- },
6594
- {
6595
- GeneralIndex: 22222012
6596
- }
6597
- ]
6598
- }
6599
- },
6600
- {
6601
- parents: 1,
6602
- interior: {
6603
- X2: [
6604
- {
6605
- Parachain: 2032
6606
- },
6607
- {
6608
- GeneralKey: {
6609
- length: 2,
6610
- data: "0x0001000000000000000000000000000000000000000000000000000000000000"
6611
- }
6612
- }
6613
- ]
6614
- }
6615
- }
6616
- ],
6617
6613
  [
6618
6614
  {
6619
6615
  parents: 1,
@@ -9303,32 +9299,9 @@ var BifrostExchange = /*#__PURE__*/function (_ExchangeChain) {
9303
9299
  }]);
9304
9300
  }(ExchangeChain);
9305
9301
 
9306
- var getAssetInfo = /*#__PURE__*/function () {
9307
- var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(assetClient, asset) {
9308
- var assets;
9309
- return _regenerator().w(function (_context) {
9310
- while (1) switch (_context.n) {
9311
- case 0:
9312
- _context.n = 1;
9313
- return assetClient.getSupported();
9314
- case 1:
9315
- assets = _context.v;
9316
- return _context.a(2, asset.assetId ? assets.find(function (a) {
9317
- return a.id.toString() === asset.assetId;
9318
- }) : assets.find(function (a) {
9319
- return a.symbol === asset.symbol;
9320
- }));
9321
- }
9322
- }, _callee);
9323
- }));
9324
- return function getAssetInfo(_x, _x2) {
9325
- return _ref.apply(this, arguments);
9326
- };
9327
- }();
9328
-
9329
9302
  var calculateFee = /*#__PURE__*/function () {
9330
- var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(_ref, tradeRouter, txBuilderFactory, assetClient, currencyFromInfo, currencyToInfo, currencyFromDecimals, chain, toDestTransactionFee) {
9331
- var amount, slippagePct, feeCalcAddress, sender, trade, nativeCurrencyInfo, nativeCurrencyDecimals, substrateTx, tx, _yield$tx$getPaymentI, swapFee, feeNative, currencyFromPriceInfo, currencyFromPrice, feeInCurrencyFrom, finalFee;
9303
+ var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(_ref, tradeRouter, txBuilderFactory, currencyFromInfo, currencyToInfo, currencyFromDecimals, chain, toDestTransactionFee) {
9304
+ var amount, slippagePct, feeCalcAddress, sender, trade, nativeAsset, substrateTx, tx, _yield$tx$getPaymentI, swapFee, feeNative, currencyFromPriceInfo, currencyFromPrice, feeInCurrencyFrom, finalFee;
9332
9305
  return _regenerator().w(function (_context) {
9333
9306
  while (1) switch (_context.n) {
9334
9307
  case 0:
@@ -9337,58 +9310,40 @@ var calculateFee = /*#__PURE__*/function () {
9337
9310
  return tradeRouter.getBestSell(currencyFromInfo.id, currencyToInfo.id, amount.toString());
9338
9311
  case 1:
9339
9312
  trade = _context.v;
9313
+ nativeAsset = findNativeAssetInfoOrThrow(chain);
9340
9314
  _context.n = 2;
9341
- return getAssetInfo(assetClient, {
9342
- symbol: getNativeAssetSymbol(chain)
9343
- });
9344
- case 2:
9345
- nativeCurrencyInfo = _context.v;
9346
- if (!(nativeCurrencyInfo === undefined)) {
9347
- _context.n = 3;
9348
- break;
9349
- }
9350
- throw new UnableToComputeError('Native currency not found');
9351
- case 3:
9352
- nativeCurrencyDecimals = getAssetDecimals(chain, nativeCurrencyInfo.symbol);
9353
- if (!(nativeCurrencyDecimals === null)) {
9354
- _context.n = 4;
9355
- break;
9356
- }
9357
- throw new UnableToComputeError('Native currency decimals not found');
9358
- case 4:
9359
- _context.n = 5;
9360
9315
  return txBuilderFactory.trade(trade).withSlippage(Number(slippagePct)).withBeneficiary(sender).build();
9361
- case 5:
9316
+ case 2:
9362
9317
  substrateTx = _context.v;
9363
9318
  tx = substrateTx.get();
9364
- _context.n = 6;
9319
+ _context.n = 3;
9365
9320
  return tx.getPaymentInfo(feeCalcAddress);
9366
- case 6:
9321
+ case 3:
9367
9322
  _yield$tx$getPaymentI = _context.v;
9368
9323
  swapFee = _yield$tx$getPaymentI.partial_fee;
9369
9324
  feeNative = swapFee + toDestTransactionFee + toDestTransactionFee;
9370
- Logger.log('XCM to exch. fee:', toDestTransactionFee, nativeCurrencyInfo.symbol);
9371
- Logger.log('XCM to dest. fee:', toDestTransactionFee, nativeCurrencyInfo.symbol);
9372
- Logger.log('Swap fee:', swapFee, nativeCurrencyInfo.symbol);
9373
- Logger.log('Total fee:', feeNative, nativeCurrencyInfo.symbol);
9374
- if (!(currencyFromInfo.symbol === nativeCurrencyInfo.symbol)) {
9375
- _context.n = 7;
9325
+ Logger.log('XCM to exch. fee:', toDestTransactionFee, nativeAsset.symbol);
9326
+ Logger.log('XCM to dest. fee:', toDestTransactionFee, nativeAsset.symbol);
9327
+ Logger.log('Swap fee:', swapFee, nativeAsset.symbol);
9328
+ Logger.log('Total fee:', feeNative, nativeAsset.symbol);
9329
+ if (!(currencyFromInfo.symbol === nativeAsset.symbol)) {
9330
+ _context.n = 4;
9376
9331
  break;
9377
9332
  }
9378
9333
  return _context.a(2, feeNative);
9379
- case 7:
9380
- _context.n = 8;
9381
- return tradeRouter.getSpotPrice(currencyFromInfo.id, nativeCurrencyInfo.id);
9382
- case 8:
9334
+ case 4:
9335
+ _context.n = 5;
9336
+ return tradeRouter.getSpotPrice(currencyFromInfo.id, Number(nativeAsset.assetId));
9337
+ case 5:
9383
9338
  currencyFromPriceInfo = _context.v;
9384
9339
  if (!(currencyFromPriceInfo === undefined)) {
9385
- _context.n = 9;
9340
+ _context.n = 6;
9386
9341
  break;
9387
9342
  }
9388
9343
  throw new UnableToComputeError('Price not found');
9389
- case 9:
9344
+ case 6:
9390
9345
  currencyFromPrice = currencyFromPriceInfo.amount;
9391
- feeInCurrencyFrom = feeNative * pow10n(currencyFromPriceInfo.decimals + currencyFromDecimals) / (currencyFromPrice * pow10n(nativeCurrencyDecimals));
9346
+ feeInCurrencyFrom = feeNative * pow10n(currencyFromPriceInfo.decimals + currencyFromDecimals) / (currencyFromPrice * pow10n(nativeAsset.decimals));
9392
9347
  Logger.log('Total fee in currency from:', feeInCurrencyFrom, currencyFromInfo.symbol);
9393
9348
  finalFee = padValueBy(feeInCurrencyFrom, FEE_BUFFER_PCT);
9394
9349
  Logger.log("Total fee in currency from with buffer ".concat(FEE_BUFFER_PCT, "%:"), finalFee, currencyFromInfo.symbol);
@@ -9396,11 +9351,34 @@ var calculateFee = /*#__PURE__*/function () {
9396
9351
  }
9397
9352
  }, _callee);
9398
9353
  }));
9399
- return function calculateFee(_x, _x2, _x3, _x4, _x5, _x6, _x7, _x8, _x9) {
9354
+ return function calculateFee(_x, _x2, _x3, _x4, _x5, _x6, _x7, _x8) {
9400
9355
  return _ref2.apply(this, arguments);
9401
9356
  };
9402
9357
  }();
9403
9358
 
9359
+ var getAssetInfo = /*#__PURE__*/function () {
9360
+ var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(assetClient, asset) {
9361
+ var assets;
9362
+ return _regenerator().w(function (_context) {
9363
+ while (1) switch (_context.n) {
9364
+ case 0:
9365
+ _context.n = 1;
9366
+ return assetClient.getSupported();
9367
+ case 1:
9368
+ assets = _context.v;
9369
+ return _context.a(2, asset.assetId ? assets.find(function (a) {
9370
+ return a.id.toString() === asset.assetId;
9371
+ }) : assets.find(function (a) {
9372
+ return a.symbol === asset.symbol;
9373
+ }));
9374
+ }
9375
+ }, _callee);
9376
+ }));
9377
+ return function getAssetInfo(_x, _x2) {
9378
+ return _ref.apply(this, arguments);
9379
+ };
9380
+ }();
9381
+
9404
9382
  var HydrationExchange = /*#__PURE__*/function (_ExchangeChain) {
9405
9383
  function HydrationExchange() {
9406
9384
  var _this;
@@ -9447,7 +9425,7 @@ var HydrationExchange = /*#__PURE__*/function (_ExchangeChain) {
9447
9425
  throw new InvalidCurrencyError("Currency to doesn't exist");
9448
9426
  case 5:
9449
9427
  _context.n = 6;
9450
- return calculateFee(options, tradeRouter, txBuilderFactory, assetClient, currencyFromInfo, currencyToInfo, currencyFromInfo.decimals, this.chain, toDestTransactionFee);
9428
+ return calculateFee(options, tradeRouter, txBuilderFactory, currencyFromInfo, currencyToInfo, currencyFromInfo.decimals, this.chain, toDestTransactionFee);
9451
9429
  case 6:
9452
9430
  tradeFee = _context.v;
9453
9431
  amountWithoutFee = origin ? amount - tradeFee : amount;
@@ -9669,8 +9647,8 @@ var getExchangeAssets = function getExchangeAssets(exchange) {
9669
9647
 
9670
9648
  var getExchangeAsset = function getExchangeAsset(exchange, currency) {
9671
9649
  var throwOnDuplicateSymbol = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
9672
- if ('location' in currency && isOverrideLocationSpecifier(currency.location) || Array.isArray(currency)) {
9673
- throw new UnsupportedOperationError('XCM Router does not support location override or multi-asset currencies yet.');
9650
+ if (Array.isArray(currency)) {
9651
+ throw new UnsupportedOperationError('XCM Router does not support multi-asset currencies yet.');
9674
9652
  }
9675
9653
  var assets = getExchangeAssets(exchange);
9676
9654
  var nativeAssets = assets.filter(function (asset) {
@@ -9680,7 +9658,7 @@ var getExchangeAsset = function getExchangeAsset(exchange, currency) {
9680
9658
  return !asset.isNative;
9681
9659
  });
9682
9660
  var asset;
9683
- if ('location' in currency && !isOverrideLocationSpecifier(currency.location)) {
9661
+ if ('location' in currency) {
9684
9662
  asset = findAssetInfoByLoc(assets, currency.location);
9685
9663
  } else if ('symbol' in currency) {
9686
9664
  if (!isSymbolSpecifier(currency.symbol)) {
@@ -10000,7 +9978,9 @@ var selectBestExchangeCommon = /*#__PURE__*/function () {
10000
9978
  }
10001
9979
  return _context.a(3, 14);
10002
9980
  case 6:
10003
- if (!(destinationSpecified && !hasSupportForAsset(to, assetTo.symbol))) {
9981
+ if (!(destinationSpecified && !findAssetInfo(to, {
9982
+ location: assetTo.location
9983
+ }))) {
10004
9984
  _context.n = 7;
10005
9985
  break;
10006
9986
  }
@@ -10239,7 +10219,9 @@ var resolveAssets = function resolveAssets(dex, _ref) {
10239
10219
  if (!assetTo) {
10240
10220
  throw new RoutingResolutionError("Currency to ".concat(JSON.stringify(currencyTo), " not found in ").concat(dex.chain, "."));
10241
10221
  }
10242
- if (destinationSpecified && !hasSupportForAsset(to, assetTo.symbol)) {
10222
+ if (destinationSpecified && !findAssetInfo(to, {
10223
+ location: assetTo.location
10224
+ })) {
10243
10225
  throw new RoutingResolutionError("Currency to ".concat(JSON.stringify(currencyTo), " not supported by ").concat(to, "."));
10244
10226
  }
10245
10227
  var feeAssetFromOrigin = feeAsset && originSpecified ? (_findAssetInfo = findAssetInfo(from, feeAsset, dex.chain)) !== null && _findAssetInfo !== void 0 ? _findAssetInfo : undefined : undefined;
@@ -10508,11 +10490,11 @@ var canUseExecuteTransfer = function canUseExecuteTransfer(dex, options) {
10508
10490
  return Boolean(options.origin || options.destination) && (dex.chain.includes('AssetHub') || dex.chain === 'Hydration');
10509
10491
  };
10510
10492
  var isFilteredError = function isFilteredError(error) {
10511
- return error instanceof DryRunFailedError && error.dryRunType === 'origin' && error.reason === 'Filtered';
10493
+ return error instanceof DryRunFailedError && error.dryRunError.chainKind === 'origin' && error.dryRunError.reason === 'Filtered';
10512
10494
  };
10513
10495
  var getSwapExecuteXcmFee = /*#__PURE__*/function () {
10514
10496
  var _ref3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(dex, options, disableFallback) {
10515
- var _origin$chain, _destination$chain;
10497
+ var _origin$chain, _destination$chain, _result$dryRunError;
10516
10498
  var api, origin, exchange, currencyFrom, currencyTo, feeAsset, destination, amount, sender, recipient, evmSenderAddress, buildTx, amountOut, result;
10517
10499
  return _regenerator().w(function (_context3) {
10518
10500
  while (1) switch (_context3.n) {
@@ -10545,7 +10527,7 @@ var getSwapExecuteXcmFee = /*#__PURE__*/function () {
10545
10527
  });
10546
10528
  case 2:
10547
10529
  result = _context3.v;
10548
- if (!(result.failureReason === 'NoDeal' && exchange.chain === 'Hydration')) {
10530
+ if (!(((_result$dryRunError = result.dryRunError) === null || _result$dryRunError === void 0 ? void 0 : _result$dryRunError.reason) === 'NoDeal' && exchange.chain === 'Hydration')) {
10549
10531
  _context3.n = 3;
10550
10532
  break;
10551
10533
  }
@@ -11048,8 +11030,8 @@ var getSwapFee = /*#__PURE__*/function () {
11048
11030
 
11049
11031
  var getRouterFees = /*#__PURE__*/function () {
11050
11032
  var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(dex, options, disableFallback) {
11051
- var _sendingChain$hops, _receivingChain$origi, _receivingChain$hops, _sendingChain$origin, _receivingChain$desti, _sendingChain$failure, _sendingChain$failure2;
11052
- var api, origin, exchange, destination, sender, _yield$getSwapExecute, result, transformedHops, sendingChain, _yield$getSwapFee, swapChain, amountOut, receivingChain, mergedHops, finalOrigin, finalDestination, _t, _t2, _t3;
11033
+ var _sendingChain$hops, _receivingChain$origi, _receivingChain$hops, _sendingChain$origin, _receivingChain$desti, _sendingChain$dryRunE;
11034
+ var api, origin, exchange, destination, sender, _yield$getSwapExecute, result, transformedHops, sendingChain, _yield$getSwapFee, swapChain, amountOut, receivingChain, mergedHops, finalOrigin, finalDestination, dryRunError, _t, _t2, _t3;
11053
11035
  return _regenerator().w(function (_context) {
11054
11036
  while (1) switch (_context.p = _context.n) {
11055
11037
  case 0:
@@ -11147,9 +11129,10 @@ var getRouterFees = /*#__PURE__*/function () {
11147
11129
  }), !origin && !destination && {
11148
11130
  fee: 0n
11149
11131
  });
11132
+ dryRunError = (_sendingChain$dryRunE = sendingChain === null || sendingChain === void 0 ? void 0 : sendingChain.dryRunError) !== null && _sendingChain$dryRunE !== void 0 ? _sendingChain$dryRunE : receivingChain === null || receivingChain === void 0 ? void 0 : receivingChain.dryRunError;
11150
11133
  return _context.a(2, {
11151
- failureReason: (_sendingChain$failure = sendingChain === null || sendingChain === void 0 ? void 0 : sendingChain.failureReason) !== null && _sendingChain$failure !== void 0 ? _sendingChain$failure : receivingChain === null || receivingChain === void 0 ? void 0 : receivingChain.failureReason,
11152
- failureChain: (_sendingChain$failure2 = sendingChain === null || sendingChain === void 0 ? void 0 : sendingChain.failureChain) !== null && _sendingChain$failure2 !== void 0 ? _sendingChain$failure2 : receivingChain === null || receivingChain === void 0 ? void 0 : receivingChain.failureChain,
11134
+ success: !dryRunError,
11135
+ dryRunError: dryRunError,
11153
11136
  origin: finalOrigin,
11154
11137
  destination: finalDestination,
11155
11138
  hops: mergedHops
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paraspell/swap",
3
- "version": "13.11.0",
3
+ "version": "14.0.0",
4
4
  "description": "Tool for XCM cross-chain asset exchanging across Polkadot and Kusama ecosystems",
5
5
  "type": "module",
6
6
  "exports": {
@@ -50,10 +50,10 @@
50
50
  "postcss": "^8.5.16",
51
51
  "react": "^19.2.7",
52
52
  "rxjs": "^7.8.2",
53
- "@paraspell/sdk": "13.11.0",
54
- "@paraspell/sdk-common": "13.11.0",
55
- "@paraspell/sdk-core": "13.11.0",
56
- "@paraspell/sdk-pjs": "13.11.0"
53
+ "@paraspell/sdk": "14.0.0",
54
+ "@paraspell/sdk-common": "14.0.0",
55
+ "@paraspell/sdk-core": "14.0.0",
56
+ "@paraspell/sdk-pjs": "14.0.0"
57
57
  },
58
58
  "devDependencies": {
59
59
  "@babel/plugin-syntax-import-attributes": "^7.29.7",