@paraspell/sdk-core 8.4.2 → 8.5.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
@@ -13919,41 +13919,6 @@ var resolveParaId = function resolveParaId(paraId, destination) {
13919
13919
  return paraId !== null && paraId !== undefined ? paraId : getParaId(destination);
13920
13920
  };
13921
13921
 
13922
- var calculateFee = /*#__PURE__*/function () {
13923
- var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(ahApi) {
13924
- var DEFAULT_FEE, feeStorageItem, leFeeHex, bytes, reversedHex, validReversedHex, leFee, transferBridgeFee, transferAssethubExecutionFee, totalFee, finalFee;
13925
- return _regeneratorRuntime().wrap(function _callee$(_context) {
13926
- while (1) switch (_context.prev = _context.next) {
13927
- case 0:
13928
- DEFAULT_FEE = 2750872500000n;
13929
- _context.next = 3;
13930
- return ahApi.getFromStorage('0x5fbc5c7ba58845ad1f1a9a7c5bc12fad');
13931
- case 3:
13932
- feeStorageItem = _context.sent;
13933
- leFeeHex = feeStorageItem.replace('0x', '');
13934
- _context.next = 7;
13935
- return ahApi.disconnect();
13936
- case 7:
13937
- bytes = leFeeHex.match(/.{1,2}/g) || [];
13938
- reversedHex = bytes.reverse().join('');
13939
- validReversedHex = reversedHex === '' ? '0' : reversedHex;
13940
- leFee = BigInt('0x' + validReversedHex);
13941
- transferBridgeFee = leFee === 0n ? DEFAULT_FEE : BigInt(leFee.toString());
13942
- transferAssethubExecutionFee = 2200000000n;
13943
- totalFee = transferBridgeFee + transferAssethubExecutionFee; // Adding a 10% margin
13944
- finalFee = totalFee * 110n / 100n;
13945
- return _context.abrupt("return", finalFee.toString());
13946
- case 16:
13947
- case "end":
13948
- return _context.stop();
13949
- }
13950
- }, _callee);
13951
- }));
13952
- return function calculateFee(_x) {
13953
- return _ref.apply(this, arguments);
13954
- };
13955
- }();
13956
-
13957
13922
  var generateAddressPayload = function generateAddressPayload(api, scenario, pallet, recipientAddress, version, nodeId) {
13958
13923
  var isMultiLocation = _typeof(recipientAddress) === 'object';
13959
13924
  if (isMultiLocation) {
@@ -14300,7 +14265,7 @@ var ParachainNode = /*#__PURE__*/function () {
14300
14265
  key: "transferToEthereum",
14301
14266
  value: function () {
14302
14267
  var _transferToEthereum = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(input) {
14303
- var api, asset, scenario, version, destination, ahAddress, versionOrDefault, ethMultiAsset, ahApi, fee, call;
14268
+ var api, asset, scenario, version, destination, ahAddress, versionOrDefault, ethMultiAsset, ahApi, _yield$getParaEthTran, _yield$getParaEthTran2, bridgeFee, executionFee, fee, call;
14304
14269
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
14305
14270
  while (1) switch (_context2.prev = _context2.next) {
14306
14271
  case 0:
@@ -14324,9 +14289,13 @@ var ParachainNode = /*#__PURE__*/function () {
14324
14289
  case 9:
14325
14290
  ahApi = _context2.sent;
14326
14291
  _context2.next = 12;
14327
- return calculateFee(ahApi);
14292
+ return getParaEthTransferFees(ahApi);
14328
14293
  case 12:
14329
- fee = _context2.sent;
14294
+ _yield$getParaEthTran = _context2.sent;
14295
+ _yield$getParaEthTran2 = _slicedToArray(_yield$getParaEthTran, 2);
14296
+ bridgeFee = _yield$getParaEthTran2[0];
14297
+ executionFee = _yield$getParaEthTran2[1];
14298
+ fee = (bridgeFee + executionFee).toString();
14330
14299
  call = {
14331
14300
  module: 'PolkadotXcm',
14332
14301
  section: 'transfer_assets_using_type_and_then',
@@ -14344,7 +14313,7 @@ var ParachainNode = /*#__PURE__*/function () {
14344
14313
  }
14345
14314
  };
14346
14315
  return _context2.abrupt("return", api.callTxMethod(call));
14347
- case 15:
14316
+ case 19:
14348
14317
  case "end":
14349
14318
  return _context2.stop();
14350
14319
  }
@@ -15296,7 +15265,7 @@ var AssetHubPolkadot$1 = /*#__PURE__*/function (_ParachainNode) {
15296
15265
  currencySelection: this.createCurrencySpec(asset.amount, scenario, versionOrDefault, asset, overriddenAsset)
15297
15266
  });
15298
15267
  }
15299
- if ((destination === 'Hydration' || destination === 'Polimec') && asset.symbol === 'DOT') {
15268
+ if ((destination === 'Hydration' || destination === 'Polimec' || destination === 'Moonbeam' || destination === 'BifrostPolkadot') && asset.symbol === 'DOT') {
15300
15269
  var _versionOrDefault = version !== null && version !== undefined ? version : this.version;
15301
15270
  return _objectSpread2(_objectSpread2({}, input), {}, {
15302
15271
  currencySelection: _superPropGet(AssetHubPolkadot, "createCurrencySpec", this, 3)([asset.amount, 'ParaToRelay', _versionOrDefault, asset, overriddenAsset])
@@ -15307,7 +15276,7 @@ var AssetHubPolkadot$1 = /*#__PURE__*/function (_ParachainNode) {
15307
15276
  }, {
15308
15277
  key: "getSection",
15309
15278
  value: function getSection(scenario, destination) {
15310
- if (destination === 'Polimec') return 'transfer_assets';
15279
+ if (destination === 'Polimec' || destination === 'Moonbeam') return 'transfer_assets';
15311
15280
  return scenario === 'ParaToPara' ? 'limited_reserve_transfer_assets' : 'limited_teleport_assets';
15312
15281
  }
15313
15282
  }, {
@@ -15334,7 +15303,7 @@ var AssetHubPolkadot$1 = /*#__PURE__*/function (_ParachainNode) {
15334
15303
  if (destination === 'BifrostPolkadot' && isEthereumAsset) {
15335
15304
  return Promise.resolve(this.handleBifrostEthTransfer(input));
15336
15305
  }
15337
- if (scenario === 'ParaToPara' && asset.symbol === 'DOT' && !isForeignAsset(asset) && destination !== 'Hydration' && destination !== 'Polimec') {
15306
+ if (scenario === 'ParaToPara' && asset.symbol === 'DOT' && !isForeignAsset(asset) && destination !== 'Hydration' && destination !== 'Polimec' && destination !== 'Moonbeam' && destination !== 'BifrostPolkadot') {
15338
15307
  throw new ScenarioNotSupportedError(this.node, scenario, 'Para to Para scenarios for DOT transfer from AssetHub are not supported, you have to transfer DOT to Relay chain and transfer to destination chain from Relay chain.');
15339
15308
  }
15340
15309
  if (scenario === 'ParaToPara' && asset.symbol === 'KSM' && !isForeignAsset(asset)) {
@@ -19818,6 +19787,41 @@ var transferMoonbeamEvm = /*#__PURE__*/function () {
19818
19787
  };
19819
19788
  }();
19820
19789
 
19790
+ var getParaEthTransferFees = /*#__PURE__*/function () {
19791
+ var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(ahApi) {
19792
+ var DEFAULT_FEE, feeStorageItem, leFeeHex, bytes, reversedHex, validReversedHex, leFee, transferBridgeFee, transferAssethubExecutionFee, finalBridgeFee, finalAssethubExecutionFee;
19793
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
19794
+ while (1) switch (_context.prev = _context.next) {
19795
+ case 0:
19796
+ DEFAULT_FEE = 2750872500000n;
19797
+ _context.next = 3;
19798
+ return ahApi.getFromStorage('0x5fbc5c7ba58845ad1f1a9a7c5bc12fad');
19799
+ case 3:
19800
+ feeStorageItem = _context.sent;
19801
+ leFeeHex = feeStorageItem.replace('0x', '');
19802
+ _context.next = 7;
19803
+ return ahApi.disconnect();
19804
+ case 7:
19805
+ bytes = leFeeHex.match(/.{1,2}/g) || [];
19806
+ reversedHex = bytes.reverse().join('');
19807
+ validReversedHex = reversedHex === '' ? '0' : reversedHex;
19808
+ leFee = BigInt('0x' + validReversedHex);
19809
+ transferBridgeFee = leFee === 0n ? DEFAULT_FEE : BigInt(leFee.toString());
19810
+ transferAssethubExecutionFee = 2200000000n;
19811
+ finalBridgeFee = transferBridgeFee * 110n / 100n;
19812
+ finalAssethubExecutionFee = transferAssethubExecutionFee * 110n / 100n;
19813
+ return _context.abrupt("return", [finalBridgeFee, finalAssethubExecutionFee]);
19814
+ case 16:
19815
+ case "end":
19816
+ return _context.stop();
19817
+ }
19818
+ }, _callee);
19819
+ }));
19820
+ return function getParaEthTransferFees(_x) {
19821
+ return _ref.apply(this, arguments);
19822
+ };
19823
+ }();
19824
+
19821
19825
  exports.Builder = Builder;
19822
19826
  exports.DuplicateAssetError = DuplicateAssetError;
19823
19827
  exports.DuplicateAssetIdError = DuplicateAssetIdError;
@@ -19839,7 +19843,6 @@ exports.NodeNotSupportedError = NodeNotSupportedError;
19839
19843
  exports.Override = Override;
19840
19844
  exports.SUPPORTED_PALLETS = SUPPORTED_PALLETS;
19841
19845
  exports.ScenarioNotSupportedError = ScenarioNotSupportedError;
19842
- exports.calculateFee = calculateFee;
19843
19846
  exports.claimAssets = claimAssets;
19844
19847
  exports.computeFeeFromDryRun = computeFeeFromDryRun;
19845
19848
  exports.computeFeeFromDryRunPjs = computeFeeFromDryRunPjs;
@@ -19880,6 +19883,7 @@ exports.getNodeProviders = getNodeProviders;
19880
19883
  exports.getOriginFeeDetails = getOriginFeeDetails;
19881
19884
  exports.getOriginFeeDetailsInternal = getOriginFeeDetailsInternal;
19882
19885
  exports.getOtherAssets = getOtherAssets;
19886
+ exports.getParaEthTransferFees = getParaEthTransferFees;
19883
19887
  exports.getParaId = getParaId;
19884
19888
  exports.getRelayChainSymbol = getRelayChainSymbol;
19885
19889
  exports.getSupportedAssets = getSupportedAssets;
package/dist/index.d.ts CHANGED
@@ -1328,6 +1328,8 @@ declare const getDryRun: <TApi, TRes>(options: TDryRunOptions<TApi, TRes>) => Pr
1328
1328
 
1329
1329
  declare const transferMoonbeamEvm: <TApi, TRes>({ api, from, to, signer, address, currency }: TEvmBuilderOptions<TApi, TRes>) => Promise<string>;
1330
1330
 
1331
+ declare const getParaEthTransferFees: <TApi, TRes>(ahApi: IPolkadotApi<TApi, TRes>) => Promise<[bigint, bigint]>;
1332
+
1331
1333
  declare const getAssetMultiLocation: (node: TNodeWithRelayChains, currency: TCurrencyInput) => TMultiLocation | null;
1332
1334
 
1333
1335
  /**
@@ -1635,8 +1637,6 @@ declare const isOverrideMultiLocationSpecifier: (multiLocationSpecifier: TMultiL
1635
1637
 
1636
1638
  declare const resolveParaId: (paraId: number | undefined, destination: TDestination) => number | undefined;
1637
1639
 
1638
- declare const calculateFee: <TApi, TRes>(ahApi: IPolkadotApi<TApi, TRes>) => Promise<string>;
1639
-
1640
1640
  declare const validateAddress: (address: TAddress, node: TNodeWithRelayChains, isDestination?: boolean) => void;
1641
1641
 
1642
1642
  /**
@@ -1764,4 +1764,4 @@ declare const getNodeProviders: (node: TNodeDotKsmWithRelayChains) => string[];
1764
1764
  */
1765
1765
  declare const getParaId: (node: TNodeWithRelayChains) => number;
1766
1766
 
1767
- export { BatchMode, Builder, DuplicateAssetError, DuplicateAssetIdError, ETHEREUM_JUNCTION, ETH_CHAIN_ID, Foreign, ForeignAbstract, GeneralBuilder, type IAccountBuilder, type IAddToBatchBuilder, type IAddressBuilder, type ICurrencyBuilder, type IFinalBuilder, type IFinalBuilderWithOptions, type IFromBuilder, type IFungibleBuilder, type IPolkadotApi, type IPolkadotXCMTransfer, type IToBuilder, type IVersionBuilder, type IXTokensTransfer, type IXTransferTransfer, IncompatibleNodesError, InvalidAddressError, InvalidCurrencyError, NODES_WITH_RELAY_CHAINS, NODES_WITH_RELAY_CHAINS_DOT_KSM, NODE_NAMES, NODE_NAMES_DOT_KSM, Native, NoXCMSupportImplementedError, NodeNotSupportedError, Override, Parents, PolkadotXcmError, SUPPORTED_PALLETS, ScenarioNotSupportedError, type TAddress, type TAmount, type TApiOrUrl, type TAsset, type TAssetJsonMap, type TBalanceResponse, type TBatchOptions, type TBifrostToken, type TCurrency, type TCurrencyCore, type TCurrencyCoreV1, type TCurrencyCoreV1WithAmount, type TCurrencyCoreWithFee, type TCurrencyInput, type TCurrencyInputWithAmount, type TCurrencySelection, type TCurrencySelectionHeader, type TCurrencySelectionHeaderArr, type TCurrencySelectionV4, type TCurrencySymbol, type TCurrencySymbolValue, type TDestWeight, type TDestination, type TDryRunBaseOptions, type TDryRunOptions, type TDryRunResult, type TEcosystemType, type TEdJsonMap, type TEvmBuilderOptions, type TEvmBuilderOptionsBase, type TForeignAsset, type TForeignAssetId, type TForeignOrNativeAsset, type TForeignOrTokenAsset, type TGetAssetBalanceOptions, type TGetAssetBalanceOptionsBase, type TGetBalanceForeignOptions, type TGetBalanceForeignOptionsBase, type TGetBalanceNativeOptions, type TGetBalanceNativeOptionsBase, type TGetMaxForeignTransferableAmountOptions, type TGetMaxForeignTransferableAmountOptionsBase, type TGetMaxNativeTransferableAmountOptions, type TGetMaxNativeTransferableAmountOptionsBase, type TGetOriginFeeDetailsOptions, type TGetOriginFeeDetailsOptionsBase, type TGetTransferInfoOptions, type TGetTransferInfoOptionsBase, type TGetTransferableAmountOptions, type TGetTransferableAmountOptionsBase, type TJunction, type TJunctionGeneralIndex, type TJunctionParachain, type TJunctionType, type TJunctions, type TMantaAsset, type TModuleError, type TMultiAsset, type TMultiAssetV3, type TMultiAssetV4, type TMultiAssetWithFee, type TMultiLocation, type TMultiLocationHeader, type TMultiLocationValue, type TMultiLocationValueWithOverride, type TNativeAsset, type TNativeTokenAsset, type TNode, type TNodeAssets, type TNodeConfig, type TNodeConfigMap, type TNodeDotKsmWithRelayChains, type TNodePolkadotKusama, type TNodeWithRelayChains, type TNodleAsset, type TOptionalEvmBuilderOptions, type TOriginFeeDetails, type TOtherReserveAsset, type TOverrideMultiLocationSpecifier, type TPallet, type TPalletDetails, type TPalletJsonMap, type TPalletMap, type TPolkadotXCMTransferOptions, type TPolkadotXcmSection, type TProviderEntry, type TRelayChainSymbol, type TRelayToParaDestination, type TRelayToParaOptions, type TRelayToParaOverrides, type TRelaychain, type TReserveAsset, type TScenario, type TSelfReserveAsset, type TSendBaseOptions, type TSendInternalOptions, type TSendOptions, type TSerializeEthTransferOptions, type TSerializedApiCall, type TSerializedEthTransfer, type TSymbolSpecifier, type TTransferInfo, type TVersionClaimAssets, type TXTokensCurrencySelection, type TXTokensSection, type TXTokensTransferOptions, type TXTransferSection, type TXTransferTransferOptions, type TXcmAsset, type TXcmForeignAsset, type TXcmPalletSection, type TZeitgeistAsset, Version, type WithAmount, type WithApi, XTokensError, calculateFee, claimAssets, computeFeeFromDryRun, computeFeeFromDryRunPjs, createApiInstanceForNode, createX1Payload, deepEqual, determineRelayChain, findAssetById, findAssetByMultiLocation, findAssetBySymbol, findBestMatches, generateAddressMultiLocationV4, generateAddressPayload, getAllAssetsSymbols, getAssetBalance, getAssetBalanceInternal, getAssetBySymbolOrId, getAssetDecimals, getAssetId, getAssetMultiLocation, getAssets, getAssetsObject, getBalanceForeign, getBalanceForeignInternal, getBalanceNative, getBalanceNativeInternal, getDefaultPallet, getDryRun, getExistentialDeposit, getFees, getMaxForeignTransferableAmount, getMaxNativeTransferableAmount, getNativeAssetSymbol, getNativeAssets, getNode, getNodeConfig, getNodeProviders, getOriginFeeDetails, getOriginFeeDetailsInternal, getOtherAssets, getParaId, getRelayChainSymbol, getSupportedAssets, getSupportedPallets, getSupportedPalletsDetails, getTNode, getTransferInfo, getTransferableAmount, hasSupportForAsset, isForeignAsset, isNodeEvm, isOverrideMultiLocationSpecifier, isRelayChain, isSymbolSpecifier, normalizeSymbol, resolveModuleError, resolveParaId, send, transferMoonbeamEvm, transferRelayToPara, validateAddress };
1767
+ export { BatchMode, Builder, DuplicateAssetError, DuplicateAssetIdError, ETHEREUM_JUNCTION, ETH_CHAIN_ID, Foreign, ForeignAbstract, GeneralBuilder, type IAccountBuilder, type IAddToBatchBuilder, type IAddressBuilder, type ICurrencyBuilder, type IFinalBuilder, type IFinalBuilderWithOptions, type IFromBuilder, type IFungibleBuilder, type IPolkadotApi, type IPolkadotXCMTransfer, type IToBuilder, type IVersionBuilder, type IXTokensTransfer, type IXTransferTransfer, IncompatibleNodesError, InvalidAddressError, InvalidCurrencyError, NODES_WITH_RELAY_CHAINS, NODES_WITH_RELAY_CHAINS_DOT_KSM, NODE_NAMES, NODE_NAMES_DOT_KSM, Native, NoXCMSupportImplementedError, NodeNotSupportedError, Override, Parents, PolkadotXcmError, SUPPORTED_PALLETS, ScenarioNotSupportedError, type TAddress, type TAmount, type TApiOrUrl, type TAsset, type TAssetJsonMap, type TBalanceResponse, type TBatchOptions, type TBifrostToken, type TCurrency, type TCurrencyCore, type TCurrencyCoreV1, type TCurrencyCoreV1WithAmount, type TCurrencyCoreWithFee, type TCurrencyInput, type TCurrencyInputWithAmount, type TCurrencySelection, type TCurrencySelectionHeader, type TCurrencySelectionHeaderArr, type TCurrencySelectionV4, type TCurrencySymbol, type TCurrencySymbolValue, type TDestWeight, type TDestination, type TDryRunBaseOptions, type TDryRunOptions, type TDryRunResult, type TEcosystemType, type TEdJsonMap, type TEvmBuilderOptions, type TEvmBuilderOptionsBase, type TForeignAsset, type TForeignAssetId, type TForeignOrNativeAsset, type TForeignOrTokenAsset, type TGetAssetBalanceOptions, type TGetAssetBalanceOptionsBase, type TGetBalanceForeignOptions, type TGetBalanceForeignOptionsBase, type TGetBalanceNativeOptions, type TGetBalanceNativeOptionsBase, type TGetMaxForeignTransferableAmountOptions, type TGetMaxForeignTransferableAmountOptionsBase, type TGetMaxNativeTransferableAmountOptions, type TGetMaxNativeTransferableAmountOptionsBase, type TGetOriginFeeDetailsOptions, type TGetOriginFeeDetailsOptionsBase, type TGetTransferInfoOptions, type TGetTransferInfoOptionsBase, type TGetTransferableAmountOptions, type TGetTransferableAmountOptionsBase, type TJunction, type TJunctionGeneralIndex, type TJunctionParachain, type TJunctionType, type TJunctions, type TMantaAsset, type TModuleError, type TMultiAsset, type TMultiAssetV3, type TMultiAssetV4, type TMultiAssetWithFee, type TMultiLocation, type TMultiLocationHeader, type TMultiLocationValue, type TMultiLocationValueWithOverride, type TNativeAsset, type TNativeTokenAsset, type TNode, type TNodeAssets, type TNodeConfig, type TNodeConfigMap, type TNodeDotKsmWithRelayChains, type TNodePolkadotKusama, type TNodeWithRelayChains, type TNodleAsset, type TOptionalEvmBuilderOptions, type TOriginFeeDetails, type TOtherReserveAsset, type TOverrideMultiLocationSpecifier, type TPallet, type TPalletDetails, type TPalletJsonMap, type TPalletMap, type TPolkadotXCMTransferOptions, type TPolkadotXcmSection, type TProviderEntry, type TRelayChainSymbol, type TRelayToParaDestination, type TRelayToParaOptions, type TRelayToParaOverrides, type TRelaychain, type TReserveAsset, type TScenario, type TSelfReserveAsset, type TSendBaseOptions, type TSendInternalOptions, type TSendOptions, type TSerializeEthTransferOptions, type TSerializedApiCall, type TSerializedEthTransfer, type TSymbolSpecifier, type TTransferInfo, type TVersionClaimAssets, type TXTokensCurrencySelection, type TXTokensSection, type TXTokensTransferOptions, type TXTransferSection, type TXTransferTransferOptions, type TXcmAsset, type TXcmForeignAsset, type TXcmPalletSection, type TZeitgeistAsset, Version, type WithAmount, type WithApi, XTokensError, claimAssets, computeFeeFromDryRun, computeFeeFromDryRunPjs, createApiInstanceForNode, createX1Payload, deepEqual, determineRelayChain, findAssetById, findAssetByMultiLocation, findAssetBySymbol, findBestMatches, generateAddressMultiLocationV4, generateAddressPayload, getAllAssetsSymbols, getAssetBalance, getAssetBalanceInternal, getAssetBySymbolOrId, getAssetDecimals, getAssetId, getAssetMultiLocation, getAssets, getAssetsObject, getBalanceForeign, getBalanceForeignInternal, getBalanceNative, getBalanceNativeInternal, getDefaultPallet, getDryRun, getExistentialDeposit, getFees, getMaxForeignTransferableAmount, getMaxNativeTransferableAmount, getNativeAssetSymbol, getNativeAssets, getNode, getNodeConfig, getNodeProviders, getOriginFeeDetails, getOriginFeeDetailsInternal, getOtherAssets, getParaEthTransferFees, getParaId, getRelayChainSymbol, getSupportedAssets, getSupportedPallets, getSupportedPalletsDetails, getTNode, getTransferInfo, getTransferableAmount, hasSupportForAsset, isForeignAsset, isNodeEvm, isOverrideMultiLocationSpecifier, isRelayChain, isSymbolSpecifier, normalizeSymbol, resolveModuleError, resolveParaId, send, transferMoonbeamEvm, transferRelayToPara, validateAddress };
package/dist/index.mjs CHANGED
@@ -13917,41 +13917,6 @@ var resolveParaId = function resolveParaId(paraId, destination) {
13917
13917
  return paraId !== null && paraId !== undefined ? paraId : getParaId(destination);
13918
13918
  };
13919
13919
 
13920
- var calculateFee = /*#__PURE__*/function () {
13921
- var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(ahApi) {
13922
- var DEFAULT_FEE, feeStorageItem, leFeeHex, bytes, reversedHex, validReversedHex, leFee, transferBridgeFee, transferAssethubExecutionFee, totalFee, finalFee;
13923
- return _regeneratorRuntime().wrap(function _callee$(_context) {
13924
- while (1) switch (_context.prev = _context.next) {
13925
- case 0:
13926
- DEFAULT_FEE = 2750872500000n;
13927
- _context.next = 3;
13928
- return ahApi.getFromStorage('0x5fbc5c7ba58845ad1f1a9a7c5bc12fad');
13929
- case 3:
13930
- feeStorageItem = _context.sent;
13931
- leFeeHex = feeStorageItem.replace('0x', '');
13932
- _context.next = 7;
13933
- return ahApi.disconnect();
13934
- case 7:
13935
- bytes = leFeeHex.match(/.{1,2}/g) || [];
13936
- reversedHex = bytes.reverse().join('');
13937
- validReversedHex = reversedHex === '' ? '0' : reversedHex;
13938
- leFee = BigInt('0x' + validReversedHex);
13939
- transferBridgeFee = leFee === 0n ? DEFAULT_FEE : BigInt(leFee.toString());
13940
- transferAssethubExecutionFee = 2200000000n;
13941
- totalFee = transferBridgeFee + transferAssethubExecutionFee; // Adding a 10% margin
13942
- finalFee = totalFee * 110n / 100n;
13943
- return _context.abrupt("return", finalFee.toString());
13944
- case 16:
13945
- case "end":
13946
- return _context.stop();
13947
- }
13948
- }, _callee);
13949
- }));
13950
- return function calculateFee(_x) {
13951
- return _ref.apply(this, arguments);
13952
- };
13953
- }();
13954
-
13955
13920
  var generateAddressPayload = function generateAddressPayload(api, scenario, pallet, recipientAddress, version, nodeId) {
13956
13921
  var isMultiLocation = _typeof(recipientAddress) === 'object';
13957
13922
  if (isMultiLocation) {
@@ -14298,7 +14263,7 @@ var ParachainNode = /*#__PURE__*/function () {
14298
14263
  key: "transferToEthereum",
14299
14264
  value: function () {
14300
14265
  var _transferToEthereum = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(input) {
14301
- var api, asset, scenario, version, destination, ahAddress, versionOrDefault, ethMultiAsset, ahApi, fee, call;
14266
+ var api, asset, scenario, version, destination, ahAddress, versionOrDefault, ethMultiAsset, ahApi, _yield$getParaEthTran, _yield$getParaEthTran2, bridgeFee, executionFee, fee, call;
14302
14267
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
14303
14268
  while (1) switch (_context2.prev = _context2.next) {
14304
14269
  case 0:
@@ -14322,9 +14287,13 @@ var ParachainNode = /*#__PURE__*/function () {
14322
14287
  case 9:
14323
14288
  ahApi = _context2.sent;
14324
14289
  _context2.next = 12;
14325
- return calculateFee(ahApi);
14290
+ return getParaEthTransferFees(ahApi);
14326
14291
  case 12:
14327
- fee = _context2.sent;
14292
+ _yield$getParaEthTran = _context2.sent;
14293
+ _yield$getParaEthTran2 = _slicedToArray(_yield$getParaEthTran, 2);
14294
+ bridgeFee = _yield$getParaEthTran2[0];
14295
+ executionFee = _yield$getParaEthTran2[1];
14296
+ fee = (bridgeFee + executionFee).toString();
14328
14297
  call = {
14329
14298
  module: 'PolkadotXcm',
14330
14299
  section: 'transfer_assets_using_type_and_then',
@@ -14342,7 +14311,7 @@ var ParachainNode = /*#__PURE__*/function () {
14342
14311
  }
14343
14312
  };
14344
14313
  return _context2.abrupt("return", api.callTxMethod(call));
14345
- case 15:
14314
+ case 19:
14346
14315
  case "end":
14347
14316
  return _context2.stop();
14348
14317
  }
@@ -15294,7 +15263,7 @@ var AssetHubPolkadot$1 = /*#__PURE__*/function (_ParachainNode) {
15294
15263
  currencySelection: this.createCurrencySpec(asset.amount, scenario, versionOrDefault, asset, overriddenAsset)
15295
15264
  });
15296
15265
  }
15297
- if ((destination === 'Hydration' || destination === 'Polimec') && asset.symbol === 'DOT') {
15266
+ if ((destination === 'Hydration' || destination === 'Polimec' || destination === 'Moonbeam' || destination === 'BifrostPolkadot') && asset.symbol === 'DOT') {
15298
15267
  var _versionOrDefault = version !== null && version !== undefined ? version : this.version;
15299
15268
  return _objectSpread2(_objectSpread2({}, input), {}, {
15300
15269
  currencySelection: _superPropGet(AssetHubPolkadot, "createCurrencySpec", this, 3)([asset.amount, 'ParaToRelay', _versionOrDefault, asset, overriddenAsset])
@@ -15305,7 +15274,7 @@ var AssetHubPolkadot$1 = /*#__PURE__*/function (_ParachainNode) {
15305
15274
  }, {
15306
15275
  key: "getSection",
15307
15276
  value: function getSection(scenario, destination) {
15308
- if (destination === 'Polimec') return 'transfer_assets';
15277
+ if (destination === 'Polimec' || destination === 'Moonbeam') return 'transfer_assets';
15309
15278
  return scenario === 'ParaToPara' ? 'limited_reserve_transfer_assets' : 'limited_teleport_assets';
15310
15279
  }
15311
15280
  }, {
@@ -15332,7 +15301,7 @@ var AssetHubPolkadot$1 = /*#__PURE__*/function (_ParachainNode) {
15332
15301
  if (destination === 'BifrostPolkadot' && isEthereumAsset) {
15333
15302
  return Promise.resolve(this.handleBifrostEthTransfer(input));
15334
15303
  }
15335
- if (scenario === 'ParaToPara' && asset.symbol === 'DOT' && !isForeignAsset(asset) && destination !== 'Hydration' && destination !== 'Polimec') {
15304
+ if (scenario === 'ParaToPara' && asset.symbol === 'DOT' && !isForeignAsset(asset) && destination !== 'Hydration' && destination !== 'Polimec' && destination !== 'Moonbeam' && destination !== 'BifrostPolkadot') {
15336
15305
  throw new ScenarioNotSupportedError(this.node, scenario, 'Para to Para scenarios for DOT transfer from AssetHub are not supported, you have to transfer DOT to Relay chain and transfer to destination chain from Relay chain.');
15337
15306
  }
15338
15307
  if (scenario === 'ParaToPara' && asset.symbol === 'KSM' && !isForeignAsset(asset)) {
@@ -19816,4 +19785,39 @@ var transferMoonbeamEvm = /*#__PURE__*/function () {
19816
19785
  };
19817
19786
  }();
19818
19787
 
19819
- export { BatchMode, Builder, DuplicateAssetError, DuplicateAssetIdError, ETHEREUM_JUNCTION, ETH_CHAIN_ID, Foreign, ForeignAbstract, GeneralBuilder, IncompatibleNodesError, InvalidAddressError, InvalidCurrencyError, NODES_WITH_RELAY_CHAINS, NODES_WITH_RELAY_CHAINS_DOT_KSM, NODE_NAMES, NODE_NAMES_DOT_KSM, Native, NoXCMSupportImplementedError, NodeNotSupportedError, Override, Parents, PolkadotXcmError, SUPPORTED_PALLETS, ScenarioNotSupportedError, Version, XTokensError, calculateFee, claimAssets, computeFeeFromDryRun, computeFeeFromDryRunPjs, createApiInstanceForNode, createX1Payload, _deepEqual as deepEqual, determineRelayChain, findAssetById, findAssetByMultiLocation, findAssetBySymbol, findBestMatches, generateAddressMultiLocationV4, generateAddressPayload, getAllAssetsSymbols, getAssetBalance, getAssetBalanceInternal, getAssetBySymbolOrId, getAssetDecimals, getAssetId, getAssetMultiLocation, getAssets, getAssetsObject, getBalanceForeign, getBalanceForeignInternal, getBalanceNative, getBalanceNativeInternal, getDefaultPallet, getDryRun, getExistentialDeposit, getFees, getMaxForeignTransferableAmount, getMaxNativeTransferableAmount, getNativeAssetSymbol, getNativeAssets, getNode, getNodeConfig, getNodeProviders, getOriginFeeDetails, getOriginFeeDetailsInternal, getOtherAssets, getParaId, getRelayChainSymbol, getSupportedAssets, getSupportedPallets, getSupportedPalletsDetails, getTNode, getTransferInfo, getTransferableAmount, hasSupportForAsset, isForeignAsset, isNodeEvm, isOverrideMultiLocationSpecifier, isRelayChain, isSymbolSpecifier, normalizeSymbol, resolveModuleError, resolveParaId, send, transferMoonbeamEvm, transferRelayToPara, validateAddress };
19788
+ var getParaEthTransferFees = /*#__PURE__*/function () {
19789
+ var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(ahApi) {
19790
+ var DEFAULT_FEE, feeStorageItem, leFeeHex, bytes, reversedHex, validReversedHex, leFee, transferBridgeFee, transferAssethubExecutionFee, finalBridgeFee, finalAssethubExecutionFee;
19791
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
19792
+ while (1) switch (_context.prev = _context.next) {
19793
+ case 0:
19794
+ DEFAULT_FEE = 2750872500000n;
19795
+ _context.next = 3;
19796
+ return ahApi.getFromStorage('0x5fbc5c7ba58845ad1f1a9a7c5bc12fad');
19797
+ case 3:
19798
+ feeStorageItem = _context.sent;
19799
+ leFeeHex = feeStorageItem.replace('0x', '');
19800
+ _context.next = 7;
19801
+ return ahApi.disconnect();
19802
+ case 7:
19803
+ bytes = leFeeHex.match(/.{1,2}/g) || [];
19804
+ reversedHex = bytes.reverse().join('');
19805
+ validReversedHex = reversedHex === '' ? '0' : reversedHex;
19806
+ leFee = BigInt('0x' + validReversedHex);
19807
+ transferBridgeFee = leFee === 0n ? DEFAULT_FEE : BigInt(leFee.toString());
19808
+ transferAssethubExecutionFee = 2200000000n;
19809
+ finalBridgeFee = transferBridgeFee * 110n / 100n;
19810
+ finalAssethubExecutionFee = transferAssethubExecutionFee * 110n / 100n;
19811
+ return _context.abrupt("return", [finalBridgeFee, finalAssethubExecutionFee]);
19812
+ case 16:
19813
+ case "end":
19814
+ return _context.stop();
19815
+ }
19816
+ }, _callee);
19817
+ }));
19818
+ return function getParaEthTransferFees(_x) {
19819
+ return _ref.apply(this, arguments);
19820
+ };
19821
+ }();
19822
+
19823
+ export { BatchMode, Builder, DuplicateAssetError, DuplicateAssetIdError, ETHEREUM_JUNCTION, ETH_CHAIN_ID, Foreign, ForeignAbstract, GeneralBuilder, IncompatibleNodesError, InvalidAddressError, InvalidCurrencyError, NODES_WITH_RELAY_CHAINS, NODES_WITH_RELAY_CHAINS_DOT_KSM, NODE_NAMES, NODE_NAMES_DOT_KSM, Native, NoXCMSupportImplementedError, NodeNotSupportedError, Override, Parents, PolkadotXcmError, SUPPORTED_PALLETS, ScenarioNotSupportedError, Version, XTokensError, claimAssets, computeFeeFromDryRun, computeFeeFromDryRunPjs, createApiInstanceForNode, createX1Payload, _deepEqual as deepEqual, determineRelayChain, findAssetById, findAssetByMultiLocation, findAssetBySymbol, findBestMatches, generateAddressMultiLocationV4, generateAddressPayload, getAllAssetsSymbols, getAssetBalance, getAssetBalanceInternal, getAssetBySymbolOrId, getAssetDecimals, getAssetId, getAssetMultiLocation, getAssets, getAssetsObject, getBalanceForeign, getBalanceForeignInternal, getBalanceNative, getBalanceNativeInternal, getDefaultPallet, getDryRun, getExistentialDeposit, getFees, getMaxForeignTransferableAmount, getMaxNativeTransferableAmount, getNativeAssetSymbol, getNativeAssets, getNode, getNodeConfig, getNodeProviders, getOriginFeeDetails, getOriginFeeDetailsInternal, getOtherAssets, getParaEthTransferFees, getParaId, getRelayChainSymbol, getSupportedAssets, getSupportedPallets, getSupportedPalletsDetails, getTNode, getTransferInfo, getTransferableAmount, hasSupportForAsset, isForeignAsset, isNodeEvm, isOverrideMultiLocationSpecifier, isRelayChain, isSymbolSpecifier, normalizeSymbol, resolveModuleError, resolveParaId, send, transferMoonbeamEvm, transferRelayToPara, validateAddress };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paraspell/sdk-core",
3
- "version": "8.4.2",
3
+ "version": "8.5.0",
4
4
  "description": "SDK core for ParaSpell XCM/XCMP tool for developers",
5
5
  "repository": {
6
6
  "type": "git",