@paraspell/sdk-core 8.4.1 → 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 +47 -38
- package/dist/index.d.ts +3 -3
- package/dist/index.mjs +47 -38
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -13919,36 +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, leFee, transfer_bridge_fee, transfer_assethub_execution_fee;
|
|
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
|
-
leFee = BigInt('0x' + leFeeHex.split('').reverse().join(''));
|
|
13938
|
-
transfer_bridge_fee = leFee === 0n ? DEFAULT_FEE : BigInt(leFee.toString());
|
|
13939
|
-
transfer_assethub_execution_fee = 2200000000n;
|
|
13940
|
-
return _context.abrupt("return", (transfer_bridge_fee + transfer_assethub_execution_fee).toString());
|
|
13941
|
-
case 11:
|
|
13942
|
-
case "end":
|
|
13943
|
-
return _context.stop();
|
|
13944
|
-
}
|
|
13945
|
-
}, _callee);
|
|
13946
|
-
}));
|
|
13947
|
-
return function calculateFee(_x) {
|
|
13948
|
-
return _ref.apply(this, arguments);
|
|
13949
|
-
};
|
|
13950
|
-
}();
|
|
13951
|
-
|
|
13952
13922
|
var generateAddressPayload = function generateAddressPayload(api, scenario, pallet, recipientAddress, version, nodeId) {
|
|
13953
13923
|
var isMultiLocation = _typeof(recipientAddress) === 'object';
|
|
13954
13924
|
if (isMultiLocation) {
|
|
@@ -14295,7 +14265,7 @@ var ParachainNode = /*#__PURE__*/function () {
|
|
|
14295
14265
|
key: "transferToEthereum",
|
|
14296
14266
|
value: function () {
|
|
14297
14267
|
var _transferToEthereum = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(input) {
|
|
14298
|
-
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;
|
|
14299
14269
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
14300
14270
|
while (1) switch (_context2.prev = _context2.next) {
|
|
14301
14271
|
case 0:
|
|
@@ -14319,9 +14289,13 @@ var ParachainNode = /*#__PURE__*/function () {
|
|
|
14319
14289
|
case 9:
|
|
14320
14290
|
ahApi = _context2.sent;
|
|
14321
14291
|
_context2.next = 12;
|
|
14322
|
-
return
|
|
14292
|
+
return getParaEthTransferFees(ahApi);
|
|
14323
14293
|
case 12:
|
|
14324
|
-
|
|
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();
|
|
14325
14299
|
call = {
|
|
14326
14300
|
module: 'PolkadotXcm',
|
|
14327
14301
|
section: 'transfer_assets_using_type_and_then',
|
|
@@ -14339,7 +14313,7 @@ var ParachainNode = /*#__PURE__*/function () {
|
|
|
14339
14313
|
}
|
|
14340
14314
|
};
|
|
14341
14315
|
return _context2.abrupt("return", api.callTxMethod(call));
|
|
14342
|
-
case
|
|
14316
|
+
case 19:
|
|
14343
14317
|
case "end":
|
|
14344
14318
|
return _context2.stop();
|
|
14345
14319
|
}
|
|
@@ -15291,7 +15265,7 @@ var AssetHubPolkadot$1 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
15291
15265
|
currencySelection: this.createCurrencySpec(asset.amount, scenario, versionOrDefault, asset, overriddenAsset)
|
|
15292
15266
|
});
|
|
15293
15267
|
}
|
|
15294
|
-
if ((destination === 'Hydration' || destination === 'Polimec') && asset.symbol === 'DOT') {
|
|
15268
|
+
if ((destination === 'Hydration' || destination === 'Polimec' || destination === 'Moonbeam' || destination === 'BifrostPolkadot') && asset.symbol === 'DOT') {
|
|
15295
15269
|
var _versionOrDefault = version !== null && version !== undefined ? version : this.version;
|
|
15296
15270
|
return _objectSpread2(_objectSpread2({}, input), {}, {
|
|
15297
15271
|
currencySelection: _superPropGet(AssetHubPolkadot, "createCurrencySpec", this, 3)([asset.amount, 'ParaToRelay', _versionOrDefault, asset, overriddenAsset])
|
|
@@ -15302,7 +15276,7 @@ var AssetHubPolkadot$1 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
15302
15276
|
}, {
|
|
15303
15277
|
key: "getSection",
|
|
15304
15278
|
value: function getSection(scenario, destination) {
|
|
15305
|
-
if (destination === 'Polimec') return 'transfer_assets';
|
|
15279
|
+
if (destination === 'Polimec' || destination === 'Moonbeam') return 'transfer_assets';
|
|
15306
15280
|
return scenario === 'ParaToPara' ? 'limited_reserve_transfer_assets' : 'limited_teleport_assets';
|
|
15307
15281
|
}
|
|
15308
15282
|
}, {
|
|
@@ -15329,7 +15303,7 @@ var AssetHubPolkadot$1 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
15329
15303
|
if (destination === 'BifrostPolkadot' && isEthereumAsset) {
|
|
15330
15304
|
return Promise.resolve(this.handleBifrostEthTransfer(input));
|
|
15331
15305
|
}
|
|
15332
|
-
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') {
|
|
15333
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.');
|
|
15334
15308
|
}
|
|
15335
15309
|
if (scenario === 'ParaToPara' && asset.symbol === 'KSM' && !isForeignAsset(asset)) {
|
|
@@ -19813,6 +19787,41 @@ var transferMoonbeamEvm = /*#__PURE__*/function () {
|
|
|
19813
19787
|
};
|
|
19814
19788
|
}();
|
|
19815
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
|
+
|
|
19816
19825
|
exports.Builder = Builder;
|
|
19817
19826
|
exports.DuplicateAssetError = DuplicateAssetError;
|
|
19818
19827
|
exports.DuplicateAssetIdError = DuplicateAssetIdError;
|
|
@@ -19834,7 +19843,6 @@ exports.NodeNotSupportedError = NodeNotSupportedError;
|
|
|
19834
19843
|
exports.Override = Override;
|
|
19835
19844
|
exports.SUPPORTED_PALLETS = SUPPORTED_PALLETS;
|
|
19836
19845
|
exports.ScenarioNotSupportedError = ScenarioNotSupportedError;
|
|
19837
|
-
exports.calculateFee = calculateFee;
|
|
19838
19846
|
exports.claimAssets = claimAssets;
|
|
19839
19847
|
exports.computeFeeFromDryRun = computeFeeFromDryRun;
|
|
19840
19848
|
exports.computeFeeFromDryRunPjs = computeFeeFromDryRunPjs;
|
|
@@ -19875,6 +19883,7 @@ exports.getNodeProviders = getNodeProviders;
|
|
|
19875
19883
|
exports.getOriginFeeDetails = getOriginFeeDetails;
|
|
19876
19884
|
exports.getOriginFeeDetailsInternal = getOriginFeeDetailsInternal;
|
|
19877
19885
|
exports.getOtherAssets = getOtherAssets;
|
|
19886
|
+
exports.getParaEthTransferFees = getParaEthTransferFees;
|
|
19878
19887
|
exports.getParaId = getParaId;
|
|
19879
19888
|
exports.getRelayChainSymbol = getRelayChainSymbol;
|
|
19880
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,
|
|
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,36 +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, leFee, transfer_bridge_fee, transfer_assethub_execution_fee;
|
|
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
|
-
leFee = BigInt('0x' + leFeeHex.split('').reverse().join(''));
|
|
13936
|
-
transfer_bridge_fee = leFee === 0n ? DEFAULT_FEE : BigInt(leFee.toString());
|
|
13937
|
-
transfer_assethub_execution_fee = 2200000000n;
|
|
13938
|
-
return _context.abrupt("return", (transfer_bridge_fee + transfer_assethub_execution_fee).toString());
|
|
13939
|
-
case 11:
|
|
13940
|
-
case "end":
|
|
13941
|
-
return _context.stop();
|
|
13942
|
-
}
|
|
13943
|
-
}, _callee);
|
|
13944
|
-
}));
|
|
13945
|
-
return function calculateFee(_x) {
|
|
13946
|
-
return _ref.apply(this, arguments);
|
|
13947
|
-
};
|
|
13948
|
-
}();
|
|
13949
|
-
|
|
13950
13920
|
var generateAddressPayload = function generateAddressPayload(api, scenario, pallet, recipientAddress, version, nodeId) {
|
|
13951
13921
|
var isMultiLocation = _typeof(recipientAddress) === 'object';
|
|
13952
13922
|
if (isMultiLocation) {
|
|
@@ -14293,7 +14263,7 @@ var ParachainNode = /*#__PURE__*/function () {
|
|
|
14293
14263
|
key: "transferToEthereum",
|
|
14294
14264
|
value: function () {
|
|
14295
14265
|
var _transferToEthereum = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(input) {
|
|
14296
|
-
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;
|
|
14297
14267
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
14298
14268
|
while (1) switch (_context2.prev = _context2.next) {
|
|
14299
14269
|
case 0:
|
|
@@ -14317,9 +14287,13 @@ var ParachainNode = /*#__PURE__*/function () {
|
|
|
14317
14287
|
case 9:
|
|
14318
14288
|
ahApi = _context2.sent;
|
|
14319
14289
|
_context2.next = 12;
|
|
14320
|
-
return
|
|
14290
|
+
return getParaEthTransferFees(ahApi);
|
|
14321
14291
|
case 12:
|
|
14322
|
-
|
|
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();
|
|
14323
14297
|
call = {
|
|
14324
14298
|
module: 'PolkadotXcm',
|
|
14325
14299
|
section: 'transfer_assets_using_type_and_then',
|
|
@@ -14337,7 +14311,7 @@ var ParachainNode = /*#__PURE__*/function () {
|
|
|
14337
14311
|
}
|
|
14338
14312
|
};
|
|
14339
14313
|
return _context2.abrupt("return", api.callTxMethod(call));
|
|
14340
|
-
case
|
|
14314
|
+
case 19:
|
|
14341
14315
|
case "end":
|
|
14342
14316
|
return _context2.stop();
|
|
14343
14317
|
}
|
|
@@ -15289,7 +15263,7 @@ var AssetHubPolkadot$1 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
15289
15263
|
currencySelection: this.createCurrencySpec(asset.amount, scenario, versionOrDefault, asset, overriddenAsset)
|
|
15290
15264
|
});
|
|
15291
15265
|
}
|
|
15292
|
-
if ((destination === 'Hydration' || destination === 'Polimec') && asset.symbol === 'DOT') {
|
|
15266
|
+
if ((destination === 'Hydration' || destination === 'Polimec' || destination === 'Moonbeam' || destination === 'BifrostPolkadot') && asset.symbol === 'DOT') {
|
|
15293
15267
|
var _versionOrDefault = version !== null && version !== undefined ? version : this.version;
|
|
15294
15268
|
return _objectSpread2(_objectSpread2({}, input), {}, {
|
|
15295
15269
|
currencySelection: _superPropGet(AssetHubPolkadot, "createCurrencySpec", this, 3)([asset.amount, 'ParaToRelay', _versionOrDefault, asset, overriddenAsset])
|
|
@@ -15300,7 +15274,7 @@ var AssetHubPolkadot$1 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
15300
15274
|
}, {
|
|
15301
15275
|
key: "getSection",
|
|
15302
15276
|
value: function getSection(scenario, destination) {
|
|
15303
|
-
if (destination === 'Polimec') return 'transfer_assets';
|
|
15277
|
+
if (destination === 'Polimec' || destination === 'Moonbeam') return 'transfer_assets';
|
|
15304
15278
|
return scenario === 'ParaToPara' ? 'limited_reserve_transfer_assets' : 'limited_teleport_assets';
|
|
15305
15279
|
}
|
|
15306
15280
|
}, {
|
|
@@ -15327,7 +15301,7 @@ var AssetHubPolkadot$1 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
15327
15301
|
if (destination === 'BifrostPolkadot' && isEthereumAsset) {
|
|
15328
15302
|
return Promise.resolve(this.handleBifrostEthTransfer(input));
|
|
15329
15303
|
}
|
|
15330
|
-
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') {
|
|
15331
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.');
|
|
15332
15306
|
}
|
|
15333
15307
|
if (scenario === 'ParaToPara' && asset.symbol === 'KSM' && !isForeignAsset(asset)) {
|
|
@@ -19811,4 +19785,39 @@ var transferMoonbeamEvm = /*#__PURE__*/function () {
|
|
|
19811
19785
|
};
|
|
19812
19786
|
}();
|
|
19813
19787
|
|
|
19814
|
-
|
|
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 };
|