@paraspell/sdk 11.2.0 → 11.2.2
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 +12 -1
- package/dist/index.mjs +12 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -1403,7 +1403,8 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1403
1403
|
}();
|
|
1404
1404
|
getExecutionSuccessFromResult = function getExecutionSuccessFromResult(result) {
|
|
1405
1405
|
var _result$value;
|
|
1406
|
-
|
|
1406
|
+
var errorInEvents = findFailingEvent(result);
|
|
1407
|
+
return (result === null || result === void 0 ? void 0 : result.success) && ((_result$value = result.value) === null || _result$value === void 0 || (_result$value = _result$value.execution_result) === null || _result$value === void 0 ? void 0 : _result$value.success) && !errorInEvents;
|
|
1407
1408
|
};
|
|
1408
1409
|
extractFailureReasonFromResult = function extractFailureReasonFromResult(result) {
|
|
1409
1410
|
var _result$value2, _executionResultValue, _executionResultValue2, _result$value3, _ref8, _result$value4;
|
|
@@ -1417,6 +1418,10 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1417
1418
|
if (result !== null && result !== void 0 && (_result$value3 = result.value) !== null && _result$value3 !== void 0 && _result$value3.type) {
|
|
1418
1419
|
return String(result.value.type);
|
|
1419
1420
|
}
|
|
1421
|
+
var erroredEvent = findFailingEvent(result);
|
|
1422
|
+
if (erroredEvent) {
|
|
1423
|
+
return erroredEvent.value.value.result.value.value.value.type;
|
|
1424
|
+
}
|
|
1420
1425
|
return JSON.stringify((_ref8 = (_result$value4 = result === null || result === void 0 ? void 0 : result.value) !== null && _result$value4 !== void 0 ? _result$value4 : result) !== null && _ref8 !== void 0 ? _ref8 : 'Unknown error structure', sdkCore.replaceBigInt);
|
|
1421
1426
|
};
|
|
1422
1427
|
failureOutputReason = '';
|
|
@@ -1777,6 +1782,12 @@ var createPapiApiCall = function createPapiApiCall(apiCall) {
|
|
|
1777
1782
|
};
|
|
1778
1783
|
}();
|
|
1779
1784
|
};
|
|
1785
|
+
var findFailingEvent = function findFailingEvent(result) {
|
|
1786
|
+
var _result$value;
|
|
1787
|
+
return (_result$value = result.value) === null || _result$value === void 0 || (_result$value = _result$value.emitted_events) === null || _result$value === void 0 ? void 0 : _result$value.find(function (event) {
|
|
1788
|
+
return event.type === 'Utility' && event.value.type === 'DispatchedAs' && event.value.value.result.success === false;
|
|
1789
|
+
});
|
|
1790
|
+
};
|
|
1780
1791
|
|
|
1781
1792
|
/**
|
|
1782
1793
|
* Retrieves the native balance for a given account on a specified chain.
|
package/dist/index.mjs
CHANGED
|
@@ -1402,7 +1402,8 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1402
1402
|
}();
|
|
1403
1403
|
getExecutionSuccessFromResult = function getExecutionSuccessFromResult(result) {
|
|
1404
1404
|
var _result$value;
|
|
1405
|
-
|
|
1405
|
+
var errorInEvents = findFailingEvent(result);
|
|
1406
|
+
return (result === null || result === void 0 ? void 0 : result.success) && ((_result$value = result.value) === null || _result$value === void 0 || (_result$value = _result$value.execution_result) === null || _result$value === void 0 ? void 0 : _result$value.success) && !errorInEvents;
|
|
1406
1407
|
};
|
|
1407
1408
|
extractFailureReasonFromResult = function extractFailureReasonFromResult(result) {
|
|
1408
1409
|
var _result$value2, _executionResultValue, _executionResultValue2, _result$value3, _ref8, _result$value4;
|
|
@@ -1416,6 +1417,10 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1416
1417
|
if (result !== null && result !== void 0 && (_result$value3 = result.value) !== null && _result$value3 !== void 0 && _result$value3.type) {
|
|
1417
1418
|
return String(result.value.type);
|
|
1418
1419
|
}
|
|
1420
|
+
var erroredEvent = findFailingEvent(result);
|
|
1421
|
+
if (erroredEvent) {
|
|
1422
|
+
return erroredEvent.value.value.result.value.value.value.type;
|
|
1423
|
+
}
|
|
1419
1424
|
return JSON.stringify((_ref8 = (_result$value4 = result === null || result === void 0 ? void 0 : result.value) !== null && _result$value4 !== void 0 ? _result$value4 : result) !== null && _ref8 !== void 0 ? _ref8 : 'Unknown error structure', replaceBigInt);
|
|
1420
1425
|
};
|
|
1421
1426
|
failureOutputReason = '';
|
|
@@ -1776,6 +1781,12 @@ var createPapiApiCall = function createPapiApiCall(apiCall) {
|
|
|
1776
1781
|
};
|
|
1777
1782
|
}();
|
|
1778
1783
|
};
|
|
1784
|
+
var findFailingEvent = function findFailingEvent(result) {
|
|
1785
|
+
var _result$value;
|
|
1786
|
+
return (_result$value = result.value) === null || _result$value === void 0 || (_result$value = _result$value.emitted_events) === null || _result$value === void 0 ? void 0 : _result$value.find(function (event) {
|
|
1787
|
+
return event.type === 'Utility' && event.value.type === 'DispatchedAs' && event.value.value.result.success === false;
|
|
1788
|
+
});
|
|
1789
|
+
};
|
|
1779
1790
|
|
|
1780
1791
|
/**
|
|
1781
1792
|
* Retrieves the native balance for a given account on a specified chain.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@paraspell/sdk",
|
|
3
|
-
"version": "11.2.
|
|
3
|
+
"version": "11.2.2",
|
|
4
4
|
"description": "SDK for ParaSpell XCM/XCMP tool for developers",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@noble/hashes": "^1.8.0",
|
|
27
27
|
"viem": "^2.33.2",
|
|
28
|
-
"@paraspell/sdk-core": "11.2.
|
|
28
|
+
"@paraspell/sdk-core": "11.2.2"
|
|
29
29
|
},
|
|
30
30
|
"peerDependencies": {
|
|
31
31
|
"polkadot-api": ">= 1.15.2 < 2"
|