@paraspell/sdk-core 8.0.1 → 8.0.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
@@ -13111,8 +13111,7 @@ var constructRelayToParaParameters = function constructRelayToParaParameters(_re
13111
13111
  includeFee: false
13112
13112
  },
13113
13113
  includeFee = _ref2.includeFee;
13114
- var isRelayDestination = !isTMultiLocation(destination) && isRelayChain(destination);
13115
- var paraId = !isRelayDestination && _typeof(destination) !== 'object' ? paraIdTo !== null && paraIdTo !== void 0 ? paraIdTo : getParaId(destination) : undefined;
13114
+ var paraId = resolveParaId(paraIdTo, destination);
13116
13115
  return _objectSpread2({
13117
13116
  dest: createPolkadotXcmHeader('RelayToPara', version, destination, paraId),
13118
13117
  beneficiary: generateAddressPayload(api, 'RelayToPara', null, address, version, paraId),
@@ -13362,6 +13361,13 @@ var XTokensTransferImpl = /*#__PURE__*/function () {
13362
13361
  }]);
13363
13362
  }();
13364
13363
 
13364
+ var resolveParaId = function resolveParaId(paraId, destination) {
13365
+ if (isTMultiLocation(destination) || isRelayChain(destination) || destination === 'Ethereum') {
13366
+ return undefined;
13367
+ }
13368
+ return paraId !== null && paraId !== void 0 ? paraId : getParaId(destination);
13369
+ };
13370
+
13365
13371
  var supportsXTokens = function supportsXTokens(obj) {
13366
13372
  return _typeof(obj) === 'object' && obj !== null && 'transferXTokens' in obj;
13367
13373
  };
@@ -13421,7 +13427,7 @@ var ParachainNode = /*#__PURE__*/function () {
13421
13427
  api = options.api, asset = options.asset, address = options.address, destination = options.destination, paraIdTo = options.paraIdTo, overriddenAsset = options.overriddenAsset, version = options.version, ahAddress = options.ahAddress, pallet = options.pallet, method = options.method;
13422
13428
  isRelayDestination = !isTMultiLocation(destination) && isRelayChain(destination);
13423
13429
  scenario = isRelayDestination ? 'ParaToRelay' : 'ParaToPara';
13424
- paraId = !isRelayDestination && _typeof(destination) !== 'object' && destination !== 'Ethereum' ? paraIdTo !== null && paraIdTo !== void 0 ? paraIdTo : getParaId(destination) : undefined;
13430
+ paraId = resolveParaId(paraIdTo, destination);
13425
13431
  if (!(destination === 'Polimec' && this.node !== 'AssetHubPolkadot')) {
13426
13432
  _context.next = 6;
13427
13433
  break;
@@ -14704,8 +14710,7 @@ var AssetHubPolkadot$1 = /*#__PURE__*/function (_ParachainNode) {
14704
14710
  destination = input.destination,
14705
14711
  paraIdTo = input.paraIdTo;
14706
14712
  var version = exports.Version.V2;
14707
- var isRelayDestination = !isTMultiLocation(destination) && isRelayChain(destination);
14708
- var paraId = !isRelayDestination && _typeof(destination) !== 'object' && destination !== 'Ethereum' ? paraIdTo !== null && paraIdTo !== void 0 ? paraIdTo : getParaId(destination) : undefined;
14713
+ var paraId = resolveParaId(paraIdTo, destination);
14709
14714
  var customMultiLocation = {
14710
14715
  parents: exports.Parents.ONE,
14711
14716
  interior: {
@@ -15630,8 +15635,7 @@ var Peaq$1 = /*#__PURE__*/function (_ParachainNode) {
15630
15635
 
15631
15636
  var GAS_LIMIT = 1000000000n;
15632
15637
  var createCustomXcmPolimec = function createCustomXcmPolimec(api, address, scenario, destination, paraIdTo, version) {
15633
- var isRelayDestination = !isTMultiLocation(destination) && isRelayChain(destination);
15634
- var paraId = !isRelayDestination && _typeof(destination) !== 'object' && destination !== 'Ethereum' ? paraIdTo !== null && paraIdTo !== void 0 ? paraIdTo : getParaId(destination) : undefined;
15638
+ var paraId = resolveParaId(paraIdTo, destination);
15635
15639
  return _defineProperty({}, version, [{
15636
15640
  DepositReserveAsset: {
15637
15641
  assets: {
@@ -18994,7 +18998,7 @@ var getDestinationMultilocation = function getDestinationMultilocation(api, addr
18994
18998
  var acc = "0x".concat(accountType).concat(addressHex, "00");
18995
18999
  var _getNodeConfig = getNodeConfig(destination),
18996
19000
  paraId = _getNodeConfig.paraId;
18997
- return [1, ["0x0000000".concat(paraId.toString(16)), acc]];
19001
+ return [1, paraId ? ["0x0000000".concat(paraId.toString(16)), acc] : [acc]];
18998
19002
  };
18999
19003
 
19000
19004
  var abi = [
@@ -19106,6 +19110,18 @@ var transferMoonbeamEvm = /*#__PURE__*/function () {
19106
19110
  while (1) switch (_context.prev = _context.next) {
19107
19111
  case 0:
19108
19112
  api = _ref.api, from = _ref.from, to = _ref.to, signer = _ref.signer, address = _ref.address, currency = _ref.currency;
19113
+ if (!('multiasset' in currency)) {
19114
+ _context.next = 3;
19115
+ break;
19116
+ }
19117
+ throw new Error('Multiassets syntax is not supported for Evm transfers');
19118
+ case 3:
19119
+ if (!('multilocation' in currency && isOverrideMultiLocationSpecifier(currency.multilocation))) {
19120
+ _context.next = 5;
19121
+ break;
19122
+ }
19123
+ throw new Error('Override multilocation is not supported for Evm transfers');
19124
+ case 5:
19109
19125
  contract = isEthersSigner(signer) ? new ethers.Contract(CONTRACT_ADDRESS, abi, signer) : viem.getContract({
19110
19126
  abi: abi,
19111
19127
  address: CONTRACT_ADDRESS,
@@ -19119,27 +19135,27 @@ var transferMoonbeamEvm = /*#__PURE__*/function () {
19119
19135
  });
19120
19136
  foundAsset = getAssetBySymbolOrId(from, currency, to);
19121
19137
  if (!(foundAsset === null)) {
19122
- _context.next = 5;
19138
+ _context.next = 9;
19123
19139
  break;
19124
19140
  }
19125
19141
  throw new InvalidCurrencyError("Origin node ".concat(from, " does not support currency ").concat(JSON.stringify(currency), "."));
19126
- case 5:
19142
+ case 9:
19127
19143
  if (!(foundAsset.symbol === getNativeAssetSymbol(from))) {
19128
- _context.next = 9;
19144
+ _context.next = 13;
19129
19145
  break;
19130
19146
  }
19131
19147
  asset = NATIVE_ASSET_ID;
19132
- _context.next = 12;
19148
+ _context.next = 16;
19133
19149
  break;
19134
- case 9:
19150
+ case 13:
19135
19151
  if (!(!isForeignAsset(foundAsset) || !foundAsset.assetId)) {
19136
- _context.next = 11;
19152
+ _context.next = 15;
19137
19153
  break;
19138
19154
  }
19139
19155
  throw new InvalidCurrencyError('Currency must be a foreign asset with valid assetId');
19140
- case 11:
19156
+ case 15:
19141
19157
  asset = formatAssetIdToERC20(foundAsset.assetId);
19142
- case 12:
19158
+ case 16:
19143
19159
  destMultiLocation = getDestinationMultilocation(api, address, to);
19144
19160
  weight = U_64_MAX; // Partially inspired by Moonbeam XCM-SDK
19145
19161
  // https://github.com/moonbeam-foundation/xcm-sdk/blob/ab835c15bf41612604b1c858d956a9f07705ed65/packages/sdk/src/contract/contracts/Xtokens/Xtokens.ts#L53
@@ -19155,26 +19171,26 @@ var transferMoonbeamEvm = /*#__PURE__*/function () {
19155
19171
  symbol: 'xcUSDT'
19156
19172
  }, to);
19157
19173
  if (!useMultiAssets) {
19158
- _context.next = 24;
19174
+ _context.next = 28;
19159
19175
  break;
19160
19176
  }
19161
- _context.next = 21;
19177
+ _context.next = 25;
19162
19178
  return createTx('transferMultiCurrencies', [[[asset, currency.amount], [formatAssetIdToERC20((_usdtAsset$assetId = usdtAsset.assetId) !== null && _usdtAsset$assetId !== void 0 ? _usdtAsset$assetId : ''), '200000']], 1,
19163
19179
  // index of the fee asset
19164
19180
  destMultiLocation, weight]);
19165
- case 21:
19181
+ case 25:
19166
19182
  _context.t0 = _context.sent;
19167
- _context.next = 27;
19183
+ _context.next = 31;
19168
19184
  break;
19169
- case 24:
19170
- _context.next = 26;
19185
+ case 28:
19186
+ _context.next = 30;
19171
19187
  return createTx('transfer', [asset, currency.amount, destMultiLocation, weight]);
19172
- case 26:
19188
+ case 30:
19173
19189
  _context.t0 = _context.sent;
19174
- case 27:
19190
+ case 31:
19175
19191
  tx = _context.t0;
19176
19192
  return _context.abrupt("return", _typeof(tx) === 'object' ? tx.hash : tx);
19177
- case 29:
19193
+ case 33:
19178
19194
  case "end":
19179
19195
  return _context.stop();
19180
19196
  }
@@ -19250,8 +19266,10 @@ exports.getTransferableAmount = getTransferableAmount;
19250
19266
  exports.hasSupportForAsset = hasSupportForAsset;
19251
19267
  exports.isForeignAsset = isForeignAsset;
19252
19268
  exports.isNodeEvm = isNodeEvm;
19269
+ exports.isOverrideMultiLocationSpecifier = isOverrideMultiLocationSpecifier;
19253
19270
  exports.isRelayChain = isRelayChain;
19254
19271
  exports.resolveModuleError = resolveModuleError;
19272
+ exports.resolveParaId = resolveParaId;
19255
19273
  exports.send = send;
19256
19274
  exports.transferMoonbeamEvm = transferMoonbeamEvm;
19257
19275
  exports.transferRelayToPara = transferRelayToPara;
package/dist/index.d.ts CHANGED
@@ -1000,11 +1000,11 @@ type TEvmBuilderOptionsBase = {
1000
1000
  /**
1001
1001
  * The destination node on Polkadot network.
1002
1002
  */
1003
- to: TNodePolkadotKusama;
1003
+ to: TNodeDotKsmWithRelayChains;
1004
1004
  /**
1005
1005
  * The currency to transfer. Symbol or ID.
1006
1006
  */
1007
- currency: TCurrencyCoreV1WithAmount;
1007
+ currency: TCurrencyInputWithAmount;
1008
1008
  /**
1009
1009
  * The Polkadot destination address.
1010
1010
  */
@@ -1594,6 +1594,10 @@ declare const computeFeeFromDryRun: (dryRun: any, node: TNodeDotKsmWithRelayChai
1594
1594
 
1595
1595
  declare const computeFeeFromDryRunPjs: (dryRun: any, node: TNodeDotKsmWithRelayChains, executionFee: bigint) => bigint;
1596
1596
 
1597
+ declare const isOverrideMultiLocationSpecifier: (multiLocationSpecifier: TMultiLocationValueWithOverride) => multiLocationSpecifier is TOverrideMultiLocationSpecifier;
1598
+
1599
+ declare const resolveParaId: (paraId: number | undefined, destination: TDestination) => number | undefined;
1600
+
1597
1601
  /**
1598
1602
  * Determines the relay chain for a given node.
1599
1603
  *
@@ -1719,4 +1723,4 @@ declare const getNodeProviders: (node: TNodeDotKsmWithRelayChains) => string[];
1719
1723
  */
1720
1724
  declare const getParaId: (node: TNodeDotKsmWithRelayChains) => number;
1721
1725
 
1722
- export { BatchMode, Builder, DuplicateAssetError, DuplicateAssetIdError, 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 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 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 TRelayChainType, 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, generateAddressMultiLocationV4, generateAddressPayload, getAllAssetsSymbols, getAssetBalance, getAssetBalanceInternal, getAssetBySymbolOrId, getAssetDecimals, getAssetId, 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, isRelayChain, resolveModuleError, send, transferMoonbeamEvm, transferRelayToPara };
1726
+ export { BatchMode, Builder, DuplicateAssetError, DuplicateAssetIdError, 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 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 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 TRelayChainType, 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, generateAddressMultiLocationV4, generateAddressPayload, getAllAssetsSymbols, getAssetBalance, getAssetBalanceInternal, getAssetBySymbolOrId, getAssetDecimals, getAssetId, 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, resolveModuleError, resolveParaId, send, transferMoonbeamEvm, transferRelayToPara };
package/dist/index.mjs CHANGED
@@ -13109,8 +13109,7 @@ var constructRelayToParaParameters = function constructRelayToParaParameters(_re
13109
13109
  includeFee: false
13110
13110
  },
13111
13111
  includeFee = _ref2.includeFee;
13112
- var isRelayDestination = !isTMultiLocation(destination) && isRelayChain(destination);
13113
- var paraId = !isRelayDestination && _typeof(destination) !== 'object' ? paraIdTo !== null && paraIdTo !== void 0 ? paraIdTo : getParaId(destination) : undefined;
13112
+ var paraId = resolveParaId(paraIdTo, destination);
13114
13113
  return _objectSpread2({
13115
13114
  dest: createPolkadotXcmHeader('RelayToPara', version, destination, paraId),
13116
13115
  beneficiary: generateAddressPayload(api, 'RelayToPara', null, address, version, paraId),
@@ -13360,6 +13359,13 @@ var XTokensTransferImpl = /*#__PURE__*/function () {
13360
13359
  }]);
13361
13360
  }();
13362
13361
 
13362
+ var resolveParaId = function resolveParaId(paraId, destination) {
13363
+ if (isTMultiLocation(destination) || isRelayChain(destination) || destination === 'Ethereum') {
13364
+ return undefined;
13365
+ }
13366
+ return paraId !== null && paraId !== void 0 ? paraId : getParaId(destination);
13367
+ };
13368
+
13363
13369
  var supportsXTokens = function supportsXTokens(obj) {
13364
13370
  return _typeof(obj) === 'object' && obj !== null && 'transferXTokens' in obj;
13365
13371
  };
@@ -13419,7 +13425,7 @@ var ParachainNode = /*#__PURE__*/function () {
13419
13425
  api = options.api, asset = options.asset, address = options.address, destination = options.destination, paraIdTo = options.paraIdTo, overriddenAsset = options.overriddenAsset, version = options.version, ahAddress = options.ahAddress, pallet = options.pallet, method = options.method;
13420
13426
  isRelayDestination = !isTMultiLocation(destination) && isRelayChain(destination);
13421
13427
  scenario = isRelayDestination ? 'ParaToRelay' : 'ParaToPara';
13422
- paraId = !isRelayDestination && _typeof(destination) !== 'object' && destination !== 'Ethereum' ? paraIdTo !== null && paraIdTo !== void 0 ? paraIdTo : getParaId(destination) : undefined;
13428
+ paraId = resolveParaId(paraIdTo, destination);
13423
13429
  if (!(destination === 'Polimec' && this.node !== 'AssetHubPolkadot')) {
13424
13430
  _context.next = 6;
13425
13431
  break;
@@ -14702,8 +14708,7 @@ var AssetHubPolkadot$1 = /*#__PURE__*/function (_ParachainNode) {
14702
14708
  destination = input.destination,
14703
14709
  paraIdTo = input.paraIdTo;
14704
14710
  var version = Version.V2;
14705
- var isRelayDestination = !isTMultiLocation(destination) && isRelayChain(destination);
14706
- var paraId = !isRelayDestination && _typeof(destination) !== 'object' && destination !== 'Ethereum' ? paraIdTo !== null && paraIdTo !== void 0 ? paraIdTo : getParaId(destination) : undefined;
14711
+ var paraId = resolveParaId(paraIdTo, destination);
14707
14712
  var customMultiLocation = {
14708
14713
  parents: Parents.ONE,
14709
14714
  interior: {
@@ -15628,8 +15633,7 @@ var Peaq$1 = /*#__PURE__*/function (_ParachainNode) {
15628
15633
 
15629
15634
  var GAS_LIMIT = 1000000000n;
15630
15635
  var createCustomXcmPolimec = function createCustomXcmPolimec(api, address, scenario, destination, paraIdTo, version) {
15631
- var isRelayDestination = !isTMultiLocation(destination) && isRelayChain(destination);
15632
- var paraId = !isRelayDestination && _typeof(destination) !== 'object' && destination !== 'Ethereum' ? paraIdTo !== null && paraIdTo !== void 0 ? paraIdTo : getParaId(destination) : undefined;
15636
+ var paraId = resolveParaId(paraIdTo, destination);
15633
15637
  return _defineProperty({}, version, [{
15634
15638
  DepositReserveAsset: {
15635
15639
  assets: {
@@ -18992,7 +18996,7 @@ var getDestinationMultilocation = function getDestinationMultilocation(api, addr
18992
18996
  var acc = "0x".concat(accountType).concat(addressHex, "00");
18993
18997
  var _getNodeConfig = getNodeConfig(destination),
18994
18998
  paraId = _getNodeConfig.paraId;
18995
- return [1, ["0x0000000".concat(paraId.toString(16)), acc]];
18999
+ return [1, paraId ? ["0x0000000".concat(paraId.toString(16)), acc] : [acc]];
18996
19000
  };
18997
19001
 
18998
19002
  var abi = [
@@ -19104,6 +19108,18 @@ var transferMoonbeamEvm = /*#__PURE__*/function () {
19104
19108
  while (1) switch (_context.prev = _context.next) {
19105
19109
  case 0:
19106
19110
  api = _ref.api, from = _ref.from, to = _ref.to, signer = _ref.signer, address = _ref.address, currency = _ref.currency;
19111
+ if (!('multiasset' in currency)) {
19112
+ _context.next = 3;
19113
+ break;
19114
+ }
19115
+ throw new Error('Multiassets syntax is not supported for Evm transfers');
19116
+ case 3:
19117
+ if (!('multilocation' in currency && isOverrideMultiLocationSpecifier(currency.multilocation))) {
19118
+ _context.next = 5;
19119
+ break;
19120
+ }
19121
+ throw new Error('Override multilocation is not supported for Evm transfers');
19122
+ case 5:
19107
19123
  contract = isEthersSigner(signer) ? new Contract(CONTRACT_ADDRESS, abi, signer) : getContract({
19108
19124
  abi: abi,
19109
19125
  address: CONTRACT_ADDRESS,
@@ -19117,27 +19133,27 @@ var transferMoonbeamEvm = /*#__PURE__*/function () {
19117
19133
  });
19118
19134
  foundAsset = getAssetBySymbolOrId(from, currency, to);
19119
19135
  if (!(foundAsset === null)) {
19120
- _context.next = 5;
19136
+ _context.next = 9;
19121
19137
  break;
19122
19138
  }
19123
19139
  throw new InvalidCurrencyError("Origin node ".concat(from, " does not support currency ").concat(JSON.stringify(currency), "."));
19124
- case 5:
19140
+ case 9:
19125
19141
  if (!(foundAsset.symbol === getNativeAssetSymbol(from))) {
19126
- _context.next = 9;
19142
+ _context.next = 13;
19127
19143
  break;
19128
19144
  }
19129
19145
  asset = NATIVE_ASSET_ID;
19130
- _context.next = 12;
19146
+ _context.next = 16;
19131
19147
  break;
19132
- case 9:
19148
+ case 13:
19133
19149
  if (!(!isForeignAsset(foundAsset) || !foundAsset.assetId)) {
19134
- _context.next = 11;
19150
+ _context.next = 15;
19135
19151
  break;
19136
19152
  }
19137
19153
  throw new InvalidCurrencyError('Currency must be a foreign asset with valid assetId');
19138
- case 11:
19154
+ case 15:
19139
19155
  asset = formatAssetIdToERC20(foundAsset.assetId);
19140
- case 12:
19156
+ case 16:
19141
19157
  destMultiLocation = getDestinationMultilocation(api, address, to);
19142
19158
  weight = U_64_MAX; // Partially inspired by Moonbeam XCM-SDK
19143
19159
  // https://github.com/moonbeam-foundation/xcm-sdk/blob/ab835c15bf41612604b1c858d956a9f07705ed65/packages/sdk/src/contract/contracts/Xtokens/Xtokens.ts#L53
@@ -19153,26 +19169,26 @@ var transferMoonbeamEvm = /*#__PURE__*/function () {
19153
19169
  symbol: 'xcUSDT'
19154
19170
  }, to);
19155
19171
  if (!useMultiAssets) {
19156
- _context.next = 24;
19172
+ _context.next = 28;
19157
19173
  break;
19158
19174
  }
19159
- _context.next = 21;
19175
+ _context.next = 25;
19160
19176
  return createTx('transferMultiCurrencies', [[[asset, currency.amount], [formatAssetIdToERC20((_usdtAsset$assetId = usdtAsset.assetId) !== null && _usdtAsset$assetId !== void 0 ? _usdtAsset$assetId : ''), '200000']], 1,
19161
19177
  // index of the fee asset
19162
19178
  destMultiLocation, weight]);
19163
- case 21:
19179
+ case 25:
19164
19180
  _context.t0 = _context.sent;
19165
- _context.next = 27;
19181
+ _context.next = 31;
19166
19182
  break;
19167
- case 24:
19168
- _context.next = 26;
19183
+ case 28:
19184
+ _context.next = 30;
19169
19185
  return createTx('transfer', [asset, currency.amount, destMultiLocation, weight]);
19170
- case 26:
19186
+ case 30:
19171
19187
  _context.t0 = _context.sent;
19172
- case 27:
19188
+ case 31:
19173
19189
  tx = _context.t0;
19174
19190
  return _context.abrupt("return", _typeof(tx) === 'object' ? tx.hash : tx);
19175
- case 29:
19191
+ case 33:
19176
19192
  case "end":
19177
19193
  return _context.stop();
19178
19194
  }
@@ -19183,4 +19199,4 @@ var transferMoonbeamEvm = /*#__PURE__*/function () {
19183
19199
  };
19184
19200
  }();
19185
19201
 
19186
- export { BatchMode, Builder, DuplicateAssetError, DuplicateAssetIdError, 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, generateAddressMultiLocationV4, generateAddressPayload, getAllAssetsSymbols, getAssetBalance, getAssetBalanceInternal, getAssetBySymbolOrId, getAssetDecimals, getAssetId, 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, isRelayChain, resolveModuleError, send, transferMoonbeamEvm, transferRelayToPara };
19202
+ export { BatchMode, Builder, DuplicateAssetError, DuplicateAssetIdError, 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, generateAddressMultiLocationV4, generateAddressPayload, getAllAssetsSymbols, getAssetBalance, getAssetBalanceInternal, getAssetBySymbolOrId, getAssetDecimals, getAssetId, 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, resolveModuleError, resolveParaId, send, transferMoonbeamEvm, transferRelayToPara };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paraspell/sdk-core",
3
- "version": "8.0.1",
3
+ "version": "8.0.3",
4
4
  "description": "SDK core for ParaSpell XCM/XCMP tool for developers",
5
5
  "repository": {
6
6
  "type": "git",
@@ -11,9 +11,9 @@
11
11
  "type": "module",
12
12
  "exports": {
13
13
  ".": {
14
+ "types": "./dist/index.d.ts",
14
15
  "import": "./dist/index.mjs",
15
- "require": "./dist/index.cjs",
16
- "types": "./dist/index.d.ts"
16
+ "require": "./dist/index.cjs"
17
17
  }
18
18
  },
19
19
  "main": "dist/index.cjs",