@paraspell/sdk-pjs 11.3.1 → 11.4.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/README.md CHANGED
@@ -276,6 +276,21 @@ import { hasDryRunSupport } from "@paraspell/sdk";
276
276
  const result = hasDryRunSupport(chain)
277
277
  ```
278
278
 
279
+ #### Dry run preview:
280
+ More on this feature in [official documentation](https://paraspell.github.io/docs/sdk/xcmPallet.html#preview-your-call-results)
281
+
282
+ ```ts
283
+ //Builder pattern
284
+ const result = await Builder(/*chain api/builder_config/ws_url_string/ws_url_array - optional*/)
285
+ .from(CHAIN)
286
+ .to(CHAIN_2)
287
+ .currency({id: currencyID, amount: amount} | {symbol: currencySymbol, amount: amount} | {symbol: Native('currencySymbol'), amount: amount} | {symbol: Foreign('currencySymbol'), amount: amount} | {symbol: ForeignAbstract('currencySymbol'), amount: amount} | {location: AssetLocationString, amount: amount | AssetLocationJson, amount: amount} | {location: Override('Custom Location'), amount: amount} | {[{currencySelection, isFeeAsset?: true /* for example symbol: symbol or id: id, or Location: Location*/, amount: amount}]})
288
+ /*.feeAsset(CURRENCY) - Optional parameter when origin === AssetHubPolkadot and TX is supposed to be paid in same fee asset as selected currency.*/
289
+ .address(ADDRESS)
290
+ .senderAddress(SENDER_ADDRESS)
291
+ .dryRunPreview(/*{ mintFeeAssets: true } - false by default - Mints fee assets also, if user does not have enough to cover fees on origin.*/)
292
+ ```
293
+
279
294
  ### Localhost test setup
280
295
 
281
296
  SDK offers enhanced localhost support. You can pass an object containing overrides for all WS endpoints (Including hops) used in the test transfer. This allows for advanced localhost testing such as localhost dry-run or xcm-fee queries. More information about available options can be found in the [official documentation](https://paraspell.github.io/docs/sdk/xcmPallet.html#localhost-testing-setup).
package/dist/index.cjs CHANGED
@@ -776,64 +776,158 @@ var PolkadotJsApi = /*#__PURE__*/function () {
776
776
  }, {
777
777
  key: "getDryRunCall",
778
778
  value: function () {
779
- var _getDryRunCall = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee15(_ref4) {
780
- var _this$api$call$dryRun, _feeAsset$symbol;
781
- var tx, address, asset, feeAsset, chain, supportsDryRunApi, chainsRequiringVersionParam, needsVersionParam, DEFAULT_XCM_VERSION, response, result, resultJson, usedSymbol, usedAsset, isSuccess, moduleError, failureReason, executionFee, fee, actualWeight, weight, forwardedXcms, destParaId;
782
- return _regenerator().w(function (_context15) {
783
- while (1) switch (_context15.n) {
779
+ var _getDryRunCall = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee16(_ref4) {
780
+ var _feeAsset$symbol,
781
+ _this = this;
782
+ var tx, address, asset, feeAsset, chain, supportsDryRunApi, DEFAULT_XCM_VERSION, usedSymbol, usedAsset, performDryRunCall, getExecutionSuccessFromResult, extractFailureReasonFromResult, response, resultHuman, resultJson, isSuccess, failureReason, shouldRetryWithVersion, msg, _msg, executionFee, fee, actualWeight, weight, forwardedXcms, destParaId, _t, _t2;
783
+ return _regenerator().w(function (_context16) {
784
+ while (1) switch (_context16.p = _context16.n) {
784
785
  case 0:
785
786
  tx = _ref4.tx, address = _ref4.address, asset = _ref4.asset, feeAsset = _ref4.feeAsset, chain = _ref4.chain;
786
787
  supportsDryRunApi = sdkCore.getAssetsObject(chain).supportsDryRunApi;
787
788
  if (supportsDryRunApi) {
788
- _context15.n = 1;
789
+ _context16.n = 1;
789
790
  break;
790
791
  }
791
792
  throw new sdkCore.ChainNotSupportedError("DryRunApi is not available on chain ".concat(chain));
792
793
  case 1:
793
- chainsRequiringVersionParam = ['BifrostPolkadot', 'BifrostKusama', 'AssetHubKusama', 'AssetHubPolkadot', 'Kusama', 'Polkadot', 'Polimec', 'Astar'];
794
- needsVersionParam = chainsRequiringVersionParam.includes(chain);
795
794
  DEFAULT_XCM_VERSION = 3;
796
- _context15.n = 2;
797
- return (_this$api$call$dryRun = this.api.call.dryRunApi).dryRunCall.apply(_this$api$call$dryRun, [{
798
- system: {
799
- Signed: address
800
- }
801
- }, tx].concat(_toConsumableArray(needsVersionParam ? [DEFAULT_XCM_VERSION] : [])));
802
- case 2:
803
- response = _context15.v;
804
- result = response.toHuman();
805
- resultJson = response.toJSON();
806
795
  usedSymbol = (_feeAsset$symbol = feeAsset === null || feeAsset === void 0 ? void 0 : feeAsset.symbol) !== null && _feeAsset$symbol !== void 0 ? _feeAsset$symbol : asset === null || asset === void 0 ? void 0 : asset.symbol;
807
796
  usedAsset = feeAsset !== null && feeAsset !== void 0 ? feeAsset : asset;
808
- isSuccess = result.Ok && result.Ok.executionResult.Ok;
809
- if (isSuccess) {
810
- _context15.n = 3;
797
+ performDryRunCall = /*#__PURE__*/function () {
798
+ var _ref5 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee15(includeVersion) {
799
+ var _this$api$call$dryRun;
800
+ return _regenerator().w(function (_context15) {
801
+ while (1) switch (_context15.n) {
802
+ case 0:
803
+ return _context15.a(2, (_this$api$call$dryRun = _this.api.call.dryRunApi).dryRunCall.apply(_this$api$call$dryRun, [{
804
+ system: {
805
+ Signed: address
806
+ }
807
+ }, tx].concat(_toConsumableArray(includeVersion ? [DEFAULT_XCM_VERSION] : []))));
808
+ }
809
+ }, _callee15);
810
+ }));
811
+ return function performDryRunCall(_x31) {
812
+ return _ref5.apply(this, arguments);
813
+ };
814
+ }();
815
+ getExecutionSuccessFromResult = function getExecutionSuccessFromResult(resultHuman) {
816
+ var _resultHuman$Ok$execu;
817
+ 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));
818
+ };
819
+ extractFailureReasonFromResult = function extractFailureReasonFromResult(resultHuman, resultJson) {
820
+ var _resultHuman$Ok, _resultHuman$Ok2, _resultJson$ok, _ref6;
821
+ var modErrHuman = resultHuman === null || resultHuman === void 0 || (_resultHuman$Ok = resultHuman.Ok) === null || _resultHuman$Ok === void 0 || (_resultHuman$Ok = _resultHuman$Ok.executionResult) === null || _resultHuman$Ok === void 0 || (_resultHuman$Ok = _resultHuman$Ok.Err) === null || _resultHuman$Ok === void 0 || (_resultHuman$Ok = _resultHuman$Ok.error) === null || _resultHuman$Ok === void 0 ? void 0 : _resultHuman$Ok.Module;
822
+ if (modErrHuman) {
823
+ return sdkCore.resolveModuleError(chain, modErrHuman);
824
+ }
825
+ var otherErrHuman = 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.Other;
826
+ if (otherErrHuman) {
827
+ return String(otherErrHuman);
828
+ }
829
+ var execErrJson = resultJson === null || resultJson === void 0 || (_resultJson$ok = resultJson.ok) === null || _resultJson$ok === void 0 || (_resultJson$ok = _resultJson$ok.executionResult) === null || _resultJson$ok === void 0 || (_resultJson$ok = _resultJson$ok.err) === null || _resultJson$ok === void 0 ? void 0 : _resultJson$ok.error;
830
+ if (execErrJson !== null && execErrJson !== void 0 && execErrJson.module) {
831
+ return sdkCore.resolveModuleError(chain, execErrJson.module);
832
+ }
833
+ if (execErrJson !== null && execErrJson !== void 0 && execErrJson.other) {
834
+ return String(execErrJson.other);
835
+ }
836
+ return JSON.stringify((_ref6 = resultJson !== null && resultJson !== void 0 ? resultJson : resultHuman) !== null && _ref6 !== void 0 ? _ref6 : 'Unknown error');
837
+ }; // Attempt 1: WITHOUT version
838
+ isSuccess = false;
839
+ failureReason = '';
840
+ shouldRetryWithVersion = false;
841
+ _context16.p = 2;
842
+ _context16.n = 3;
843
+ return performDryRunCall(false);
844
+ case 3:
845
+ response = _context16.v;
846
+ resultHuman = response.toHuman();
847
+ resultJson = response.toJSON();
848
+ isSuccess = getExecutionSuccessFromResult(resultHuman);
849
+ if (!isSuccess) {
850
+ failureReason = extractFailureReasonFromResult(resultHuman, resultJson);
851
+ if (failureReason === 'VersionedConversionFailed') {
852
+ shouldRetryWithVersion = true;
853
+ }
854
+ }
855
+ _context16.n = 6;
856
+ break;
857
+ case 4:
858
+ _context16.p = 4;
859
+ _t = _context16.v;
860
+ msg = _t instanceof Error ? _t.message : String(_t);
861
+ if (!msg.includes('Expected 3 arguments')) {
862
+ _context16.n = 5;
811
863
  break;
812
864
  }
813
- moduleError = result.Ok.executionResult.Err.error.Module;
814
- failureReason = sdkCore.resolveModuleError(chain, moduleError);
815
- return _context15.a(2, {
865
+ shouldRetryWithVersion = true;
866
+ _context16.n = 6;
867
+ break;
868
+ case 5:
869
+ return _context16.a(2, {
870
+ success: false,
871
+ failureReason: msg,
872
+ currency: usedSymbol,
873
+ asset: usedAsset
874
+ });
875
+ case 6:
876
+ if (!shouldRetryWithVersion) {
877
+ _context16.n = 10;
878
+ break;
879
+ }
880
+ _context16.p = 7;
881
+ _context16.n = 8;
882
+ return performDryRunCall(true);
883
+ case 8:
884
+ response = _context16.v;
885
+ resultHuman = response.toHuman();
886
+ resultJson = response.toJSON();
887
+ isSuccess = getExecutionSuccessFromResult(resultHuman);
888
+ if (!isSuccess) {
889
+ failureReason = extractFailureReasonFromResult(resultHuman, resultJson);
890
+ }
891
+ _context16.n = 10;
892
+ break;
893
+ case 9:
894
+ _context16.p = 9;
895
+ _t2 = _context16.v;
896
+ _msg = _t2 instanceof Error ? _t2.message : String(_t2);
897
+ failureReason = failureReason || _msg;
898
+ return _context16.a(2, {
816
899
  success: false,
817
900
  failureReason: failureReason,
818
901
  currency: usedSymbol,
819
902
  asset: usedAsset
820
903
  });
821
- case 3:
822
- _context15.n = 4;
904
+ case 10:
905
+ if (isSuccess) {
906
+ _context16.n = 11;
907
+ break;
908
+ }
909
+ return _context16.a(2, {
910
+ success: false,
911
+ failureReason: failureReason || 'Unknown error',
912
+ currency: usedSymbol,
913
+ asset: usedAsset
914
+ });
915
+ case 11:
916
+ _context16.n = 12;
823
917
  return this.calculateTransactionFee(tx, address);
824
- case 4:
825
- executionFee = _context15.v;
826
- fee = sdkCore.computeFeeFromDryRunPjs(result, chain, executionFee);
918
+ case 12:
919
+ executionFee = _context16.v;
920
+ fee = sdkCore.computeFeeFromDryRunPjs(resultHuman, chain, executionFee);
827
921
  actualWeight = resultJson.ok.executionResult.ok.actualWeight;
828
922
  weight = actualWeight ? {
829
923
  refTime: BigInt(actualWeight.refTime),
830
924
  proofSize: BigInt(actualWeight.proofSize)
831
925
  } : undefined;
832
926
  forwardedXcms = resultJson.ok.forwardedXcms.length > 0 ? resultJson.ok.forwardedXcms[0] : [];
833
- destParaId = forwardedXcms.length === 0 ? undefined : function (i, _ref5) {
834
- return i.here === null ? 0 : (_ref5 = Array.isArray(i.x1) ? i.x1[0] : i.x1) === null || _ref5 === void 0 ? void 0 : _ref5.parachain;
927
+ destParaId = forwardedXcms.length === 0 ? undefined : function (i, _ref7) {
928
+ return i.here === null ? 0 : (_ref7 = Array.isArray(i.x1) ? i.x1[0] : i.x1) === null || _ref7 === void 0 ? void 0 : _ref7.parachain;
835
929
  }(Object.values(forwardedXcms[0])[0].interior);
836
- return _context15.a(2, {
930
+ return _context16.a(2, {
837
931
  success: true,
838
932
  fee: fee,
839
933
  currency: usedSymbol,
@@ -843,7 +937,7 @@ var PolkadotJsApi = /*#__PURE__*/function () {
843
937
  destParaId: destParaId
844
938
  });
845
939
  }
846
- }, _callee15, this);
940
+ }, _callee16, this, [[7, 9], [2, 4]]);
847
941
  }));
848
942
  function getDryRunCall(_x30) {
849
943
  return _getDryRunCall.apply(this, arguments);
@@ -853,27 +947,27 @@ var PolkadotJsApi = /*#__PURE__*/function () {
853
947
  }, {
854
948
  key: "getXcmPaymentApiFee",
855
949
  value: function () {
856
- var _getXcmPaymentApiFee = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee16(chain, xcm, asset) {
950
+ var _getXcmPaymentApiFee = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee17(chain, xcm, asset) {
857
951
  var weight, localizedLocation, feeResult, res;
858
- return _regenerator().w(function (_context16) {
859
- while (1) switch (_context16.n) {
952
+ return _regenerator().w(function (_context17) {
953
+ while (1) switch (_context17.n) {
860
954
  case 0:
861
- _context16.n = 1;
955
+ _context17.n = 1;
862
956
  return this.getXcmWeight(xcm);
863
957
  case 1:
864
- weight = _context16.v;
958
+ weight = _context17.v;
865
959
  sdkCore.assertHasLocation(asset);
866
960
  localizedLocation = chain === 'AssetHubPolkadot' || chain === 'AssetHubKusama' || sdkCore.isRelayChain(chain) ? sdkCore.localizeLocation(chain, asset.location) : asset.location;
867
- _context16.n = 2;
961
+ _context17.n = 2;
868
962
  return this.api.call.xcmPaymentApi.queryWeightToAssetFee(weight, sdkCore.addXcmVersionHeader(localizedLocation, sdkCore.Version.V4));
869
963
  case 2:
870
- feeResult = _context16.v;
964
+ feeResult = _context17.v;
871
965
  res = feeResult.toJSON();
872
- return _context16.a(2, BigInt(res.ok));
966
+ return _context17.a(2, BigInt(res.ok));
873
967
  }
874
- }, _callee16, this);
968
+ }, _callee17, this);
875
969
  }));
876
- function getXcmPaymentApiFee(_x31, _x32, _x33) {
970
+ function getXcmPaymentApiFee(_x32, _x33, _x34) {
877
971
  return _getXcmPaymentApiFee.apply(this, arguments);
878
972
  }
879
973
  return getXcmPaymentApiFee;
@@ -881,21 +975,21 @@ var PolkadotJsApi = /*#__PURE__*/function () {
881
975
  }, {
882
976
  key: "getXcmWeight",
883
977
  value: function () {
884
- var _getXcmWeight = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee17(xcm) {
978
+ var _getXcmWeight = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee18(xcm) {
885
979
  var result, resultJson;
886
- return _regenerator().w(function (_context17) {
887
- while (1) switch (_context17.n) {
980
+ return _regenerator().w(function (_context18) {
981
+ while (1) switch (_context18.n) {
888
982
  case 0:
889
- _context17.n = 1;
983
+ _context18.n = 1;
890
984
  return this.api.call.xcmPaymentApi.queryXcmWeight(xcm);
891
985
  case 1:
892
- result = _context17.v;
986
+ result = _context18.v;
893
987
  resultJson = result.toJSON();
894
- return _context17.a(2, resultJson.ok);
988
+ return _context18.a(2, resultJson.ok);
895
989
  }
896
- }, _callee17, this);
990
+ }, _callee18, this);
897
991
  }));
898
- function getXcmWeight(_x34) {
992
+ function getXcmWeight(_x35) {
899
993
  return _getXcmWeight.apply(this, arguments);
900
994
  }
901
995
  return getXcmWeight;
@@ -903,34 +997,34 @@ var PolkadotJsApi = /*#__PURE__*/function () {
903
997
  }, {
904
998
  key: "getDryRunXcm",
905
999
  value: function () {
906
- var _getDryRunXcm = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee18(_ref6) {
907
- var _ref7, _ref8, _ref9;
1000
+ var _getDryRunXcm = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee19(_ref8) {
1001
+ var _ref9, _ref0, _ref1;
908
1002
  var originLocation, xcm, asset, chain, origin, supportsDryRunApi, response, result, resultJson, symbol, isSuccess, failureReason, emitted, reversedEvents, palletsWithIssued, feeEvent, feeAmount, fee, actualWeight, weight, forwardedXcms, destParaId;
909
- return _regenerator().w(function (_context18) {
910
- while (1) switch (_context18.n) {
1003
+ return _regenerator().w(function (_context19) {
1004
+ while (1) switch (_context19.n) {
911
1005
  case 0:
912
- originLocation = _ref6.originLocation, xcm = _ref6.xcm, asset = _ref6.asset, chain = _ref6.chain, origin = _ref6.origin;
1006
+ originLocation = _ref8.originLocation, xcm = _ref8.xcm, asset = _ref8.asset, chain = _ref8.chain, origin = _ref8.origin;
913
1007
  supportsDryRunApi = sdkCore.getAssetsObject(chain).supportsDryRunApi;
914
1008
  if (supportsDryRunApi) {
915
- _context18.n = 1;
1009
+ _context19.n = 1;
916
1010
  break;
917
1011
  }
918
1012
  throw new sdkCore.ChainNotSupportedError("DryRunApi is not available on chain ".concat(chain));
919
1013
  case 1:
920
- _context18.n = 2;
1014
+ _context19.n = 2;
921
1015
  return this.api.call.dryRunApi.dryRunXcm(originLocation, xcm);
922
1016
  case 2:
923
- response = _context18.v;
1017
+ response = _context19.v;
924
1018
  result = response.toHuman();
925
1019
  resultJson = response.toJSON();
926
1020
  symbol = asset.symbol;
927
1021
  isSuccess = result.Ok && result.Ok.executionResult.Complete;
928
1022
  if (isSuccess) {
929
- _context18.n = 3;
1023
+ _context19.n = 3;
930
1024
  break;
931
1025
  }
932
1026
  failureReason = result.Ok.executionResult.Incomplete.error;
933
- return _context18.a(2, {
1027
+ return _context19.a(2, {
934
1028
  success: false,
935
1029
  failureReason: failureReason,
936
1030
  currency: symbol,
@@ -940,24 +1034,24 @@ var PolkadotJsApi = /*#__PURE__*/function () {
940
1034
  emitted = result.Ok.emittedEvents; // We want to look for the last event
941
1035
  reversedEvents = _toConsumableArray(emitted).reverse();
942
1036
  palletsWithIssued = ['balances', 'foreignAssets', 'assets'];
943
- feeEvent = (_ref7 = (_ref8 = (_ref9 = origin === 'Mythos' ? reversedEvents.find(function (event) {
1037
+ feeEvent = (_ref9 = (_ref0 = (_ref1 = origin === 'Mythos' ? reversedEvents.find(function (event) {
944
1038
  return event.section === 'assetConversion' && event.method === 'SwapCreditExecuted';
945
- }) : undefined) !== null && _ref9 !== void 0 ? _ref9 :
1039
+ }) : undefined) !== null && _ref1 !== void 0 ? _ref1 :
946
1040
  // Prefer an Issued event
947
1041
  reversedEvents.find(function (event) {
948
1042
  return palletsWithIssued.includes(event.section) && event.method === 'Issued';
949
- })) !== null && _ref8 !== void 0 ? _ref8 :
1043
+ })) !== null && _ref0 !== void 0 ? _ref0 :
950
1044
  // Fallback to Minted event
951
1045
  reversedEvents.find(function (event) {
952
1046
  return ['balances', 'foreignAssets'].includes(event.section) && event.method === 'Minted';
953
- })) !== null && _ref7 !== void 0 ? _ref7 : reversedEvents.find(function (event) {
1047
+ })) !== null && _ref9 !== void 0 ? _ref9 : reversedEvents.find(function (event) {
954
1048
  return ['currencies', 'tokens'].includes(event.section) && event.method === 'Deposited';
955
1049
  });
956
1050
  if (feeEvent) {
957
- _context18.n = 4;
1051
+ _context19.n = 4;
958
1052
  break;
959
1053
  }
960
- return _context18.a(2, Promise.resolve({
1054
+ return _context19.a(2, Promise.resolve({
961
1055
  success: false,
962
1056
  failureReason: 'Cannot determine destination fee. No Issued event found',
963
1057
  currency: symbol,
@@ -972,10 +1066,10 @@ var PolkadotJsApi = /*#__PURE__*/function () {
972
1066
  proofSize: BigInt(actualWeight.proofSize)
973
1067
  } : undefined;
974
1068
  forwardedXcms = resultJson.ok.forwardedXcms.length > 0 ? resultJson.ok.forwardedXcms[0] : [];
975
- destParaId = forwardedXcms.length === 0 ? undefined : function (i, _ref0) {
976
- return i.Here ? 0 : (_ref0 = Array.isArray(i.x1) ? i.x1[0] : i.x1) === null || _ref0 === void 0 ? void 0 : _ref0.parachain;
1069
+ destParaId = forwardedXcms.length === 0 ? undefined : function (i, _ref10) {
1070
+ return i.Here ? 0 : (_ref10 = Array.isArray(i.x1) ? i.x1[0] : i.x1) === null || _ref10 === void 0 ? void 0 : _ref10.parachain;
977
1071
  }(Object.values(forwardedXcms[0])[0].interior);
978
- return _context18.a(2, {
1072
+ return _context19.a(2, {
979
1073
  success: true,
980
1074
  fee: fee,
981
1075
  currency: symbol,
@@ -985,9 +1079,9 @@ var PolkadotJsApi = /*#__PURE__*/function () {
985
1079
  destParaId: destParaId
986
1080
  });
987
1081
  }
988
- }, _callee18, this);
1082
+ }, _callee19, this);
989
1083
  }));
990
- function getDryRunXcm(_x35) {
1084
+ function getDryRunXcm(_x36) {
991
1085
  return _getDryRunXcm.apply(this, arguments);
992
1086
  }
993
1087
  return getDryRunXcm;
@@ -995,18 +1089,18 @@ var PolkadotJsApi = /*#__PURE__*/function () {
995
1089
  }, {
996
1090
  key: "getBridgeStatus",
997
1091
  value: function () {
998
- var _getBridgeStatus = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee19() {
1092
+ var _getBridgeStatus = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee20() {
999
1093
  var outboundOperatingMode;
1000
- return _regenerator().w(function (_context19) {
1001
- while (1) switch (_context19.n) {
1094
+ return _regenerator().w(function (_context20) {
1095
+ while (1) switch (_context20.n) {
1002
1096
  case 0:
1003
- _context19.n = 1;
1097
+ _context20.n = 1;
1004
1098
  return this.api.query.ethereumOutboundQueue.operatingMode();
1005
1099
  case 1:
1006
- outboundOperatingMode = _context19.v;
1007
- return _context19.a(2, outboundOperatingMode.toPrimitive());
1100
+ outboundOperatingMode = _context20.v;
1101
+ return _context20.a(2, outboundOperatingMode.toPrimitive());
1008
1102
  }
1009
- }, _callee19, this);
1103
+ }, _callee20, this);
1010
1104
  }));
1011
1105
  function getBridgeStatus() {
1012
1106
  return _getBridgeStatus.apply(this, arguments);
@@ -1026,38 +1120,38 @@ var PolkadotJsApi = /*#__PURE__*/function () {
1026
1120
  }, {
1027
1121
  key: "disconnect",
1028
1122
  value: function () {
1029
- var _disconnect = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee20() {
1123
+ var _disconnect = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee21() {
1030
1124
  var _this$_config$apiOver2;
1031
1125
  var force,
1032
1126
  api,
1033
- _args20 = arguments;
1034
- return _regenerator().w(function (_context20) {
1035
- while (1) switch (_context20.n) {
1127
+ _args21 = arguments;
1128
+ return _regenerator().w(function (_context21) {
1129
+ while (1) switch (_context21.n) {
1036
1130
  case 0:
1037
- force = _args20.length > 0 && _args20[0] !== undefined ? _args20[0] : false;
1131
+ force = _args21.length > 0 && _args21[0] !== undefined ? _args21[0] : false;
1038
1132
  if (this.initialized) {
1039
- _context20.n = 1;
1133
+ _context21.n = 1;
1040
1134
  break;
1041
1135
  }
1042
- return _context20.a(2, Promise.resolve());
1136
+ return _context21.a(2, Promise.resolve());
1043
1137
  case 1:
1044
1138
  if (!(!force && !this.disconnectAllowed)) {
1045
- _context20.n = 2;
1139
+ _context21.n = 2;
1046
1140
  break;
1047
1141
  }
1048
- return _context20.a(2);
1142
+ return _context21.a(2);
1049
1143
  case 2:
1050
1144
  api = sdkCore.isConfig(this._config) ? (_this$_config$apiOver2 = this._config.apiOverrides) === null || _this$_config$apiOver2 === void 0 ? void 0 : _this$_config$apiOver2[this._chain] : this._config; // Disconnect api only if it was created automatically
1051
1145
  if (!(force || typeof api === 'string' || api === undefined)) {
1052
- _context20.n = 3;
1146
+ _context21.n = 3;
1053
1147
  break;
1054
1148
  }
1055
- _context20.n = 3;
1149
+ _context21.n = 3;
1056
1150
  return this.api.disconnect();
1057
1151
  case 3:
1058
- return _context20.a(2);
1152
+ return _context21.a(2);
1059
1153
  }
1060
- }, _callee20, this);
1154
+ }, _callee21, this);
1061
1155
  }));
1062
1156
  function disconnect() {
1063
1157
  return _disconnect.apply(this, arguments);
package/dist/index.d.ts CHANGED
@@ -57,6 +57,8 @@ declare const getBalanceNative: (options: _paraspell_sdk_core.TGetBalanceNativeO
57
57
  * @returns The balance of the foreign asset as a bigint, or null if not found.
58
58
  */
59
59
  declare const getBalanceForeign: (options: _paraspell_sdk_core.TGetBalanceForeignOptionsBase & {
60
+ currency: _paraspell_sdk_core.TCurrencyCore;
61
+ } & {
60
62
  api?: TPjsApiOrUrl;
61
63
  }) => Promise<bigint>;
62
64
  /**
package/dist/index.mjs CHANGED
@@ -775,64 +775,158 @@ var PolkadotJsApi = /*#__PURE__*/function () {
775
775
  }, {
776
776
  key: "getDryRunCall",
777
777
  value: function () {
778
- var _getDryRunCall = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee15(_ref4) {
779
- var _this$api$call$dryRun, _feeAsset$symbol;
780
- var tx, address, asset, feeAsset, chain, supportsDryRunApi, chainsRequiringVersionParam, needsVersionParam, DEFAULT_XCM_VERSION, response, result, resultJson, usedSymbol, usedAsset, isSuccess, moduleError, failureReason, executionFee, fee, actualWeight, weight, forwardedXcms, destParaId;
781
- return _regenerator().w(function (_context15) {
782
- while (1) switch (_context15.n) {
778
+ var _getDryRunCall = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee16(_ref4) {
779
+ var _feeAsset$symbol,
780
+ _this = this;
781
+ var tx, address, asset, feeAsset, chain, supportsDryRunApi, DEFAULT_XCM_VERSION, usedSymbol, usedAsset, performDryRunCall, getExecutionSuccessFromResult, extractFailureReasonFromResult, response, resultHuman, resultJson, isSuccess, failureReason, shouldRetryWithVersion, msg, _msg, executionFee, fee, actualWeight, weight, forwardedXcms, destParaId, _t, _t2;
782
+ return _regenerator().w(function (_context16) {
783
+ while (1) switch (_context16.p = _context16.n) {
783
784
  case 0:
784
785
  tx = _ref4.tx, address = _ref4.address, asset = _ref4.asset, feeAsset = _ref4.feeAsset, chain = _ref4.chain;
785
786
  supportsDryRunApi = getAssetsObject(chain).supportsDryRunApi;
786
787
  if (supportsDryRunApi) {
787
- _context15.n = 1;
788
+ _context16.n = 1;
788
789
  break;
789
790
  }
790
791
  throw new ChainNotSupportedError("DryRunApi is not available on chain ".concat(chain));
791
792
  case 1:
792
- chainsRequiringVersionParam = ['BifrostPolkadot', 'BifrostKusama', 'AssetHubKusama', 'AssetHubPolkadot', 'Kusama', 'Polkadot', 'Polimec', 'Astar'];
793
- needsVersionParam = chainsRequiringVersionParam.includes(chain);
794
793
  DEFAULT_XCM_VERSION = 3;
795
- _context15.n = 2;
796
- return (_this$api$call$dryRun = this.api.call.dryRunApi).dryRunCall.apply(_this$api$call$dryRun, [{
797
- system: {
798
- Signed: address
799
- }
800
- }, tx].concat(_toConsumableArray(needsVersionParam ? [DEFAULT_XCM_VERSION] : [])));
801
- case 2:
802
- response = _context15.v;
803
- result = response.toHuman();
804
- resultJson = response.toJSON();
805
794
  usedSymbol = (_feeAsset$symbol = feeAsset === null || feeAsset === void 0 ? void 0 : feeAsset.symbol) !== null && _feeAsset$symbol !== void 0 ? _feeAsset$symbol : asset === null || asset === void 0 ? void 0 : asset.symbol;
806
795
  usedAsset = feeAsset !== null && feeAsset !== void 0 ? feeAsset : asset;
807
- isSuccess = result.Ok && result.Ok.executionResult.Ok;
808
- if (isSuccess) {
809
- _context15.n = 3;
796
+ performDryRunCall = /*#__PURE__*/function () {
797
+ var _ref5 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee15(includeVersion) {
798
+ var _this$api$call$dryRun;
799
+ return _regenerator().w(function (_context15) {
800
+ while (1) switch (_context15.n) {
801
+ case 0:
802
+ return _context15.a(2, (_this$api$call$dryRun = _this.api.call.dryRunApi).dryRunCall.apply(_this$api$call$dryRun, [{
803
+ system: {
804
+ Signed: address
805
+ }
806
+ }, tx].concat(_toConsumableArray(includeVersion ? [DEFAULT_XCM_VERSION] : []))));
807
+ }
808
+ }, _callee15);
809
+ }));
810
+ return function performDryRunCall(_x31) {
811
+ return _ref5.apply(this, arguments);
812
+ };
813
+ }();
814
+ getExecutionSuccessFromResult = function getExecutionSuccessFromResult(resultHuman) {
815
+ var _resultHuman$Ok$execu;
816
+ 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));
817
+ };
818
+ extractFailureReasonFromResult = function extractFailureReasonFromResult(resultHuman, resultJson) {
819
+ var _resultHuman$Ok, _resultHuman$Ok2, _resultJson$ok, _ref6;
820
+ var modErrHuman = resultHuman === null || resultHuman === void 0 || (_resultHuman$Ok = resultHuman.Ok) === null || _resultHuman$Ok === void 0 || (_resultHuman$Ok = _resultHuman$Ok.executionResult) === null || _resultHuman$Ok === void 0 || (_resultHuman$Ok = _resultHuman$Ok.Err) === null || _resultHuman$Ok === void 0 || (_resultHuman$Ok = _resultHuman$Ok.error) === null || _resultHuman$Ok === void 0 ? void 0 : _resultHuman$Ok.Module;
821
+ if (modErrHuman) {
822
+ return resolveModuleError(chain, modErrHuman);
823
+ }
824
+ var otherErrHuman = 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.Other;
825
+ if (otherErrHuman) {
826
+ return String(otherErrHuman);
827
+ }
828
+ var execErrJson = resultJson === null || resultJson === void 0 || (_resultJson$ok = resultJson.ok) === null || _resultJson$ok === void 0 || (_resultJson$ok = _resultJson$ok.executionResult) === null || _resultJson$ok === void 0 || (_resultJson$ok = _resultJson$ok.err) === null || _resultJson$ok === void 0 ? void 0 : _resultJson$ok.error;
829
+ if (execErrJson !== null && execErrJson !== void 0 && execErrJson.module) {
830
+ return resolveModuleError(chain, execErrJson.module);
831
+ }
832
+ if (execErrJson !== null && execErrJson !== void 0 && execErrJson.other) {
833
+ return String(execErrJson.other);
834
+ }
835
+ return JSON.stringify((_ref6 = resultJson !== null && resultJson !== void 0 ? resultJson : resultHuman) !== null && _ref6 !== void 0 ? _ref6 : 'Unknown error');
836
+ }; // Attempt 1: WITHOUT version
837
+ isSuccess = false;
838
+ failureReason = '';
839
+ shouldRetryWithVersion = false;
840
+ _context16.p = 2;
841
+ _context16.n = 3;
842
+ return performDryRunCall(false);
843
+ case 3:
844
+ response = _context16.v;
845
+ resultHuman = response.toHuman();
846
+ resultJson = response.toJSON();
847
+ isSuccess = getExecutionSuccessFromResult(resultHuman);
848
+ if (!isSuccess) {
849
+ failureReason = extractFailureReasonFromResult(resultHuman, resultJson);
850
+ if (failureReason === 'VersionedConversionFailed') {
851
+ shouldRetryWithVersion = true;
852
+ }
853
+ }
854
+ _context16.n = 6;
855
+ break;
856
+ case 4:
857
+ _context16.p = 4;
858
+ _t = _context16.v;
859
+ msg = _t instanceof Error ? _t.message : String(_t);
860
+ if (!msg.includes('Expected 3 arguments')) {
861
+ _context16.n = 5;
810
862
  break;
811
863
  }
812
- moduleError = result.Ok.executionResult.Err.error.Module;
813
- failureReason = resolveModuleError(chain, moduleError);
814
- return _context15.a(2, {
864
+ shouldRetryWithVersion = true;
865
+ _context16.n = 6;
866
+ break;
867
+ case 5:
868
+ return _context16.a(2, {
869
+ success: false,
870
+ failureReason: msg,
871
+ currency: usedSymbol,
872
+ asset: usedAsset
873
+ });
874
+ case 6:
875
+ if (!shouldRetryWithVersion) {
876
+ _context16.n = 10;
877
+ break;
878
+ }
879
+ _context16.p = 7;
880
+ _context16.n = 8;
881
+ return performDryRunCall(true);
882
+ case 8:
883
+ response = _context16.v;
884
+ resultHuman = response.toHuman();
885
+ resultJson = response.toJSON();
886
+ isSuccess = getExecutionSuccessFromResult(resultHuman);
887
+ if (!isSuccess) {
888
+ failureReason = extractFailureReasonFromResult(resultHuman, resultJson);
889
+ }
890
+ _context16.n = 10;
891
+ break;
892
+ case 9:
893
+ _context16.p = 9;
894
+ _t2 = _context16.v;
895
+ _msg = _t2 instanceof Error ? _t2.message : String(_t2);
896
+ failureReason = failureReason || _msg;
897
+ return _context16.a(2, {
815
898
  success: false,
816
899
  failureReason: failureReason,
817
900
  currency: usedSymbol,
818
901
  asset: usedAsset
819
902
  });
820
- case 3:
821
- _context15.n = 4;
903
+ case 10:
904
+ if (isSuccess) {
905
+ _context16.n = 11;
906
+ break;
907
+ }
908
+ return _context16.a(2, {
909
+ success: false,
910
+ failureReason: failureReason || 'Unknown error',
911
+ currency: usedSymbol,
912
+ asset: usedAsset
913
+ });
914
+ case 11:
915
+ _context16.n = 12;
822
916
  return this.calculateTransactionFee(tx, address);
823
- case 4:
824
- executionFee = _context15.v;
825
- fee = computeFeeFromDryRunPjs(result, chain, executionFee);
917
+ case 12:
918
+ executionFee = _context16.v;
919
+ fee = computeFeeFromDryRunPjs(resultHuman, chain, executionFee);
826
920
  actualWeight = resultJson.ok.executionResult.ok.actualWeight;
827
921
  weight = actualWeight ? {
828
922
  refTime: BigInt(actualWeight.refTime),
829
923
  proofSize: BigInt(actualWeight.proofSize)
830
924
  } : undefined;
831
925
  forwardedXcms = resultJson.ok.forwardedXcms.length > 0 ? resultJson.ok.forwardedXcms[0] : [];
832
- destParaId = forwardedXcms.length === 0 ? undefined : function (i, _ref5) {
833
- return i.here === null ? 0 : (_ref5 = Array.isArray(i.x1) ? i.x1[0] : i.x1) === null || _ref5 === void 0 ? void 0 : _ref5.parachain;
926
+ destParaId = forwardedXcms.length === 0 ? undefined : function (i, _ref7) {
927
+ return i.here === null ? 0 : (_ref7 = Array.isArray(i.x1) ? i.x1[0] : i.x1) === null || _ref7 === void 0 ? void 0 : _ref7.parachain;
834
928
  }(Object.values(forwardedXcms[0])[0].interior);
835
- return _context15.a(2, {
929
+ return _context16.a(2, {
836
930
  success: true,
837
931
  fee: fee,
838
932
  currency: usedSymbol,
@@ -842,7 +936,7 @@ var PolkadotJsApi = /*#__PURE__*/function () {
842
936
  destParaId: destParaId
843
937
  });
844
938
  }
845
- }, _callee15, this);
939
+ }, _callee16, this, [[7, 9], [2, 4]]);
846
940
  }));
847
941
  function getDryRunCall(_x30) {
848
942
  return _getDryRunCall.apply(this, arguments);
@@ -852,27 +946,27 @@ var PolkadotJsApi = /*#__PURE__*/function () {
852
946
  }, {
853
947
  key: "getXcmPaymentApiFee",
854
948
  value: function () {
855
- var _getXcmPaymentApiFee = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee16(chain, xcm, asset) {
949
+ var _getXcmPaymentApiFee = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee17(chain, xcm, asset) {
856
950
  var weight, localizedLocation, feeResult, res;
857
- return _regenerator().w(function (_context16) {
858
- while (1) switch (_context16.n) {
951
+ return _regenerator().w(function (_context17) {
952
+ while (1) switch (_context17.n) {
859
953
  case 0:
860
- _context16.n = 1;
954
+ _context17.n = 1;
861
955
  return this.getXcmWeight(xcm);
862
956
  case 1:
863
- weight = _context16.v;
957
+ weight = _context17.v;
864
958
  assertHasLocation(asset);
865
959
  localizedLocation = chain === 'AssetHubPolkadot' || chain === 'AssetHubKusama' || isRelayChain(chain) ? localizeLocation(chain, asset.location) : asset.location;
866
- _context16.n = 2;
960
+ _context17.n = 2;
867
961
  return this.api.call.xcmPaymentApi.queryWeightToAssetFee(weight, addXcmVersionHeader(localizedLocation, Version.V4));
868
962
  case 2:
869
- feeResult = _context16.v;
963
+ feeResult = _context17.v;
870
964
  res = feeResult.toJSON();
871
- return _context16.a(2, BigInt(res.ok));
965
+ return _context17.a(2, BigInt(res.ok));
872
966
  }
873
- }, _callee16, this);
967
+ }, _callee17, this);
874
968
  }));
875
- function getXcmPaymentApiFee(_x31, _x32, _x33) {
969
+ function getXcmPaymentApiFee(_x32, _x33, _x34) {
876
970
  return _getXcmPaymentApiFee.apply(this, arguments);
877
971
  }
878
972
  return getXcmPaymentApiFee;
@@ -880,21 +974,21 @@ var PolkadotJsApi = /*#__PURE__*/function () {
880
974
  }, {
881
975
  key: "getXcmWeight",
882
976
  value: function () {
883
- var _getXcmWeight = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee17(xcm) {
977
+ var _getXcmWeight = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee18(xcm) {
884
978
  var result, resultJson;
885
- return _regenerator().w(function (_context17) {
886
- while (1) switch (_context17.n) {
979
+ return _regenerator().w(function (_context18) {
980
+ while (1) switch (_context18.n) {
887
981
  case 0:
888
- _context17.n = 1;
982
+ _context18.n = 1;
889
983
  return this.api.call.xcmPaymentApi.queryXcmWeight(xcm);
890
984
  case 1:
891
- result = _context17.v;
985
+ result = _context18.v;
892
986
  resultJson = result.toJSON();
893
- return _context17.a(2, resultJson.ok);
987
+ return _context18.a(2, resultJson.ok);
894
988
  }
895
- }, _callee17, this);
989
+ }, _callee18, this);
896
990
  }));
897
- function getXcmWeight(_x34) {
991
+ function getXcmWeight(_x35) {
898
992
  return _getXcmWeight.apply(this, arguments);
899
993
  }
900
994
  return getXcmWeight;
@@ -902,34 +996,34 @@ var PolkadotJsApi = /*#__PURE__*/function () {
902
996
  }, {
903
997
  key: "getDryRunXcm",
904
998
  value: function () {
905
- var _getDryRunXcm = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee18(_ref6) {
906
- var _ref7, _ref8, _ref9;
999
+ var _getDryRunXcm = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee19(_ref8) {
1000
+ var _ref9, _ref0, _ref1;
907
1001
  var originLocation, xcm, asset, chain, origin, supportsDryRunApi, response, result, resultJson, symbol, isSuccess, failureReason, emitted, reversedEvents, palletsWithIssued, feeEvent, feeAmount, fee, actualWeight, weight, forwardedXcms, destParaId;
908
- return _regenerator().w(function (_context18) {
909
- while (1) switch (_context18.n) {
1002
+ return _regenerator().w(function (_context19) {
1003
+ while (1) switch (_context19.n) {
910
1004
  case 0:
911
- originLocation = _ref6.originLocation, xcm = _ref6.xcm, asset = _ref6.asset, chain = _ref6.chain, origin = _ref6.origin;
1005
+ originLocation = _ref8.originLocation, xcm = _ref8.xcm, asset = _ref8.asset, chain = _ref8.chain, origin = _ref8.origin;
912
1006
  supportsDryRunApi = getAssetsObject(chain).supportsDryRunApi;
913
1007
  if (supportsDryRunApi) {
914
- _context18.n = 1;
1008
+ _context19.n = 1;
915
1009
  break;
916
1010
  }
917
1011
  throw new ChainNotSupportedError("DryRunApi is not available on chain ".concat(chain));
918
1012
  case 1:
919
- _context18.n = 2;
1013
+ _context19.n = 2;
920
1014
  return this.api.call.dryRunApi.dryRunXcm(originLocation, xcm);
921
1015
  case 2:
922
- response = _context18.v;
1016
+ response = _context19.v;
923
1017
  result = response.toHuman();
924
1018
  resultJson = response.toJSON();
925
1019
  symbol = asset.symbol;
926
1020
  isSuccess = result.Ok && result.Ok.executionResult.Complete;
927
1021
  if (isSuccess) {
928
- _context18.n = 3;
1022
+ _context19.n = 3;
929
1023
  break;
930
1024
  }
931
1025
  failureReason = result.Ok.executionResult.Incomplete.error;
932
- return _context18.a(2, {
1026
+ return _context19.a(2, {
933
1027
  success: false,
934
1028
  failureReason: failureReason,
935
1029
  currency: symbol,
@@ -939,24 +1033,24 @@ var PolkadotJsApi = /*#__PURE__*/function () {
939
1033
  emitted = result.Ok.emittedEvents; // We want to look for the last event
940
1034
  reversedEvents = _toConsumableArray(emitted).reverse();
941
1035
  palletsWithIssued = ['balances', 'foreignAssets', 'assets'];
942
- feeEvent = (_ref7 = (_ref8 = (_ref9 = origin === 'Mythos' ? reversedEvents.find(function (event) {
1036
+ feeEvent = (_ref9 = (_ref0 = (_ref1 = origin === 'Mythos' ? reversedEvents.find(function (event) {
943
1037
  return event.section === 'assetConversion' && event.method === 'SwapCreditExecuted';
944
- }) : undefined) !== null && _ref9 !== void 0 ? _ref9 :
1038
+ }) : undefined) !== null && _ref1 !== void 0 ? _ref1 :
945
1039
  // Prefer an Issued event
946
1040
  reversedEvents.find(function (event) {
947
1041
  return palletsWithIssued.includes(event.section) && event.method === 'Issued';
948
- })) !== null && _ref8 !== void 0 ? _ref8 :
1042
+ })) !== null && _ref0 !== void 0 ? _ref0 :
949
1043
  // Fallback to Minted event
950
1044
  reversedEvents.find(function (event) {
951
1045
  return ['balances', 'foreignAssets'].includes(event.section) && event.method === 'Minted';
952
- })) !== null && _ref7 !== void 0 ? _ref7 : reversedEvents.find(function (event) {
1046
+ })) !== null && _ref9 !== void 0 ? _ref9 : reversedEvents.find(function (event) {
953
1047
  return ['currencies', 'tokens'].includes(event.section) && event.method === 'Deposited';
954
1048
  });
955
1049
  if (feeEvent) {
956
- _context18.n = 4;
1050
+ _context19.n = 4;
957
1051
  break;
958
1052
  }
959
- return _context18.a(2, Promise.resolve({
1053
+ return _context19.a(2, Promise.resolve({
960
1054
  success: false,
961
1055
  failureReason: 'Cannot determine destination fee. No Issued event found',
962
1056
  currency: symbol,
@@ -971,10 +1065,10 @@ var PolkadotJsApi = /*#__PURE__*/function () {
971
1065
  proofSize: BigInt(actualWeight.proofSize)
972
1066
  } : undefined;
973
1067
  forwardedXcms = resultJson.ok.forwardedXcms.length > 0 ? resultJson.ok.forwardedXcms[0] : [];
974
- destParaId = forwardedXcms.length === 0 ? undefined : function (i, _ref0) {
975
- return i.Here ? 0 : (_ref0 = Array.isArray(i.x1) ? i.x1[0] : i.x1) === null || _ref0 === void 0 ? void 0 : _ref0.parachain;
1068
+ destParaId = forwardedXcms.length === 0 ? undefined : function (i, _ref10) {
1069
+ return i.Here ? 0 : (_ref10 = Array.isArray(i.x1) ? i.x1[0] : i.x1) === null || _ref10 === void 0 ? void 0 : _ref10.parachain;
976
1070
  }(Object.values(forwardedXcms[0])[0].interior);
977
- return _context18.a(2, {
1071
+ return _context19.a(2, {
978
1072
  success: true,
979
1073
  fee: fee,
980
1074
  currency: symbol,
@@ -984,9 +1078,9 @@ var PolkadotJsApi = /*#__PURE__*/function () {
984
1078
  destParaId: destParaId
985
1079
  });
986
1080
  }
987
- }, _callee18, this);
1081
+ }, _callee19, this);
988
1082
  }));
989
- function getDryRunXcm(_x35) {
1083
+ function getDryRunXcm(_x36) {
990
1084
  return _getDryRunXcm.apply(this, arguments);
991
1085
  }
992
1086
  return getDryRunXcm;
@@ -994,18 +1088,18 @@ var PolkadotJsApi = /*#__PURE__*/function () {
994
1088
  }, {
995
1089
  key: "getBridgeStatus",
996
1090
  value: function () {
997
- var _getBridgeStatus = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee19() {
1091
+ var _getBridgeStatus = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee20() {
998
1092
  var outboundOperatingMode;
999
- return _regenerator().w(function (_context19) {
1000
- while (1) switch (_context19.n) {
1093
+ return _regenerator().w(function (_context20) {
1094
+ while (1) switch (_context20.n) {
1001
1095
  case 0:
1002
- _context19.n = 1;
1096
+ _context20.n = 1;
1003
1097
  return this.api.query.ethereumOutboundQueue.operatingMode();
1004
1098
  case 1:
1005
- outboundOperatingMode = _context19.v;
1006
- return _context19.a(2, outboundOperatingMode.toPrimitive());
1099
+ outboundOperatingMode = _context20.v;
1100
+ return _context20.a(2, outboundOperatingMode.toPrimitive());
1007
1101
  }
1008
- }, _callee19, this);
1102
+ }, _callee20, this);
1009
1103
  }));
1010
1104
  function getBridgeStatus() {
1011
1105
  return _getBridgeStatus.apply(this, arguments);
@@ -1025,38 +1119,38 @@ var PolkadotJsApi = /*#__PURE__*/function () {
1025
1119
  }, {
1026
1120
  key: "disconnect",
1027
1121
  value: function () {
1028
- var _disconnect = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee20() {
1122
+ var _disconnect = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee21() {
1029
1123
  var _this$_config$apiOver2;
1030
1124
  var force,
1031
1125
  api,
1032
- _args20 = arguments;
1033
- return _regenerator().w(function (_context20) {
1034
- while (1) switch (_context20.n) {
1126
+ _args21 = arguments;
1127
+ return _regenerator().w(function (_context21) {
1128
+ while (1) switch (_context21.n) {
1035
1129
  case 0:
1036
- force = _args20.length > 0 && _args20[0] !== undefined ? _args20[0] : false;
1130
+ force = _args21.length > 0 && _args21[0] !== undefined ? _args21[0] : false;
1037
1131
  if (this.initialized) {
1038
- _context20.n = 1;
1132
+ _context21.n = 1;
1039
1133
  break;
1040
1134
  }
1041
- return _context20.a(2, Promise.resolve());
1135
+ return _context21.a(2, Promise.resolve());
1042
1136
  case 1:
1043
1137
  if (!(!force && !this.disconnectAllowed)) {
1044
- _context20.n = 2;
1138
+ _context21.n = 2;
1045
1139
  break;
1046
1140
  }
1047
- return _context20.a(2);
1141
+ return _context21.a(2);
1048
1142
  case 2:
1049
1143
  api = isConfig(this._config) ? (_this$_config$apiOver2 = this._config.apiOverrides) === null || _this$_config$apiOver2 === void 0 ? void 0 : _this$_config$apiOver2[this._chain] : this._config; // Disconnect api only if it was created automatically
1050
1144
  if (!(force || typeof api === 'string' || api === undefined)) {
1051
- _context20.n = 3;
1145
+ _context21.n = 3;
1052
1146
  break;
1053
1147
  }
1054
- _context20.n = 3;
1148
+ _context21.n = 3;
1055
1149
  return this.api.disconnect();
1056
1150
  case 3:
1057
- return _context20.a(2);
1151
+ return _context21.a(2);
1058
1152
  }
1059
- }, _callee20, this);
1153
+ }, _callee21, this);
1060
1154
  }));
1061
1155
  function disconnect() {
1062
1156
  return _disconnect.apply(this, arguments);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paraspell/sdk-pjs",
3
- "version": "11.3.1",
3
+ "version": "11.4.0",
4
4
  "description": "Polkadot.js based SDK for ParaSpell XCM/XCMP tool for developers",
5
5
  "repository": {
6
6
  "type": "git",
@@ -27,7 +27,7 @@
27
27
  "@snowbridge/contract-types": "0.2.0",
28
28
  "ethers": "^6.15.0",
29
29
  "viem": "^2.36.0",
30
- "@paraspell/sdk-core": "11.3.1"
30
+ "@paraspell/sdk-core": "11.4.0"
31
31
  },
32
32
  "peerDependencies": {
33
33
  "@polkadot/api": ">= 16.0 < 17",