@paraspell/sdk 9.1.1 → 9.2.0

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
@@ -1437,7 +1437,7 @@ var PapiApi = /*#__PURE__*/function () {
1437
1437
  value: function () {
1438
1438
  var _getDryRunCall = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee17(_ref6) {
1439
1439
  var _this$api$getUnsafeAp;
1440
- var tx, address, node, supportsDryRunApi, needsVersionParam, DEFAULT_XCM_VERSION, result, isSuccess, failureReason, executionFee, fee, actualWeight, weight, forwardedXcms, destParaId;
1440
+ var tx, address, node, supportsDryRunApi, needsVersionParam, DEFAULT_XCM_VERSION, result, isSuccess, _result$value, _ref7, _errorValue$value$typ, _errorValue$value, errorValue, failureReason, executionFee, fee, actualWeight, weight, forwardedXcms, destParaId;
1441
1441
  return _regeneratorRuntime().wrap(function _callee17$(_context17) {
1442
1442
  while (1) switch (_context17.prev = _context17.next) {
1443
1443
  case 0:
@@ -1463,18 +1463,19 @@ var PapiApi = /*#__PURE__*/function () {
1463
1463
  result = _context17.sent;
1464
1464
  isSuccess = result.success && result.value.execution_result.success;
1465
1465
  if (isSuccess) {
1466
- _context17.next = 13;
1466
+ _context17.next = 14;
1467
1467
  break;
1468
1468
  }
1469
- failureReason = result.value.execution_result.value.error.value.value.type;
1469
+ 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;
1470
+ failureReason = (_ref7 = (_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 && _ref7 !== void 0 ? _ref7 : 'Unknown';
1470
1471
  return _context17.abrupt("return", Promise.resolve({
1471
1472
  success: false,
1472
1473
  failureReason: failureReason
1473
1474
  }));
1474
- case 13:
1475
- _context17.next = 15;
1475
+ case 14:
1476
+ _context17.next = 16;
1476
1477
  return this.calculateTransactionFee(tx, address);
1477
- case 15:
1478
+ case 16:
1478
1479
  executionFee = _context17.sent;
1479
1480
  fee = sdkCore.computeFeeFromDryRun(result, node, executionFee);
1480
1481
  actualWeight = result.value.execution_result.value.actual_weight;
@@ -1491,7 +1492,7 @@ var PapiApi = /*#__PURE__*/function () {
1491
1492
  forwardedXcms: forwardedXcms,
1492
1493
  destParaId: destParaId
1493
1494
  }));
1494
- case 22:
1495
+ case 23:
1495
1496
  case "end":
1496
1497
  return _context17.stop();
1497
1498
  }
@@ -1505,13 +1506,13 @@ var PapiApi = /*#__PURE__*/function () {
1505
1506
  }, {
1506
1507
  key: "getDryRunXcm",
1507
1508
  value: function () {
1508
- var _getDryRunXcm = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee18(_ref7) {
1509
- var _ref8, _ref9, _ref0;
1509
+ var _getDryRunXcm = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee18(_ref8) {
1510
+ var _ref9, _ref0, _ref1;
1510
1511
  var originLocation, xcm, node, origin, supportsDryRunApi, transformedOriginLocation, result, isSuccess, failureReason, emitted, reversedEvents, palletsWithIssued, feeEvent, fee, actualWeight, weight, forwardedXcms, destParaId;
1511
1512
  return _regeneratorRuntime().wrap(function _callee18$(_context18) {
1512
1513
  while (1) switch (_context18.prev = _context18.next) {
1513
1514
  case 0:
1514
- originLocation = _ref7.originLocation, xcm = _ref7.xcm, node = _ref7.node, origin = _ref7.origin;
1515
+ originLocation = _ref8.originLocation, xcm = _ref8.xcm, node = _ref8.node, origin = _ref8.origin;
1515
1516
  supportsDryRunApi = sdkCore.getAssetsObject(node).supportsDryRunApi;
1516
1517
  if (supportsDryRunApi) {
1517
1518
  _context18.next = 4;
@@ -1538,17 +1539,17 @@ var PapiApi = /*#__PURE__*/function () {
1538
1539
  emitted = result.value.emitted_events; // We want to look for the last event
1539
1540
  reversedEvents = _toConsumableArray(emitted).reverse();
1540
1541
  palletsWithIssued = ['Balances', 'ForeignAssets', 'Assets'];
1541
- feeEvent = (_ref8 = (_ref9 = (_ref0 = origin === 'Mythos' ? reversedEvents.find(function (event) {
1542
+ feeEvent = (_ref9 = (_ref0 = (_ref1 = origin === 'Mythos' ? reversedEvents.find(function (event) {
1542
1543
  return event.type === 'AssetConversion' && event.value.type === 'SwapCreditExecuted';
1543
- }) : undefined) !== null && _ref0 !== void 0 ? _ref0 :
1544
+ }) : undefined) !== null && _ref1 !== void 0 ? _ref1 :
1544
1545
  // Prefer an Issued event
1545
1546
  reversedEvents.find(function (event) {
1546
1547
  return palletsWithIssued.includes(event.type) && event.value.type === 'Issued';
1547
- })) !== null && _ref9 !== void 0 ? _ref9 :
1548
+ })) !== null && _ref0 !== void 0 ? _ref0 :
1548
1549
  // Fallback to Minted event
1549
1550
  reversedEvents.find(function (event) {
1550
1551
  return ['Balances', 'ForeignAssets'].includes(event.type) && event.value.type === 'Minted';
1551
- })) !== null && _ref8 !== void 0 ? _ref8 : reversedEvents.find(function (event) {
1552
+ })) !== null && _ref9 !== void 0 ? _ref9 : reversedEvents.find(function (event) {
1552
1553
  return ['Currencies', 'Tokens'].includes(event.type) && event.value.type === 'Deposited';
1553
1554
  });
1554
1555
  if (feeEvent) {
@@ -1942,12 +1943,14 @@ var getBridgeStatus = /*#__PURE__*/function () {
1942
1943
  return _ref2.apply(this, arguments);
1943
1944
  };
1944
1945
  }();
1946
+ var getFeeForOriginNode = createPapiApiCall(sdkCore.getFeeForOriginNode);
1945
1947
 
1946
1948
  var transfer = /*#__PURE__*/Object.freeze({
1947
1949
  __proto__: null,
1948
1950
  dryRun: dryRun,
1949
1951
  dryRunOrigin: dryRunOrigin,
1950
1952
  getBridgeStatus: getBridgeStatus,
1953
+ getFeeForOriginNode: getFeeForOriginNode,
1951
1954
  getParaEthTransferFees: getParaEthTransferFees,
1952
1955
  send: send
1953
1956
  });
@@ -1964,6 +1967,7 @@ exports.getAssetBalance = getAssetBalance;
1964
1967
  exports.getBalanceForeign = getBalanceForeign;
1965
1968
  exports.getBalanceNative = getBalanceNative;
1966
1969
  exports.getBridgeStatus = getBridgeStatus;
1970
+ exports.getFeeForOriginNode = getFeeForOriginNode;
1967
1971
  exports.getMaxForeignTransferableAmount = getMaxForeignTransferableAmount;
1968
1972
  exports.getMaxNativeTransferableAmount = getMaxNativeTransferableAmount;
1969
1973
  exports.getOriginFeeDetails = getOriginFeeDetails;
package/dist/index.d.ts CHANGED
@@ -226,10 +226,20 @@ declare const getParaEthTransferFees: (ahApi?: TPapiApiOrUrl) => Promise<[bigint
226
226
  * Gets the Ethereum bridge status.
227
227
  */
228
228
  declare const getBridgeStatus: (ahApi?: TPapiApiOrUrl) => Promise<_paraspell_sdk_core.TBridgeStatus>;
229
+ declare const getFeeForOriginNode: (options: _paraspell_sdk_core.TGetFeeForOriginNodeBaseOptions<TPapiTransaction> & {
230
+ api?: TPapiApiOrUrl;
231
+ }) => Promise<{
232
+ fee?: bigint;
233
+ feeType?: _paraspell_sdk_core.TFeeType;
234
+ dryRunError?: string;
235
+ forwardedXcms?: any;
236
+ destParaId?: number;
237
+ }>;
229
238
 
230
239
  declare const transfer_dryRun: typeof dryRun;
231
240
  declare const transfer_dryRunOrigin: typeof dryRunOrigin;
232
241
  declare const transfer_getBridgeStatus: typeof getBridgeStatus;
242
+ declare const transfer_getFeeForOriginNode: typeof getFeeForOriginNode;
233
243
  declare const transfer_getParaEthTransferFees: typeof getParaEthTransferFees;
234
244
  declare const transfer_send: typeof send;
235
245
  declare namespace transfer {
@@ -237,6 +247,7 @@ declare namespace transfer {
237
247
  transfer_dryRun as dryRun,
238
248
  transfer_dryRunOrigin as dryRunOrigin,
239
249
  transfer_getBridgeStatus as getBridgeStatus,
250
+ transfer_getFeeForOriginNode as getFeeForOriginNode,
240
251
  transfer_getParaEthTransferFees as getParaEthTransferFees,
241
252
  transfer_send as send,
242
253
  };
@@ -244,5 +255,5 @@ declare namespace transfer {
244
255
 
245
256
  declare const createApiInstanceForNode: (node: TNodeDotKsmWithRelayChains) => Promise<polkadot_api.PolkadotClient>;
246
257
 
247
- export { Builder, EvmBuilder, assets, claimAssets, convertSs58, createApiInstanceForNode, dryRun, dryRunOrigin, getAssetBalance, getBalanceForeign, getBalanceNative, getBridgeStatus, getMaxForeignTransferableAmount, getMaxNativeTransferableAmount, getOriginFeeDetails, getParaEthTransferFees, getTransferInfo, getTransferableAmount, send, verifyEdOnDestination, transfer as xcmPallet };
258
+ export { Builder, EvmBuilder, assets, claimAssets, convertSs58, createApiInstanceForNode, dryRun, dryRunOrigin, getAssetBalance, getBalanceForeign, getBalanceNative, getBridgeStatus, getFeeForOriginNode, getMaxForeignTransferableAmount, getMaxNativeTransferableAmount, getOriginFeeDetails, getParaEthTransferFees, getTransferInfo, getTransferableAmount, send, verifyEdOnDestination, transfer as xcmPallet };
248
259
  export type { GeneralBuilder, TEvmNodeFromPapi, TPapiApi, TPapiApiOrUrl, TPapiTransaction };
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { InvalidParameterError, BatchMode, getNodeProviders, createApiInstanceForNode as createApiInstanceForNode$1, NodeNotSupportedError, Parents, Version, getNode, isForeignAsset, computeFeeFromDryRun, getAssetsObject, getBalanceNative as getBalanceNative$1, getBalanceForeign as getBalanceForeign$1, getTransferInfo as getTransferInfo$1, getAssetBalance as getAssetBalance$1, claimAssets as claimAssets$1, getOriginFeeDetails as getOriginFeeDetails$1, getMaxNativeTransferableAmount as getMaxNativeTransferableAmount$1, getMaxForeignTransferableAmount as getMaxForeignTransferableAmount$1, getTransferableAmount as getTransferableAmount$1, verifyEdOnDestination as verifyEdOnDestination$1, Foreign, ForeignAbstract, Native, Override, findAsset, getAllAssetsSymbols, getAssetDecimals, getAssetId, getAssets, getExistentialDeposit, getNativeAssetSymbol, getNativeAssets, getOtherAssets, getRelayChainSymbol, getSupportedAssets, getTNode, hasSupportForAsset, isNodeEvm, convertSs58 as convertSs58$1, transferMoonbeamEvm, validateAddress, transferMoonbeamToEth, Builder as Builder$1, getParaEthTransferFees as getParaEthTransferFees$1, getBridgeStatus as getBridgeStatus$1, send as send$1, dryRun as dryRun$1, dryRunOrigin as dryRunOrigin$1 } from '@paraspell/sdk-core';
1
+ import { InvalidParameterError, BatchMode, getNodeProviders, createApiInstanceForNode as createApiInstanceForNode$1, NodeNotSupportedError, Parents, Version, getNode, isForeignAsset, computeFeeFromDryRun, getAssetsObject, getBalanceNative as getBalanceNative$1, getBalanceForeign as getBalanceForeign$1, getTransferInfo as getTransferInfo$1, getAssetBalance as getAssetBalance$1, claimAssets as claimAssets$1, getOriginFeeDetails as getOriginFeeDetails$1, getMaxNativeTransferableAmount as getMaxNativeTransferableAmount$1, getMaxForeignTransferableAmount as getMaxForeignTransferableAmount$1, getTransferableAmount as getTransferableAmount$1, verifyEdOnDestination as verifyEdOnDestination$1, Foreign, ForeignAbstract, Native, Override, findAsset, getAllAssetsSymbols, getAssetDecimals, getAssetId, getAssets, getExistentialDeposit, getNativeAssetSymbol, getNativeAssets, getOtherAssets, getRelayChainSymbol, getSupportedAssets, getTNode, hasSupportForAsset, isNodeEvm, convertSs58 as convertSs58$1, transferMoonbeamEvm, validateAddress, transferMoonbeamToEth, Builder as Builder$1, getParaEthTransferFees as getParaEthTransferFees$1, getBridgeStatus as getBridgeStatus$1, send as send$1, dryRun as dryRun$1, dryRunOrigin as dryRunOrigin$1, getFeeForOriginNode as getFeeForOriginNode$1 } from '@paraspell/sdk-core';
2
2
  export * from '@paraspell/sdk-core';
3
3
  import { blake2b } from '@noble/hashes/blake2';
4
4
  import { bytesToHex } from '@noble/hashes/utils';
@@ -1436,7 +1436,7 @@ var PapiApi = /*#__PURE__*/function () {
1436
1436
  value: function () {
1437
1437
  var _getDryRunCall = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee17(_ref6) {
1438
1438
  var _this$api$getUnsafeAp;
1439
- var tx, address, node, supportsDryRunApi, needsVersionParam, DEFAULT_XCM_VERSION, result, isSuccess, failureReason, executionFee, fee, actualWeight, weight, forwardedXcms, destParaId;
1439
+ var tx, address, node, supportsDryRunApi, needsVersionParam, DEFAULT_XCM_VERSION, result, isSuccess, _result$value, _ref7, _errorValue$value$typ, _errorValue$value, errorValue, failureReason, executionFee, fee, actualWeight, weight, forwardedXcms, destParaId;
1440
1440
  return _regeneratorRuntime().wrap(function _callee17$(_context17) {
1441
1441
  while (1) switch (_context17.prev = _context17.next) {
1442
1442
  case 0:
@@ -1462,18 +1462,19 @@ var PapiApi = /*#__PURE__*/function () {
1462
1462
  result = _context17.sent;
1463
1463
  isSuccess = result.success && result.value.execution_result.success;
1464
1464
  if (isSuccess) {
1465
- _context17.next = 13;
1465
+ _context17.next = 14;
1466
1466
  break;
1467
1467
  }
1468
- failureReason = result.value.execution_result.value.error.value.value.type;
1468
+ 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;
1469
+ failureReason = (_ref7 = (_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 && _ref7 !== void 0 ? _ref7 : 'Unknown';
1469
1470
  return _context17.abrupt("return", Promise.resolve({
1470
1471
  success: false,
1471
1472
  failureReason: failureReason
1472
1473
  }));
1473
- case 13:
1474
- _context17.next = 15;
1474
+ case 14:
1475
+ _context17.next = 16;
1475
1476
  return this.calculateTransactionFee(tx, address);
1476
- case 15:
1477
+ case 16:
1477
1478
  executionFee = _context17.sent;
1478
1479
  fee = computeFeeFromDryRun(result, node, executionFee);
1479
1480
  actualWeight = result.value.execution_result.value.actual_weight;
@@ -1490,7 +1491,7 @@ var PapiApi = /*#__PURE__*/function () {
1490
1491
  forwardedXcms: forwardedXcms,
1491
1492
  destParaId: destParaId
1492
1493
  }));
1493
- case 22:
1494
+ case 23:
1494
1495
  case "end":
1495
1496
  return _context17.stop();
1496
1497
  }
@@ -1504,13 +1505,13 @@ var PapiApi = /*#__PURE__*/function () {
1504
1505
  }, {
1505
1506
  key: "getDryRunXcm",
1506
1507
  value: function () {
1507
- var _getDryRunXcm = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee18(_ref7) {
1508
- var _ref8, _ref9, _ref0;
1508
+ var _getDryRunXcm = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee18(_ref8) {
1509
+ var _ref9, _ref0, _ref1;
1509
1510
  var originLocation, xcm, node, origin, supportsDryRunApi, transformedOriginLocation, result, isSuccess, failureReason, emitted, reversedEvents, palletsWithIssued, feeEvent, fee, actualWeight, weight, forwardedXcms, destParaId;
1510
1511
  return _regeneratorRuntime().wrap(function _callee18$(_context18) {
1511
1512
  while (1) switch (_context18.prev = _context18.next) {
1512
1513
  case 0:
1513
- originLocation = _ref7.originLocation, xcm = _ref7.xcm, node = _ref7.node, origin = _ref7.origin;
1514
+ originLocation = _ref8.originLocation, xcm = _ref8.xcm, node = _ref8.node, origin = _ref8.origin;
1514
1515
  supportsDryRunApi = getAssetsObject(node).supportsDryRunApi;
1515
1516
  if (supportsDryRunApi) {
1516
1517
  _context18.next = 4;
@@ -1537,17 +1538,17 @@ var PapiApi = /*#__PURE__*/function () {
1537
1538
  emitted = result.value.emitted_events; // We want to look for the last event
1538
1539
  reversedEvents = _toConsumableArray(emitted).reverse();
1539
1540
  palletsWithIssued = ['Balances', 'ForeignAssets', 'Assets'];
1540
- feeEvent = (_ref8 = (_ref9 = (_ref0 = origin === 'Mythos' ? reversedEvents.find(function (event) {
1541
+ feeEvent = (_ref9 = (_ref0 = (_ref1 = origin === 'Mythos' ? reversedEvents.find(function (event) {
1541
1542
  return event.type === 'AssetConversion' && event.value.type === 'SwapCreditExecuted';
1542
- }) : undefined) !== null && _ref0 !== void 0 ? _ref0 :
1543
+ }) : undefined) !== null && _ref1 !== void 0 ? _ref1 :
1543
1544
  // Prefer an Issued event
1544
1545
  reversedEvents.find(function (event) {
1545
1546
  return palletsWithIssued.includes(event.type) && event.value.type === 'Issued';
1546
- })) !== null && _ref9 !== void 0 ? _ref9 :
1547
+ })) !== null && _ref0 !== void 0 ? _ref0 :
1547
1548
  // Fallback to Minted event
1548
1549
  reversedEvents.find(function (event) {
1549
1550
  return ['Balances', 'ForeignAssets'].includes(event.type) && event.value.type === 'Minted';
1550
- })) !== null && _ref8 !== void 0 ? _ref8 : reversedEvents.find(function (event) {
1551
+ })) !== null && _ref9 !== void 0 ? _ref9 : reversedEvents.find(function (event) {
1551
1552
  return ['Currencies', 'Tokens'].includes(event.type) && event.value.type === 'Deposited';
1552
1553
  });
1553
1554
  if (feeEvent) {
@@ -1941,14 +1942,16 @@ var getBridgeStatus = /*#__PURE__*/function () {
1941
1942
  return _ref2.apply(this, arguments);
1942
1943
  };
1943
1944
  }();
1945
+ var getFeeForOriginNode = createPapiApiCall(getFeeForOriginNode$1);
1944
1946
 
1945
1947
  var transfer = /*#__PURE__*/Object.freeze({
1946
1948
  __proto__: null,
1947
1949
  dryRun: dryRun,
1948
1950
  dryRunOrigin: dryRunOrigin,
1949
1951
  getBridgeStatus: getBridgeStatus,
1952
+ getFeeForOriginNode: getFeeForOriginNode,
1950
1953
  getParaEthTransferFees: getParaEthTransferFees,
1951
1954
  send: send
1952
1955
  });
1953
1956
 
1954
- export { Builder, EvmBuilder, assets, claimAssets, convertSs58, createApiInstanceForNode, dryRun, dryRunOrigin, getAssetBalance, getBalanceForeign, getBalanceNative, getBridgeStatus, getMaxForeignTransferableAmount, getMaxNativeTransferableAmount, getOriginFeeDetails, getParaEthTransferFees, getTransferInfo, getTransferableAmount, send, verifyEdOnDestination, transfer as xcmPallet };
1957
+ export { Builder, EvmBuilder, assets, claimAssets, convertSs58, createApiInstanceForNode, dryRun, dryRunOrigin, getAssetBalance, getBalanceForeign, getBalanceNative, getBridgeStatus, getFeeForOriginNode, getMaxForeignTransferableAmount, getMaxNativeTransferableAmount, getOriginFeeDetails, getParaEthTransferFees, getTransferInfo, getTransferableAmount, send, verifyEdOnDestination, transfer as xcmPallet };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paraspell/sdk",
3
- "version": "9.1.1",
3
+ "version": "9.2.0",
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.1.1"
30
+ "@paraspell/sdk-core": "9.2.0"
31
31
  },
32
32
  "peerDependencies": {
33
33
  "polkadot-api": ">= 1.10.2 < 2"