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