@paraspell/sdk 9.2.2 → 9.2.5
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 +108 -48
- package/dist/index.mjs +108 -48
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -1435,48 +1435,108 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1435
1435
|
}, {
|
|
1436
1436
|
key: "getDryRunCall",
|
|
1437
1437
|
value: function () {
|
|
1438
|
-
var _getDryRunCall = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1439
|
-
var _this
|
|
1440
|
-
var tx, address, node, supportsDryRunApi,
|
|
1441
|
-
return _regeneratorRuntime().wrap(function
|
|
1442
|
-
while (1) switch (
|
|
1438
|
+
var _getDryRunCall = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee18(_ref6) {
|
|
1439
|
+
var _this = this;
|
|
1440
|
+
var tx, address, node, supportsDryRunApi, DEFAULT_XCM_VERSION, basePayload, performDryRunCall, getExecutionSuccessFromResult, extractFailureReasonFromResult, result, isSuccess, failureOutputReason, initialFailureReason, executionFee, fee, actualWeight, weight, forwardedXcms, destParaId;
|
|
1441
|
+
return _regeneratorRuntime().wrap(function _callee18$(_context18) {
|
|
1442
|
+
while (1) switch (_context18.prev = _context18.next) {
|
|
1443
1443
|
case 0:
|
|
1444
1444
|
tx = _ref6.tx, address = _ref6.address, node = _ref6.node;
|
|
1445
1445
|
supportsDryRunApi = sdkCore.getAssetsObject(node).supportsDryRunApi;
|
|
1446
1446
|
if (supportsDryRunApi) {
|
|
1447
|
-
|
|
1447
|
+
_context18.next = 4;
|
|
1448
1448
|
break;
|
|
1449
1449
|
}
|
|
1450
1450
|
throw new sdkCore.NodeNotSupportedError("DryRunApi is not available on node ".concat(node));
|
|
1451
1451
|
case 4:
|
|
1452
|
-
needsVersionParam = node === 'BifrostPolkadot' || node === 'BifrostKusama' || node === 'AssetHubKusama' || node === 'Kusama' || node === 'Polimec';
|
|
1453
1452
|
DEFAULT_XCM_VERSION = 3;
|
|
1454
|
-
|
|
1455
|
-
return (_this$api$getUnsafeAp = this.api.getUnsafeApi().apis.DryRunApi).dry_run_call.apply(_this$api$getUnsafeAp, [{
|
|
1453
|
+
basePayload = {
|
|
1456
1454
|
type: 'system',
|
|
1457
1455
|
value: {
|
|
1458
1456
|
type: 'Signed',
|
|
1459
1457
|
value: address
|
|
1460
1458
|
}
|
|
1461
|
-
}
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1459
|
+
};
|
|
1460
|
+
performDryRunCall = /*#__PURE__*/function () {
|
|
1461
|
+
var _ref7 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee17(includeVersion) {
|
|
1462
|
+
var _this$api$getUnsafeAp;
|
|
1463
|
+
var callArgs;
|
|
1464
|
+
return _regeneratorRuntime().wrap(function _callee17$(_context17) {
|
|
1465
|
+
while (1) switch (_context17.prev = _context17.next) {
|
|
1466
|
+
case 0:
|
|
1467
|
+
callArgs = [basePayload, tx.decodedCall];
|
|
1468
|
+
if (includeVersion) {
|
|
1469
|
+
callArgs.push(DEFAULT_XCM_VERSION);
|
|
1470
|
+
}
|
|
1471
|
+
return _context17.abrupt("return", (_this$api$getUnsafeAp = _this.api.getUnsafeApi().apis.DryRunApi).dry_run_call.apply(_this$api$getUnsafeAp, callArgs));
|
|
1472
|
+
case 3:
|
|
1473
|
+
case "end":
|
|
1474
|
+
return _context17.stop();
|
|
1475
|
+
}
|
|
1476
|
+
}, _callee17);
|
|
1477
|
+
}));
|
|
1478
|
+
return function performDryRunCall(_x32) {
|
|
1479
|
+
return _ref7.apply(this, arguments);
|
|
1480
|
+
};
|
|
1481
|
+
}();
|
|
1482
|
+
getExecutionSuccessFromResult = function getExecutionSuccessFromResult(result) {
|
|
1483
|
+
var _result$value;
|
|
1484
|
+
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);
|
|
1485
|
+
};
|
|
1486
|
+
extractFailureReasonFromResult = function extractFailureReasonFromResult(result) {
|
|
1487
|
+
var _result$value2, _executionResultValue, _executionResultValue2, _result$value3, _ref8, _result$value4;
|
|
1488
|
+
var executionResultValue = result === null || result === void 0 || (_result$value2 = result.value) === null || _result$value2 === void 0 || (_result$value2 = _result$value2.execution_result) === null || _result$value2 === void 0 ? void 0 : _result$value2.value;
|
|
1489
|
+
if (executionResultValue !== null && executionResultValue !== void 0 && (_executionResultValue = executionResultValue.error) !== null && _executionResultValue !== void 0 && (_executionResultValue = _executionResultValue.value) !== null && _executionResultValue !== void 0 && (_executionResultValue = _executionResultValue.value) !== null && _executionResultValue !== void 0 && _executionResultValue.type) {
|
|
1490
|
+
return String(executionResultValue.error.value.value.type);
|
|
1491
|
+
}
|
|
1492
|
+
if (executionResultValue !== null && executionResultValue !== void 0 && (_executionResultValue2 = executionResultValue.error) !== null && _executionResultValue2 !== void 0 && (_executionResultValue2 = _executionResultValue2.value) !== null && _executionResultValue2 !== void 0 && _executionResultValue2.type) {
|
|
1493
|
+
return String(executionResultValue.error.value.type);
|
|
1494
|
+
}
|
|
1495
|
+
if (result !== null && result !== void 0 && (_result$value3 = result.value) !== null && _result$value3 !== void 0 && _result$value3.type) {
|
|
1496
|
+
return String(result.value.type);
|
|
1497
|
+
}
|
|
1498
|
+
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');
|
|
1499
|
+
};
|
|
1500
|
+
failureOutputReason = '';
|
|
1501
|
+
_context18.next = 12;
|
|
1502
|
+
return performDryRunCall(false);
|
|
1503
|
+
case 12:
|
|
1504
|
+
result = _context18.sent;
|
|
1505
|
+
isSuccess = getExecutionSuccessFromResult(result);
|
|
1465
1506
|
if (isSuccess) {
|
|
1466
|
-
|
|
1507
|
+
_context18.next = 23;
|
|
1467
1508
|
break;
|
|
1468
1509
|
}
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1510
|
+
initialFailureReason = extractFailureReasonFromResult(result);
|
|
1511
|
+
failureOutputReason = initialFailureReason;
|
|
1512
|
+
if (!(initialFailureReason === 'VersionedConversionFailed')) {
|
|
1513
|
+
_context18.next = 23;
|
|
1514
|
+
break;
|
|
1515
|
+
}
|
|
1516
|
+
_context18.next = 20;
|
|
1517
|
+
return performDryRunCall(true);
|
|
1518
|
+
case 20:
|
|
1519
|
+
result = _context18.sent;
|
|
1520
|
+
isSuccess = getExecutionSuccessFromResult(result);
|
|
1521
|
+
if (!isSuccess) {
|
|
1522
|
+
failureOutputReason = extractFailureReasonFromResult(result);
|
|
1523
|
+
} else {
|
|
1524
|
+
failureOutputReason = '';
|
|
1525
|
+
}
|
|
1526
|
+
case 23:
|
|
1527
|
+
if (isSuccess) {
|
|
1528
|
+
_context18.next = 25;
|
|
1529
|
+
break;
|
|
1530
|
+
}
|
|
1531
|
+
return _context18.abrupt("return", Promise.resolve({
|
|
1472
1532
|
success: false,
|
|
1473
|
-
failureReason:
|
|
1533
|
+
failureReason: failureOutputReason
|
|
1474
1534
|
}));
|
|
1475
|
-
case
|
|
1476
|
-
|
|
1535
|
+
case 25:
|
|
1536
|
+
_context18.next = 27;
|
|
1477
1537
|
return this.calculateTransactionFee(tx, address);
|
|
1478
|
-
case
|
|
1479
|
-
executionFee =
|
|
1538
|
+
case 27:
|
|
1539
|
+
executionFee = _context18.sent;
|
|
1480
1540
|
fee = sdkCore.computeFeeFromDryRun(result, node, executionFee);
|
|
1481
1541
|
actualWeight = result.value.execution_result.value.actual_weight;
|
|
1482
1542
|
weight = actualWeight ? {
|
|
@@ -1485,18 +1545,18 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1485
1545
|
} : undefined;
|
|
1486
1546
|
forwardedXcms = result.value.forwarded_xcms.length > 0 ? result.value.forwarded_xcms[0] : [];
|
|
1487
1547
|
destParaId = forwardedXcms.length === 0 ? undefined : forwardedXcms[0].value.interior.type === 'Here' ? 0 : forwardedXcms[0].value.interior.value.value;
|
|
1488
|
-
return
|
|
1548
|
+
return _context18.abrupt("return", Promise.resolve({
|
|
1489
1549
|
success: true,
|
|
1490
1550
|
fee: fee,
|
|
1491
1551
|
weight: weight,
|
|
1492
1552
|
forwardedXcms: forwardedXcms,
|
|
1493
1553
|
destParaId: destParaId
|
|
1494
1554
|
}));
|
|
1495
|
-
case
|
|
1555
|
+
case 34:
|
|
1496
1556
|
case "end":
|
|
1497
|
-
return
|
|
1557
|
+
return _context18.stop();
|
|
1498
1558
|
}
|
|
1499
|
-
},
|
|
1559
|
+
}, _callee18, this);
|
|
1500
1560
|
}));
|
|
1501
1561
|
function getDryRunCall(_x31) {
|
|
1502
1562
|
return _getDryRunCall.apply(this, arguments);
|
|
@@ -1506,32 +1566,32 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1506
1566
|
}, {
|
|
1507
1567
|
key: "getDryRunXcm",
|
|
1508
1568
|
value: function () {
|
|
1509
|
-
var _getDryRunXcm = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1569
|
+
var _getDryRunXcm = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee19(_ref9) {
|
|
1510
1570
|
var _ref0, _ref1, _ref10;
|
|
1511
1571
|
var originLocation, xcm, node, origin, supportsDryRunApi, transformedOriginLocation, result, isSuccess, failureReason, emitted, reversedEvents, palletsWithIssued, feeEvent, fee, actualWeight, weight, forwardedXcms, destParaId;
|
|
1512
|
-
return _regeneratorRuntime().wrap(function
|
|
1513
|
-
while (1) switch (
|
|
1572
|
+
return _regeneratorRuntime().wrap(function _callee19$(_context19) {
|
|
1573
|
+
while (1) switch (_context19.prev = _context19.next) {
|
|
1514
1574
|
case 0:
|
|
1515
1575
|
originLocation = _ref9.originLocation, xcm = _ref9.xcm, node = _ref9.node, origin = _ref9.origin;
|
|
1516
1576
|
supportsDryRunApi = sdkCore.getAssetsObject(node).supportsDryRunApi;
|
|
1517
1577
|
if (supportsDryRunApi) {
|
|
1518
|
-
|
|
1578
|
+
_context19.next = 4;
|
|
1519
1579
|
break;
|
|
1520
1580
|
}
|
|
1521
1581
|
throw new sdkCore.NodeNotSupportedError("DryRunApi is not available on node ".concat(node));
|
|
1522
1582
|
case 4:
|
|
1523
1583
|
transformedOriginLocation = _transform(originLocation);
|
|
1524
|
-
|
|
1584
|
+
_context19.next = 7;
|
|
1525
1585
|
return this.api.getUnsafeApi().apis.DryRunApi.dry_run_xcm(transformedOriginLocation, xcm);
|
|
1526
1586
|
case 7:
|
|
1527
|
-
result =
|
|
1587
|
+
result = _context19.sent;
|
|
1528
1588
|
isSuccess = result.success && result.value.execution_result.type === 'Complete';
|
|
1529
1589
|
if (isSuccess) {
|
|
1530
|
-
|
|
1590
|
+
_context19.next = 12;
|
|
1531
1591
|
break;
|
|
1532
1592
|
}
|
|
1533
1593
|
failureReason = result.value.execution_result.value.error.type;
|
|
1534
|
-
return
|
|
1594
|
+
return _context19.abrupt("return", Promise.resolve({
|
|
1535
1595
|
success: false,
|
|
1536
1596
|
failureReason: failureReason
|
|
1537
1597
|
}));
|
|
@@ -1553,10 +1613,10 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1553
1613
|
return ['Currencies', 'Tokens'].includes(event.type) && event.value.type === 'Deposited';
|
|
1554
1614
|
});
|
|
1555
1615
|
if (feeEvent) {
|
|
1556
|
-
|
|
1616
|
+
_context19.next = 18;
|
|
1557
1617
|
break;
|
|
1558
1618
|
}
|
|
1559
|
-
return
|
|
1619
|
+
return _context19.abrupt("return", Promise.resolve({
|
|
1560
1620
|
success: false,
|
|
1561
1621
|
failureReason: 'Cannot determine destination fee. No Issued event found'
|
|
1562
1622
|
}));
|
|
@@ -1569,7 +1629,7 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1569
1629
|
} : undefined;
|
|
1570
1630
|
forwardedXcms = result.value.forwarded_xcms.length > 0 ? result.value.forwarded_xcms[0] : [];
|
|
1571
1631
|
destParaId = forwardedXcms.length === 0 ? undefined : forwardedXcms[0].value.interior.type === 'Here' ? 0 : forwardedXcms[0].value.interior.value.value;
|
|
1572
|
-
return
|
|
1632
|
+
return _context19.abrupt("return", Promise.resolve({
|
|
1573
1633
|
success: true,
|
|
1574
1634
|
fee: fee,
|
|
1575
1635
|
weight: weight,
|
|
@@ -1578,11 +1638,11 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1578
1638
|
}));
|
|
1579
1639
|
case 24:
|
|
1580
1640
|
case "end":
|
|
1581
|
-
return
|
|
1641
|
+
return _context19.stop();
|
|
1582
1642
|
}
|
|
1583
|
-
},
|
|
1643
|
+
}, _callee19, this);
|
|
1584
1644
|
}));
|
|
1585
|
-
function getDryRunXcm(
|
|
1645
|
+
function getDryRunXcm(_x33) {
|
|
1586
1646
|
return _getDryRunXcm.apply(this, arguments);
|
|
1587
1647
|
}
|
|
1588
1648
|
return getDryRunXcm;
|
|
@@ -1590,21 +1650,21 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1590
1650
|
}, {
|
|
1591
1651
|
key: "getBridgeStatus",
|
|
1592
1652
|
value: function () {
|
|
1593
|
-
var _getBridgeStatus = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1653
|
+
var _getBridgeStatus = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee20() {
|
|
1594
1654
|
var outboundOperatingMode;
|
|
1595
|
-
return _regeneratorRuntime().wrap(function
|
|
1596
|
-
while (1) switch (
|
|
1655
|
+
return _regeneratorRuntime().wrap(function _callee20$(_context20) {
|
|
1656
|
+
while (1) switch (_context20.prev = _context20.next) {
|
|
1597
1657
|
case 0:
|
|
1598
|
-
|
|
1658
|
+
_context20.next = 2;
|
|
1599
1659
|
return this.api.getUnsafeApi().query.EthereumOutboundQueue.OperatingMode.getValue();
|
|
1600
1660
|
case 2:
|
|
1601
|
-
outboundOperatingMode =
|
|
1602
|
-
return
|
|
1661
|
+
outboundOperatingMode = _context20.sent;
|
|
1662
|
+
return _context20.abrupt("return", outboundOperatingMode.type);
|
|
1603
1663
|
case 4:
|
|
1604
1664
|
case "end":
|
|
1605
|
-
return
|
|
1665
|
+
return _context20.stop();
|
|
1606
1666
|
}
|
|
1607
|
-
},
|
|
1667
|
+
}, _callee20, this);
|
|
1608
1668
|
}));
|
|
1609
1669
|
function getBridgeStatus() {
|
|
1610
1670
|
return _getBridgeStatus.apply(this, arguments);
|
package/dist/index.mjs
CHANGED
|
@@ -1434,48 +1434,108 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1434
1434
|
}, {
|
|
1435
1435
|
key: "getDryRunCall",
|
|
1436
1436
|
value: function () {
|
|
1437
|
-
var _getDryRunCall = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1438
|
-
var _this
|
|
1439
|
-
var tx, address, node, supportsDryRunApi,
|
|
1440
|
-
return _regeneratorRuntime().wrap(function
|
|
1441
|
-
while (1) switch (
|
|
1437
|
+
var _getDryRunCall = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee18(_ref6) {
|
|
1438
|
+
var _this = this;
|
|
1439
|
+
var tx, address, node, supportsDryRunApi, DEFAULT_XCM_VERSION, basePayload, performDryRunCall, getExecutionSuccessFromResult, extractFailureReasonFromResult, result, isSuccess, failureOutputReason, initialFailureReason, executionFee, fee, actualWeight, weight, forwardedXcms, destParaId;
|
|
1440
|
+
return _regeneratorRuntime().wrap(function _callee18$(_context18) {
|
|
1441
|
+
while (1) switch (_context18.prev = _context18.next) {
|
|
1442
1442
|
case 0:
|
|
1443
1443
|
tx = _ref6.tx, address = _ref6.address, node = _ref6.node;
|
|
1444
1444
|
supportsDryRunApi = getAssetsObject(node).supportsDryRunApi;
|
|
1445
1445
|
if (supportsDryRunApi) {
|
|
1446
|
-
|
|
1446
|
+
_context18.next = 4;
|
|
1447
1447
|
break;
|
|
1448
1448
|
}
|
|
1449
1449
|
throw new NodeNotSupportedError("DryRunApi is not available on node ".concat(node));
|
|
1450
1450
|
case 4:
|
|
1451
|
-
needsVersionParam = node === 'BifrostPolkadot' || node === 'BifrostKusama' || node === 'AssetHubKusama' || node === 'Kusama' || node === 'Polimec';
|
|
1452
1451
|
DEFAULT_XCM_VERSION = 3;
|
|
1453
|
-
|
|
1454
|
-
return (_this$api$getUnsafeAp = this.api.getUnsafeApi().apis.DryRunApi).dry_run_call.apply(_this$api$getUnsafeAp, [{
|
|
1452
|
+
basePayload = {
|
|
1455
1453
|
type: 'system',
|
|
1456
1454
|
value: {
|
|
1457
1455
|
type: 'Signed',
|
|
1458
1456
|
value: address
|
|
1459
1457
|
}
|
|
1460
|
-
}
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1458
|
+
};
|
|
1459
|
+
performDryRunCall = /*#__PURE__*/function () {
|
|
1460
|
+
var _ref7 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee17(includeVersion) {
|
|
1461
|
+
var _this$api$getUnsafeAp;
|
|
1462
|
+
var callArgs;
|
|
1463
|
+
return _regeneratorRuntime().wrap(function _callee17$(_context17) {
|
|
1464
|
+
while (1) switch (_context17.prev = _context17.next) {
|
|
1465
|
+
case 0:
|
|
1466
|
+
callArgs = [basePayload, tx.decodedCall];
|
|
1467
|
+
if (includeVersion) {
|
|
1468
|
+
callArgs.push(DEFAULT_XCM_VERSION);
|
|
1469
|
+
}
|
|
1470
|
+
return _context17.abrupt("return", (_this$api$getUnsafeAp = _this.api.getUnsafeApi().apis.DryRunApi).dry_run_call.apply(_this$api$getUnsafeAp, callArgs));
|
|
1471
|
+
case 3:
|
|
1472
|
+
case "end":
|
|
1473
|
+
return _context17.stop();
|
|
1474
|
+
}
|
|
1475
|
+
}, _callee17);
|
|
1476
|
+
}));
|
|
1477
|
+
return function performDryRunCall(_x32) {
|
|
1478
|
+
return _ref7.apply(this, arguments);
|
|
1479
|
+
};
|
|
1480
|
+
}();
|
|
1481
|
+
getExecutionSuccessFromResult = function getExecutionSuccessFromResult(result) {
|
|
1482
|
+
var _result$value;
|
|
1483
|
+
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);
|
|
1484
|
+
};
|
|
1485
|
+
extractFailureReasonFromResult = function extractFailureReasonFromResult(result) {
|
|
1486
|
+
var _result$value2, _executionResultValue, _executionResultValue2, _result$value3, _ref8, _result$value4;
|
|
1487
|
+
var executionResultValue = result === null || result === void 0 || (_result$value2 = result.value) === null || _result$value2 === void 0 || (_result$value2 = _result$value2.execution_result) === null || _result$value2 === void 0 ? void 0 : _result$value2.value;
|
|
1488
|
+
if (executionResultValue !== null && executionResultValue !== void 0 && (_executionResultValue = executionResultValue.error) !== null && _executionResultValue !== void 0 && (_executionResultValue = _executionResultValue.value) !== null && _executionResultValue !== void 0 && (_executionResultValue = _executionResultValue.value) !== null && _executionResultValue !== void 0 && _executionResultValue.type) {
|
|
1489
|
+
return String(executionResultValue.error.value.value.type);
|
|
1490
|
+
}
|
|
1491
|
+
if (executionResultValue !== null && executionResultValue !== void 0 && (_executionResultValue2 = executionResultValue.error) !== null && _executionResultValue2 !== void 0 && (_executionResultValue2 = _executionResultValue2.value) !== null && _executionResultValue2 !== void 0 && _executionResultValue2.type) {
|
|
1492
|
+
return String(executionResultValue.error.value.type);
|
|
1493
|
+
}
|
|
1494
|
+
if (result !== null && result !== void 0 && (_result$value3 = result.value) !== null && _result$value3 !== void 0 && _result$value3.type) {
|
|
1495
|
+
return String(result.value.type);
|
|
1496
|
+
}
|
|
1497
|
+
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');
|
|
1498
|
+
};
|
|
1499
|
+
failureOutputReason = '';
|
|
1500
|
+
_context18.next = 12;
|
|
1501
|
+
return performDryRunCall(false);
|
|
1502
|
+
case 12:
|
|
1503
|
+
result = _context18.sent;
|
|
1504
|
+
isSuccess = getExecutionSuccessFromResult(result);
|
|
1464
1505
|
if (isSuccess) {
|
|
1465
|
-
|
|
1506
|
+
_context18.next = 23;
|
|
1466
1507
|
break;
|
|
1467
1508
|
}
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1509
|
+
initialFailureReason = extractFailureReasonFromResult(result);
|
|
1510
|
+
failureOutputReason = initialFailureReason;
|
|
1511
|
+
if (!(initialFailureReason === 'VersionedConversionFailed')) {
|
|
1512
|
+
_context18.next = 23;
|
|
1513
|
+
break;
|
|
1514
|
+
}
|
|
1515
|
+
_context18.next = 20;
|
|
1516
|
+
return performDryRunCall(true);
|
|
1517
|
+
case 20:
|
|
1518
|
+
result = _context18.sent;
|
|
1519
|
+
isSuccess = getExecutionSuccessFromResult(result);
|
|
1520
|
+
if (!isSuccess) {
|
|
1521
|
+
failureOutputReason = extractFailureReasonFromResult(result);
|
|
1522
|
+
} else {
|
|
1523
|
+
failureOutputReason = '';
|
|
1524
|
+
}
|
|
1525
|
+
case 23:
|
|
1526
|
+
if (isSuccess) {
|
|
1527
|
+
_context18.next = 25;
|
|
1528
|
+
break;
|
|
1529
|
+
}
|
|
1530
|
+
return _context18.abrupt("return", Promise.resolve({
|
|
1471
1531
|
success: false,
|
|
1472
|
-
failureReason:
|
|
1532
|
+
failureReason: failureOutputReason
|
|
1473
1533
|
}));
|
|
1474
|
-
case
|
|
1475
|
-
|
|
1534
|
+
case 25:
|
|
1535
|
+
_context18.next = 27;
|
|
1476
1536
|
return this.calculateTransactionFee(tx, address);
|
|
1477
|
-
case
|
|
1478
|
-
executionFee =
|
|
1537
|
+
case 27:
|
|
1538
|
+
executionFee = _context18.sent;
|
|
1479
1539
|
fee = computeFeeFromDryRun(result, node, executionFee);
|
|
1480
1540
|
actualWeight = result.value.execution_result.value.actual_weight;
|
|
1481
1541
|
weight = actualWeight ? {
|
|
@@ -1484,18 +1544,18 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1484
1544
|
} : undefined;
|
|
1485
1545
|
forwardedXcms = result.value.forwarded_xcms.length > 0 ? result.value.forwarded_xcms[0] : [];
|
|
1486
1546
|
destParaId = forwardedXcms.length === 0 ? undefined : forwardedXcms[0].value.interior.type === 'Here' ? 0 : forwardedXcms[0].value.interior.value.value;
|
|
1487
|
-
return
|
|
1547
|
+
return _context18.abrupt("return", Promise.resolve({
|
|
1488
1548
|
success: true,
|
|
1489
1549
|
fee: fee,
|
|
1490
1550
|
weight: weight,
|
|
1491
1551
|
forwardedXcms: forwardedXcms,
|
|
1492
1552
|
destParaId: destParaId
|
|
1493
1553
|
}));
|
|
1494
|
-
case
|
|
1554
|
+
case 34:
|
|
1495
1555
|
case "end":
|
|
1496
|
-
return
|
|
1556
|
+
return _context18.stop();
|
|
1497
1557
|
}
|
|
1498
|
-
},
|
|
1558
|
+
}, _callee18, this);
|
|
1499
1559
|
}));
|
|
1500
1560
|
function getDryRunCall(_x31) {
|
|
1501
1561
|
return _getDryRunCall.apply(this, arguments);
|
|
@@ -1505,32 +1565,32 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1505
1565
|
}, {
|
|
1506
1566
|
key: "getDryRunXcm",
|
|
1507
1567
|
value: function () {
|
|
1508
|
-
var _getDryRunXcm = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1568
|
+
var _getDryRunXcm = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee19(_ref9) {
|
|
1509
1569
|
var _ref0, _ref1, _ref10;
|
|
1510
1570
|
var originLocation, xcm, node, origin, supportsDryRunApi, transformedOriginLocation, result, isSuccess, failureReason, emitted, reversedEvents, palletsWithIssued, feeEvent, fee, actualWeight, weight, forwardedXcms, destParaId;
|
|
1511
|
-
return _regeneratorRuntime().wrap(function
|
|
1512
|
-
while (1) switch (
|
|
1571
|
+
return _regeneratorRuntime().wrap(function _callee19$(_context19) {
|
|
1572
|
+
while (1) switch (_context19.prev = _context19.next) {
|
|
1513
1573
|
case 0:
|
|
1514
1574
|
originLocation = _ref9.originLocation, xcm = _ref9.xcm, node = _ref9.node, origin = _ref9.origin;
|
|
1515
1575
|
supportsDryRunApi = getAssetsObject(node).supportsDryRunApi;
|
|
1516
1576
|
if (supportsDryRunApi) {
|
|
1517
|
-
|
|
1577
|
+
_context19.next = 4;
|
|
1518
1578
|
break;
|
|
1519
1579
|
}
|
|
1520
1580
|
throw new NodeNotSupportedError("DryRunApi is not available on node ".concat(node));
|
|
1521
1581
|
case 4:
|
|
1522
1582
|
transformedOriginLocation = _transform(originLocation);
|
|
1523
|
-
|
|
1583
|
+
_context19.next = 7;
|
|
1524
1584
|
return this.api.getUnsafeApi().apis.DryRunApi.dry_run_xcm(transformedOriginLocation, xcm);
|
|
1525
1585
|
case 7:
|
|
1526
|
-
result =
|
|
1586
|
+
result = _context19.sent;
|
|
1527
1587
|
isSuccess = result.success && result.value.execution_result.type === 'Complete';
|
|
1528
1588
|
if (isSuccess) {
|
|
1529
|
-
|
|
1589
|
+
_context19.next = 12;
|
|
1530
1590
|
break;
|
|
1531
1591
|
}
|
|
1532
1592
|
failureReason = result.value.execution_result.value.error.type;
|
|
1533
|
-
return
|
|
1593
|
+
return _context19.abrupt("return", Promise.resolve({
|
|
1534
1594
|
success: false,
|
|
1535
1595
|
failureReason: failureReason
|
|
1536
1596
|
}));
|
|
@@ -1552,10 +1612,10 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1552
1612
|
return ['Currencies', 'Tokens'].includes(event.type) && event.value.type === 'Deposited';
|
|
1553
1613
|
});
|
|
1554
1614
|
if (feeEvent) {
|
|
1555
|
-
|
|
1615
|
+
_context19.next = 18;
|
|
1556
1616
|
break;
|
|
1557
1617
|
}
|
|
1558
|
-
return
|
|
1618
|
+
return _context19.abrupt("return", Promise.resolve({
|
|
1559
1619
|
success: false,
|
|
1560
1620
|
failureReason: 'Cannot determine destination fee. No Issued event found'
|
|
1561
1621
|
}));
|
|
@@ -1568,7 +1628,7 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1568
1628
|
} : undefined;
|
|
1569
1629
|
forwardedXcms = result.value.forwarded_xcms.length > 0 ? result.value.forwarded_xcms[0] : [];
|
|
1570
1630
|
destParaId = forwardedXcms.length === 0 ? undefined : forwardedXcms[0].value.interior.type === 'Here' ? 0 : forwardedXcms[0].value.interior.value.value;
|
|
1571
|
-
return
|
|
1631
|
+
return _context19.abrupt("return", Promise.resolve({
|
|
1572
1632
|
success: true,
|
|
1573
1633
|
fee: fee,
|
|
1574
1634
|
weight: weight,
|
|
@@ -1577,11 +1637,11 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1577
1637
|
}));
|
|
1578
1638
|
case 24:
|
|
1579
1639
|
case "end":
|
|
1580
|
-
return
|
|
1640
|
+
return _context19.stop();
|
|
1581
1641
|
}
|
|
1582
|
-
},
|
|
1642
|
+
}, _callee19, this);
|
|
1583
1643
|
}));
|
|
1584
|
-
function getDryRunXcm(
|
|
1644
|
+
function getDryRunXcm(_x33) {
|
|
1585
1645
|
return _getDryRunXcm.apply(this, arguments);
|
|
1586
1646
|
}
|
|
1587
1647
|
return getDryRunXcm;
|
|
@@ -1589,21 +1649,21 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1589
1649
|
}, {
|
|
1590
1650
|
key: "getBridgeStatus",
|
|
1591
1651
|
value: function () {
|
|
1592
|
-
var _getBridgeStatus = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1652
|
+
var _getBridgeStatus = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee20() {
|
|
1593
1653
|
var outboundOperatingMode;
|
|
1594
|
-
return _regeneratorRuntime().wrap(function
|
|
1595
|
-
while (1) switch (
|
|
1654
|
+
return _regeneratorRuntime().wrap(function _callee20$(_context20) {
|
|
1655
|
+
while (1) switch (_context20.prev = _context20.next) {
|
|
1596
1656
|
case 0:
|
|
1597
|
-
|
|
1657
|
+
_context20.next = 2;
|
|
1598
1658
|
return this.api.getUnsafeApi().query.EthereumOutboundQueue.OperatingMode.getValue();
|
|
1599
1659
|
case 2:
|
|
1600
|
-
outboundOperatingMode =
|
|
1601
|
-
return
|
|
1660
|
+
outboundOperatingMode = _context20.sent;
|
|
1661
|
+
return _context20.abrupt("return", outboundOperatingMode.type);
|
|
1602
1662
|
case 4:
|
|
1603
1663
|
case "end":
|
|
1604
|
-
return
|
|
1664
|
+
return _context20.stop();
|
|
1605
1665
|
}
|
|
1606
|
-
},
|
|
1666
|
+
}, _callee20, this);
|
|
1607
1667
|
}));
|
|
1608
1668
|
function getBridgeStatus() {
|
|
1609
1669
|
return _getBridgeStatus.apply(this, arguments);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@paraspell/sdk",
|
|
3
|
-
"version": "9.2.
|
|
3
|
+
"version": "9.2.5",
|
|
4
4
|
"description": "SDK for ParaSpell XCM/XCMP tool for developers",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"ethers": "^6.13.7",
|
|
28
28
|
"quick-lru": "^7.0.1",
|
|
29
29
|
"viem": "^2.28.1",
|
|
30
|
-
"@paraspell/sdk-core": "9.2.
|
|
30
|
+
"@paraspell/sdk-core": "9.2.5"
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {
|
|
33
33
|
"polkadot-api": ">= 1.10.2 < 2"
|