@paraspell/sdk 12.1.0 → 12.1.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.
Files changed (2) hide show
  1. package/dist/index.mjs +201 -133
  2. package/package.json +8 -8
package/dist/index.mjs CHANGED
@@ -313,7 +313,7 @@ function _unsupportedIterableToArray(r, a) {
313
313
  }
314
314
  }
315
315
 
316
- var LEGACY_CHAINS = ['Interlay', 'CrustShadow', 'Kintsugi', 'RobonomicsKusama', 'RobonomicsPolkadot', 'Pendulum'];
316
+ var LEGACY_CHAINS = ['Interlay', 'CrustShadow', 'Kintsugi', 'RobonomicsPolkadot', 'Pendulum'];
317
317
  // Cache settings
318
318
  var DEFAULT_TTL_MS = 60000; // 1 minute
319
319
  var MAX_CLIENTS = 100;
@@ -1202,16 +1202,16 @@ var PapiApi = /*#__PURE__*/function () {
1202
1202
  }, {
1203
1203
  key: "getDryRunCall",
1204
1204
  value: function () {
1205
- var _getDryRunCall = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee1(options) {
1205
+ var _getDryRunCall = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee10(options) {
1206
1206
  var _this = this;
1207
- var tx, chain, destination, address, feeAsset, bypassOptions, _options$useRootOrigi, useRootOrigin, supportsDryRunApi, DEFAULT_XCM_VERSION, basePayload, resolvedTx, performDryRunCall, getExecutionSuccessFromResult, findFailureObjectFromResult, extractFailureReasonFromResult, result, isSuccess, failureOutputReason, initialFailureReason, resolvedFeeAsset, actualWeight, weight, forwardedXcms, destParaId, hasLocation, xcmFee, executionFee, fee, _t2;
1208
- return _regenerator().w(function (_context1) {
1209
- while (1) switch (_context1.n) {
1207
+ var tx, chain, destination, address, feeAsset, bypassOptions, _options$useRootOrigi, useRootOrigin, supportsDryRunApi, DEFAULT_XCM_VERSION, basePayload, resolvedTx, performDryRunCall, getExecutionSuccessFromResult, findFailureObjectFromResult, extractFailureReasonFromResult, result, isSuccess, failureOutputReason, initialFailureReason, resolvedFeeAsset, actualWeight, weight, forwardedXcms, destParaId, hasLocation, getPaymentInfoWeight, overriddenWeight, xcmFee, executionFee, fee, _t2, _t3;
1208
+ return _regenerator().w(function (_context10) {
1209
+ while (1) switch (_context10.n) {
1210
1210
  case 0:
1211
1211
  tx = options.tx, chain = options.chain, destination = options.destination, address = options.address, feeAsset = options.feeAsset, bypassOptions = options.bypassOptions, _options$useRootOrigi = options.useRootOrigin, useRootOrigin = _options$useRootOrigi === void 0 ? false : _options$useRootOrigi;
1212
1212
  supportsDryRunApi = getAssetsObject(chain).supportsDryRunApi;
1213
1213
  if (supportsDryRunApi) {
1214
- _context1.n = 1;
1214
+ _context10.n = 1;
1215
1215
  break;
1216
1216
  }
1217
1217
  throw new RuntimeApiUnavailableError(chain, 'DryRunApi');
@@ -1227,16 +1227,16 @@ var PapiApi = /*#__PURE__*/function () {
1227
1227
  }
1228
1228
  };
1229
1229
  if (!useRootOrigin) {
1230
- _context1.n = 3;
1230
+ _context10.n = 3;
1231
1231
  break;
1232
1232
  }
1233
- _context1.n = 2;
1233
+ _context10.n = 2;
1234
1234
  return wrapTxBypass(_objectSpread2(_objectSpread2({}, options), {}, {
1235
1235
  api: this
1236
1236
  }), bypassOptions);
1237
1237
  case 2:
1238
- _t2 = _context1.v;
1239
- _context1.n = 4;
1238
+ _t2 = _context10.v;
1239
+ _context10.n = 4;
1240
1240
  break;
1241
1241
  case 3:
1242
1242
  _t2 = tx;
@@ -1307,25 +1307,25 @@ var PapiApi = /*#__PURE__*/function () {
1307
1307
  failureOutputReason = {
1308
1308
  failureReason: ''
1309
1309
  };
1310
- _context1.n = 5;
1310
+ _context10.n = 5;
1311
1311
  return performDryRunCall(false);
1312
1312
  case 5:
1313
- result = _context1.v;
1313
+ result = _context10.v;
1314
1314
  isSuccess = getExecutionSuccessFromResult(result);
1315
1315
  if (isSuccess) {
1316
- _context1.n = 7;
1316
+ _context10.n = 7;
1317
1317
  break;
1318
1318
  }
1319
1319
  initialFailureReason = extractFailureReasonFromResult(result);
1320
1320
  failureOutputReason = initialFailureReason;
1321
1321
  if (!(initialFailureReason.failureReason === 'VersionedConversionFailed')) {
1322
- _context1.n = 7;
1322
+ _context10.n = 7;
1323
1323
  break;
1324
1324
  }
1325
- _context1.n = 6;
1325
+ _context10.n = 6;
1326
1326
  return performDryRunCall(true);
1327
1327
  case 6:
1328
- result = _context1.v;
1328
+ result = _context10.v;
1329
1329
  isSuccess = getExecutionSuccessFromResult(result);
1330
1330
  if (!isSuccess) {
1331
1331
  failureOutputReason = extractFailureReasonFromResult(result);
@@ -1336,15 +1336,15 @@ var PapiApi = /*#__PURE__*/function () {
1336
1336
  };
1337
1337
  }
1338
1338
  case 7:
1339
- _context1.n = 8;
1339
+ _context10.n = 8;
1340
1340
  return this.resolveFeeAsset(options);
1341
1341
  case 8:
1342
- resolvedFeeAsset = _context1.v;
1342
+ resolvedFeeAsset = _context10.v;
1343
1343
  if (isSuccess) {
1344
- _context1.n = 9;
1344
+ _context10.n = 9;
1345
1345
  break;
1346
1346
  }
1347
- return _context1.a(2, Promise.resolve({
1347
+ return _context10.a(2, Promise.resolve({
1348
1348
  success: false,
1349
1349
  failureReason: failureOutputReason.failureReason,
1350
1350
  failureSubReason: failureOutputReason.failureSubReason,
@@ -1360,18 +1360,51 @@ var PapiApi = /*#__PURE__*/function () {
1360
1360
  destParaId = forwardedXcms.length === 0 ? undefined : forwardedXcms[0].value.interior.type === 'Here' ? 0 : forwardedXcms[0].value.interior.value.value;
1361
1361
  hasLocation = resolvedFeeAsset.asset.location;
1362
1362
  if (!(hasXcmPaymentApiSupport(chain) && result.value.local_xcm && hasLocation && (feeAsset || chain.startsWith('AssetHub') && destination === 'Ethereum') || resolvedFeeAsset.isCustomAsset)) {
1363
- _context1.n = 12;
1363
+ _context10.n = 15;
1364
+ break;
1365
+ }
1366
+ getPaymentInfoWeight = /*#__PURE__*/function () {
1367
+ var _ref1 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee1() {
1368
+ var _yield$tx$getPaymentI, weight;
1369
+ return _regenerator().w(function (_context1) {
1370
+ while (1) switch (_context1.n) {
1371
+ case 0:
1372
+ _context1.n = 1;
1373
+ return tx.getPaymentInfo(address);
1374
+ case 1:
1375
+ _yield$tx$getPaymentI = _context1.v;
1376
+ weight = _yield$tx$getPaymentI.weight;
1377
+ return _context1.a(2, weight);
1378
+ }
1379
+ }, _callee1);
1380
+ }));
1381
+ return function getPaymentInfoWeight() {
1382
+ return _ref1.apply(this, arguments);
1383
+ };
1384
+ }();
1385
+ if (result.value.local_xcm) {
1386
+ _context10.n = 11;
1364
1387
  break;
1365
1388
  }
1366
- _context1.n = 10;
1367
- return this.getXcmPaymentApiFee(chain, result.value.local_xcm, forwardedXcms, resolvedFeeAsset.asset);
1389
+ _context10.n = 10;
1390
+ return getPaymentInfoWeight();
1368
1391
  case 10:
1369
- xcmFee = _context1.v;
1392
+ _t3 = _context10.v;
1393
+ _context10.n = 12;
1394
+ break;
1395
+ case 11:
1396
+ _t3 = undefined;
1397
+ case 12:
1398
+ overriddenWeight = _t3;
1399
+ _context10.n = 13;
1400
+ return this.getXcmPaymentApiFee(chain, result.value.local_xcm, forwardedXcms, resolvedFeeAsset.asset, false, overriddenWeight);
1401
+ case 13:
1402
+ xcmFee = _context10.v;
1370
1403
  if (!(typeof xcmFee === 'bigint')) {
1371
- _context1.n = 11;
1404
+ _context10.n = 14;
1372
1405
  break;
1373
1406
  }
1374
- return _context1.a(2, Promise.resolve({
1407
+ return _context10.a(2, Promise.resolve({
1375
1408
  success: true,
1376
1409
  fee: xcmFee,
1377
1410
  asset: resolvedFeeAsset.asset,
@@ -1379,18 +1412,18 @@ var PapiApi = /*#__PURE__*/function () {
1379
1412
  forwardedXcms: forwardedXcms,
1380
1413
  destParaId: destParaId
1381
1414
  }));
1382
- case 11:
1415
+ case 14:
1383
1416
  resolvedFeeAsset = {
1384
1417
  isCustomAsset: false,
1385
1418
  asset: this.resolveDefaultFeeAsset(options)
1386
1419
  };
1387
- case 12:
1388
- _context1.n = 13;
1420
+ case 15:
1421
+ _context10.n = 16;
1389
1422
  return this.calculateTransactionFee(tx, address);
1390
- case 13:
1391
- executionFee = _context1.v;
1423
+ case 16:
1424
+ executionFee = _context10.v;
1392
1425
  fee = computeFeeFromDryRun(result, chain, executionFee, !!feeAsset);
1393
- return _context1.a(2, Promise.resolve({
1426
+ return _context10.a(2, Promise.resolve({
1394
1427
  success: true,
1395
1428
  fee: fee,
1396
1429
  asset: resolvedFeeAsset.asset,
@@ -1399,7 +1432,7 @@ var PapiApi = /*#__PURE__*/function () {
1399
1432
  destParaId: destParaId
1400
1433
  }));
1401
1434
  }
1402
- }, _callee1, this);
1435
+ }, _callee10, this);
1403
1436
  }));
1404
1437
  function getDryRunCall(_x15) {
1405
1438
  return _getDryRunCall.apply(this, arguments);
@@ -1409,22 +1442,22 @@ var PapiApi = /*#__PURE__*/function () {
1409
1442
  }, {
1410
1443
  key: "getXcmWeight",
1411
1444
  value: function () {
1412
- var _getXcmWeight = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee10(xcm) {
1445
+ var _getXcmWeight = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee11(xcm) {
1413
1446
  var weightResult, _weightResult$value, ref_time, proof_size;
1414
- return _regenerator().w(function (_context10) {
1415
- while (1) switch (_context10.n) {
1447
+ return _regenerator().w(function (_context11) {
1448
+ while (1) switch (_context11.n) {
1416
1449
  case 0:
1417
- _context10.n = 1;
1450
+ _context11.n = 1;
1418
1451
  return this.api.getUnsafeApi().apis.XcmPaymentApi.query_xcm_weight(!xcm.type ? _transform(xcm) : xcm);
1419
1452
  case 1:
1420
- weightResult = _context10.v;
1453
+ weightResult = _context11.v;
1421
1454
  _weightResult$value = weightResult.value, ref_time = _weightResult$value.ref_time, proof_size = _weightResult$value.proof_size;
1422
- return _context10.a(2, {
1455
+ return _context11.a(2, {
1423
1456
  refTime: ref_time,
1424
1457
  proofSize: proof_size
1425
1458
  });
1426
1459
  }
1427
- }, _callee10, this);
1460
+ }, _callee11, this);
1428
1461
  }));
1429
1462
  function getXcmWeight(_x17) {
1430
1463
  return _getXcmWeight.apply(this, arguments);
@@ -1434,10 +1467,15 @@ var PapiApi = /*#__PURE__*/function () {
1434
1467
  }, {
1435
1468
  key: "getXcmPaymentApiFee",
1436
1469
  value: function () {
1437
- var _getXcmPaymentApiFee = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee11(chain, localXcm, forwardedXcm, asset) {
1438
- var _execFeeRes$value, _deliveryFeeRes$value, _deliveryFeeRes$value2;
1470
+ var _getXcmPaymentApiFee = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee13(chain, localXcm, forwardedXcm, asset) {
1471
+ var _this2 = this,
1472
+ _execFeeRes$value,
1473
+ _deliveryFeeRes$value,
1474
+ _deliveryFeeRes$value2;
1439
1475
  var transformXcm,
1476
+ overridenWeight,
1440
1477
  transformedXcm,
1478
+ queryWeight,
1441
1479
  weight,
1442
1480
  assetLocalizedLoc,
1443
1481
  transformedAssetLoc,
@@ -1449,86 +1487,116 @@ var PapiApi = /*#__PURE__*/function () {
1449
1487
  nativeAsset,
1450
1488
  deliveryFee,
1451
1489
  res,
1452
- _args11 = arguments,
1453
- _t3,
1454
- _t4;
1455
- return _regenerator().w(function (_context11) {
1456
- while (1) switch (_context11.p = _context11.n) {
1490
+ _args13 = arguments,
1491
+ _t4,
1492
+ _t5,
1493
+ _t6;
1494
+ return _regenerator().w(function (_context13) {
1495
+ while (1) switch (_context13.p = _context13.n) {
1457
1496
  case 0:
1458
- transformXcm = _args11.length > 4 && _args11[4] !== undefined ? _args11[4] : false;
1497
+ transformXcm = _args13.length > 4 && _args13[4] !== undefined ? _args13[4] : false;
1498
+ overridenWeight = _args13.length > 5 ? _args13[5] : undefined;
1459
1499
  transformedXcm = transformXcm ? _transform(localXcm) : localXcm;
1460
- _context11.n = 1;
1461
- return this.api.getUnsafeApi().apis.XcmPaymentApi.query_xcm_weight(transformedXcm);
1500
+ queryWeight = /*#__PURE__*/function () {
1501
+ var _ref10 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee12() {
1502
+ var weightRes;
1503
+ return _regenerator().w(function (_context12) {
1504
+ while (1) switch (_context12.n) {
1505
+ case 0:
1506
+ _context12.n = 1;
1507
+ return _this2.api.getUnsafeApi().apis.XcmPaymentApi.query_xcm_weight(transformedXcm);
1508
+ case 1:
1509
+ weightRes = _context12.v;
1510
+ return _context12.a(2, weightRes.value);
1511
+ }
1512
+ }, _callee12);
1513
+ }));
1514
+ return function queryWeight() {
1515
+ return _ref10.apply(this, arguments);
1516
+ };
1517
+ }();
1518
+ if (!(overridenWeight !== null && overridenWeight !== void 0)) {
1519
+ _context13.n = 1;
1520
+ break;
1521
+ }
1522
+ _t4 = overridenWeight;
1523
+ _context13.n = 3;
1524
+ break;
1462
1525
  case 1:
1463
- weight = _context11.v;
1526
+ _context13.n = 2;
1527
+ return queryWeight();
1528
+ case 2:
1529
+ _t4 = _context13.v;
1530
+ case 3:
1531
+ weight = _t4;
1464
1532
  assertHasLocation(asset);
1465
1533
  assetLocalizedLoc = localizeLocation(chain, asset.location);
1466
1534
  transformedAssetLoc = _transform(assetLocalizedLoc);
1467
- _context11.n = 2;
1468
- return this.api.getUnsafeApi().apis.XcmPaymentApi.query_weight_to_asset_fee(weight.value, {
1535
+ _context13.n = 4;
1536
+ return this.api.getUnsafeApi().apis.XcmPaymentApi.query_weight_to_asset_fee(weight, {
1469
1537
  type: Version.V4,
1470
1538
  value: transformedAssetLoc
1471
1539
  });
1472
- case 2:
1473
- execFeeRes = _context11.v;
1540
+ case 4:
1541
+ execFeeRes = _context13.v;
1474
1542
  execFee = typeof (execFeeRes === null || execFeeRes === void 0 ? void 0 : execFeeRes.value) === 'bigint' ? execFeeRes.value : 0n;
1475
1543
  if (!(chain.startsWith('BridgeHub') && (execFeeRes === null || execFeeRes === void 0 ? void 0 : execFeeRes.success) === false && (execFeeRes === null || execFeeRes === void 0 || (_execFeeRes$value = execFeeRes.value) === null || _execFeeRes$value === void 0 ? void 0 : _execFeeRes$value.type) === 'AssetNotFound')) {
1476
- _context11.n = 4;
1544
+ _context13.n = 6;
1477
1545
  break;
1478
1546
  }
1479
- _context11.n = 3;
1480
- return this.getBridgeHubFallbackExecFee(chain, weight.value, asset);
1481
- case 3:
1482
- bridgeHubExecFee = _context11.v;
1547
+ _context13.n = 5;
1548
+ return this.getBridgeHubFallbackExecFee(chain, weight, asset);
1549
+ case 5:
1550
+ bridgeHubExecFee = _context13.v;
1483
1551
  if (typeof bridgeHubExecFee === 'bigint') {
1484
1552
  execFee = bridgeHubExecFee;
1485
1553
  }
1486
- case 4:
1554
+ case 6:
1487
1555
  if (!(forwardedXcm.length > 0)) {
1488
- _context11.n = 6;
1556
+ _context13.n = 8;
1489
1557
  break;
1490
1558
  }
1491
- _context11.n = 5;
1559
+ _context13.n = 7;
1492
1560
  return this.api.getUnsafeApi().apis.XcmPaymentApi.query_delivery_fees(forwardedXcm[0], forwardedXcm[1][0]);
1493
- case 5:
1494
- _t3 = _context11.v;
1495
- _context11.n = 7;
1496
- break;
1497
- case 6:
1498
- _t3 = undefined;
1499
1561
  case 7:
1500
- deliveryFeeRes = _t3;
1562
+ _t5 = _context13.v;
1563
+ _context13.n = 9;
1564
+ break;
1565
+ case 8:
1566
+ _t5 = undefined;
1567
+ case 9:
1568
+ deliveryFeeRes = _t5;
1501
1569
  deliveryFeeResolved = (deliveryFeeRes === null || deliveryFeeRes === void 0 || (_deliveryFeeRes$value = deliveryFeeRes.value) === null || _deliveryFeeRes$value === void 0 ? void 0 : _deliveryFeeRes$value.value.length) > 0 ? deliveryFeeRes === null || deliveryFeeRes === void 0 || (_deliveryFeeRes$value2 = deliveryFeeRes.value) === null || _deliveryFeeRes$value2 === void 0 ? void 0 : _deliveryFeeRes$value2.value[0].fun.value : 0n;
1502
1570
  nativeAsset = findNativeAssetInfoOrThrow(chain);
1503
1571
  if (!isAssetXcEqual(asset, nativeAsset)) {
1504
- _context11.n = 8;
1572
+ _context13.n = 10;
1505
1573
  break;
1506
1574
  }
1507
1575
  deliveryFee = deliveryFeeResolved;
1508
- _context11.n = 11;
1576
+ _context13.n = 13;
1509
1577
  break;
1510
- case 8:
1511
- _context11.p = 8;
1578
+ case 10:
1579
+ _context13.p = 10;
1512
1580
  assertHasLocation(nativeAsset);
1513
- _context11.n = 9;
1581
+ _context13.n = 11;
1514
1582
  return this.quoteAhPrice(localizeLocation(chain, nativeAsset.location), assetLocalizedLoc, deliveryFeeResolved, false);
1515
- case 9:
1516
- res = _context11.v;
1583
+ case 11:
1584
+ res = _context13.v;
1517
1585
  deliveryFee = res !== null && res !== void 0 ? res : 0n;
1518
- _context11.n = 11;
1586
+ _context13.n = 13;
1519
1587
  break;
1520
- case 10:
1521
- _context11.p = 10;
1522
- _t4 = _context11.v;
1523
- if (_t4 instanceof Error && /Runtime entry RuntimeCall\(.+\) not found/.test(_t4.message)) {
1588
+ case 12:
1589
+ _context13.p = 12;
1590
+ _t6 = _context13.v;
1591
+ if (_t6 instanceof Error && /Runtime entry RuntimeCall\(.+\) not found/.test(_t6.message)) {
1524
1592
  deliveryFee = 0n;
1525
1593
  } else {
1526
1594
  deliveryFee = 0n;
1527
1595
  }
1528
- case 11:
1529
- return _context11.a(2, execFee + deliveryFee);
1596
+ case 13:
1597
+ return _context13.a(2, execFee + deliveryFee);
1530
1598
  }
1531
- }, _callee11, this, [[8, 10]]);
1599
+ }, _callee13, this, [[10, 12]]);
1532
1600
  }));
1533
1601
  function getXcmPaymentApiFee(_x18, _x19, _x20, _x21) {
1534
1602
  return _getXcmPaymentApiFee.apply(this, arguments);
@@ -1538,44 +1606,44 @@ var PapiApi = /*#__PURE__*/function () {
1538
1606
  }, {
1539
1607
  key: "getBridgeHubFallbackExecFee",
1540
1608
  value: function () {
1541
- var _getBridgeHubFallbackExecFee = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee12(chain, weightValue, asset) {
1609
+ var _getBridgeHubFallbackExecFee = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee14(chain, weightValue, asset) {
1542
1610
  var fallbackExecFeeRes, ahApi, assetHubChain, ahLocalizedLoc, convertedExecFee;
1543
- return _regenerator().w(function (_context12) {
1544
- while (1) switch (_context12.n) {
1611
+ return _regenerator().w(function (_context14) {
1612
+ while (1) switch (_context14.n) {
1545
1613
  case 0:
1546
- _context12.n = 1;
1614
+ _context14.n = 1;
1547
1615
  return this.api.getUnsafeApi().apis.XcmPaymentApi.query_weight_to_asset_fee(weightValue, {
1548
1616
  type: Version.V4,
1549
1617
  value: _transform(RELAY_LOCATION)
1550
1618
  });
1551
1619
  case 1:
1552
- fallbackExecFeeRes = _context12.v;
1620
+ fallbackExecFeeRes = _context14.v;
1553
1621
  if (!(typeof (fallbackExecFeeRes === null || fallbackExecFeeRes === void 0 ? void 0 : fallbackExecFeeRes.value) !== 'bigint')) {
1554
- _context12.n = 2;
1622
+ _context14.n = 2;
1555
1623
  break;
1556
1624
  }
1557
- return _context12.a(2, undefined);
1625
+ return _context14.a(2, undefined);
1558
1626
  case 2:
1559
1627
  ahApi = this.clone();
1560
1628
  assetHubChain = "AssetHub".concat(getRelayChainOf(chain));
1561
- _context12.n = 3;
1629
+ _context14.n = 3;
1562
1630
  return ahApi.init(assetHubChain);
1563
1631
  case 3:
1564
1632
  assertHasLocation(asset);
1565
1633
  ahLocalizedLoc = localizeLocation(assetHubChain, asset.location);
1566
- _context12.n = 4;
1634
+ _context14.n = 4;
1567
1635
  return ahApi.quoteAhPrice(RELAY_LOCATION, ahLocalizedLoc, fallbackExecFeeRes.value, false);
1568
1636
  case 4:
1569
- convertedExecFee = _context12.v;
1637
+ convertedExecFee = _context14.v;
1570
1638
  if (!(typeof convertedExecFee === 'bigint')) {
1571
- _context12.n = 5;
1639
+ _context14.n = 5;
1572
1640
  break;
1573
1641
  }
1574
- return _context12.a(2, convertedExecFee);
1642
+ return _context14.a(2, convertedExecFee);
1575
1643
  case 5:
1576
- return _context12.a(2, undefined);
1644
+ return _context14.a(2, undefined);
1577
1645
  }
1578
- }, _callee12, this);
1646
+ }, _callee14, this);
1579
1647
  }));
1580
1648
  function getBridgeHubFallbackExecFee(_x22, _x23, _x24) {
1581
1649
  return _getBridgeHubFallbackExecFee.apply(this, arguments);
@@ -1585,32 +1653,32 @@ var PapiApi = /*#__PURE__*/function () {
1585
1653
  }, {
1586
1654
  key: "getDryRunXcm",
1587
1655
  value: function () {
1588
- var _getDryRunXcm = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee13(_ref1) {
1589
- var _ref10, _processAssetsDeposit, _ref11, _ref12, _ref13, _ref14, _ref15;
1656
+ var _getDryRunXcm = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee15(_ref11) {
1657
+ var _ref12, _processAssetsDeposit, _ref13, _ref14, _ref15, _ref16, _ref17;
1590
1658
  var originLocation, xcm, chain, origin, asset, feeAsset, originFee, amount, supportsDryRunApi, transformedOriginLocation, result, isSuccess, failureReason, actualWeight, weight, forwardedXcms, destParaId, _fee, emitted, reversedEvents, palletsWithIssued, isFeeAsset, feeAssetFeeEvent, processedAssetsAmount, feeEvent, fee, processedFee;
1591
- return _regenerator().w(function (_context13) {
1592
- while (1) switch (_context13.n) {
1659
+ return _regenerator().w(function (_context15) {
1660
+ while (1) switch (_context15.n) {
1593
1661
  case 0:
1594
- originLocation = _ref1.originLocation, xcm = _ref1.xcm, chain = _ref1.chain, origin = _ref1.origin, asset = _ref1.asset, feeAsset = _ref1.feeAsset, originFee = _ref1.originFee, amount = _ref1.amount;
1662
+ originLocation = _ref11.originLocation, xcm = _ref11.xcm, chain = _ref11.chain, origin = _ref11.origin, asset = _ref11.asset, feeAsset = _ref11.feeAsset, originFee = _ref11.originFee, amount = _ref11.amount;
1595
1663
  supportsDryRunApi = getAssetsObject(chain).supportsDryRunApi;
1596
1664
  if (supportsDryRunApi) {
1597
- _context13.n = 1;
1665
+ _context15.n = 1;
1598
1666
  break;
1599
1667
  }
1600
1668
  throw new RuntimeApiUnavailableError(chain, 'DryRunApi');
1601
1669
  case 1:
1602
1670
  transformedOriginLocation = _transform(originLocation);
1603
- _context13.n = 2;
1671
+ _context15.n = 2;
1604
1672
  return this.api.getUnsafeApi().apis.DryRunApi.dry_run_xcm(transformedOriginLocation, xcm);
1605
1673
  case 2:
1606
- result = _context13.v;
1674
+ result = _context15.v;
1607
1675
  isSuccess = result.success && result.value.execution_result.type === 'Complete';
1608
1676
  if (isSuccess) {
1609
- _context13.n = 3;
1677
+ _context15.n = 3;
1610
1678
  break;
1611
1679
  }
1612
1680
  failureReason = extractDryRunXcmFailureReason(result);
1613
- return _context13.a(2, {
1681
+ return _context15.a(2, {
1614
1682
  success: false,
1615
1683
  failureReason: failureReason,
1616
1684
  asset: asset
@@ -1624,18 +1692,18 @@ var PapiApi = /*#__PURE__*/function () {
1624
1692
  forwardedXcms = result.value.forwarded_xcms.length > 0 ? result.value.forwarded_xcms[0] : [];
1625
1693
  destParaId = forwardedXcms.length === 0 ? undefined : forwardedXcms[0].value.interior.type === 'Here' ? 0 : forwardedXcms[0].value.interior.value.value;
1626
1694
  if (!(hasXcmPaymentApiSupport(chain) && asset)) {
1627
- _context13.n = 5;
1695
+ _context15.n = 5;
1628
1696
  break;
1629
1697
  }
1630
- _context13.n = 4;
1698
+ _context15.n = 4;
1631
1699
  return this.getXcmPaymentApiFee(chain, xcm, forwardedXcms, asset);
1632
1700
  case 4:
1633
- _fee = _context13.v;
1701
+ _fee = _context15.v;
1634
1702
  if (!(typeof _fee === 'bigint')) {
1635
- _context13.n = 5;
1703
+ _context15.n = 5;
1636
1704
  break;
1637
1705
  }
1638
- return _context13.a(2, {
1706
+ return _context15.a(2, {
1639
1707
  success: true,
1640
1708
  fee: _fee,
1641
1709
  asset: asset,
@@ -1648,13 +1716,13 @@ var PapiApi = /*#__PURE__*/function () {
1648
1716
  reversedEvents = _toConsumableArray(emitted).reverse();
1649
1717
  palletsWithIssued = ['Balances', 'ForeignAssets', 'Assets'];
1650
1718
  isFeeAsset = origin === 'AssetHubPolkadot' && feeAsset && asset && isAssetEqual(feeAsset, asset);
1651
- feeAssetFeeEvent = (_ref10 = isFeeAsset ? _toConsumableArray(emitted).find(function (event) {
1719
+ feeAssetFeeEvent = (_ref12 = isFeeAsset ? _toConsumableArray(emitted).find(function (event) {
1652
1720
  return (event.type === 'ForeignAssets' || event.type === 'Assets') && event.value.type === 'Issued';
1653
- }) : undefined) !== null && _ref10 !== void 0 ? _ref10 : isFeeAsset ? _toConsumableArray(emitted).find(function (event) {
1721
+ }) : undefined) !== null && _ref12 !== void 0 ? _ref12 : isFeeAsset ? _toConsumableArray(emitted).find(function (event) {
1654
1722
  return event.type === 'Tokens' && event.value.type === 'Deposited';
1655
1723
  }) : undefined;
1656
1724
  processedAssetsAmount = chain === 'AssetHubPolkadot' && (asset === null || asset === void 0 ? void 0 : asset.symbol) !== 'DOT' ? processAssetsDepositedEvents(emitted, amount, 'Assets', 'Deposited', true) : (_processAssetsDeposit = processAssetsDepositedEvents(emitted, amount, 'Balances', 'Minted', false)) !== null && _processAssetsDeposit !== void 0 ? _processAssetsDeposit : processAssetsDepositedEvents(emitted, amount, 'Balances', 'Issued', false);
1657
- feeEvent = (_ref11 = (_ref12 = (_ref13 = (_ref14 = (_ref15 = feeAssetFeeEvent !== null && feeAssetFeeEvent !== void 0 ? feeAssetFeeEvent :
1725
+ feeEvent = (_ref13 = (_ref14 = (_ref15 = (_ref16 = (_ref17 = feeAssetFeeEvent !== null && feeAssetFeeEvent !== void 0 ? feeAssetFeeEvent :
1658
1726
  //
1659
1727
  processedAssetsAmount !== undefined ? {
1660
1728
  type: 'Assets',
@@ -1664,30 +1732,30 @@ var PapiApi = /*#__PURE__*/function () {
1664
1732
  amount: processedAssetsAmount
1665
1733
  }
1666
1734
  }
1667
- } : undefined) !== null && _ref15 !== void 0 ? _ref15 :
1735
+ } : undefined) !== null && _ref17 !== void 0 ? _ref17 :
1668
1736
  //
1669
1737
  chain === 'Mythos' ? reversedEvents.find(function (event) {
1670
1738
  return event.type === 'Balances' && event.value.type === 'Issued';
1671
- }) : undefined) !== null && _ref14 !== void 0 ? _ref14 :
1739
+ }) : undefined) !== null && _ref16 !== void 0 ? _ref16 :
1672
1740
  //
1673
1741
  origin === 'Mythos' || chain === 'AssetHubPolkadot' && (asset === null || asset === void 0 ? void 0 : asset.symbol) !== 'DOT' ? reversedEvents.find(function (event) {
1674
1742
  return event.type === 'AssetConversion' && event.value.type === 'SwapCreditExecuted';
1675
- }) : undefined) !== null && _ref13 !== void 0 ? _ref13 :
1743
+ }) : undefined) !== null && _ref15 !== void 0 ? _ref15 :
1676
1744
  // Prefer to Minted event
1677
1745
  reversedEvents.find(function (event) {
1678
1746
  return ['Balances', 'ForeignAssets'].includes(event.type) && event.value.type === 'Minted';
1679
- })) !== null && _ref12 !== void 0 ? _ref12 :
1747
+ })) !== null && _ref14 !== void 0 ? _ref14 :
1680
1748
  // Fallback an Issued event
1681
1749
  reversedEvents.find(function (event) {
1682
1750
  return palletsWithIssued.includes(event.type) && event.value.type === 'Issued';
1683
- })) !== null && _ref11 !== void 0 ? _ref11 : reversedEvents.find(function (event) {
1751
+ })) !== null && _ref13 !== void 0 ? _ref13 : reversedEvents.find(function (event) {
1684
1752
  return ['Currencies', 'Tokens'].includes(event.type) && event.value.type === 'Deposited';
1685
1753
  });
1686
1754
  if (feeEvent) {
1687
- _context13.n = 6;
1755
+ _context15.n = 6;
1688
1756
  break;
1689
1757
  }
1690
- return _context13.a(2, Promise.resolve({
1758
+ return _context15.a(2, Promise.resolve({
1691
1759
  success: false,
1692
1760
  failureReason: 'Cannot determine destination fee. No fee event found',
1693
1761
  asset: asset
@@ -1698,7 +1766,7 @@ var PapiApi = /*#__PURE__*/function () {
1698
1766
  fee = amount - originFee - feeEvent.value.value.amount;
1699
1767
  }
1700
1768
  processedFee = (isRelayChain(chain) || chain.includes('AssetHub')) && (asset === null || asset === void 0 ? void 0 : asset.symbol) === 'DOT' ? padValueBy(fee, 30) : fee;
1701
- return _context13.a(2, Promise.resolve({
1769
+ return _context15.a(2, Promise.resolve({
1702
1770
  success: true,
1703
1771
  fee: processedFee,
1704
1772
  asset: asset,
@@ -1707,7 +1775,7 @@ var PapiApi = /*#__PURE__*/function () {
1707
1775
  destParaId: destParaId
1708
1776
  }));
1709
1777
  }
1710
- }, _callee13, this);
1778
+ }, _callee15, this);
1711
1779
  }));
1712
1780
  function getDryRunXcm(_x25) {
1713
1781
  return _getDryRunXcm.apply(this, arguments);
@@ -1717,18 +1785,18 @@ var PapiApi = /*#__PURE__*/function () {
1717
1785
  }, {
1718
1786
  key: "getBridgeStatus",
1719
1787
  value: function () {
1720
- var _getBridgeStatus = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee14() {
1788
+ var _getBridgeStatus = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee16() {
1721
1789
  var outboundOperatingMode;
1722
- return _regenerator().w(function (_context14) {
1723
- while (1) switch (_context14.n) {
1790
+ return _regenerator().w(function (_context16) {
1791
+ while (1) switch (_context16.n) {
1724
1792
  case 0:
1725
- _context14.n = 1;
1793
+ _context16.n = 1;
1726
1794
  return this.api.getUnsafeApi().query.EthereumOutboundQueue.OperatingMode.getValue();
1727
1795
  case 1:
1728
- outboundOperatingMode = _context14.v;
1729
- return _context14.a(2, outboundOperatingMode.type);
1796
+ outboundOperatingMode = _context16.v;
1797
+ return _context16.a(2, outboundOperatingMode.type);
1730
1798
  }
1731
- }, _callee14, this);
1799
+ }, _callee16, this);
1732
1800
  }));
1733
1801
  function getBridgeStatus() {
1734
1802
  return _getBridgeStatus.apply(this, arguments);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paraspell/sdk",
3
- "version": "12.1.0",
3
+ "version": "12.1.2",
4
4
  "description": "SDK for ParaSpell XCM/XCMP tool for developers",
5
5
  "repository": {
6
6
  "type": "git",
@@ -25,28 +25,28 @@
25
25
  "dependencies": {
26
26
  "@noble/hashes": "^2.0.1",
27
27
  "@polkadot-api/legacy-provider": "^0.3.6",
28
- "viem": "^2.40.3",
29
- "@paraspell/sdk-core": "12.1.0"
28
+ "viem": "2.40.3",
29
+ "@paraspell/sdk-core": "12.1.2"
30
30
  },
31
31
  "peerDependencies": {
32
- "polkadot-api": ">= 1.22.0 < 2"
32
+ "polkadot-api": ">= 1.23.1 < 2"
33
33
  },
34
34
  "devDependencies": {
35
35
  "@babel/plugin-syntax-import-attributes": "^7.27.1",
36
36
  "@babel/preset-env": "^7.28.5",
37
37
  "@codecov/rollup-plugin": "^1.9.1",
38
38
  "@noble/curves": "^2.0.1",
39
- "@polkadot-labs/hdkd": "^0.0.25",
40
- "@polkadot-labs/hdkd-helpers": "^0.0.26",
39
+ "@polkadot-labs/hdkd": "^0.0.26",
40
+ "@polkadot-labs/hdkd-helpers": "^0.0.27",
41
41
  "@rollup/plugin-babel": "^6.1.0",
42
42
  "@rollup/plugin-json": "^6.1.0",
43
43
  "@rollup/plugin-typescript": "^12.3.0",
44
44
  "@scure/bip32": "^2.0.1",
45
45
  "@scure/bip39": "^2.0.1",
46
- "@vitest/coverage-v8": "^4.0.14",
46
+ "@vitest/coverage-v8": "^4.0.16",
47
47
  "axios": "^1.13.2",
48
48
  "dotenv": "^17.2.3",
49
- "rollup": "^4.53.3",
49
+ "rollup": "^4.54.0",
50
50
  "rollup-plugin-dts": "^6.3.0",
51
51
  "tslib": "^2.8.1"
52
52
  },