@paraspell/sdk-pjs 13.1.0 → 13.2.1

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 (3) hide show
  1. package/README.md +1 -4
  2. package/dist/index.mjs +281 -254
  3. package/package.json +2 -2
package/README.md CHANGED
@@ -13,9 +13,6 @@
13
13
  <a href="https://github.com/paraspell/xcm-sdk/actions">
14
14
  <img alt="build" src="https://github.com/paraspell/xcm-tools/actions/workflows/ci.yml/badge.svg" />
15
15
  </a>
16
- <a href="https://snyk.io/test/github/paraspell/sdk">
17
- <img alt="snyk" src="https://snyk.io/test/github/paraspell/sdk/badge.svg" />
18
- </a>
19
16
  </p>
20
17
  <p>Supporting every XCM Active Parachain <a href = "https://paraspell.github.io/docs/supported.html"\>[list]</p>
21
18
  <p>SDK documentation <a href = "https://paraspell.github.io/docs/" \>[here]</p>
@@ -603,7 +600,7 @@ console.log(CHAINS)
603
600
 
604
601
  - Run unit tests using `pnpm test`
605
602
 
606
- - Run end-to-end tests using `pnpm test:e2e`
603
+ - Run end-to-end tests (SDK+SWAP) using `pnpm test:e2e`
607
604
 
608
605
  - Run all core tests and checks using `pnpm runAll`
609
606
 
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { getNativeAssetSymbol, getOtherAssets, hasJunction, getJunctionValue, getEvmPrivateKeyHex, UnsupportedOperationError, createClientCache, MAX_CLIENTS, EXTENSION_MS, createClientPoolHelpers, BatchMode, isConfig, findNativeAssetInfoOrThrow, getChainProviders, isSenderSigner, PolkadotApi, resolveChainApi, DEFAULT_TTL_MS, isExternalChain, findAssetInfoOrThrow, hasXcmPaymentApiSupport, resolveModuleError, getAssetsObject, RuntimeApiUnavailableError, wrapTxBypass, localizeLocation, addXcmVersionHeader, isAssetXcEqual, RELAY_LOCATION, getRelayChainOf, SubmitTransactionError, createChainClient as createChainClient$1, getBalance as getBalance$1, Foreign, ForeignAbstract, Native, Override, findAssetInfo, getAllAssetsSymbols, getAssetDecimals, getAssetId, getAssets, getExistentialDeposit, getNativeAssets, getRelayChainSymbol, getSupportedAssets, getTChain, hasSupportForAsset, isChainEvm, convertSs58 as convertSs58$1, assertHasId, getParaId, RoutingResolutionError, abstractDecimals, MissingParameterError, isOverrideLocationSpecifier, transferMoonbeamEvm, transferMoonbeamToEth, validateAddress as validateAddress$1, Builder as Builder$1, getBridgeStatus as getBridgeStatus$1, getParaEthTransferFees as getParaEthTransferFees$1, DRY_RUN_CLIENT_TIMEOUT_MS, dryRun as dryRun$1, dryRunOrigin as dryRunOrigin$1 } from '@paraspell/sdk-core';
1
+ import { getNativeAssetSymbol, getOtherAssets, hasJunction, getJunctionValue, getEvmPrivateKeyHex, UnsupportedOperationError, createClientCache, MAX_CLIENTS, EXTENSION_MS, createClientPoolHelpers, BatchMode, isConfig, findNativeAssetInfoOrThrow, getChainProviders, isSenderSigner, PolkadotApi, resolveChainApi, DEFAULT_TTL_MS, isExternalChain, findAssetInfoOrThrow, hasXcmPaymentApiSupport, resolveModuleError, getAssetsObject, RuntimeApiUnavailableError, wrapTxBypass, normalizeLocation, localizeLocation, createAssetId, addXcmVersionHeader, isAssetXcEqual, RELAY_LOCATION, getRelayChainOf, SubmitTransactionError, createChainClient as createChainClient$1, getBalance as getBalance$1, Foreign, ForeignAbstract, Native, Override, findAssetInfo, getAllAssetsSymbols, getAssetDecimals, getAssetId, getAssets, getExistentialDeposit, getNativeAssets, getRelayChainSymbol, getSupportedAssets, getTChain, hasSupportForAsset, isChainEvm, convertSs58 as convertSs58$1, assertHasId, getParaId, RoutingResolutionError, abstractDecimals, MissingParameterError, isOverrideLocationSpecifier, transferMoonbeamEvm, transferMoonbeamToEth, validateAddress as validateAddress$1, Builder as Builder$1, getBridgeStatus as getBridgeStatus$1, getParaEthTransferFees as getParaEthTransferFees$1, DRY_RUN_CLIENT_TIMEOUT_MS, dryRun as dryRun$1, dryRunOrigin as dryRunOrigin$1 } from '@paraspell/sdk-core';
2
2
  export * from '@paraspell/sdk-core';
3
3
  import { Keyring, WsProvider, ApiPromise } from '@polkadot/api';
4
4
  import { u8aConcat, compactToU8a, u8aEq, isHex, u8aToHex, hexToU8a, stringToU8a } from '@polkadot/util';
@@ -516,8 +516,8 @@ var PolkadotJsApi = /*#__PURE__*/function (_PolkadotApi) {
516
516
  this._ttlMs = clientTtlMs;
517
517
  this._chain = chain;
518
518
  _context3.n = 2;
519
- return resolveChainApi(this._config, chain, function (wsUrl, c) {
520
- return _this2.createApiInstance(wsUrl, c);
519
+ return resolveChainApi(this._config, chain, function (wsUrl) {
520
+ return leaseClient(wsUrl, _this2._ttlMs);
521
521
  });
522
522
  case 2:
523
523
  this._api = _context3.v;
@@ -534,7 +534,7 @@ var PolkadotJsApi = /*#__PURE__*/function (_PolkadotApi) {
534
534
  }, {
535
535
  key: "createApiInstance",
536
536
  value: function createApiInstance(wsUrl, _chain) {
537
- return leaseClient(wsUrl, this._ttlMs, false);
537
+ return leaseClient(wsUrl, this._ttlMs);
538
538
  }
539
539
  }, {
540
540
  key: "accountToHex",
@@ -550,8 +550,8 @@ var PolkadotJsApi = /*#__PURE__*/function (_PolkadotApi) {
550
550
  return decodeAddress(address);
551
551
  }
552
552
  }, {
553
- key: "convertToPjsCall",
554
- value: function convertToPjsCall(_ref3) {
553
+ key: "convertToPjsTxCall",
554
+ value: function convertToPjsTxCall(_ref3) {
555
555
  var module = _ref3.module,
556
556
  method = _ref3.method;
557
557
  return {
@@ -559,15 +559,25 @@ var PolkadotJsApi = /*#__PURE__*/function (_PolkadotApi) {
559
559
  method: snakeToCamel(method)
560
560
  };
561
561
  }
562
+ }, {
563
+ key: "convertToPjsStateQuery",
564
+ value: function convertToPjsStateQuery(_ref4) {
565
+ var module = _ref4.module,
566
+ method = _ref4.method;
567
+ return {
568
+ module: lowercaseFirstLetter(module),
569
+ method: lowercaseFirstLetter(method)
570
+ };
571
+ }
562
572
  }, {
563
573
  key: "deserializeExtrinsics",
564
574
  value: function deserializeExtrinsics(serialized) {
565
575
  var _this$api$tx$module;
566
576
  var params = serialized.params;
567
577
  var values = Object.values(params);
568
- var _this$convertToPjsCal = this.convertToPjsCall(serialized),
569
- module = _this$convertToPjsCal.module,
570
- method = _this$convertToPjsCal.method;
578
+ var _this$convertToPjsTxC = this.convertToPjsTxCall(serialized),
579
+ module = _this$convertToPjsTxC.module,
580
+ method = _this$convertToPjsTxC.method;
571
581
  return (_this$api$tx$module = this.api.tx[module])[method].apply(_this$api$tx$module, values);
572
582
  }
573
583
  }, {
@@ -580,12 +590,12 @@ var PolkadotJsApi = /*#__PURE__*/function (_PolkadotApi) {
580
590
  value: function () {
581
591
  var _queryState = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(serialized) {
582
592
  var _this$api$query$modul;
583
- var params, _this$convertToPjsCal2, module, method, res;
593
+ var params, _this$convertToPjsSta, module, method, res;
584
594
  return _regenerator().w(function (_context4) {
585
595
  while (1) switch (_context4.n) {
586
596
  case 0:
587
597
  params = serialized.params;
588
- _this$convertToPjsCal2 = this.convertToPjsCall(serialized), module = _this$convertToPjsCal2.module, method = _this$convertToPjsCal2.method;
598
+ _this$convertToPjsSta = this.convertToPjsStateQuery(serialized), module = _this$convertToPjsSta.module, method = _this$convertToPjsSta.method;
589
599
  _context4.n = 1;
590
600
  return (_this$api$query$modul = this.api.query[module])[method].apply(_this$api$query$modul, _toConsumableArray(params));
591
601
  case 1:
@@ -601,14 +611,28 @@ var PolkadotJsApi = /*#__PURE__*/function (_PolkadotApi) {
601
611
  }()
602
612
  }, {
603
613
  key: "queryRuntimeApi",
604
- value: function queryRuntimeApi(serialized) {
605
- var _this$api$call$module;
606
- var params = serialized.params;
607
- var _this$convertToPjsCal3 = this.convertToPjsCall(serialized),
608
- module = _this$convertToPjsCal3.module,
609
- method = _this$convertToPjsCal3.method;
610
- return (_this$api$call$module = this.api.call[module])[method].apply(_this$api$call$module, _toConsumableArray(params));
611
- }
614
+ value: function () {
615
+ var _queryRuntimeApi = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5(serialized) {
616
+ var _this$api$call$module;
617
+ var params, _this$convertToPjsTxC2, module, method, res;
618
+ return _regenerator().w(function (_context5) {
619
+ while (1) switch (_context5.n) {
620
+ case 0:
621
+ params = serialized.params;
622
+ _this$convertToPjsTxC2 = this.convertToPjsTxCall(serialized), module = _this$convertToPjsTxC2.module, method = _this$convertToPjsTxC2.method;
623
+ _context5.n = 1;
624
+ return (_this$api$call$module = this.api.call[module])[method].apply(_this$api$call$module, _toConsumableArray(params));
625
+ case 1:
626
+ res = _context5.v;
627
+ return _context5.a(2, res.toJSON());
628
+ }
629
+ }, _callee5, this);
630
+ }));
631
+ function queryRuntimeApi(_x5) {
632
+ return _queryRuntimeApi.apply(this, arguments);
633
+ }
634
+ return queryRuntimeApi;
635
+ }()
612
636
  }, {
613
637
  key: "callBatchMethod",
614
638
  value: function callBatchMethod(calls, mode) {
@@ -643,20 +667,20 @@ var PolkadotJsApi = /*#__PURE__*/function (_PolkadotApi) {
643
667
  }, {
644
668
  key: "getPaymentInfo",
645
669
  value: function () {
646
- var _getPaymentInfo = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5(tx, address) {
670
+ var _getPaymentInfo = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6(tx, address) {
647
671
  var _yield$tx$paymentInfo, _yield$tx$paymentInfo2, proofSize, refTime, partialFee;
648
- return _regenerator().w(function (_context5) {
649
- while (1) switch (_context5.n) {
672
+ return _regenerator().w(function (_context6) {
673
+ while (1) switch (_context6.n) {
650
674
  case 0:
651
- _context5.n = 1;
675
+ _context6.n = 1;
652
676
  return tx.paymentInfo(address);
653
677
  case 1:
654
- _yield$tx$paymentInfo = _context5.v;
678
+ _yield$tx$paymentInfo = _context6.v;
655
679
  _yield$tx$paymentInfo2 = _yield$tx$paymentInfo.weight;
656
680
  proofSize = _yield$tx$paymentInfo2.proofSize;
657
681
  refTime = _yield$tx$paymentInfo2.refTime;
658
682
  partialFee = _yield$tx$paymentInfo.partialFee;
659
- return _context5.a(2, {
683
+ return _context6.a(2, {
660
684
  weight: {
661
685
  proofSize: proofSize.toBigInt(),
662
686
  refTime: refTime.toBigInt()
@@ -664,9 +688,9 @@ var PolkadotJsApi = /*#__PURE__*/function (_PolkadotApi) {
664
688
  partialFee: partialFee.toBigInt()
665
689
  });
666
690
  }
667
- }, _callee5);
691
+ }, _callee6);
668
692
  }));
669
- function getPaymentInfo(_x5, _x6) {
693
+ function getPaymentInfo(_x6, _x7) {
670
694
  return _getPaymentInfo.apply(this, arguments);
671
695
  }
672
696
  return getPaymentInfo;
@@ -674,23 +698,23 @@ var PolkadotJsApi = /*#__PURE__*/function (_PolkadotApi) {
674
698
  }, {
675
699
  key: "quoteAhPrice",
676
700
  value: function () {
677
- var _quoteAhPrice = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6(fromMl, toMl, amountIn) {
701
+ var _quoteAhPrice = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee7(fromMl, toMl, amountIn) {
678
702
  var includeFee,
679
703
  quoted,
680
- _args4 = arguments;
681
- return _regenerator().w(function (_context6) {
682
- while (1) switch (_context6.n) {
704
+ _args5 = arguments;
705
+ return _regenerator().w(function (_context7) {
706
+ while (1) switch (_context7.n) {
683
707
  case 0:
684
- includeFee = _args4.length > 3 && _args4[3] !== undefined ? _args4[3] : true;
685
- _context6.n = 1;
708
+ includeFee = _args5.length > 3 && _args5[3] !== undefined ? _args5[3] : true;
709
+ _context7.n = 1;
686
710
  return this.api.call.assetConversionApi.quotePriceExactTokensForTokens(fromMl, toMl, amountIn.toString(), includeFee);
687
711
  case 1:
688
- quoted = _context6.v;
689
- return _context6.a(2, quoted.toJSON() !== null ? BigInt(quoted.toString()) : undefined);
712
+ quoted = _context7.v;
713
+ return _context7.a(2, quoted.toJSON() !== null ? BigInt(quoted.toString()) : undefined);
690
714
  }
691
- }, _callee6, this);
715
+ }, _callee7, this);
692
716
  }));
693
- function quoteAhPrice(_x7, _x8, _x9) {
717
+ function quoteAhPrice(_x8, _x9, _x0) {
694
718
  return _quoteAhPrice.apply(this, arguments);
695
719
  }
696
720
  return quoteAhPrice;
@@ -723,27 +747,27 @@ var PolkadotJsApi = /*#__PURE__*/function (_PolkadotApi) {
723
747
  }, {
724
748
  key: "getFromRpc",
725
749
  value: function () {
726
- var _getFromRpc = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee7(module, method, key) {
750
+ var _getFromRpc = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee8(module, method, key) {
727
751
  var rpcModule, response;
728
- return _regenerator().w(function (_context7) {
729
- while (1) switch (_context7.n) {
752
+ return _regenerator().w(function (_context8) {
753
+ while (1) switch (_context8.n) {
730
754
  case 0:
731
755
  rpcModule = this.api.rpc[module];
732
756
  if (!(!rpcModule || !rpcModule[method])) {
733
- _context7.n = 1;
757
+ _context8.n = 1;
734
758
  break;
735
759
  }
736
760
  throw new UnsupportedOperationError("RPC method ".concat(module, ".").concat(method, " not available"));
737
761
  case 1:
738
- _context7.n = 2;
762
+ _context8.n = 2;
739
763
  return rpcModule[method](key);
740
764
  case 2:
741
- response = _context7.v;
742
- return _context7.a(2, response.toHex());
765
+ response = _context8.v;
766
+ return _context8.a(2, response.toHex());
743
767
  }
744
- }, _callee7, this);
768
+ }, _callee8, this);
745
769
  }));
746
- function getFromRpc(_x0, _x1, _x10) {
770
+ function getFromRpc(_x1, _x10, _x11) {
747
771
  return _getFromRpc.apply(this, arguments);
748
772
  }
749
773
  return getFromRpc;
@@ -761,73 +785,73 @@ var PolkadotJsApi = /*#__PURE__*/function (_PolkadotApi) {
761
785
  }, {
762
786
  key: "createApiForChain",
763
787
  value: function () {
764
- var _createApiForChain = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee8(chain) {
788
+ var _createApiForChain = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee9(chain) {
765
789
  var api;
766
- return _regenerator().w(function (_context8) {
767
- while (1) switch (_context8.n) {
790
+ return _regenerator().w(function (_context9) {
791
+ while (1) switch (_context9.n) {
768
792
  case 0:
769
793
  api = new PolkadotJsApi(isConfig(this._config) ? this._config : undefined);
770
- _context8.n = 1;
794
+ _context9.n = 1;
771
795
  return api.init(chain);
772
796
  case 1:
773
- return _context8.a(2, api);
797
+ return _context9.a(2, api);
774
798
  }
775
- }, _callee8, this);
799
+ }, _callee9, this);
776
800
  }));
777
- function createApiForChain(_x11) {
801
+ function createApiForChain(_x12) {
778
802
  return _createApiForChain.apply(this, arguments);
779
803
  }
780
804
  return createApiForChain;
781
805
  }()
782
806
  }, {
783
807
  key: "resolveDefaultFeeAsset",
784
- value: function resolveDefaultFeeAsset(_ref4) {
785
- var chain = _ref4.chain,
786
- feeAsset = _ref4.feeAsset;
808
+ value: function resolveDefaultFeeAsset(_ref5) {
809
+ var chain = _ref5.chain,
810
+ feeAsset = _ref5.feeAsset;
787
811
  return feeAsset !== null && feeAsset !== void 0 ? feeAsset : findNativeAssetInfoOrThrow(chain);
788
812
  }
789
813
  }, {
790
814
  key: "resolveFeeAsset",
791
815
  value: function () {
792
- var _resolveFeeAsset = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee9(options) {
816
+ var _resolveFeeAsset = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee0(options) {
793
817
  var chain, address, response, assetId;
794
- return _regenerator().w(function (_context9) {
795
- while (1) switch (_context9.n) {
818
+ return _regenerator().w(function (_context0) {
819
+ while (1) switch (_context0.n) {
796
820
  case 0:
797
821
  chain = options.chain, address = options.address;
798
822
  if (chain.startsWith('Hydration')) {
799
- _context9.n = 1;
823
+ _context0.n = 1;
800
824
  break;
801
825
  }
802
- return _context9.a(2, {
826
+ return _context0.a(2, {
803
827
  isCustomAsset: false,
804
828
  asset: this.resolveDefaultFeeAsset(options)
805
829
  });
806
830
  case 1:
807
- _context9.n = 2;
831
+ _context0.n = 2;
808
832
  return this.api.query.multiTransactionPayment.accountCurrencyMap(address);
809
833
  case 2:
810
- response = _context9.v;
834
+ response = _context0.v;
811
835
  assetId = response.toJSON();
812
836
  if (!(assetId === null)) {
813
- _context9.n = 3;
837
+ _context0.n = 3;
814
838
  break;
815
839
  }
816
- return _context9.a(2, {
840
+ return _context0.a(2, {
817
841
  isCustomAsset: false,
818
842
  asset: this.resolveDefaultFeeAsset(options)
819
843
  });
820
844
  case 3:
821
- return _context9.a(2, {
845
+ return _context0.a(2, {
822
846
  isCustomAsset: true,
823
847
  asset: findAssetInfoOrThrow(chain, {
824
848
  id: assetId
825
849
  })
826
850
  });
827
851
  }
828
- }, _callee9, this);
852
+ }, _callee0, this);
829
853
  }));
830
- function resolveFeeAsset(_x12) {
854
+ function resolveFeeAsset(_x13) {
831
855
  return _resolveFeeAsset.apply(this, arguments);
832
856
  }
833
857
  return resolveFeeAsset;
@@ -835,16 +859,16 @@ var PolkadotJsApi = /*#__PURE__*/function (_PolkadotApi) {
835
859
  }, {
836
860
  key: "getDryRunCall",
837
861
  value: function () {
838
- var _getDryRunCall = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee1(options) {
862
+ var _getDryRunCall = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee10(options) {
839
863
  var _this3 = this;
840
864
  var tx, address, feeAsset, chain, destination, version, _options$useRootOrigi, useRootOrigin, bypassOptions, supportsDryRunApi, basePayload, resolvedTx, resolvedFeeAsset, performDryRunCall, findFailingEventInResult, getExecutionSuccessFromResult, extractFailureReasonFromResult, response, resultHuman, resultJson, isSuccess, failureErr, shouldRetryWithVersion, msg, _msg, forwardedXcms, actualWeight, weight, destParaId, overriddenWeight, xcmFee, _yield$this$getPaymen, executionFee, fee, _t, _t2, _t3, _t4;
841
- return _regenerator().w(function (_context1) {
842
- while (1) switch (_context1.p = _context1.n) {
865
+ return _regenerator().w(function (_context10) {
866
+ while (1) switch (_context10.p = _context10.n) {
843
867
  case 0:
844
868
  tx = options.tx, address = options.address, feeAsset = options.feeAsset, chain = options.chain, destination = options.destination, version = options.version, _options$useRootOrigi = options.useRootOrigin, useRootOrigin = _options$useRootOrigi === void 0 ? false : _options$useRootOrigi, bypassOptions = options.bypassOptions;
845
869
  supportsDryRunApi = getAssetsObject(chain).supportsDryRunApi;
846
870
  if (supportsDryRunApi) {
847
- _context1.n = 1;
871
+ _context10.n = 1;
848
872
  break;
849
873
  }
850
874
  throw new RuntimeApiUnavailableError(chain, 'DryRunApi');
@@ -859,39 +883,39 @@ var PolkadotJsApi = /*#__PURE__*/function (_PolkadotApi) {
859
883
  }
860
884
  };
861
885
  if (!useRootOrigin) {
862
- _context1.n = 3;
886
+ _context10.n = 3;
863
887
  break;
864
888
  }
865
- _context1.n = 2;
889
+ _context10.n = 2;
866
890
  return wrapTxBypass(_objectSpread2(_objectSpread2({}, options), {}, {
867
891
  api: this
868
892
  }), bypassOptions);
869
893
  case 2:
870
- _t = _context1.v;
871
- _context1.n = 4;
894
+ _t = _context10.v;
895
+ _context10.n = 4;
872
896
  break;
873
897
  case 3:
874
898
  _t = tx;
875
899
  case 4:
876
900
  resolvedTx = _t;
877
- _context1.n = 5;
901
+ _context10.n = 5;
878
902
  return this.resolveFeeAsset(options);
879
903
  case 5:
880
- resolvedFeeAsset = _context1.v;
904
+ resolvedFeeAsset = _context10.v;
881
905
  performDryRunCall = /*#__PURE__*/function () {
882
- var _ref5 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee0(includeVersion) {
906
+ var _ref6 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee1(includeVersion) {
883
907
  var _this3$api$call$dryRu;
884
908
  var versionNum;
885
- return _regenerator().w(function (_context0) {
886
- while (1) switch (_context0.n) {
909
+ return _regenerator().w(function (_context1) {
910
+ while (1) switch (_context1.n) {
887
911
  case 0:
888
912
  versionNum = Number(version.charAt(1));
889
- return _context0.a(2, (_this3$api$call$dryRu = _this3.api.call.dryRunApi).dryRunCall.apply(_this3$api$call$dryRu, [basePayload, resolvedTx].concat(_toConsumableArray(includeVersion ? [versionNum] : []))));
913
+ return _context1.a(2, (_this3$api$call$dryRu = _this3.api.call.dryRunApi).dryRunCall.apply(_this3$api$call$dryRu, [basePayload, resolvedTx].concat(_toConsumableArray(includeVersion ? [versionNum] : []))));
890
914
  }
891
- }, _callee0);
915
+ }, _callee1);
892
916
  }));
893
- return function performDryRunCall(_x14) {
894
- return _ref5.apply(this, arguments);
917
+ return function performDryRunCall(_x15) {
918
+ return _ref6.apply(this, arguments);
895
919
  };
896
920
  }();
897
921
  findFailingEventInResult = function findFailingEventInResult(resultHuman) {
@@ -907,7 +931,7 @@ var PolkadotJsApi = /*#__PURE__*/function (_PolkadotApi) {
907
931
  return Boolean((resultHuman === null || resultHuman === void 0 ? void 0 : resultHuman.Ok) && ((_resultHuman$Ok$execu = resultHuman.Ok.executionResult) === null || _resultHuman$Ok$execu === void 0 ? void 0 : _resultHuman$Ok$execu.Ok) && !errorInEvents);
908
932
  };
909
933
  extractFailureReasonFromResult = function extractFailureReasonFromResult(resultHuman, resultJson) {
910
- var _resultHuman$Ok2, _resultHuman$Ok3, _resultHuman$Ok4, _resultJson$ok, _ref6;
934
+ var _resultHuman$Ok2, _resultHuman$Ok3, _resultHuman$Ok4, _resultJson$ok, _ref7;
911
935
  var modErrHuman = resultHuman === null || resultHuman === void 0 || (_resultHuman$Ok2 = resultHuman.Ok) === null || _resultHuman$Ok2 === void 0 || (_resultHuman$Ok2 = _resultHuman$Ok2.executionResult) === null || _resultHuman$Ok2 === void 0 || (_resultHuman$Ok2 = _resultHuman$Ok2.Err) === null || _resultHuman$Ok2 === void 0 || (_resultHuman$Ok2 = _resultHuman$Ok2.error) === null || _resultHuman$Ok2 === void 0 ? void 0 : _resultHuman$Ok2.Module;
912
936
  if (modErrHuman) {
913
937
  return resolveModuleError(chain, modErrHuman);
@@ -947,7 +971,7 @@ var PolkadotJsApi = /*#__PURE__*/function (_PolkadotApi) {
947
971
  }
948
972
  }
949
973
  return {
950
- failureReason: JSON.stringify((_ref6 = resultJson !== null && resultJson !== void 0 ? resultJson : resultHuman) !== null && _ref6 !== void 0 ? _ref6 : 'Unknown error')
974
+ failureReason: JSON.stringify((_ref7 = resultJson !== null && resultJson !== void 0 ? resultJson : resultHuman) !== null && _ref7 !== void 0 ? _ref7 : 'Unknown error')
951
975
  };
952
976
  }; // Attempt 1: WITHOUT version
953
977
  isSuccess = false;
@@ -955,11 +979,11 @@ var PolkadotJsApi = /*#__PURE__*/function (_PolkadotApi) {
955
979
  failureReason: ''
956
980
  };
957
981
  shouldRetryWithVersion = false;
958
- _context1.p = 6;
959
- _context1.n = 7;
982
+ _context10.p = 6;
983
+ _context10.n = 7;
960
984
  return performDryRunCall(false);
961
985
  case 7:
962
- response = _context1.v;
986
+ response = _context10.v;
963
987
  resultHuman = response.toHuman();
964
988
  resultJson = response.toJSON();
965
989
  isSuccess = getExecutionSuccessFromResult(resultHuman);
@@ -969,49 +993,49 @@ var PolkadotJsApi = /*#__PURE__*/function (_PolkadotApi) {
969
993
  shouldRetryWithVersion = true;
970
994
  }
971
995
  }
972
- _context1.n = 10;
996
+ _context10.n = 10;
973
997
  break;
974
998
  case 8:
975
- _context1.p = 8;
976
- _t2 = _context1.v;
999
+ _context10.p = 8;
1000
+ _t2 = _context10.v;
977
1001
  msg = _t2 instanceof Error ? _t2.message : String(_t2);
978
1002
  if (!msg.includes('Expected 3 arguments')) {
979
- _context1.n = 9;
1003
+ _context10.n = 9;
980
1004
  break;
981
1005
  }
982
1006
  shouldRetryWithVersion = true;
983
- _context1.n = 10;
1007
+ _context10.n = 10;
984
1008
  break;
985
1009
  case 9:
986
- return _context1.a(2, {
1010
+ return _context10.a(2, {
987
1011
  success: false,
988
1012
  failureReason: msg,
989
1013
  asset: resolvedFeeAsset.asset
990
1014
  });
991
1015
  case 10:
992
1016
  if (!shouldRetryWithVersion) {
993
- _context1.n = 14;
1017
+ _context10.n = 14;
994
1018
  break;
995
1019
  }
996
- _context1.p = 11;
997
- _context1.n = 12;
1020
+ _context10.p = 11;
1021
+ _context10.n = 12;
998
1022
  return performDryRunCall(true);
999
1023
  case 12:
1000
- response = _context1.v;
1024
+ response = _context10.v;
1001
1025
  resultHuman = response.toHuman();
1002
1026
  resultJson = response.toJSON();
1003
1027
  isSuccess = getExecutionSuccessFromResult(resultHuman);
1004
1028
  if (!isSuccess) {
1005
1029
  failureErr = extractFailureReasonFromResult(resultHuman, resultJson);
1006
1030
  }
1007
- _context1.n = 14;
1031
+ _context10.n = 14;
1008
1032
  break;
1009
1033
  case 13:
1010
- _context1.p = 13;
1011
- _t3 = _context1.v;
1034
+ _context10.p = 13;
1035
+ _t3 = _context10.v;
1012
1036
  _msg = _t3 instanceof Error ? _t3.message : String(_t3);
1013
1037
  failureErr = failureErr || _msg;
1014
- return _context1.a(2, {
1038
+ return _context10.a(2, {
1015
1039
  success: false,
1016
1040
  failureReason: failureErr.failureReason,
1017
1041
  failureSubReason: failureErr.failureSubReason,
@@ -1019,10 +1043,10 @@ var PolkadotJsApi = /*#__PURE__*/function (_PolkadotApi) {
1019
1043
  });
1020
1044
  case 14:
1021
1045
  if (isSuccess) {
1022
- _context1.n = 15;
1046
+ _context10.n = 15;
1023
1047
  break;
1024
1048
  }
1025
- return _context1.a(2, {
1049
+ return _context10.a(2, {
1026
1050
  success: false,
1027
1051
  failureReason: failureErr.failureReason || 'Unknown error',
1028
1052
  failureSubReason: failureErr.failureSubReason,
@@ -1035,36 +1059,36 @@ var PolkadotJsApi = /*#__PURE__*/function (_PolkadotApi) {
1035
1059
  refTime: BigInt(actualWeight.refTime),
1036
1060
  proofSize: BigInt(actualWeight.proofSize)
1037
1061
  } : undefined;
1038
- destParaId = forwardedXcms.length === 0 ? undefined : function (i, _ref7) {
1039
- return i.here === null ? 0 : (_ref7 = Array.isArray(i.x1) ? i.x1[0] : i.x1) === null || _ref7 === void 0 ? void 0 : _ref7.parachain;
1062
+ destParaId = forwardedXcms.length === 0 ? undefined : function (i, _ref8) {
1063
+ return i.here === null ? 0 : (_ref8 = Array.isArray(i.x1) ? i.x1[0] : i.x1) === null || _ref8 === void 0 ? void 0 : _ref8.parachain;
1040
1064
  }(Object.values(forwardedXcms[0])[0].interior);
1041
1065
  if (!(hasXcmPaymentApiSupport(chain) && resultJson.ok.local_xcm && (feeAsset || chain.startsWith('AssetHub') && destination === 'Ethereum') || resolvedFeeAsset.isCustomAsset)) {
1042
- _context1.n = 21;
1066
+ _context10.n = 21;
1043
1067
  break;
1044
1068
  }
1045
1069
  if (resultJson.ok.local_xcm) {
1046
- _context1.n = 17;
1070
+ _context10.n = 17;
1047
1071
  break;
1048
1072
  }
1049
- _context1.n = 16;
1073
+ _context10.n = 16;
1050
1074
  return this.getPaymentInfo(tx, address);
1051
1075
  case 16:
1052
- _t4 = _context1.v.weight;
1053
- _context1.n = 18;
1076
+ _t4 = _context10.v.weight;
1077
+ _context10.n = 18;
1054
1078
  break;
1055
1079
  case 17:
1056
1080
  _t4 = undefined;
1057
1081
  case 18:
1058
1082
  overriddenWeight = _t4;
1059
- _context1.n = 19;
1083
+ _context10.n = 19;
1060
1084
  return this.getXcmPaymentApiFee(chain, resultJson.ok.local_xcm, forwardedXcms, resolvedFeeAsset.asset, version, false, overriddenWeight);
1061
1085
  case 19:
1062
- xcmFee = _context1.v;
1086
+ xcmFee = _context10.v;
1063
1087
  if (!(typeof xcmFee === 'bigint')) {
1064
- _context1.n = 20;
1088
+ _context10.n = 20;
1065
1089
  break;
1066
1090
  }
1067
- return _context1.a(2, Promise.resolve({
1091
+ return _context10.a(2, Promise.resolve({
1068
1092
  success: true,
1069
1093
  fee: xcmFee,
1070
1094
  asset: resolvedFeeAsset.asset,
@@ -1078,13 +1102,13 @@ var PolkadotJsApi = /*#__PURE__*/function (_PolkadotApi) {
1078
1102
  asset: this.resolveDefaultFeeAsset(options)
1079
1103
  };
1080
1104
  case 21:
1081
- _context1.n = 22;
1105
+ _context10.n = 22;
1082
1106
  return this.getPaymentInfo(tx, address);
1083
1107
  case 22:
1084
- _yield$this$getPaymen = _context1.v;
1108
+ _yield$this$getPaymen = _context10.v;
1085
1109
  executionFee = _yield$this$getPaymen.partialFee;
1086
1110
  fee = computeOriginFee(resultHuman, chain, executionFee);
1087
- return _context1.a(2, {
1111
+ return _context10.a(2, {
1088
1112
  success: true,
1089
1113
  fee: fee,
1090
1114
  asset: resolvedFeeAsset.asset,
@@ -1093,9 +1117,9 @@ var PolkadotJsApi = /*#__PURE__*/function (_PolkadotApi) {
1093
1117
  destParaId: destParaId
1094
1118
  });
1095
1119
  }
1096
- }, _callee1, this, [[11, 13], [6, 8]]);
1120
+ }, _callee10, this, [[11, 13], [6, 8]]);
1097
1121
  }));
1098
- function getDryRunCall(_x13) {
1122
+ function getDryRunCall(_x14) {
1099
1123
  return _getDryRunCall.apply(this, arguments);
1100
1124
  }
1101
1125
  return getDryRunCall;
@@ -1103,10 +1127,11 @@ var PolkadotJsApi = /*#__PURE__*/function (_PolkadotApi) {
1103
1127
  }, {
1104
1128
  key: "getXcmPaymentApiFee",
1105
1129
  value: function () {
1106
- var _getXcmPaymentApiFee = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee10(chain, localXcm, forwardedXcm, asset, version) {
1130
+ var _getXcmPaymentApiFee = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee11(chain, localXcm, forwardedXcm, asset, version) {
1107
1131
  var overridenWeight,
1108
1132
  weight,
1109
1133
  assetLocalizedLoc,
1134
+ assetId,
1110
1135
  feeResult,
1111
1136
  execFeeRes,
1112
1137
  execFeeOk,
@@ -1114,56 +1139,57 @@ var PolkadotJsApi = /*#__PURE__*/function (_PolkadotApi) {
1114
1139
  isAssetNotFound,
1115
1140
  bridgeHubExecFee,
1116
1141
  deliveryFee,
1117
- _args0 = arguments,
1142
+ _args1 = arguments,
1118
1143
  _t5;
1119
- return _regenerator().w(function (_context10) {
1120
- while (1) switch (_context10.n) {
1144
+ return _regenerator().w(function (_context11) {
1145
+ while (1) switch (_context11.n) {
1121
1146
  case 0:
1122
- overridenWeight = _args0.length > 6 ? _args0[6] : undefined;
1147
+ overridenWeight = _args1.length > 6 ? _args1[6] : undefined;
1123
1148
  if (!(overridenWeight !== null && overridenWeight !== void 0)) {
1124
- _context10.n = 1;
1149
+ _context11.n = 1;
1125
1150
  break;
1126
1151
  }
1127
1152
  _t5 = overridenWeight;
1128
- _context10.n = 3;
1153
+ _context11.n = 3;
1129
1154
  break;
1130
1155
  case 1:
1131
- _context10.n = 2;
1156
+ _context11.n = 2;
1132
1157
  return this.getXcmWeight(localXcm);
1133
1158
  case 2:
1134
- _t5 = _context10.v;
1159
+ _t5 = _context11.v;
1135
1160
  case 3:
1136
1161
  weight = _t5;
1137
- assetLocalizedLoc = localizeLocation(chain, asset.location);
1138
- _context10.n = 4;
1139
- return this.api.call.xcmPaymentApi.queryWeightToAssetFee(weight, addXcmVersionHeader(assetLocalizedLoc, version));
1162
+ assetLocalizedLoc = normalizeLocation(localizeLocation(chain, asset.location), version);
1163
+ assetId = createAssetId(version, assetLocalizedLoc);
1164
+ _context11.n = 4;
1165
+ return this.api.call.xcmPaymentApi.queryWeightToAssetFee(weight, addXcmVersionHeader(assetId, version));
1140
1166
  case 4:
1141
- feeResult = _context10.v;
1167
+ feeResult = _context11.v;
1142
1168
  execFeeRes = feeResult.toJSON();
1143
1169
  execFeeOk = execFeeRes === null || execFeeRes === void 0 ? void 0 : execFeeRes.ok;
1144
1170
  execFee = typeof execFeeOk === 'string' || typeof execFeeOk === 'number' ? BigInt(execFeeOk) : 0n;
1145
1171
  isAssetNotFound = (execFeeRes === null || execFeeRes === void 0 ? void 0 : execFeeRes.err) === 'AssetNotFound';
1146
1172
  if (!(chain.startsWith('BridgeHub') && isAssetNotFound)) {
1147
- _context10.n = 6;
1173
+ _context11.n = 6;
1148
1174
  break;
1149
1175
  }
1150
- _context10.n = 5;
1176
+ _context11.n = 5;
1151
1177
  return this.getBridgeHubFallbackExecFee(chain, weight, asset, version);
1152
1178
  case 5:
1153
- bridgeHubExecFee = _context10.v;
1179
+ bridgeHubExecFee = _context11.v;
1154
1180
  if (typeof bridgeHubExecFee === 'bigint') {
1155
1181
  execFee = bridgeHubExecFee;
1156
1182
  }
1157
1183
  case 6:
1158
- _context10.n = 7;
1184
+ _context11.n = 7;
1159
1185
  return this.getDeliveryFee(chain, forwardedXcm, asset, assetLocalizedLoc, version);
1160
1186
  case 7:
1161
- deliveryFee = _context10.v;
1162
- return _context10.a(2, execFee + deliveryFee);
1187
+ deliveryFee = _context11.v;
1188
+ return _context11.a(2, execFee + deliveryFee);
1163
1189
  }
1164
- }, _callee10, this);
1190
+ }, _callee11, this);
1165
1191
  }));
1166
- function getXcmPaymentApiFee(_x15, _x16, _x17, _x18, _x19) {
1192
+ function getXcmPaymentApiFee(_x16, _x17, _x18, _x19, _x20) {
1167
1193
  return _getXcmPaymentApiFee.apply(this, arguments);
1168
1194
  }
1169
1195
  return getXcmPaymentApiFee;
@@ -1171,67 +1197,68 @@ var PolkadotJsApi = /*#__PURE__*/function (_PolkadotApi) {
1171
1197
  }, {
1172
1198
  key: "getDeliveryFee",
1173
1199
  value: function () {
1174
- var _getDeliveryFee = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee11(chain, forwardedXcm, asset, assetLocalizedLoc, version) {
1175
- var _deliveryFeeRes, _ref8, _deliveryFeeResJson$o, _deliveryFeeResJson$o2, _deliveryFeeResJson$o3, _ref9, _deliveryFeeResJson$o4, _deliveryFeeResJson$o5, _deliveryFeeResJson$o6;
1176
- var usedThirdParam, deliveryFeeRes, baseArgs, _this$api$call$xcmPay, message, _this$api$call$xcmPay2, versionedAssetLoc, deliveryFeeResJson, deliveryFeeResolved, nativeAsset, res, _t6;
1177
- return _regenerator().w(function (_context11) {
1178
- while (1) switch (_context11.p = _context11.n) {
1200
+ var _getDeliveryFee = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee12(chain, forwardedXcm, asset, assetLocalizedLoc, version) {
1201
+ var _deliveryFeeRes, _ref9, _deliveryFeeResJson$o, _deliveryFeeResJson$o2, _deliveryFeeResJson$o3, _ref0, _deliveryFeeResJson$o4, _deliveryFeeResJson$o5, _deliveryFeeResJson$o6;
1202
+ var usedThirdParam, deliveryFeeRes, baseArgs, _this$api$call$xcmPay, message, _this$api$call$xcmPay2, assetId, versionedAssetLoc, deliveryFeeResJson, deliveryFeeResolved, nativeAsset, res, _t6;
1203
+ return _regenerator().w(function (_context12) {
1204
+ while (1) switch (_context12.p = _context12.n) {
1179
1205
  case 0:
1180
1206
  usedThirdParam = false;
1181
1207
  if (!(forwardedXcm.length > 0)) {
1182
- _context11.n = 6;
1208
+ _context12.n = 6;
1183
1209
  break;
1184
1210
  }
1185
1211
  baseArgs = [forwardedXcm[0], forwardedXcm[1][0]];
1186
- _context11.p = 1;
1187
- _context11.n = 2;
1212
+ _context12.p = 1;
1213
+ _context12.n = 2;
1188
1214
  return (_this$api$call$xcmPay = this.api.call.xcmPaymentApi).queryDeliveryFees.apply(_this$api$call$xcmPay, baseArgs);
1189
1215
  case 2:
1190
- deliveryFeeRes = _context11.v;
1191
- _context11.n = 6;
1216
+ deliveryFeeRes = _context12.v;
1217
+ _context12.n = 6;
1192
1218
  break;
1193
1219
  case 3:
1194
- _context11.p = 3;
1195
- _t6 = _context11.v;
1220
+ _context12.p = 3;
1221
+ _t6 = _context12.v;
1196
1222
  message = _t6 instanceof Error ? _t6.message : String(_t6);
1197
1223
  if (!message.includes('Expected 3 arguments')) {
1198
- _context11.n = 5;
1224
+ _context12.n = 5;
1199
1225
  break;
1200
1226
  }
1201
1227
  usedThirdParam = true;
1202
- versionedAssetLoc = addXcmVersionHeader(assetLocalizedLoc, version);
1203
- _context11.n = 4;
1228
+ assetId = createAssetId(version, assetLocalizedLoc);
1229
+ versionedAssetLoc = addXcmVersionHeader(assetId, version);
1230
+ _context12.n = 4;
1204
1231
  return (_this$api$call$xcmPay2 = this.api.call.xcmPaymentApi).queryDeliveryFees.apply(_this$api$call$xcmPay2, baseArgs.concat([versionedAssetLoc]));
1205
1232
  case 4:
1206
- deliveryFeeRes = _context11.v;
1207
- _context11.n = 6;
1233
+ deliveryFeeRes = _context12.v;
1234
+ _context12.n = 6;
1208
1235
  break;
1209
1236
  case 5:
1210
1237
  throw _t6;
1211
1238
  case 6:
1212
1239
  deliveryFeeResJson = (_deliveryFeeRes = deliveryFeeRes) === null || _deliveryFeeRes === void 0 ? void 0 : _deliveryFeeRes.toJSON();
1213
- deliveryFeeResolved = deliveryFeeRes && ((_ref8 = (_deliveryFeeResJson$o = (_deliveryFeeResJson$o2 = deliveryFeeResJson.ok) === null || _deliveryFeeResJson$o2 === void 0 ? void 0 : _deliveryFeeResJson$o2.v4) !== null && _deliveryFeeResJson$o !== void 0 ? _deliveryFeeResJson$o : (_deliveryFeeResJson$o3 = deliveryFeeResJson.ok) === null || _deliveryFeeResJson$o3 === void 0 ? void 0 : _deliveryFeeResJson$o3.v3) === null || _ref8 === void 0 ? void 0 : _ref8.length) > 0 ? BigInt((_ref9 = (_deliveryFeeResJson$o4 = deliveryFeeResJson === null || deliveryFeeResJson === void 0 || (_deliveryFeeResJson$o5 = deliveryFeeResJson.ok) === null || _deliveryFeeResJson$o5 === void 0 ? void 0 : _deliveryFeeResJson$o5.v4) !== null && _deliveryFeeResJson$o4 !== void 0 ? _deliveryFeeResJson$o4 : deliveryFeeResJson === null || deliveryFeeResJson === void 0 || (_deliveryFeeResJson$o6 = deliveryFeeResJson.ok) === null || _deliveryFeeResJson$o6 === void 0 ? void 0 : _deliveryFeeResJson$o6.v3) === null || _ref9 === void 0 || (_ref9 = _ref9[0]) === null || _ref9 === void 0 || (_ref9 = _ref9.fun) === null || _ref9 === void 0 ? void 0 : _ref9.fungible) : 0n;
1240
+ deliveryFeeResolved = deliveryFeeRes && ((_ref9 = (_deliveryFeeResJson$o = (_deliveryFeeResJson$o2 = deliveryFeeResJson.ok) === null || _deliveryFeeResJson$o2 === void 0 ? void 0 : _deliveryFeeResJson$o2.v4) !== null && _deliveryFeeResJson$o !== void 0 ? _deliveryFeeResJson$o : (_deliveryFeeResJson$o3 = deliveryFeeResJson.ok) === null || _deliveryFeeResJson$o3 === void 0 ? void 0 : _deliveryFeeResJson$o3.v3) === null || _ref9 === void 0 ? void 0 : _ref9.length) > 0 ? BigInt((_ref0 = (_deliveryFeeResJson$o4 = deliveryFeeResJson === null || deliveryFeeResJson === void 0 || (_deliveryFeeResJson$o5 = deliveryFeeResJson.ok) === null || _deliveryFeeResJson$o5 === void 0 ? void 0 : _deliveryFeeResJson$o5.v4) !== null && _deliveryFeeResJson$o4 !== void 0 ? _deliveryFeeResJson$o4 : deliveryFeeResJson === null || deliveryFeeResJson === void 0 || (_deliveryFeeResJson$o6 = deliveryFeeResJson.ok) === null || _deliveryFeeResJson$o6 === void 0 ? void 0 : _deliveryFeeResJson$o6.v3) === null || _ref0 === void 0 || (_ref0 = _ref0[0]) === null || _ref0 === void 0 || (_ref0 = _ref0.fun) === null || _ref0 === void 0 ? void 0 : _ref0.fungible) : 0n;
1214
1241
  nativeAsset = findNativeAssetInfoOrThrow(chain);
1215
1242
  if (!(isAssetXcEqual(asset, nativeAsset) || usedThirdParam)) {
1216
- _context11.n = 7;
1243
+ _context12.n = 7;
1217
1244
  break;
1218
1245
  }
1219
- return _context11.a(2, deliveryFeeResolved);
1246
+ return _context12.a(2, deliveryFeeResolved);
1220
1247
  case 7:
1221
- _context11.p = 7;
1222
- _context11.n = 8;
1248
+ _context12.p = 7;
1249
+ _context12.n = 8;
1223
1250
  return this.quoteAhPrice(localizeLocation(chain, nativeAsset.location), assetLocalizedLoc, deliveryFeeResolved, false);
1224
1251
  case 8:
1225
- res = _context11.v;
1226
- return _context11.a(2, res !== null && res !== void 0 ? res : 0n);
1252
+ res = _context12.v;
1253
+ return _context12.a(2, res !== null && res !== void 0 ? res : 0n);
1227
1254
  case 9:
1228
- _context11.p = 9;
1229
- _context11.v;
1230
- return _context11.a(2, 0n);
1255
+ _context12.p = 9;
1256
+ _context12.v;
1257
+ return _context12.a(2, 0n);
1231
1258
  }
1232
- }, _callee11, this, [[7, 9], [1, 3]]);
1259
+ }, _callee12, this, [[7, 9], [1, 3]]);
1233
1260
  }));
1234
- function getDeliveryFee(_x20, _x21, _x22, _x23, _x24) {
1261
+ function getDeliveryFee(_x21, _x22, _x23, _x24, _x25) {
1235
1262
  return _getDeliveryFee.apply(this, arguments);
1236
1263
  }
1237
1264
  return getDeliveryFee;
@@ -1239,45 +1266,45 @@ var PolkadotJsApi = /*#__PURE__*/function (_PolkadotApi) {
1239
1266
  }, {
1240
1267
  key: "getBridgeHubFallbackExecFee",
1241
1268
  value: function () {
1242
- var _getBridgeHubFallbackExecFee = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee12(chain, weightValue, asset, version) {
1269
+ var _getBridgeHubFallbackExecFee = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee13(chain, weightValue, asset, version) {
1243
1270
  var fallbackExecFeeRes, fallbackJson, fallbackOk, fallbackExecFee, ahApi, assetHubChain, ahLocalizedLoc, convertedExecFee;
1244
- return _regenerator().w(function (_context12) {
1245
- while (1) switch (_context12.n) {
1271
+ return _regenerator().w(function (_context13) {
1272
+ while (1) switch (_context13.n) {
1246
1273
  case 0:
1247
- _context12.n = 1;
1274
+ _context13.n = 1;
1248
1275
  return this.api.call.xcmPaymentApi.queryWeightToAssetFee(weightValue, addXcmVersionHeader(RELAY_LOCATION, version));
1249
1276
  case 1:
1250
- fallbackExecFeeRes = _context12.v;
1277
+ fallbackExecFeeRes = _context13.v;
1251
1278
  fallbackJson = fallbackExecFeeRes.toJSON();
1252
1279
  fallbackOk = fallbackJson === null || fallbackJson === void 0 ? void 0 : fallbackJson.ok;
1253
1280
  fallbackExecFee = typeof fallbackOk === 'string' || typeof fallbackOk === 'number' ? BigInt(fallbackOk) : undefined;
1254
1281
  if (!(fallbackExecFee === undefined)) {
1255
- _context12.n = 2;
1282
+ _context13.n = 2;
1256
1283
  break;
1257
1284
  }
1258
- return _context12.a(2, undefined);
1285
+ return _context13.a(2, undefined);
1259
1286
  case 2:
1260
1287
  ahApi = this.clone();
1261
1288
  assetHubChain = "AssetHub".concat(getRelayChainOf(chain));
1262
- _context12.n = 3;
1289
+ _context13.n = 3;
1263
1290
  return ahApi.init(assetHubChain);
1264
1291
  case 3:
1265
1292
  ahLocalizedLoc = localizeLocation(assetHubChain, asset.location);
1266
- _context12.n = 4;
1293
+ _context13.n = 4;
1267
1294
  return ahApi.quoteAhPrice(RELAY_LOCATION, ahLocalizedLoc, fallbackExecFee, false);
1268
1295
  case 4:
1269
- convertedExecFee = _context12.v;
1296
+ convertedExecFee = _context13.v;
1270
1297
  if (!(typeof convertedExecFee === 'bigint')) {
1271
- _context12.n = 5;
1298
+ _context13.n = 5;
1272
1299
  break;
1273
1300
  }
1274
- return _context12.a(2, convertedExecFee);
1301
+ return _context13.a(2, convertedExecFee);
1275
1302
  case 5:
1276
- return _context12.a(2, undefined);
1303
+ return _context13.a(2, undefined);
1277
1304
  }
1278
- }, _callee12, this);
1305
+ }, _callee13, this);
1279
1306
  }));
1280
- function getBridgeHubFallbackExecFee(_x25, _x26, _x27, _x28) {
1307
+ function getBridgeHubFallbackExecFee(_x26, _x27, _x28, _x29) {
1281
1308
  return _getBridgeHubFallbackExecFee.apply(this, arguments);
1282
1309
  }
1283
1310
  return getBridgeHubFallbackExecFee;
@@ -1285,21 +1312,21 @@ var PolkadotJsApi = /*#__PURE__*/function (_PolkadotApi) {
1285
1312
  }, {
1286
1313
  key: "getXcmWeight",
1287
1314
  value: function () {
1288
- var _getXcmWeight = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee13(xcm) {
1315
+ var _getXcmWeight = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee14(xcm) {
1289
1316
  var result, resultJson;
1290
- return _regenerator().w(function (_context13) {
1291
- while (1) switch (_context13.n) {
1317
+ return _regenerator().w(function (_context14) {
1318
+ while (1) switch (_context14.n) {
1292
1319
  case 0:
1293
- _context13.n = 1;
1320
+ _context14.n = 1;
1294
1321
  return this.api.call.xcmPaymentApi.queryXcmWeight(xcm);
1295
1322
  case 1:
1296
- result = _context13.v;
1323
+ result = _context14.v;
1297
1324
  resultJson = result.toJSON();
1298
- return _context13.a(2, resultJson.ok);
1325
+ return _context14.a(2, resultJson.ok);
1299
1326
  }
1300
- }, _callee13, this);
1327
+ }, _callee14, this);
1301
1328
  }));
1302
- function getXcmWeight(_x29) {
1329
+ function getXcmWeight(_x30) {
1303
1330
  return _getXcmWeight.apply(this, arguments);
1304
1331
  }
1305
1332
  return getXcmWeight;
@@ -1307,34 +1334,34 @@ var PolkadotJsApi = /*#__PURE__*/function (_PolkadotApi) {
1307
1334
  }, {
1308
1335
  key: "getDryRunXcm",
1309
1336
  value: function () {
1310
- var _getDryRunXcm = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee14(_ref0) {
1311
- var _ref10, _ref11, _ref12;
1337
+ var _getDryRunXcm = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee15(_ref1) {
1338
+ var _ref11, _ref12, _ref13;
1312
1339
  var originLocation, xcm, asset, chain, version, origin, supportsDryRunApi, response, result, resultJson, isSuccess, error, failureReason, forwardedXcms, actualWeight, weight, destParaId, _fee, emitted, reversedEvents, palletsWithIssued, feeEvent, feeAmount, fee;
1313
- return _regenerator().w(function (_context14) {
1314
- while (1) switch (_context14.n) {
1340
+ return _regenerator().w(function (_context15) {
1341
+ while (1) switch (_context15.n) {
1315
1342
  case 0:
1316
- originLocation = _ref0.originLocation, xcm = _ref0.xcm, asset = _ref0.asset, chain = _ref0.chain, version = _ref0.version, origin = _ref0.origin;
1343
+ originLocation = _ref1.originLocation, xcm = _ref1.xcm, asset = _ref1.asset, chain = _ref1.chain, version = _ref1.version, origin = _ref1.origin;
1317
1344
  supportsDryRunApi = getAssetsObject(chain).supportsDryRunApi;
1318
1345
  if (supportsDryRunApi) {
1319
- _context14.n = 1;
1346
+ _context15.n = 1;
1320
1347
  break;
1321
1348
  }
1322
1349
  throw new RuntimeApiUnavailableError(chain, 'DryRunApi');
1323
1350
  case 1:
1324
- _context14.n = 2;
1351
+ _context15.n = 2;
1325
1352
  return this.api.call.dryRunApi.dryRunXcm(originLocation, xcm);
1326
1353
  case 2:
1327
- response = _context14.v;
1354
+ response = _context15.v;
1328
1355
  result = response.toHuman();
1329
1356
  resultJson = response.toJSON();
1330
1357
  isSuccess = result.Ok && result.Ok.executionResult.Complete;
1331
1358
  if (isSuccess) {
1332
- _context14.n = 3;
1359
+ _context15.n = 3;
1333
1360
  break;
1334
1361
  }
1335
1362
  error = result.Ok.executionResult.Incomplete.error;
1336
1363
  failureReason = typeof error === 'string' ? error : error.error;
1337
- return _context14.a(2, {
1364
+ return _context15.a(2, {
1338
1365
  success: false,
1339
1366
  failureReason: failureReason,
1340
1367
  asset: asset
@@ -1346,22 +1373,22 @@ var PolkadotJsApi = /*#__PURE__*/function (_PolkadotApi) {
1346
1373
  refTime: BigInt(actualWeight.refTime),
1347
1374
  proofSize: BigInt(actualWeight.proofSize)
1348
1375
  } : undefined;
1349
- destParaId = forwardedXcms.length === 0 ? undefined : function (i, _ref1) {
1350
- return i.Here ? 0 : (_ref1 = Array.isArray(i.x1) ? i.x1[0] : i.x1) === null || _ref1 === void 0 ? void 0 : _ref1.parachain;
1376
+ destParaId = forwardedXcms.length === 0 ? undefined : function (i, _ref10) {
1377
+ return i.Here ? 0 : (_ref10 = Array.isArray(i.x1) ? i.x1[0] : i.x1) === null || _ref10 === void 0 ? void 0 : _ref10.parachain;
1351
1378
  }(Object.values(forwardedXcms[0])[0].interior);
1352
1379
  if (!(hasXcmPaymentApiSupport(chain) && asset)) {
1353
- _context14.n = 5;
1380
+ _context15.n = 5;
1354
1381
  break;
1355
1382
  }
1356
- _context14.n = 4;
1383
+ _context15.n = 4;
1357
1384
  return this.getXcmPaymentApiFee(chain, xcm, forwardedXcms, asset, version);
1358
1385
  case 4:
1359
- _fee = _context14.v;
1386
+ _fee = _context15.v;
1360
1387
  if (!(typeof _fee === 'bigint')) {
1361
- _context14.n = 5;
1388
+ _context15.n = 5;
1362
1389
  break;
1363
1390
  }
1364
- return _context14.a(2, {
1391
+ return _context15.a(2, {
1365
1392
  success: true,
1366
1393
  fee: _fee,
1367
1394
  asset: asset,
@@ -1373,24 +1400,24 @@ var PolkadotJsApi = /*#__PURE__*/function (_PolkadotApi) {
1373
1400
  emitted = result.Ok.emittedEvents; // We want to look for the last event
1374
1401
  reversedEvents = _toConsumableArray(emitted).reverse();
1375
1402
  palletsWithIssued = ['balances', 'foreignAssets', 'assets'];
1376
- feeEvent = (_ref10 = (_ref11 = (_ref12 = origin === 'Mythos' ? reversedEvents.find(function (event) {
1403
+ feeEvent = (_ref11 = (_ref12 = (_ref13 = origin === 'Mythos' ? reversedEvents.find(function (event) {
1377
1404
  return event.section === 'assetConversion' && event.method === 'SwapCreditExecuted';
1378
- }) : undefined) !== null && _ref12 !== void 0 ? _ref12 :
1405
+ }) : undefined) !== null && _ref13 !== void 0 ? _ref13 :
1379
1406
  // Prefer an Issued event
1380
1407
  reversedEvents.find(function (event) {
1381
1408
  return palletsWithIssued.includes(event.section) && event.method === 'Issued';
1382
- })) !== null && _ref11 !== void 0 ? _ref11 :
1409
+ })) !== null && _ref12 !== void 0 ? _ref12 :
1383
1410
  // Fallback to Minted event
1384
1411
  reversedEvents.find(function (event) {
1385
1412
  return ['balances', 'foreignAssets'].includes(event.section) && event.method === 'Minted';
1386
- })) !== null && _ref10 !== void 0 ? _ref10 : reversedEvents.find(function (event) {
1413
+ })) !== null && _ref11 !== void 0 ? _ref11 : reversedEvents.find(function (event) {
1387
1414
  return ['currencies', 'tokens'].includes(event.section) && event.method === 'Deposited';
1388
1415
  });
1389
1416
  if (feeEvent) {
1390
- _context14.n = 6;
1417
+ _context15.n = 6;
1391
1418
  break;
1392
1419
  }
1393
- return _context14.a(2, Promise.resolve({
1420
+ return _context15.a(2, Promise.resolve({
1394
1421
  success: false,
1395
1422
  failureReason: 'Cannot determine destination fee. No Issued event found',
1396
1423
  asset: asset
@@ -1398,7 +1425,7 @@ var PolkadotJsApi = /*#__PURE__*/function (_PolkadotApi) {
1398
1425
  case 6:
1399
1426
  feeAmount = feeEvent.section === 'assetConversion' ? feeEvent.data.amountIn : feeEvent.data.amount;
1400
1427
  fee = BigInt(feeAmount.replace(/,/g, ''));
1401
- return _context14.a(2, {
1428
+ return _context15.a(2, {
1402
1429
  success: true,
1403
1430
  fee: fee,
1404
1431
  asset: asset,
@@ -1407,9 +1434,9 @@ var PolkadotJsApi = /*#__PURE__*/function (_PolkadotApi) {
1407
1434
  destParaId: destParaId
1408
1435
  });
1409
1436
  }
1410
- }, _callee14, this);
1437
+ }, _callee15, this);
1411
1438
  }));
1412
- function getDryRunXcm(_x30) {
1439
+ function getDryRunXcm(_x31) {
1413
1440
  return _getDryRunXcm.apply(this, arguments);
1414
1441
  }
1415
1442
  return getDryRunXcm;
@@ -1417,18 +1444,18 @@ var PolkadotJsApi = /*#__PURE__*/function (_PolkadotApi) {
1417
1444
  }, {
1418
1445
  key: "getBridgeStatus",
1419
1446
  value: function () {
1420
- var _getBridgeStatus = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee15() {
1447
+ var _getBridgeStatus = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee16() {
1421
1448
  var outboundOperatingMode;
1422
- return _regenerator().w(function (_context15) {
1423
- while (1) switch (_context15.n) {
1449
+ return _regenerator().w(function (_context16) {
1450
+ while (1) switch (_context16.n) {
1424
1451
  case 0:
1425
- _context15.n = 1;
1452
+ _context16.n = 1;
1426
1453
  return this.api.query.ethereumOutboundQueue.operatingMode();
1427
1454
  case 1:
1428
- outboundOperatingMode = _context15.v;
1429
- return _context15.a(2, outboundOperatingMode.toPrimitive());
1455
+ outboundOperatingMode = _context16.v;
1456
+ return _context16.a(2, outboundOperatingMode.toPrimitive());
1430
1457
  }
1431
- }, _callee15, this);
1458
+ }, _callee16, this);
1432
1459
  }));
1433
1460
  function getBridgeStatus() {
1434
1461
  return _getBridgeStatus.apply(this, arguments);
@@ -1479,35 +1506,35 @@ var PolkadotJsApi = /*#__PURE__*/function (_PolkadotApi) {
1479
1506
  }, {
1480
1507
  key: "signAndSubmit",
1481
1508
  value: function () {
1482
- var _signAndSubmit = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee16(tx, sender) {
1509
+ var _signAndSubmit = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee17(tx, sender) {
1483
1510
  var hash, _t8;
1484
- return _regenerator().w(function (_context16) {
1485
- while (1) switch (_context16.n) {
1511
+ return _regenerator().w(function (_context17) {
1512
+ while (1) switch (_context17.n) {
1486
1513
  case 0:
1487
1514
  if (!isSenderSigner(sender)) {
1488
- _context16.n = 2;
1515
+ _context17.n = 2;
1489
1516
  break;
1490
1517
  }
1491
- _context16.n = 1;
1518
+ _context17.n = 1;
1492
1519
  return tx.signAndSend(sender.address, {
1493
1520
  signer: sender.signer
1494
1521
  });
1495
1522
  case 1:
1496
- _t8 = _context16.v;
1497
- _context16.n = 4;
1523
+ _t8 = _context17.v;
1524
+ _context17.n = 4;
1498
1525
  break;
1499
1526
  case 2:
1500
- _context16.n = 3;
1527
+ _context17.n = 3;
1501
1528
  return tx.signAndSend(createKeyringPair(sender));
1502
1529
  case 3:
1503
- _t8 = _context16.v;
1530
+ _t8 = _context17.v;
1504
1531
  case 4:
1505
1532
  hash = _t8;
1506
- return _context16.a(2, hash.toHex());
1533
+ return _context17.a(2, hash.toHex());
1507
1534
  }
1508
- }, _callee16);
1535
+ }, _callee17);
1509
1536
  }));
1510
- function signAndSubmit(_x31, _x32) {
1537
+ function signAndSubmit(_x32, _x33) {
1511
1538
  return _signAndSubmit.apply(this, arguments);
1512
1539
  }
1513
1540
  return signAndSubmit;
@@ -1515,31 +1542,31 @@ var PolkadotJsApi = /*#__PURE__*/function (_PolkadotApi) {
1515
1542
  }, {
1516
1543
  key: "signAndSubmitFinalized",
1517
1544
  value: function () {
1518
- var _signAndSubmitFinalized = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee17(tx, sender) {
1545
+ var _signAndSubmitFinalized = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee18(tx, sender) {
1519
1546
  var _this4 = this;
1520
- return _regenerator().w(function (_context17) {
1521
- while (1) switch (_context17.n) {
1547
+ return _regenerator().w(function (_context18) {
1548
+ while (1) switch (_context18.n) {
1522
1549
  case 0:
1523
1550
  if (!isSenderSigner(sender)) {
1524
- _context17.n = 2;
1551
+ _context18.n = 2;
1525
1552
  break;
1526
1553
  }
1527
- _context17.n = 1;
1554
+ _context18.n = 1;
1528
1555
  return tx.signAsync(sender.address, {
1529
1556
  signer: sender.signer
1530
1557
  });
1531
1558
  case 1:
1532
- _context17.n = 3;
1559
+ _context18.n = 3;
1533
1560
  break;
1534
1561
  case 2:
1535
- _context17.n = 3;
1562
+ _context18.n = 3;
1536
1563
  return tx.signAsync(createKeyringPair(sender));
1537
1564
  case 3:
1538
- return _context17.a(2, new Promise(function (resolve, reject) {
1539
- tx.send(function (_ref13) {
1540
- var status = _ref13.status,
1541
- dispatchError = _ref13.dispatchError,
1542
- txHash = _ref13.txHash;
1565
+ return _context18.a(2, new Promise(function (resolve, reject) {
1566
+ tx.send(function (_ref14) {
1567
+ var status = _ref14.status,
1568
+ dispatchError = _ref14.dispatchError,
1569
+ txHash = _ref14.txHash;
1543
1570
  if (status.isFinalized) {
1544
1571
  if (dispatchError !== undefined) {
1545
1572
  if (dispatchError.isModule) {
@@ -1560,9 +1587,9 @@ var PolkadotJsApi = /*#__PURE__*/function (_PolkadotApi) {
1560
1587
  });
1561
1588
  }));
1562
1589
  }
1563
- }, _callee17);
1590
+ }, _callee18);
1564
1591
  }));
1565
- function signAndSubmitFinalized(_x33, _x34) {
1592
+ function signAndSubmitFinalized(_x34, _x35) {
1566
1593
  return _signAndSubmitFinalized.apply(this, arguments);
1567
1594
  }
1568
1595
  return signAndSubmitFinalized;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paraspell/sdk-pjs",
3
- "version": "13.1.0",
3
+ "version": "13.2.1",
4
4
  "description": "Polkadot.js based SDK for ParaSpell XCM/XCMP tool for developers",
5
5
  "repository": {
6
6
  "type": "git",
@@ -29,7 +29,7 @@
29
29
  "@snowbridge/registry": "^0.4.4",
30
30
  "ethers": "^6.16.0",
31
31
  "viem": "^2.47.6",
32
- "@paraspell/sdk-core": "13.1.0"
32
+ "@paraspell/sdk-core": "13.2.1"
33
33
  },
34
34
  "peerDependencies": {
35
35
  "@polkadot/api": ">= 16.0 < 17",