@paraspell/sdk 10.4.2 → 10.4.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -1359,36 +1359,61 @@ var PapiApi = /*#__PURE__*/function () {
1359
1359
  return getDryRunCall;
1360
1360
  }()
1361
1361
  }, {
1362
- key: "getXcmPaymentApiFee",
1362
+ key: "getXcmWeight",
1363
1363
  value: function () {
1364
- var _getXcmPaymentApiFee = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee19(xcm, asset) {
1365
- var weight, transformedMultiLocation, feeResult;
1364
+ var _getXcmWeight = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee19(xcm) {
1365
+ var weightResult, _weightResult$value, ref_time, proof_size;
1366
1366
  return _regenerator().w(function (_context19) {
1367
1367
  while (1) switch (_context19.n) {
1368
1368
  case 0:
1369
1369
  _context19.n = 1;
1370
+ return this.api.getUnsafeApi().apis.XcmPaymentApi.query_xcm_weight(!xcm.type ? _transform(xcm) : xcm);
1371
+ case 1:
1372
+ weightResult = _context19.v;
1373
+ _weightResult$value = weightResult.value, ref_time = _weightResult$value.ref_time, proof_size = _weightResult$value.proof_size;
1374
+ return _context19.a(2, {
1375
+ refTime: ref_time,
1376
+ proofSize: proof_size
1377
+ });
1378
+ }
1379
+ }, _callee19, this);
1380
+ }));
1381
+ function getXcmWeight(_x33) {
1382
+ return _getXcmWeight.apply(this, arguments);
1383
+ }
1384
+ return getXcmWeight;
1385
+ }()
1386
+ }, {
1387
+ key: "getXcmPaymentApiFee",
1388
+ value: function () {
1389
+ var _getXcmPaymentApiFee = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee20(xcm, asset) {
1390
+ var weight, transformedMultiLocation, feeResult;
1391
+ return _regenerator().w(function (_context20) {
1392
+ while (1) switch (_context20.n) {
1393
+ case 0:
1394
+ _context20.n = 1;
1370
1395
  return this.api.getUnsafeApi().apis.XcmPaymentApi.query_xcm_weight(xcm);
1371
1396
  case 1:
1372
- weight = _context19.v;
1397
+ weight = _context20.v;
1373
1398
  if (asset !== null && asset !== void 0 && asset.multiLocation) {
1374
- _context19.n = 2;
1399
+ _context20.n = 2;
1375
1400
  break;
1376
1401
  }
1377
1402
  throw new sdkCore.InvalidCurrencyError('This asset does not have a multiLocation defined. Cannot determine destination fee.');
1378
1403
  case 2:
1379
1404
  transformedMultiLocation = _transform(sdkCore.normalizeMultiLocation(asset.multiLocation));
1380
- _context19.n = 3;
1381
- return this.api.getUnsafeApi().apis.XcmPaymentApi.query_weight_to_asset_fee(weight.value, {
1405
+ _context20.n = 3;
1406
+ return this.api.getUnsafeApi().apis.XcmPaymentApi.query_weight_to_asset_fee(weight, {
1382
1407
  type: 'V4',
1383
1408
  value: transformedMultiLocation
1384
1409
  });
1385
1410
  case 3:
1386
- feeResult = _context19.v;
1387
- return _context19.a(2, feeResult.value);
1411
+ feeResult = _context20.v;
1412
+ return _context20.a(2, feeResult.value);
1388
1413
  }
1389
- }, _callee19, this);
1414
+ }, _callee20, this);
1390
1415
  }));
1391
- function getXcmPaymentApiFee(_x33, _x34) {
1416
+ function getXcmPaymentApiFee(_x34, _x35) {
1392
1417
  return _getXcmPaymentApiFee.apply(this, arguments);
1393
1418
  }
1394
1419
  return getXcmPaymentApiFee;
@@ -1396,32 +1421,32 @@ var PapiApi = /*#__PURE__*/function () {
1396
1421
  }, {
1397
1422
  key: "getDryRunXcm",
1398
1423
  value: function () {
1399
- var _getDryRunXcm = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee20(_ref9) {
1424
+ var _getDryRunXcm = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee21(_ref9) {
1400
1425
  var _ref0, _ref1, _ref10, _ref11;
1401
1426
  var originLocation, xcm, node, origin, asset, feeAsset, originFee, amount, supportsDryRunApi, transformedOriginLocation, result, isSuccess, failureReason, actualWeight, weight, forwardedXcms, destParaId, _fee, emitted, reversedEvents, palletsWithIssued, isFeeAsset, feeAssetFeeEvent, feeEvent, fee;
1402
- return _regenerator().w(function (_context20) {
1403
- while (1) switch (_context20.n) {
1427
+ return _regenerator().w(function (_context21) {
1428
+ while (1) switch (_context21.n) {
1404
1429
  case 0:
1405
1430
  originLocation = _ref9.originLocation, xcm = _ref9.xcm, node = _ref9.node, origin = _ref9.origin, asset = _ref9.asset, feeAsset = _ref9.feeAsset, originFee = _ref9.originFee, amount = _ref9.amount;
1406
1431
  supportsDryRunApi = sdkCore.getAssetsObject(node).supportsDryRunApi;
1407
1432
  if (supportsDryRunApi) {
1408
- _context20.n = 1;
1433
+ _context21.n = 1;
1409
1434
  break;
1410
1435
  }
1411
1436
  throw new sdkCore.NodeNotSupportedError("DryRunApi is not available on node ".concat(node));
1412
1437
  case 1:
1413
1438
  transformedOriginLocation = _transform(originLocation);
1414
- _context20.n = 2;
1439
+ _context21.n = 2;
1415
1440
  return this.api.getUnsafeApi().apis.DryRunApi.dry_run_xcm(transformedOriginLocation, xcm);
1416
1441
  case 2:
1417
- result = _context20.v;
1442
+ result = _context21.v;
1418
1443
  isSuccess = result.success && result.value.execution_result.type === 'Complete';
1419
1444
  if (isSuccess) {
1420
- _context20.n = 3;
1445
+ _context21.n = 3;
1421
1446
  break;
1422
1447
  }
1423
1448
  failureReason = result.value.execution_result.value.error.type;
1424
- return _context20.a(2, Promise.resolve({
1449
+ return _context21.a(2, Promise.resolve({
1425
1450
  success: false,
1426
1451
  failureReason: failureReason
1427
1452
  }));
@@ -1434,14 +1459,14 @@ var PapiApi = /*#__PURE__*/function () {
1434
1459
  forwardedXcms = result.value.forwarded_xcms.length > 0 ? result.value.forwarded_xcms[0] : [];
1435
1460
  destParaId = forwardedXcms.length === 0 ? undefined : forwardedXcms[0].value.interior.type === 'Here' ? 0 : forwardedXcms[0].value.interior.value.value;
1436
1461
  if (!(node === 'Moonbeam' || node === 'Moonriver')) {
1437
- _context20.n = 5;
1462
+ _context21.n = 5;
1438
1463
  break;
1439
1464
  }
1440
- _context20.n = 4;
1465
+ _context21.n = 4;
1441
1466
  return this.getXcmPaymentApiFee(xcm, asset);
1442
1467
  case 4:
1443
- _fee = _context20.v;
1444
- return _context20.a(2, {
1468
+ _fee = _context21.v;
1469
+ return _context21.a(2, {
1445
1470
  success: true,
1446
1471
  fee: _fee,
1447
1472
  weight: weight,
@@ -1472,10 +1497,10 @@ var PapiApi = /*#__PURE__*/function () {
1472
1497
  return ['Currencies', 'Tokens'].includes(event.type) && event.value.type === 'Deposited';
1473
1498
  });
1474
1499
  if (feeEvent) {
1475
- _context20.n = 6;
1500
+ _context21.n = 6;
1476
1501
  break;
1477
1502
  }
1478
- return _context20.a(2, Promise.resolve({
1503
+ return _context21.a(2, Promise.resolve({
1479
1504
  success: false,
1480
1505
  failureReason: 'Cannot determine destination fee. No Issued event found'
1481
1506
  }));
@@ -1484,7 +1509,7 @@ var PapiApi = /*#__PURE__*/function () {
1484
1509
  if (feeAssetFeeEvent) {
1485
1510
  fee = amount - originFee - feeEvent.value.value.amount;
1486
1511
  }
1487
- return _context20.a(2, Promise.resolve({
1512
+ return _context21.a(2, Promise.resolve({
1488
1513
  success: true,
1489
1514
  fee: fee,
1490
1515
  weight: weight,
@@ -1492,9 +1517,9 @@ var PapiApi = /*#__PURE__*/function () {
1492
1517
  destParaId: destParaId
1493
1518
  }));
1494
1519
  }
1495
- }, _callee20, this);
1520
+ }, _callee21, this);
1496
1521
  }));
1497
- function getDryRunXcm(_x35) {
1522
+ function getDryRunXcm(_x36) {
1498
1523
  return _getDryRunXcm.apply(this, arguments);
1499
1524
  }
1500
1525
  return getDryRunXcm;
@@ -1502,18 +1527,18 @@ var PapiApi = /*#__PURE__*/function () {
1502
1527
  }, {
1503
1528
  key: "getBridgeStatus",
1504
1529
  value: function () {
1505
- var _getBridgeStatus = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee21() {
1530
+ var _getBridgeStatus = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee22() {
1506
1531
  var outboundOperatingMode;
1507
- return _regenerator().w(function (_context21) {
1508
- while (1) switch (_context21.n) {
1532
+ return _regenerator().w(function (_context22) {
1533
+ while (1) switch (_context22.n) {
1509
1534
  case 0:
1510
- _context21.n = 1;
1535
+ _context22.n = 1;
1511
1536
  return this.api.getUnsafeApi().query.EthereumOutboundQueue.OperatingMode.getValue();
1512
1537
  case 1:
1513
- outboundOperatingMode = _context21.v;
1514
- return _context21.a(2, outboundOperatingMode.type);
1538
+ outboundOperatingMode = _context22.v;
1539
+ return _context22.a(2, outboundOperatingMode.type);
1515
1540
  }
1516
- }, _callee21, this);
1541
+ }, _callee22, this);
1517
1542
  }));
1518
1543
  function getBridgeStatus() {
1519
1544
  return _getBridgeStatus.apply(this, arguments);
package/dist/index.mjs CHANGED
@@ -1358,36 +1358,61 @@ var PapiApi = /*#__PURE__*/function () {
1358
1358
  return getDryRunCall;
1359
1359
  }()
1360
1360
  }, {
1361
- key: "getXcmPaymentApiFee",
1361
+ key: "getXcmWeight",
1362
1362
  value: function () {
1363
- var _getXcmPaymentApiFee = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee19(xcm, asset) {
1364
- var weight, transformedMultiLocation, feeResult;
1363
+ var _getXcmWeight = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee19(xcm) {
1364
+ var weightResult, _weightResult$value, ref_time, proof_size;
1365
1365
  return _regenerator().w(function (_context19) {
1366
1366
  while (1) switch (_context19.n) {
1367
1367
  case 0:
1368
1368
  _context19.n = 1;
1369
+ return this.api.getUnsafeApi().apis.XcmPaymentApi.query_xcm_weight(!xcm.type ? _transform(xcm) : xcm);
1370
+ case 1:
1371
+ weightResult = _context19.v;
1372
+ _weightResult$value = weightResult.value, ref_time = _weightResult$value.ref_time, proof_size = _weightResult$value.proof_size;
1373
+ return _context19.a(2, {
1374
+ refTime: ref_time,
1375
+ proofSize: proof_size
1376
+ });
1377
+ }
1378
+ }, _callee19, this);
1379
+ }));
1380
+ function getXcmWeight(_x33) {
1381
+ return _getXcmWeight.apply(this, arguments);
1382
+ }
1383
+ return getXcmWeight;
1384
+ }()
1385
+ }, {
1386
+ key: "getXcmPaymentApiFee",
1387
+ value: function () {
1388
+ var _getXcmPaymentApiFee = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee20(xcm, asset) {
1389
+ var weight, transformedMultiLocation, feeResult;
1390
+ return _regenerator().w(function (_context20) {
1391
+ while (1) switch (_context20.n) {
1392
+ case 0:
1393
+ _context20.n = 1;
1369
1394
  return this.api.getUnsafeApi().apis.XcmPaymentApi.query_xcm_weight(xcm);
1370
1395
  case 1:
1371
- weight = _context19.v;
1396
+ weight = _context20.v;
1372
1397
  if (asset !== null && asset !== void 0 && asset.multiLocation) {
1373
- _context19.n = 2;
1398
+ _context20.n = 2;
1374
1399
  break;
1375
1400
  }
1376
1401
  throw new InvalidCurrencyError('This asset does not have a multiLocation defined. Cannot determine destination fee.');
1377
1402
  case 2:
1378
1403
  transformedMultiLocation = _transform(normalizeMultiLocation(asset.multiLocation));
1379
- _context19.n = 3;
1380
- return this.api.getUnsafeApi().apis.XcmPaymentApi.query_weight_to_asset_fee(weight.value, {
1404
+ _context20.n = 3;
1405
+ return this.api.getUnsafeApi().apis.XcmPaymentApi.query_weight_to_asset_fee(weight, {
1381
1406
  type: 'V4',
1382
1407
  value: transformedMultiLocation
1383
1408
  });
1384
1409
  case 3:
1385
- feeResult = _context19.v;
1386
- return _context19.a(2, feeResult.value);
1410
+ feeResult = _context20.v;
1411
+ return _context20.a(2, feeResult.value);
1387
1412
  }
1388
- }, _callee19, this);
1413
+ }, _callee20, this);
1389
1414
  }));
1390
- function getXcmPaymentApiFee(_x33, _x34) {
1415
+ function getXcmPaymentApiFee(_x34, _x35) {
1391
1416
  return _getXcmPaymentApiFee.apply(this, arguments);
1392
1417
  }
1393
1418
  return getXcmPaymentApiFee;
@@ -1395,32 +1420,32 @@ var PapiApi = /*#__PURE__*/function () {
1395
1420
  }, {
1396
1421
  key: "getDryRunXcm",
1397
1422
  value: function () {
1398
- var _getDryRunXcm = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee20(_ref9) {
1423
+ var _getDryRunXcm = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee21(_ref9) {
1399
1424
  var _ref0, _ref1, _ref10, _ref11;
1400
1425
  var originLocation, xcm, node, origin, asset, feeAsset, originFee, amount, supportsDryRunApi, transformedOriginLocation, result, isSuccess, failureReason, actualWeight, weight, forwardedXcms, destParaId, _fee, emitted, reversedEvents, palletsWithIssued, isFeeAsset, feeAssetFeeEvent, feeEvent, fee;
1401
- return _regenerator().w(function (_context20) {
1402
- while (1) switch (_context20.n) {
1426
+ return _regenerator().w(function (_context21) {
1427
+ while (1) switch (_context21.n) {
1403
1428
  case 0:
1404
1429
  originLocation = _ref9.originLocation, xcm = _ref9.xcm, node = _ref9.node, origin = _ref9.origin, asset = _ref9.asset, feeAsset = _ref9.feeAsset, originFee = _ref9.originFee, amount = _ref9.amount;
1405
1430
  supportsDryRunApi = getAssetsObject(node).supportsDryRunApi;
1406
1431
  if (supportsDryRunApi) {
1407
- _context20.n = 1;
1432
+ _context21.n = 1;
1408
1433
  break;
1409
1434
  }
1410
1435
  throw new NodeNotSupportedError("DryRunApi is not available on node ".concat(node));
1411
1436
  case 1:
1412
1437
  transformedOriginLocation = _transform(originLocation);
1413
- _context20.n = 2;
1438
+ _context21.n = 2;
1414
1439
  return this.api.getUnsafeApi().apis.DryRunApi.dry_run_xcm(transformedOriginLocation, xcm);
1415
1440
  case 2:
1416
- result = _context20.v;
1441
+ result = _context21.v;
1417
1442
  isSuccess = result.success && result.value.execution_result.type === 'Complete';
1418
1443
  if (isSuccess) {
1419
- _context20.n = 3;
1444
+ _context21.n = 3;
1420
1445
  break;
1421
1446
  }
1422
1447
  failureReason = result.value.execution_result.value.error.type;
1423
- return _context20.a(2, Promise.resolve({
1448
+ return _context21.a(2, Promise.resolve({
1424
1449
  success: false,
1425
1450
  failureReason: failureReason
1426
1451
  }));
@@ -1433,14 +1458,14 @@ var PapiApi = /*#__PURE__*/function () {
1433
1458
  forwardedXcms = result.value.forwarded_xcms.length > 0 ? result.value.forwarded_xcms[0] : [];
1434
1459
  destParaId = forwardedXcms.length === 0 ? undefined : forwardedXcms[0].value.interior.type === 'Here' ? 0 : forwardedXcms[0].value.interior.value.value;
1435
1460
  if (!(node === 'Moonbeam' || node === 'Moonriver')) {
1436
- _context20.n = 5;
1461
+ _context21.n = 5;
1437
1462
  break;
1438
1463
  }
1439
- _context20.n = 4;
1464
+ _context21.n = 4;
1440
1465
  return this.getXcmPaymentApiFee(xcm, asset);
1441
1466
  case 4:
1442
- _fee = _context20.v;
1443
- return _context20.a(2, {
1467
+ _fee = _context21.v;
1468
+ return _context21.a(2, {
1444
1469
  success: true,
1445
1470
  fee: _fee,
1446
1471
  weight: weight,
@@ -1471,10 +1496,10 @@ var PapiApi = /*#__PURE__*/function () {
1471
1496
  return ['Currencies', 'Tokens'].includes(event.type) && event.value.type === 'Deposited';
1472
1497
  });
1473
1498
  if (feeEvent) {
1474
- _context20.n = 6;
1499
+ _context21.n = 6;
1475
1500
  break;
1476
1501
  }
1477
- return _context20.a(2, Promise.resolve({
1502
+ return _context21.a(2, Promise.resolve({
1478
1503
  success: false,
1479
1504
  failureReason: 'Cannot determine destination fee. No Issued event found'
1480
1505
  }));
@@ -1483,7 +1508,7 @@ var PapiApi = /*#__PURE__*/function () {
1483
1508
  if (feeAssetFeeEvent) {
1484
1509
  fee = amount - originFee - feeEvent.value.value.amount;
1485
1510
  }
1486
- return _context20.a(2, Promise.resolve({
1511
+ return _context21.a(2, Promise.resolve({
1487
1512
  success: true,
1488
1513
  fee: fee,
1489
1514
  weight: weight,
@@ -1491,9 +1516,9 @@ var PapiApi = /*#__PURE__*/function () {
1491
1516
  destParaId: destParaId
1492
1517
  }));
1493
1518
  }
1494
- }, _callee20, this);
1519
+ }, _callee21, this);
1495
1520
  }));
1496
- function getDryRunXcm(_x35) {
1521
+ function getDryRunXcm(_x36) {
1497
1522
  return _getDryRunXcm.apply(this, arguments);
1498
1523
  }
1499
1524
  return getDryRunXcm;
@@ -1501,18 +1526,18 @@ var PapiApi = /*#__PURE__*/function () {
1501
1526
  }, {
1502
1527
  key: "getBridgeStatus",
1503
1528
  value: function () {
1504
- var _getBridgeStatus = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee21() {
1529
+ var _getBridgeStatus = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee22() {
1505
1530
  var outboundOperatingMode;
1506
- return _regenerator().w(function (_context21) {
1507
- while (1) switch (_context21.n) {
1531
+ return _regenerator().w(function (_context22) {
1532
+ while (1) switch (_context22.n) {
1508
1533
  case 0:
1509
- _context21.n = 1;
1534
+ _context22.n = 1;
1510
1535
  return this.api.getUnsafeApi().query.EthereumOutboundQueue.OperatingMode.getValue();
1511
1536
  case 1:
1512
- outboundOperatingMode = _context21.v;
1513
- return _context21.a(2, outboundOperatingMode.type);
1537
+ outboundOperatingMode = _context22.v;
1538
+ return _context22.a(2, outboundOperatingMode.type);
1514
1539
  }
1515
- }, _callee21, this);
1540
+ }, _callee22, this);
1516
1541
  }));
1517
1542
  function getBridgeStatus() {
1518
1543
  return _getBridgeStatus.apply(this, arguments);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paraspell/sdk",
3
- "version": "10.4.2",
3
+ "version": "10.4.3",
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.30.5",
28
- "@paraspell/sdk-core": "10.4.2"
28
+ "@paraspell/sdk-core": "10.4.3"
29
29
  },
30
30
  "peerDependencies": {
31
31
  "polkadot-api": ">= 1.13.0 < 2"