@paraspell/sdk-pjs 10.4.1 → 10.4.3
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 +55 -33
- package/dist/index.mjs +55 -33
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -809,36 +809,58 @@ var PolkadotJsApi = /*#__PURE__*/function () {
|
|
|
809
809
|
}
|
|
810
810
|
return getDryRunCall;
|
|
811
811
|
}()
|
|
812
|
+
}, {
|
|
813
|
+
key: "getXcmWeight",
|
|
814
|
+
value: function () {
|
|
815
|
+
var _getXcmWeight = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee15(xcm) {
|
|
816
|
+
var result, resultJson;
|
|
817
|
+
return _regenerator().w(function (_context15) {
|
|
818
|
+
while (1) switch (_context15.n) {
|
|
819
|
+
case 0:
|
|
820
|
+
_context15.n = 1;
|
|
821
|
+
return this.api.call.xcmPaymentApi.queryXcmWeight(xcm);
|
|
822
|
+
case 1:
|
|
823
|
+
result = _context15.v;
|
|
824
|
+
resultJson = result.toJSON();
|
|
825
|
+
return _context15.a(2, resultJson.ok);
|
|
826
|
+
}
|
|
827
|
+
}, _callee15, this);
|
|
828
|
+
}));
|
|
829
|
+
function getXcmWeight(_x29) {
|
|
830
|
+
return _getXcmWeight.apply(this, arguments);
|
|
831
|
+
}
|
|
832
|
+
return getXcmWeight;
|
|
833
|
+
}()
|
|
812
834
|
}, {
|
|
813
835
|
key: "getDryRunXcm",
|
|
814
836
|
value: function () {
|
|
815
|
-
var _getDryRunXcm = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
837
|
+
var _getDryRunXcm = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee16(_ref6) {
|
|
816
838
|
var _ref7, _ref8, _ref9;
|
|
817
839
|
var originLocation, xcm, node, origin, supportsDryRunApi, response, result, resultJson, isSuccess, failureReason, emitted, reversedEvents, palletsWithIssued, feeEvent, feeAmount, fee, actualWeight, weight, forwardedXcms, destParaId;
|
|
818
|
-
return _regenerator().w(function (
|
|
819
|
-
while (1) switch (
|
|
840
|
+
return _regenerator().w(function (_context16) {
|
|
841
|
+
while (1) switch (_context16.n) {
|
|
820
842
|
case 0:
|
|
821
843
|
originLocation = _ref6.originLocation, xcm = _ref6.xcm, node = _ref6.node, origin = _ref6.origin;
|
|
822
844
|
supportsDryRunApi = sdkCore.getAssetsObject(node).supportsDryRunApi;
|
|
823
845
|
if (supportsDryRunApi) {
|
|
824
|
-
|
|
846
|
+
_context16.n = 1;
|
|
825
847
|
break;
|
|
826
848
|
}
|
|
827
849
|
throw new sdkCore.NodeNotSupportedError("DryRunApi is not available on node ".concat(node));
|
|
828
850
|
case 1:
|
|
829
|
-
|
|
851
|
+
_context16.n = 2;
|
|
830
852
|
return this.api.call.dryRunApi.dryRunXcm(originLocation, xcm);
|
|
831
853
|
case 2:
|
|
832
|
-
response =
|
|
854
|
+
response = _context16.v;
|
|
833
855
|
result = response.toHuman();
|
|
834
856
|
resultJson = response.toJSON();
|
|
835
857
|
isSuccess = result.Ok && result.Ok.executionResult.Complete;
|
|
836
858
|
if (isSuccess) {
|
|
837
|
-
|
|
859
|
+
_context16.n = 3;
|
|
838
860
|
break;
|
|
839
861
|
}
|
|
840
862
|
failureReason = result.Ok.executionResult.Incomplete.error;
|
|
841
|
-
return
|
|
863
|
+
return _context16.a(2, {
|
|
842
864
|
success: false,
|
|
843
865
|
failureReason: failureReason
|
|
844
866
|
});
|
|
@@ -860,10 +882,10 @@ var PolkadotJsApi = /*#__PURE__*/function () {
|
|
|
860
882
|
return ['currencies', 'tokens'].includes(event.section) && event.method === 'Deposited';
|
|
861
883
|
});
|
|
862
884
|
if (feeEvent) {
|
|
863
|
-
|
|
885
|
+
_context16.n = 4;
|
|
864
886
|
break;
|
|
865
887
|
}
|
|
866
|
-
return
|
|
888
|
+
return _context16.a(2, Promise.resolve({
|
|
867
889
|
success: false,
|
|
868
890
|
failureReason: 'Cannot determine destination fee. No Issued event found'
|
|
869
891
|
}));
|
|
@@ -879,7 +901,7 @@ var PolkadotJsApi = /*#__PURE__*/function () {
|
|
|
879
901
|
destParaId = forwardedXcms.length === 0 ? undefined : function (i, _ref0) {
|
|
880
902
|
return i.Here ? 0 : (_ref0 = Array.isArray(i.x1) ? i.x1[0] : i.x1) === null || _ref0 === void 0 ? void 0 : _ref0.parachain;
|
|
881
903
|
}(Object.values(forwardedXcms[0])[0].interior);
|
|
882
|
-
return
|
|
904
|
+
return _context16.a(2, {
|
|
883
905
|
success: true,
|
|
884
906
|
fee: fee,
|
|
885
907
|
weight: weight,
|
|
@@ -887,9 +909,9 @@ var PolkadotJsApi = /*#__PURE__*/function () {
|
|
|
887
909
|
destParaId: destParaId
|
|
888
910
|
});
|
|
889
911
|
}
|
|
890
|
-
},
|
|
912
|
+
}, _callee16, this);
|
|
891
913
|
}));
|
|
892
|
-
function getDryRunXcm(
|
|
914
|
+
function getDryRunXcm(_x30) {
|
|
893
915
|
return _getDryRunXcm.apply(this, arguments);
|
|
894
916
|
}
|
|
895
917
|
return getDryRunXcm;
|
|
@@ -897,18 +919,18 @@ var PolkadotJsApi = /*#__PURE__*/function () {
|
|
|
897
919
|
}, {
|
|
898
920
|
key: "getBridgeStatus",
|
|
899
921
|
value: function () {
|
|
900
|
-
var _getBridgeStatus = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
922
|
+
var _getBridgeStatus = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee17() {
|
|
901
923
|
var outboundOperatingMode;
|
|
902
|
-
return _regenerator().w(function (
|
|
903
|
-
while (1) switch (
|
|
924
|
+
return _regenerator().w(function (_context17) {
|
|
925
|
+
while (1) switch (_context17.n) {
|
|
904
926
|
case 0:
|
|
905
|
-
|
|
927
|
+
_context17.n = 1;
|
|
906
928
|
return this.api.query.ethereumOutboundQueue.operatingMode();
|
|
907
929
|
case 1:
|
|
908
|
-
outboundOperatingMode =
|
|
909
|
-
return
|
|
930
|
+
outboundOperatingMode = _context17.v;
|
|
931
|
+
return _context17.a(2, outboundOperatingMode.toPrimitive());
|
|
910
932
|
}
|
|
911
|
-
},
|
|
933
|
+
}, _callee17, this);
|
|
912
934
|
}));
|
|
913
935
|
function getBridgeStatus() {
|
|
914
936
|
return _getBridgeStatus.apply(this, arguments);
|
|
@@ -928,35 +950,35 @@ var PolkadotJsApi = /*#__PURE__*/function () {
|
|
|
928
950
|
}, {
|
|
929
951
|
key: "disconnect",
|
|
930
952
|
value: function () {
|
|
931
|
-
var _disconnect = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
953
|
+
var _disconnect = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee18() {
|
|
932
954
|
var force,
|
|
933
|
-
|
|
934
|
-
return _regenerator().w(function (
|
|
935
|
-
while (1) switch (
|
|
955
|
+
_args18 = arguments;
|
|
956
|
+
return _regenerator().w(function (_context18) {
|
|
957
|
+
while (1) switch (_context18.n) {
|
|
936
958
|
case 0:
|
|
937
|
-
force =
|
|
959
|
+
force = _args18.length > 0 && _args18[0] !== undefined ? _args18[0] : false;
|
|
938
960
|
if (this.initialized) {
|
|
939
|
-
|
|
961
|
+
_context18.n = 1;
|
|
940
962
|
break;
|
|
941
963
|
}
|
|
942
|
-
return
|
|
964
|
+
return _context18.a(2, Promise.resolve());
|
|
943
965
|
case 1:
|
|
944
966
|
if (!(!force && !this.disconnectAllowed)) {
|
|
945
|
-
|
|
967
|
+
_context18.n = 2;
|
|
946
968
|
break;
|
|
947
969
|
}
|
|
948
|
-
return
|
|
970
|
+
return _context18.a(2);
|
|
949
971
|
case 2:
|
|
950
972
|
if (!(force || typeof this._api === 'string' || this._api === undefined)) {
|
|
951
|
-
|
|
973
|
+
_context18.n = 3;
|
|
952
974
|
break;
|
|
953
975
|
}
|
|
954
|
-
|
|
976
|
+
_context18.n = 3;
|
|
955
977
|
return this.api.disconnect();
|
|
956
978
|
case 3:
|
|
957
|
-
return
|
|
979
|
+
return _context18.a(2);
|
|
958
980
|
}
|
|
959
|
-
},
|
|
981
|
+
}, _callee18, this);
|
|
960
982
|
}));
|
|
961
983
|
function disconnect() {
|
|
962
984
|
return _disconnect.apply(this, arguments);
|
package/dist/index.mjs
CHANGED
|
@@ -808,36 +808,58 @@ var PolkadotJsApi = /*#__PURE__*/function () {
|
|
|
808
808
|
}
|
|
809
809
|
return getDryRunCall;
|
|
810
810
|
}()
|
|
811
|
+
}, {
|
|
812
|
+
key: "getXcmWeight",
|
|
813
|
+
value: function () {
|
|
814
|
+
var _getXcmWeight = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee15(xcm) {
|
|
815
|
+
var result, resultJson;
|
|
816
|
+
return _regenerator().w(function (_context15) {
|
|
817
|
+
while (1) switch (_context15.n) {
|
|
818
|
+
case 0:
|
|
819
|
+
_context15.n = 1;
|
|
820
|
+
return this.api.call.xcmPaymentApi.queryXcmWeight(xcm);
|
|
821
|
+
case 1:
|
|
822
|
+
result = _context15.v;
|
|
823
|
+
resultJson = result.toJSON();
|
|
824
|
+
return _context15.a(2, resultJson.ok);
|
|
825
|
+
}
|
|
826
|
+
}, _callee15, this);
|
|
827
|
+
}));
|
|
828
|
+
function getXcmWeight(_x29) {
|
|
829
|
+
return _getXcmWeight.apply(this, arguments);
|
|
830
|
+
}
|
|
831
|
+
return getXcmWeight;
|
|
832
|
+
}()
|
|
811
833
|
}, {
|
|
812
834
|
key: "getDryRunXcm",
|
|
813
835
|
value: function () {
|
|
814
|
-
var _getDryRunXcm = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
836
|
+
var _getDryRunXcm = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee16(_ref6) {
|
|
815
837
|
var _ref7, _ref8, _ref9;
|
|
816
838
|
var originLocation, xcm, node, origin, supportsDryRunApi, response, result, resultJson, isSuccess, failureReason, emitted, reversedEvents, palletsWithIssued, feeEvent, feeAmount, fee, actualWeight, weight, forwardedXcms, destParaId;
|
|
817
|
-
return _regenerator().w(function (
|
|
818
|
-
while (1) switch (
|
|
839
|
+
return _regenerator().w(function (_context16) {
|
|
840
|
+
while (1) switch (_context16.n) {
|
|
819
841
|
case 0:
|
|
820
842
|
originLocation = _ref6.originLocation, xcm = _ref6.xcm, node = _ref6.node, origin = _ref6.origin;
|
|
821
843
|
supportsDryRunApi = getAssetsObject(node).supportsDryRunApi;
|
|
822
844
|
if (supportsDryRunApi) {
|
|
823
|
-
|
|
845
|
+
_context16.n = 1;
|
|
824
846
|
break;
|
|
825
847
|
}
|
|
826
848
|
throw new NodeNotSupportedError("DryRunApi is not available on node ".concat(node));
|
|
827
849
|
case 1:
|
|
828
|
-
|
|
850
|
+
_context16.n = 2;
|
|
829
851
|
return this.api.call.dryRunApi.dryRunXcm(originLocation, xcm);
|
|
830
852
|
case 2:
|
|
831
|
-
response =
|
|
853
|
+
response = _context16.v;
|
|
832
854
|
result = response.toHuman();
|
|
833
855
|
resultJson = response.toJSON();
|
|
834
856
|
isSuccess = result.Ok && result.Ok.executionResult.Complete;
|
|
835
857
|
if (isSuccess) {
|
|
836
|
-
|
|
858
|
+
_context16.n = 3;
|
|
837
859
|
break;
|
|
838
860
|
}
|
|
839
861
|
failureReason = result.Ok.executionResult.Incomplete.error;
|
|
840
|
-
return
|
|
862
|
+
return _context16.a(2, {
|
|
841
863
|
success: false,
|
|
842
864
|
failureReason: failureReason
|
|
843
865
|
});
|
|
@@ -859,10 +881,10 @@ var PolkadotJsApi = /*#__PURE__*/function () {
|
|
|
859
881
|
return ['currencies', 'tokens'].includes(event.section) && event.method === 'Deposited';
|
|
860
882
|
});
|
|
861
883
|
if (feeEvent) {
|
|
862
|
-
|
|
884
|
+
_context16.n = 4;
|
|
863
885
|
break;
|
|
864
886
|
}
|
|
865
|
-
return
|
|
887
|
+
return _context16.a(2, Promise.resolve({
|
|
866
888
|
success: false,
|
|
867
889
|
failureReason: 'Cannot determine destination fee. No Issued event found'
|
|
868
890
|
}));
|
|
@@ -878,7 +900,7 @@ var PolkadotJsApi = /*#__PURE__*/function () {
|
|
|
878
900
|
destParaId = forwardedXcms.length === 0 ? undefined : function (i, _ref0) {
|
|
879
901
|
return i.Here ? 0 : (_ref0 = Array.isArray(i.x1) ? i.x1[0] : i.x1) === null || _ref0 === void 0 ? void 0 : _ref0.parachain;
|
|
880
902
|
}(Object.values(forwardedXcms[0])[0].interior);
|
|
881
|
-
return
|
|
903
|
+
return _context16.a(2, {
|
|
882
904
|
success: true,
|
|
883
905
|
fee: fee,
|
|
884
906
|
weight: weight,
|
|
@@ -886,9 +908,9 @@ var PolkadotJsApi = /*#__PURE__*/function () {
|
|
|
886
908
|
destParaId: destParaId
|
|
887
909
|
});
|
|
888
910
|
}
|
|
889
|
-
},
|
|
911
|
+
}, _callee16, this);
|
|
890
912
|
}));
|
|
891
|
-
function getDryRunXcm(
|
|
913
|
+
function getDryRunXcm(_x30) {
|
|
892
914
|
return _getDryRunXcm.apply(this, arguments);
|
|
893
915
|
}
|
|
894
916
|
return getDryRunXcm;
|
|
@@ -896,18 +918,18 @@ var PolkadotJsApi = /*#__PURE__*/function () {
|
|
|
896
918
|
}, {
|
|
897
919
|
key: "getBridgeStatus",
|
|
898
920
|
value: function () {
|
|
899
|
-
var _getBridgeStatus = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
921
|
+
var _getBridgeStatus = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee17() {
|
|
900
922
|
var outboundOperatingMode;
|
|
901
|
-
return _regenerator().w(function (
|
|
902
|
-
while (1) switch (
|
|
923
|
+
return _regenerator().w(function (_context17) {
|
|
924
|
+
while (1) switch (_context17.n) {
|
|
903
925
|
case 0:
|
|
904
|
-
|
|
926
|
+
_context17.n = 1;
|
|
905
927
|
return this.api.query.ethereumOutboundQueue.operatingMode();
|
|
906
928
|
case 1:
|
|
907
|
-
outboundOperatingMode =
|
|
908
|
-
return
|
|
929
|
+
outboundOperatingMode = _context17.v;
|
|
930
|
+
return _context17.a(2, outboundOperatingMode.toPrimitive());
|
|
909
931
|
}
|
|
910
|
-
},
|
|
932
|
+
}, _callee17, this);
|
|
911
933
|
}));
|
|
912
934
|
function getBridgeStatus() {
|
|
913
935
|
return _getBridgeStatus.apply(this, arguments);
|
|
@@ -927,35 +949,35 @@ var PolkadotJsApi = /*#__PURE__*/function () {
|
|
|
927
949
|
}, {
|
|
928
950
|
key: "disconnect",
|
|
929
951
|
value: function () {
|
|
930
|
-
var _disconnect = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
952
|
+
var _disconnect = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee18() {
|
|
931
953
|
var force,
|
|
932
|
-
|
|
933
|
-
return _regenerator().w(function (
|
|
934
|
-
while (1) switch (
|
|
954
|
+
_args18 = arguments;
|
|
955
|
+
return _regenerator().w(function (_context18) {
|
|
956
|
+
while (1) switch (_context18.n) {
|
|
935
957
|
case 0:
|
|
936
|
-
force =
|
|
958
|
+
force = _args18.length > 0 && _args18[0] !== undefined ? _args18[0] : false;
|
|
937
959
|
if (this.initialized) {
|
|
938
|
-
|
|
960
|
+
_context18.n = 1;
|
|
939
961
|
break;
|
|
940
962
|
}
|
|
941
|
-
return
|
|
963
|
+
return _context18.a(2, Promise.resolve());
|
|
942
964
|
case 1:
|
|
943
965
|
if (!(!force && !this.disconnectAllowed)) {
|
|
944
|
-
|
|
966
|
+
_context18.n = 2;
|
|
945
967
|
break;
|
|
946
968
|
}
|
|
947
|
-
return
|
|
969
|
+
return _context18.a(2);
|
|
948
970
|
case 2:
|
|
949
971
|
if (!(force || typeof this._api === 'string' || this._api === undefined)) {
|
|
950
|
-
|
|
972
|
+
_context18.n = 3;
|
|
951
973
|
break;
|
|
952
974
|
}
|
|
953
|
-
|
|
975
|
+
_context18.n = 3;
|
|
954
976
|
return this.api.disconnect();
|
|
955
977
|
case 3:
|
|
956
|
-
return
|
|
978
|
+
return _context18.a(2);
|
|
957
979
|
}
|
|
958
|
-
},
|
|
980
|
+
}, _callee18, this);
|
|
959
981
|
}));
|
|
960
982
|
function disconnect() {
|
|
961
983
|
return _disconnect.apply(this, arguments);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@paraspell/sdk-pjs",
|
|
3
|
-
"version": "10.4.
|
|
3
|
+
"version": "10.4.3",
|
|
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.1.55",
|
|
28
28
|
"ethers": "^6.14.3",
|
|
29
29
|
"viem": "^2.30.5",
|
|
30
|
-
"@paraspell/sdk-core": "10.4.
|
|
30
|
+
"@paraspell/sdk-core": "10.4.3"
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {
|
|
33
33
|
"@polkadot/api": ">= 16.0 < 17",
|