@paraspell/sdk-pjs 12.2.1 → 12.3.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.mjs +137 -104
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getEvmPrivateKeyHex, createClientCache, createClientPoolHelpers, isConfig, getChainProviders, BatchMode, findNativeAssetInfoOrThrow, MissingChainApiError, UnsupportedOperationError, findAssetInfoOrThrow, computeFeeFromDryRunPjs, hasXcmPaymentApiSupport, resolveModuleError, getAssetsObject, RuntimeApiUnavailableError, wrapTxBypass, assertHasLocation, localizeLocation,
|
|
1
|
+
import { getEvmPrivateKeyHex, createClientCache, createClientPoolHelpers, isConfig, getChainProviders, BatchMode, findNativeAssetInfoOrThrow, MissingChainApiError, isExternalChain, UnsupportedOperationError, findAssetInfoOrThrow, computeFeeFromDryRunPjs, hasXcmPaymentApiSupport, resolveModuleError, getAssetsObject, RuntimeApiUnavailableError, wrapTxBypass, assertHasLocation, localizeLocation, addXcmVersionHeader, Version, isAssetXcEqual, RELAY_LOCATION, getRelayChainOf, createChainClient as createChainClient$1, getBalance as getBalance$1, claimAssets as claimAssets$1, Foreign, ForeignAbstract, Native, Override, findAssetInfo, getAllAssetsSymbols, getAssetDecimals, getAssetId, getAssets, getExistentialDeposit, getNativeAssetSymbol, getNativeAssets, getOtherAssets, getRelayChainSymbol, getSupportedAssets, getTChain, hasSupportForAsset, isChainEvm, convertSs58 as convertSs58$1, getParaId, ETH_MAINNET_CHAIN_ID, RoutingResolutionError, abstractDecimals, assertHasId, MissingParameterError, isOverrideLocationSpecifier, transferMoonbeamEvm, transferMoonbeamToEth, validateAddress as validateAddress$1, Builder as Builder$1, getParaEthTransferFees as getParaEthTransferFees$1, DRY_RUN_CLIENT_TIMEOUT_MS, getBridgeStatus as getBridgeStatus$1, send as send$1, 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 { isHex, u8aToHex, hexToU8a, stringToU8a } from '@polkadot/util';
|
|
@@ -319,7 +319,7 @@ var PolkadotJsApi = /*#__PURE__*/function () {
|
|
|
319
319
|
while (1) switch (_context3.n) {
|
|
320
320
|
case 0:
|
|
321
321
|
clientTtlMs = _args.length > 1 && _args[1] !== undefined ? _args[1] : DEFAULT_TTL_MS;
|
|
322
|
-
if (!(this.initialized || chain
|
|
322
|
+
if (!(this.initialized || isExternalChain(chain))) {
|
|
323
323
|
_context3.n = 1;
|
|
324
324
|
break;
|
|
325
325
|
}
|
|
@@ -723,7 +723,7 @@ var PolkadotJsApi = /*#__PURE__*/function () {
|
|
|
723
723
|
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));
|
|
724
724
|
};
|
|
725
725
|
extractFailureReasonFromResult = function extractFailureReasonFromResult(resultHuman, resultJson) {
|
|
726
|
-
var _resultHuman$Ok, _resultHuman$Ok2, _resultJson$ok, _ref6;
|
|
726
|
+
var _resultHuman$Ok, _resultHuman$Ok2, _resultHuman$Ok3, _resultJson$ok, _ref6;
|
|
727
727
|
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;
|
|
728
728
|
if (modErrHuman) {
|
|
729
729
|
return resolveModuleError(chain, modErrHuman);
|
|
@@ -734,6 +734,12 @@ var PolkadotJsApi = /*#__PURE__*/function () {
|
|
|
734
734
|
failureReason: String(otherErrHuman)
|
|
735
735
|
};
|
|
736
736
|
}
|
|
737
|
+
var secondErrHuman = resultHuman === null || resultHuman === void 0 || (_resultHuman$Ok3 = resultHuman.Ok) === null || _resultHuman$Ok3 === void 0 || (_resultHuman$Ok3 = _resultHuman$Ok3.executionResult) === null || _resultHuman$Ok3 === void 0 || (_resultHuman$Ok3 = _resultHuman$Ok3.Err) === null || _resultHuman$Ok3 === void 0 ? void 0 : _resultHuman$Ok3.error;
|
|
738
|
+
if (secondErrHuman) {
|
|
739
|
+
return {
|
|
740
|
+
failureReason: String(secondErrHuman)
|
|
741
|
+
};
|
|
742
|
+
}
|
|
737
743
|
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;
|
|
738
744
|
if (execErrJson !== null && execErrJson !== void 0 && execErrJson.module) {
|
|
739
745
|
return resolveModuleError(chain, execErrJson.module);
|
|
@@ -921,7 +927,6 @@ var PolkadotJsApi = /*#__PURE__*/function () {
|
|
|
921
927
|
key: "getXcmPaymentApiFee",
|
|
922
928
|
value: function () {
|
|
923
929
|
var _getXcmPaymentApiFee = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee11(chain, localXcm, forwardedXcm, asset) {
|
|
924
|
-
var _ref9, _deliveryFeeResJson$o, _deliveryFeeResJson$o2, _deliveryFeeResJson$o3, _ref0, _deliveryFeeResJson$o4, _deliveryFeeResJson$o5, _deliveryFeeResJson$o6;
|
|
925
930
|
var overridenWeight,
|
|
926
931
|
weight,
|
|
927
932
|
assetLocalizedLoc,
|
|
@@ -931,17 +936,11 @@ var PolkadotJsApi = /*#__PURE__*/function () {
|
|
|
931
936
|
execFee,
|
|
932
937
|
isAssetNotFound,
|
|
933
938
|
bridgeHubExecFee,
|
|
934
|
-
deliveryFeeRes,
|
|
935
|
-
deliveryFeeResJson,
|
|
936
|
-
deliveryFeeResolved,
|
|
937
|
-
nativeAsset,
|
|
938
939
|
deliveryFee,
|
|
939
|
-
res,
|
|
940
940
|
_args1 = arguments,
|
|
941
|
-
_t5
|
|
942
|
-
_t6;
|
|
941
|
+
_t5;
|
|
943
942
|
return _regenerator().w(function (_context11) {
|
|
944
|
-
while (1) switch (_context11.
|
|
943
|
+
while (1) switch (_context11.n) {
|
|
945
944
|
case 0:
|
|
946
945
|
overridenWeight = _args1.length > 5 ? _args1[5] : undefined;
|
|
947
946
|
if (!(overridenWeight !== null && overridenWeight !== void 0)) {
|
|
@@ -980,97 +979,131 @@ var PolkadotJsApi = /*#__PURE__*/function () {
|
|
|
980
979
|
execFee = bridgeHubExecFee;
|
|
981
980
|
}
|
|
982
981
|
case 6:
|
|
982
|
+
_context11.n = 7;
|
|
983
|
+
return this.getDeliveryFee(chain, forwardedXcm, asset, assetLocalizedLoc);
|
|
984
|
+
case 7:
|
|
985
|
+
deliveryFee = _context11.v;
|
|
986
|
+
return _context11.a(2, execFee + deliveryFee);
|
|
987
|
+
}
|
|
988
|
+
}, _callee11, this);
|
|
989
|
+
}));
|
|
990
|
+
function getXcmPaymentApiFee(_x15, _x16, _x17, _x18) {
|
|
991
|
+
return _getXcmPaymentApiFee.apply(this, arguments);
|
|
992
|
+
}
|
|
993
|
+
return getXcmPaymentApiFee;
|
|
994
|
+
}()
|
|
995
|
+
}, {
|
|
996
|
+
key: "getDeliveryFee",
|
|
997
|
+
value: function () {
|
|
998
|
+
var _getDeliveryFee = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee12(chain, forwardedXcm, asset, assetLocalizedLoc) {
|
|
999
|
+
var _deliveryFeeRes, _ref9, _deliveryFeeResJson$o, _deliveryFeeResJson$o2, _deliveryFeeResJson$o3, _ref0, _deliveryFeeResJson$o4, _deliveryFeeResJson$o5, _deliveryFeeResJson$o6;
|
|
1000
|
+
var usedThirdParam, deliveryFeeRes, baseArgs, _this$api$call$xcmPay, message, _this$api$call$xcmPay2, versionedAssetLoc, deliveryFeeResJson, deliveryFeeResolved, nativeAsset, res, _t6;
|
|
1001
|
+
return _regenerator().w(function (_context12) {
|
|
1002
|
+
while (1) switch (_context12.p = _context12.n) {
|
|
1003
|
+
case 0:
|
|
1004
|
+
usedThirdParam = false;
|
|
983
1005
|
if (!(forwardedXcm.length > 0)) {
|
|
984
|
-
|
|
1006
|
+
_context12.n = 6;
|
|
985
1007
|
break;
|
|
986
1008
|
}
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
1009
|
+
baseArgs = [forwardedXcm[0], forwardedXcm[1][0]];
|
|
1010
|
+
_context12.p = 1;
|
|
1011
|
+
_context12.n = 2;
|
|
1012
|
+
return (_this$api$call$xcmPay = this.api.call.xcmPaymentApi).queryDeliveryFees.apply(_this$api$call$xcmPay, baseArgs);
|
|
1013
|
+
case 2:
|
|
1014
|
+
deliveryFeeRes = _context12.v;
|
|
1015
|
+
_context12.n = 6;
|
|
992
1016
|
break;
|
|
993
|
-
case
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
1017
|
+
case 3:
|
|
1018
|
+
_context12.p = 3;
|
|
1019
|
+
_t6 = _context12.v;
|
|
1020
|
+
message = _t6 instanceof Error ? _t6.message : String(_t6);
|
|
1021
|
+
if (!message.includes('Expected 3 arguments')) {
|
|
1022
|
+
_context12.n = 5;
|
|
1023
|
+
break;
|
|
1024
|
+
}
|
|
1025
|
+
usedThirdParam = true;
|
|
1026
|
+
versionedAssetLoc = addXcmVersionHeader(assetLocalizedLoc, Version.V4);
|
|
1027
|
+
_context12.n = 4;
|
|
1028
|
+
return (_this$api$call$xcmPay2 = this.api.call.xcmPaymentApi).queryDeliveryFees.apply(_this$api$call$xcmPay2, baseArgs.concat([versionedAssetLoc]));
|
|
1029
|
+
case 4:
|
|
1030
|
+
deliveryFeeRes = _context12.v;
|
|
1031
|
+
_context12.n = 6;
|
|
1032
|
+
break;
|
|
1033
|
+
case 5:
|
|
1034
|
+
throw _t6;
|
|
1035
|
+
case 6:
|
|
1036
|
+
deliveryFeeResJson = (_deliveryFeeRes = deliveryFeeRes) === null || _deliveryFeeRes === void 0 ? void 0 : _deliveryFeeRes.toJSON();
|
|
998
1037
|
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;
|
|
999
1038
|
nativeAsset = findNativeAssetInfoOrThrow(chain);
|
|
1000
|
-
if (!isAssetXcEqual(asset, nativeAsset)) {
|
|
1001
|
-
|
|
1039
|
+
if (!(isAssetXcEqual(asset, nativeAsset) || usedThirdParam)) {
|
|
1040
|
+
_context12.n = 7;
|
|
1002
1041
|
break;
|
|
1003
1042
|
}
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
case 10:
|
|
1008
|
-
_context11.p = 10;
|
|
1043
|
+
return _context12.a(2, deliveryFeeResolved);
|
|
1044
|
+
case 7:
|
|
1045
|
+
_context12.p = 7;
|
|
1009
1046
|
assertHasLocation(nativeAsset);
|
|
1010
|
-
|
|
1047
|
+
_context12.n = 8;
|
|
1011
1048
|
return this.quoteAhPrice(localizeLocation(chain, nativeAsset.location), assetLocalizedLoc, deliveryFeeResolved, false);
|
|
1012
|
-
case
|
|
1013
|
-
res =
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
_context11.v;
|
|
1020
|
-
deliveryFee = 0n;
|
|
1021
|
-
case 13:
|
|
1022
|
-
return _context11.a(2, execFee + deliveryFee);
|
|
1049
|
+
case 8:
|
|
1050
|
+
res = _context12.v;
|
|
1051
|
+
return _context12.a(2, res !== null && res !== void 0 ? res : 0n);
|
|
1052
|
+
case 9:
|
|
1053
|
+
_context12.p = 9;
|
|
1054
|
+
_context12.v;
|
|
1055
|
+
return _context12.a(2, 0n);
|
|
1023
1056
|
}
|
|
1024
|
-
},
|
|
1057
|
+
}, _callee12, this, [[7, 9], [1, 3]]);
|
|
1025
1058
|
}));
|
|
1026
|
-
function
|
|
1027
|
-
return
|
|
1059
|
+
function getDeliveryFee(_x19, _x20, _x21, _x22) {
|
|
1060
|
+
return _getDeliveryFee.apply(this, arguments);
|
|
1028
1061
|
}
|
|
1029
|
-
return
|
|
1062
|
+
return getDeliveryFee;
|
|
1030
1063
|
}()
|
|
1031
1064
|
}, {
|
|
1032
1065
|
key: "getBridgeHubFallbackExecFee",
|
|
1033
1066
|
value: function () {
|
|
1034
|
-
var _getBridgeHubFallbackExecFee = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
1067
|
+
var _getBridgeHubFallbackExecFee = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee13(chain, weightValue, asset) {
|
|
1035
1068
|
var fallbackExecFeeRes, fallbackJson, fallbackOk, fallbackExecFee, ahApi, assetHubChain, ahLocalizedLoc, convertedExecFee;
|
|
1036
|
-
return _regenerator().w(function (
|
|
1037
|
-
while (1) switch (
|
|
1069
|
+
return _regenerator().w(function (_context13) {
|
|
1070
|
+
while (1) switch (_context13.n) {
|
|
1038
1071
|
case 0:
|
|
1039
|
-
|
|
1072
|
+
_context13.n = 1;
|
|
1040
1073
|
return this.api.call.xcmPaymentApi.queryWeightToAssetFee(weightValue, addXcmVersionHeader(RELAY_LOCATION, Version.V4));
|
|
1041
1074
|
case 1:
|
|
1042
|
-
fallbackExecFeeRes =
|
|
1075
|
+
fallbackExecFeeRes = _context13.v;
|
|
1043
1076
|
fallbackJson = fallbackExecFeeRes.toJSON();
|
|
1044
1077
|
fallbackOk = fallbackJson === null || fallbackJson === void 0 ? void 0 : fallbackJson.ok;
|
|
1045
1078
|
fallbackExecFee = typeof fallbackOk === 'string' || typeof fallbackOk === 'number' ? BigInt(fallbackOk) : undefined;
|
|
1046
1079
|
if (!(fallbackExecFee === undefined)) {
|
|
1047
|
-
|
|
1080
|
+
_context13.n = 2;
|
|
1048
1081
|
break;
|
|
1049
1082
|
}
|
|
1050
|
-
return
|
|
1083
|
+
return _context13.a(2, undefined);
|
|
1051
1084
|
case 2:
|
|
1052
1085
|
ahApi = this.clone();
|
|
1053
1086
|
assetHubChain = "AssetHub".concat(getRelayChainOf(chain));
|
|
1054
|
-
|
|
1087
|
+
_context13.n = 3;
|
|
1055
1088
|
return ahApi.init(assetHubChain);
|
|
1056
1089
|
case 3:
|
|
1057
1090
|
assertHasLocation(asset);
|
|
1058
1091
|
ahLocalizedLoc = localizeLocation(assetHubChain, asset.location);
|
|
1059
|
-
|
|
1092
|
+
_context13.n = 4;
|
|
1060
1093
|
return ahApi.quoteAhPrice(RELAY_LOCATION, ahLocalizedLoc, fallbackExecFee, false);
|
|
1061
1094
|
case 4:
|
|
1062
|
-
convertedExecFee =
|
|
1095
|
+
convertedExecFee = _context13.v;
|
|
1063
1096
|
if (!(typeof convertedExecFee === 'bigint')) {
|
|
1064
|
-
|
|
1097
|
+
_context13.n = 5;
|
|
1065
1098
|
break;
|
|
1066
1099
|
}
|
|
1067
|
-
return
|
|
1100
|
+
return _context13.a(2, convertedExecFee);
|
|
1068
1101
|
case 5:
|
|
1069
|
-
return
|
|
1102
|
+
return _context13.a(2, undefined);
|
|
1070
1103
|
}
|
|
1071
|
-
},
|
|
1104
|
+
}, _callee13, this);
|
|
1072
1105
|
}));
|
|
1073
|
-
function getBridgeHubFallbackExecFee(
|
|
1106
|
+
function getBridgeHubFallbackExecFee(_x23, _x24, _x25) {
|
|
1074
1107
|
return _getBridgeHubFallbackExecFee.apply(this, arguments);
|
|
1075
1108
|
}
|
|
1076
1109
|
return getBridgeHubFallbackExecFee;
|
|
@@ -1078,21 +1111,21 @@ var PolkadotJsApi = /*#__PURE__*/function () {
|
|
|
1078
1111
|
}, {
|
|
1079
1112
|
key: "getXcmWeight",
|
|
1080
1113
|
value: function () {
|
|
1081
|
-
var _getXcmWeight = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
1114
|
+
var _getXcmWeight = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee14(xcm) {
|
|
1082
1115
|
var result, resultJson;
|
|
1083
|
-
return _regenerator().w(function (
|
|
1084
|
-
while (1) switch (
|
|
1116
|
+
return _regenerator().w(function (_context14) {
|
|
1117
|
+
while (1) switch (_context14.n) {
|
|
1085
1118
|
case 0:
|
|
1086
|
-
|
|
1119
|
+
_context14.n = 1;
|
|
1087
1120
|
return this.api.call.xcmPaymentApi.queryXcmWeight(xcm);
|
|
1088
1121
|
case 1:
|
|
1089
|
-
result =
|
|
1122
|
+
result = _context14.v;
|
|
1090
1123
|
resultJson = result.toJSON();
|
|
1091
|
-
return
|
|
1124
|
+
return _context14.a(2, resultJson.ok);
|
|
1092
1125
|
}
|
|
1093
|
-
},
|
|
1126
|
+
}, _callee14, this);
|
|
1094
1127
|
}));
|
|
1095
|
-
function getXcmWeight(
|
|
1128
|
+
function getXcmWeight(_x26) {
|
|
1096
1129
|
return _getXcmWeight.apply(this, arguments);
|
|
1097
1130
|
}
|
|
1098
1131
|
return getXcmWeight;
|
|
@@ -1100,34 +1133,34 @@ var PolkadotJsApi = /*#__PURE__*/function () {
|
|
|
1100
1133
|
}, {
|
|
1101
1134
|
key: "getDryRunXcm",
|
|
1102
1135
|
value: function () {
|
|
1103
|
-
var _getDryRunXcm = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
1136
|
+
var _getDryRunXcm = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee15(_ref1) {
|
|
1104
1137
|
var _ref11, _ref12, _ref13;
|
|
1105
1138
|
var originLocation, xcm, asset, chain, origin, supportsDryRunApi, response, result, resultJson, isSuccess, error, failureReason, forwardedXcms, actualWeight, weight, destParaId, _fee, emitted, reversedEvents, palletsWithIssued, feeEvent, feeAmount, fee;
|
|
1106
|
-
return _regenerator().w(function (
|
|
1107
|
-
while (1) switch (
|
|
1139
|
+
return _regenerator().w(function (_context15) {
|
|
1140
|
+
while (1) switch (_context15.n) {
|
|
1108
1141
|
case 0:
|
|
1109
1142
|
originLocation = _ref1.originLocation, xcm = _ref1.xcm, asset = _ref1.asset, chain = _ref1.chain, origin = _ref1.origin;
|
|
1110
1143
|
supportsDryRunApi = getAssetsObject(chain).supportsDryRunApi;
|
|
1111
1144
|
if (supportsDryRunApi) {
|
|
1112
|
-
|
|
1145
|
+
_context15.n = 1;
|
|
1113
1146
|
break;
|
|
1114
1147
|
}
|
|
1115
1148
|
throw new RuntimeApiUnavailableError(chain, 'DryRunApi');
|
|
1116
1149
|
case 1:
|
|
1117
|
-
|
|
1150
|
+
_context15.n = 2;
|
|
1118
1151
|
return this.api.call.dryRunApi.dryRunXcm(originLocation, xcm);
|
|
1119
1152
|
case 2:
|
|
1120
|
-
response =
|
|
1153
|
+
response = _context15.v;
|
|
1121
1154
|
result = response.toHuman();
|
|
1122
1155
|
resultJson = response.toJSON();
|
|
1123
1156
|
isSuccess = result.Ok && result.Ok.executionResult.Complete;
|
|
1124
1157
|
if (isSuccess) {
|
|
1125
|
-
|
|
1158
|
+
_context15.n = 3;
|
|
1126
1159
|
break;
|
|
1127
1160
|
}
|
|
1128
1161
|
error = result.Ok.executionResult.Incomplete.error;
|
|
1129
1162
|
failureReason = typeof error === 'string' ? error : error.error;
|
|
1130
|
-
return
|
|
1163
|
+
return _context15.a(2, {
|
|
1131
1164
|
success: false,
|
|
1132
1165
|
failureReason: failureReason,
|
|
1133
1166
|
asset: asset
|
|
@@ -1143,18 +1176,18 @@ var PolkadotJsApi = /*#__PURE__*/function () {
|
|
|
1143
1176
|
return i.Here ? 0 : (_ref10 = Array.isArray(i.x1) ? i.x1[0] : i.x1) === null || _ref10 === void 0 ? void 0 : _ref10.parachain;
|
|
1144
1177
|
}(Object.values(forwardedXcms[0])[0].interior);
|
|
1145
1178
|
if (!(hasXcmPaymentApiSupport(chain) && asset)) {
|
|
1146
|
-
|
|
1179
|
+
_context15.n = 5;
|
|
1147
1180
|
break;
|
|
1148
1181
|
}
|
|
1149
|
-
|
|
1182
|
+
_context15.n = 4;
|
|
1150
1183
|
return this.getXcmPaymentApiFee(chain, xcm, forwardedXcms, asset);
|
|
1151
1184
|
case 4:
|
|
1152
|
-
_fee =
|
|
1185
|
+
_fee = _context15.v;
|
|
1153
1186
|
if (!(typeof _fee === 'bigint')) {
|
|
1154
|
-
|
|
1187
|
+
_context15.n = 5;
|
|
1155
1188
|
break;
|
|
1156
1189
|
}
|
|
1157
|
-
return
|
|
1190
|
+
return _context15.a(2, {
|
|
1158
1191
|
success: true,
|
|
1159
1192
|
fee: _fee,
|
|
1160
1193
|
asset: asset,
|
|
@@ -1180,10 +1213,10 @@ var PolkadotJsApi = /*#__PURE__*/function () {
|
|
|
1180
1213
|
return ['currencies', 'tokens'].includes(event.section) && event.method === 'Deposited';
|
|
1181
1214
|
});
|
|
1182
1215
|
if (feeEvent) {
|
|
1183
|
-
|
|
1216
|
+
_context15.n = 6;
|
|
1184
1217
|
break;
|
|
1185
1218
|
}
|
|
1186
|
-
return
|
|
1219
|
+
return _context15.a(2, Promise.resolve({
|
|
1187
1220
|
success: false,
|
|
1188
1221
|
failureReason: 'Cannot determine destination fee. No Issued event found',
|
|
1189
1222
|
asset: asset
|
|
@@ -1191,7 +1224,7 @@ var PolkadotJsApi = /*#__PURE__*/function () {
|
|
|
1191
1224
|
case 6:
|
|
1192
1225
|
feeAmount = feeEvent.section === 'assetConversion' ? feeEvent.data.amountIn : feeEvent.data.amount;
|
|
1193
1226
|
fee = BigInt(feeAmount.replace(/,/g, ''));
|
|
1194
|
-
return
|
|
1227
|
+
return _context15.a(2, {
|
|
1195
1228
|
success: true,
|
|
1196
1229
|
fee: fee,
|
|
1197
1230
|
asset: asset,
|
|
@@ -1200,9 +1233,9 @@ var PolkadotJsApi = /*#__PURE__*/function () {
|
|
|
1200
1233
|
destParaId: destParaId
|
|
1201
1234
|
});
|
|
1202
1235
|
}
|
|
1203
|
-
},
|
|
1236
|
+
}, _callee15, this);
|
|
1204
1237
|
}));
|
|
1205
|
-
function getDryRunXcm(
|
|
1238
|
+
function getDryRunXcm(_x27) {
|
|
1206
1239
|
return _getDryRunXcm.apply(this, arguments);
|
|
1207
1240
|
}
|
|
1208
1241
|
return getDryRunXcm;
|
|
@@ -1210,18 +1243,18 @@ var PolkadotJsApi = /*#__PURE__*/function () {
|
|
|
1210
1243
|
}, {
|
|
1211
1244
|
key: "getBridgeStatus",
|
|
1212
1245
|
value: function () {
|
|
1213
|
-
var _getBridgeStatus = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
1246
|
+
var _getBridgeStatus = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee16() {
|
|
1214
1247
|
var outboundOperatingMode;
|
|
1215
|
-
return _regenerator().w(function (
|
|
1216
|
-
while (1) switch (
|
|
1248
|
+
return _regenerator().w(function (_context16) {
|
|
1249
|
+
while (1) switch (_context16.n) {
|
|
1217
1250
|
case 0:
|
|
1218
|
-
|
|
1251
|
+
_context16.n = 1;
|
|
1219
1252
|
return this.api.query.ethereumOutboundQueue.operatingMode();
|
|
1220
1253
|
case 1:
|
|
1221
|
-
outboundOperatingMode =
|
|
1222
|
-
return
|
|
1254
|
+
outboundOperatingMode = _context16.v;
|
|
1255
|
+
return _context16.a(2, outboundOperatingMode.toPrimitive());
|
|
1223
1256
|
}
|
|
1224
|
-
},
|
|
1257
|
+
}, _callee16, this);
|
|
1225
1258
|
}));
|
|
1226
1259
|
function getBridgeStatus() {
|
|
1227
1260
|
return _getBridgeStatus.apply(this, arguments);
|
|
@@ -1281,21 +1314,21 @@ var PolkadotJsApi = /*#__PURE__*/function () {
|
|
|
1281
1314
|
}, {
|
|
1282
1315
|
key: "signAndSubmit",
|
|
1283
1316
|
value: function () {
|
|
1284
|
-
var _signAndSubmit = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
1317
|
+
var _signAndSubmit = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee17(tx, path) {
|
|
1285
1318
|
var pair, hash;
|
|
1286
|
-
return _regenerator().w(function (
|
|
1287
|
-
while (1) switch (
|
|
1319
|
+
return _regenerator().w(function (_context17) {
|
|
1320
|
+
while (1) switch (_context17.n) {
|
|
1288
1321
|
case 0:
|
|
1289
1322
|
pair = createKeyringPair(path);
|
|
1290
|
-
|
|
1323
|
+
_context17.n = 1;
|
|
1291
1324
|
return tx.signAndSend(pair);
|
|
1292
1325
|
case 1:
|
|
1293
|
-
hash =
|
|
1294
|
-
return
|
|
1326
|
+
hash = _context17.v;
|
|
1327
|
+
return _context17.a(2, hash.toHex());
|
|
1295
1328
|
}
|
|
1296
|
-
},
|
|
1329
|
+
}, _callee17);
|
|
1297
1330
|
}));
|
|
1298
|
-
function signAndSubmit(
|
|
1331
|
+
function signAndSubmit(_x28, _x29) {
|
|
1299
1332
|
return _signAndSubmit.apply(this, arguments);
|
|
1300
1333
|
}
|
|
1301
1334
|
return signAndSubmit;
|
|
@@ -1457,7 +1490,7 @@ var createContext = function createContext(executionUrl, env) {
|
|
|
1457
1490
|
graphqlApiUrl: config.GRAPHQL_API_URL,
|
|
1458
1491
|
ethereum: {
|
|
1459
1492
|
ethChainId: env.ethChainId,
|
|
1460
|
-
ethChains: _defineProperty(_defineProperty({},
|
|
1493
|
+
ethChains: _defineProperty(_defineProperty({}, ETH_MAINNET_CHAIN_ID.toString(), executionUrl), getParaId('Moonbeam'), 'https://rpc.api.moonbeam.network'),
|
|
1461
1494
|
beacon_url: config.BEACON_HTTP_API
|
|
1462
1495
|
},
|
|
1463
1496
|
polkadot: {
|
|
@@ -1791,7 +1824,7 @@ var EvmBuilderCore = /*#__PURE__*/function () {
|
|
|
1791
1824
|
}
|
|
1792
1825
|
throw new UnsupportedOperationError('Ethers signer is not supported for Moonbeam to Ethereum transfers.');
|
|
1793
1826
|
case 1:
|
|
1794
|
-
return _context.a(2, transferMoonbeamToEth(_objectSpread2(_objectSpread2({}, this._options), {}, {
|
|
1827
|
+
return _context.a(2, transferMoonbeamToEth(from, _objectSpread2(_objectSpread2({}, this._options), {}, {
|
|
1795
1828
|
signer: signer
|
|
1796
1829
|
})));
|
|
1797
1830
|
case 2:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@paraspell/sdk-pjs",
|
|
3
|
-
"version": "12.
|
|
3
|
+
"version": "12.3.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.20",
|
|
28
28
|
"ethers": "6.15.0",
|
|
29
29
|
"viem": "2.40.3",
|
|
30
|
-
"@paraspell/sdk-core": "12.
|
|
30
|
+
"@paraspell/sdk-core": "12.3.0"
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {
|
|
33
33
|
"@polkadot/api": ">= 16.0 < 17",
|