@paraspell/sdk-pjs 11.13.0 → 11.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -793,7 +793,7 @@ var PolkadotJsApi = /*#__PURE__*/function () {
793
793
  value: function () {
794
794
  var _getDryRunCall = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee16(options) {
795
795
  var _this = this;
796
- var tx, address, feeAsset, chain, destination, _options$useRootOrigi, useRootOrigin, bypassOptions, supportsDryRunApi, DEFAULT_XCM_VERSION, basePayload, resolvedTx, usedAsset, usedSymbol, performDryRunCall, getExecutionSuccessFromResult, extractFailureReasonFromResult, response, resultHuman, resultJson, isSuccess, failureReason, shouldRetryWithVersion, msg, _msg, forwardedXcms, actualWeight, weight, nativeAsset, hasLocation, destParaId, xcmFee, executionFee, fee, _t, _t2, _t3;
796
+ var tx, address, feeAsset, chain, destination, _options$useRootOrigi, useRootOrigin, bypassOptions, supportsDryRunApi, DEFAULT_XCM_VERSION, basePayload, resolvedTx, usedAsset, usedSymbol, performDryRunCall, getExecutionSuccessFromResult, extractFailureReasonFromResult, response, resultHuman, resultJson, isSuccess, failureErr, shouldRetryWithVersion, msg, _msg, forwardedXcms, actualWeight, weight, nativeAsset, hasLocation, destParaId, xcmFee, executionFee, fee, _t, _t2, _t3;
797
797
  return _regenerator().w(function (_context16) {
798
798
  while (1) switch (_context16.p = _context16.n) {
799
799
  case 0:
@@ -859,19 +859,27 @@ var PolkadotJsApi = /*#__PURE__*/function () {
859
859
  }
860
860
  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;
861
861
  if (otherErrHuman) {
862
- return String(otherErrHuman);
862
+ return {
863
+ failureReason: String(otherErrHuman)
864
+ };
863
865
  }
864
866
  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;
865
867
  if (execErrJson !== null && execErrJson !== void 0 && execErrJson.module) {
866
868
  return sdkCore.resolveModuleError(chain, execErrJson.module);
867
869
  }
868
870
  if (execErrJson !== null && execErrJson !== void 0 && execErrJson.other) {
869
- return String(execErrJson.other);
871
+ return {
872
+ failureReason: String(execErrJson.other)
873
+ };
870
874
  }
871
- return JSON.stringify((_ref5 = resultJson !== null && resultJson !== void 0 ? resultJson : resultHuman) !== null && _ref5 !== void 0 ? _ref5 : 'Unknown error');
875
+ return {
876
+ failureReason: JSON.stringify((_ref5 = resultJson !== null && resultJson !== void 0 ? resultJson : resultHuman) !== null && _ref5 !== void 0 ? _ref5 : 'Unknown error')
877
+ };
872
878
  }; // Attempt 1: WITHOUT version
873
879
  isSuccess = false;
874
- failureReason = '';
880
+ failureErr = {
881
+ failureReason: ''
882
+ };
875
883
  shouldRetryWithVersion = false;
876
884
  _context16.p = 5;
877
885
  _context16.n = 6;
@@ -882,8 +890,8 @@ var PolkadotJsApi = /*#__PURE__*/function () {
882
890
  resultJson = response.toJSON();
883
891
  isSuccess = getExecutionSuccessFromResult(resultHuman);
884
892
  if (!isSuccess) {
885
- failureReason = extractFailureReasonFromResult(resultHuman, resultJson);
886
- if (failureReason === 'VersionedConversionFailed') {
893
+ failureErr = extractFailureReasonFromResult(resultHuman, resultJson);
894
+ if (failureErr.failureReason === 'VersionedConversionFailed') {
887
895
  shouldRetryWithVersion = true;
888
896
  }
889
897
  }
@@ -921,7 +929,7 @@ var PolkadotJsApi = /*#__PURE__*/function () {
921
929
  resultJson = response.toJSON();
922
930
  isSuccess = getExecutionSuccessFromResult(resultHuman);
923
931
  if (!isSuccess) {
924
- failureReason = extractFailureReasonFromResult(resultHuman, resultJson);
932
+ failureErr = extractFailureReasonFromResult(resultHuman, resultJson);
925
933
  }
926
934
  _context16.n = 13;
927
935
  break;
@@ -929,10 +937,11 @@ var PolkadotJsApi = /*#__PURE__*/function () {
929
937
  _context16.p = 12;
930
938
  _t3 = _context16.v;
931
939
  _msg = _t3 instanceof Error ? _t3.message : String(_t3);
932
- failureReason = failureReason || _msg;
940
+ failureErr = failureErr || _msg;
933
941
  return _context16.a(2, {
934
942
  success: false,
935
- failureReason: failureReason,
943
+ failureReason: failureErr.failureReason,
944
+ failureSubReason: failureErr.failureSubReason,
936
945
  currency: usedSymbol,
937
946
  asset: usedAsset
938
947
  });
@@ -943,7 +952,8 @@ var PolkadotJsApi = /*#__PURE__*/function () {
943
952
  }
944
953
  return _context16.a(2, {
945
954
  success: false,
946
- failureReason: failureReason || 'Unknown error',
955
+ failureReason: failureErr.failureReason || 'Unknown error',
956
+ failureSubReason: failureErr.failureSubReason,
947
957
  currency: usedSymbol,
948
958
  asset: usedAsset
949
959
  });
@@ -1099,7 +1109,7 @@ var PolkadotJsApi = /*#__PURE__*/function () {
1099
1109
  value: function () {
1100
1110
  var _getDryRunXcm = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee19(_ref9) {
1101
1111
  var _ref1, _ref10, _ref11;
1102
- var originLocation, xcm, asset, chain, origin, supportsDryRunApi, response, result, resultJson, symbol, isSuccess, failureReason, forwardedXcms, actualWeight, weight, destParaId, _fee, emitted, reversedEvents, palletsWithIssued, feeEvent, feeAmount, fee;
1112
+ var originLocation, xcm, asset, chain, origin, supportsDryRunApi, response, result, resultJson, symbol, isSuccess, error, failureReason, forwardedXcms, actualWeight, weight, destParaId, _fee, emitted, reversedEvents, palletsWithIssued, feeEvent, feeAmount, fee;
1103
1113
  return _regenerator().w(function (_context19) {
1104
1114
  while (1) switch (_context19.n) {
1105
1115
  case 0:
@@ -1123,7 +1133,8 @@ var PolkadotJsApi = /*#__PURE__*/function () {
1123
1133
  _context19.n = 3;
1124
1134
  break;
1125
1135
  }
1126
- failureReason = result.Ok.executionResult.Incomplete.error;
1136
+ error = result.Ok.executionResult.Incomplete.error;
1137
+ failureReason = typeof error === 'string' ? error : error.error;
1127
1138
  return _context19.a(2, {
1128
1139
  success: false,
1129
1140
  failureReason: failureReason,
package/dist/index.mjs CHANGED
@@ -792,7 +792,7 @@ var PolkadotJsApi = /*#__PURE__*/function () {
792
792
  value: function () {
793
793
  var _getDryRunCall = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee16(options) {
794
794
  var _this = this;
795
- var tx, address, feeAsset, chain, destination, _options$useRootOrigi, useRootOrigin, bypassOptions, supportsDryRunApi, DEFAULT_XCM_VERSION, basePayload, resolvedTx, usedAsset, usedSymbol, performDryRunCall, getExecutionSuccessFromResult, extractFailureReasonFromResult, response, resultHuman, resultJson, isSuccess, failureReason, shouldRetryWithVersion, msg, _msg, forwardedXcms, actualWeight, weight, nativeAsset, hasLocation, destParaId, xcmFee, executionFee, fee, _t, _t2, _t3;
795
+ var tx, address, feeAsset, chain, destination, _options$useRootOrigi, useRootOrigin, bypassOptions, supportsDryRunApi, DEFAULT_XCM_VERSION, basePayload, resolvedTx, usedAsset, usedSymbol, performDryRunCall, getExecutionSuccessFromResult, extractFailureReasonFromResult, response, resultHuman, resultJson, isSuccess, failureErr, shouldRetryWithVersion, msg, _msg, forwardedXcms, actualWeight, weight, nativeAsset, hasLocation, destParaId, xcmFee, executionFee, fee, _t, _t2, _t3;
796
796
  return _regenerator().w(function (_context16) {
797
797
  while (1) switch (_context16.p = _context16.n) {
798
798
  case 0:
@@ -858,19 +858,27 @@ var PolkadotJsApi = /*#__PURE__*/function () {
858
858
  }
859
859
  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;
860
860
  if (otherErrHuman) {
861
- return String(otherErrHuman);
861
+ return {
862
+ failureReason: String(otherErrHuman)
863
+ };
862
864
  }
863
865
  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;
864
866
  if (execErrJson !== null && execErrJson !== void 0 && execErrJson.module) {
865
867
  return resolveModuleError(chain, execErrJson.module);
866
868
  }
867
869
  if (execErrJson !== null && execErrJson !== void 0 && execErrJson.other) {
868
- return String(execErrJson.other);
870
+ return {
871
+ failureReason: String(execErrJson.other)
872
+ };
869
873
  }
870
- return JSON.stringify((_ref5 = resultJson !== null && resultJson !== void 0 ? resultJson : resultHuman) !== null && _ref5 !== void 0 ? _ref5 : 'Unknown error');
874
+ return {
875
+ failureReason: JSON.stringify((_ref5 = resultJson !== null && resultJson !== void 0 ? resultJson : resultHuman) !== null && _ref5 !== void 0 ? _ref5 : 'Unknown error')
876
+ };
871
877
  }; // Attempt 1: WITHOUT version
872
878
  isSuccess = false;
873
- failureReason = '';
879
+ failureErr = {
880
+ failureReason: ''
881
+ };
874
882
  shouldRetryWithVersion = false;
875
883
  _context16.p = 5;
876
884
  _context16.n = 6;
@@ -881,8 +889,8 @@ var PolkadotJsApi = /*#__PURE__*/function () {
881
889
  resultJson = response.toJSON();
882
890
  isSuccess = getExecutionSuccessFromResult(resultHuman);
883
891
  if (!isSuccess) {
884
- failureReason = extractFailureReasonFromResult(resultHuman, resultJson);
885
- if (failureReason === 'VersionedConversionFailed') {
892
+ failureErr = extractFailureReasonFromResult(resultHuman, resultJson);
893
+ if (failureErr.failureReason === 'VersionedConversionFailed') {
886
894
  shouldRetryWithVersion = true;
887
895
  }
888
896
  }
@@ -920,7 +928,7 @@ var PolkadotJsApi = /*#__PURE__*/function () {
920
928
  resultJson = response.toJSON();
921
929
  isSuccess = getExecutionSuccessFromResult(resultHuman);
922
930
  if (!isSuccess) {
923
- failureReason = extractFailureReasonFromResult(resultHuman, resultJson);
931
+ failureErr = extractFailureReasonFromResult(resultHuman, resultJson);
924
932
  }
925
933
  _context16.n = 13;
926
934
  break;
@@ -928,10 +936,11 @@ var PolkadotJsApi = /*#__PURE__*/function () {
928
936
  _context16.p = 12;
929
937
  _t3 = _context16.v;
930
938
  _msg = _t3 instanceof Error ? _t3.message : String(_t3);
931
- failureReason = failureReason || _msg;
939
+ failureErr = failureErr || _msg;
932
940
  return _context16.a(2, {
933
941
  success: false,
934
- failureReason: failureReason,
942
+ failureReason: failureErr.failureReason,
943
+ failureSubReason: failureErr.failureSubReason,
935
944
  currency: usedSymbol,
936
945
  asset: usedAsset
937
946
  });
@@ -942,7 +951,8 @@ var PolkadotJsApi = /*#__PURE__*/function () {
942
951
  }
943
952
  return _context16.a(2, {
944
953
  success: false,
945
- failureReason: failureReason || 'Unknown error',
954
+ failureReason: failureErr.failureReason || 'Unknown error',
955
+ failureSubReason: failureErr.failureSubReason,
946
956
  currency: usedSymbol,
947
957
  asset: usedAsset
948
958
  });
@@ -1098,7 +1108,7 @@ var PolkadotJsApi = /*#__PURE__*/function () {
1098
1108
  value: function () {
1099
1109
  var _getDryRunXcm = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee19(_ref9) {
1100
1110
  var _ref1, _ref10, _ref11;
1101
- var originLocation, xcm, asset, chain, origin, supportsDryRunApi, response, result, resultJson, symbol, isSuccess, failureReason, forwardedXcms, actualWeight, weight, destParaId, _fee, emitted, reversedEvents, palletsWithIssued, feeEvent, feeAmount, fee;
1111
+ var originLocation, xcm, asset, chain, origin, supportsDryRunApi, response, result, resultJson, symbol, isSuccess, error, failureReason, forwardedXcms, actualWeight, weight, destParaId, _fee, emitted, reversedEvents, palletsWithIssued, feeEvent, feeAmount, fee;
1102
1112
  return _regenerator().w(function (_context19) {
1103
1113
  while (1) switch (_context19.n) {
1104
1114
  case 0:
@@ -1122,7 +1132,8 @@ var PolkadotJsApi = /*#__PURE__*/function () {
1122
1132
  _context19.n = 3;
1123
1133
  break;
1124
1134
  }
1125
- failureReason = result.Ok.executionResult.Incomplete.error;
1135
+ error = result.Ok.executionResult.Incomplete.error;
1136
+ failureReason = typeof error === 'string' ? error : error.error;
1126
1137
  return _context19.a(2, {
1127
1138
  success: false,
1128
1139
  failureReason: failureReason,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paraspell/sdk-pjs",
3
- "version": "11.13.0",
3
+ "version": "11.14.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.12",
28
28
  "ethers": "^6.15.0",
29
29
  "viem": "^2.38.5",
30
- "@paraspell/sdk-core": "11.13.0"
30
+ "@paraspell/sdk-core": "11.14.0"
31
31
  },
32
32
  "peerDependencies": {
33
33
  "@polkadot/api": ">= 16.0 < 17",