@paraspell/sdk-core 11.14.8 → 11.14.10

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
@@ -751,6 +751,14 @@ var assertIsForeign = function assertIsForeign(asset) {
751
751
  }
752
752
  };
753
753
 
754
+ var createId = function createId(version, location) {
755
+ if (version === sdkCommon.Version.V3) {
756
+ return {
757
+ Concrete: location
758
+ };
759
+ }
760
+ return location;
761
+ };
754
762
  var createAsset = function createAsset(version, amount, location) {
755
763
  if (version === sdkCommon.Version.V3) {
756
764
  return {
@@ -2774,16 +2782,6 @@ var resolveTChainFromLocation = function resolveTChainFromLocation(relaychain, l
2774
2782
  }
2775
2783
  return chain;
2776
2784
  };
2777
- var throwUnsupportedCurrency = function throwUnsupportedCurrency(currency, chain) {
2778
- var _ref = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {
2779
- isDestination: false
2780
- },
2781
- isDestination = _ref.isDestination;
2782
- if ('location' in currency) {
2783
- throw new assets.InvalidCurrencyError("\n Selected chain doesn't support location you provided. Maybe you meant custom location. If so, you need to use override option. Your selection should look like this: {location: Override(".concat(JSON.stringify(currency.location), ")}."));
2784
- }
2785
- throw new assets.InvalidCurrencyError("".concat(isDestination ? 'Destination' : 'Origin', " chain ").concat(chain, " does not support currency ").concat(JSON.stringify(currency, sdkCommon.replaceBigInt), "."));
2786
- };
2787
2785
 
2788
2786
  var buildClaimAssetsParams = function buildClaimAssetsParams(options) {
2789
2787
  var assets = options.assets,
@@ -4551,14 +4549,13 @@ var validateAssetSupport = function validateAssetSupport(_ref, assetCheckEnabled
4551
4549
  var origin = _ref.from,
4552
4550
  destination = _ref.to,
4553
4551
  currency = _ref.currency;
4554
- var isRelayDestination = !sdkCommon.isTLocation(destination) && sdkCommon.isRelayChain(destination);
4555
4552
  var isLocationDestination = _typeof(destination) === 'object';
4556
- if (!isBridge && !isRelayDestination && !isLocationDestination && (asset === null || asset === void 0 ? void 0 : asset.symbol) !== undefined && assetCheckEnabled && !('id' in currency) && !assets.hasSupportForAsset(destination, asset.symbol)) {
4557
- throw new assets.InvalidCurrencyError("Destination chain ".concat(destination, " does not support currency ").concat(JSON.stringify(currency, sdkCommon.replaceBigInt), "."));
4558
- }
4559
4553
  if (asset === null && assetCheckEnabled) {
4560
4554
  throwUnsupportedCurrency(currency, origin);
4561
4555
  }
4556
+ if (!isLocationDestination && assetCheckEnabled && !assets.findAssetInfoOnDest(origin, destination, currency, asset)) {
4557
+ throw new assets.InvalidCurrencyError("Destination chain ".concat(destination, " does not support currency ").concat(JSON.stringify(currency, sdkCommon.replaceBigInt), "."));
4558
+ }
4562
4559
  validateBridgeAsset(origin, destination, asset, currency, isBridge);
4563
4560
  validateEthereumAsset(origin, destination, asset);
4564
4561
  };
@@ -9779,11 +9776,13 @@ var applyDecimalAbstraction = function applyDecimalAbstraction(amount, decimals,
9779
9776
  return parseUnits(amount.toString(), decimals);
9780
9777
  };
9781
9778
 
9782
- var createAssetsFilter = function createAssetsFilter(asset) {
9779
+ var createAssetsFilter = function createAssetsFilter(asset, version) {
9780
+ var location = assets.extractAssetLocation(asset);
9781
+ var id = createId(version, location);
9783
9782
  return {
9784
9783
  Wild: {
9785
9784
  AllOf: {
9786
- id: assets.extractAssetLocation(asset),
9785
+ id: id,
9787
9786
  fun: 'Fungible'
9788
9787
  }
9789
9788
  }
@@ -9866,7 +9865,7 @@ var createBaseExecuteXcm = function createBaseExecuteXcm(options) {
9866
9865
  var isReserveDest = reserveChain === destChain;
9867
9866
  var resolvedDepositInstruction = isReserveDest ? suffixXcm : [{
9868
9867
  DepositReserveAsset: {
9869
- assets: createAssetsFilter(assetLocalizedToReserve),
9868
+ assets: createAssetsFilter(assetLocalizedToReserve, version),
9870
9869
  dest: createDestination(version, reserveChain !== null && reserveChain !== void 0 ? reserveChain : chain, destChain, paraIdTo),
9871
9870
  xcm: [{
9872
9871
  BuyExecution: {
@@ -9882,7 +9881,7 @@ var createBaseExecuteXcm = function createBaseExecuteXcm(options) {
9882
9881
  // Use teleport for trusted chains
9883
9882
  mainInstructions = [{
9884
9883
  InitiateTeleport: {
9885
- assets: createAssetsFilter(assetLocalized),
9884
+ assets: createAssetsFilter(assetLocalized, version),
9886
9885
  dest: destLocation,
9887
9886
  xcm: [{
9888
9887
  BuyExecution: {
@@ -9897,7 +9896,7 @@ var createBaseExecuteXcm = function createBaseExecuteXcm(options) {
9897
9896
  // Teleport to reserve chain first
9898
9897
  mainInstructions = [{
9899
9898
  InitiateTeleport: {
9900
- assets: createAssetsFilter(assetLocalized),
9899
+ assets: createAssetsFilter(assetLocalized, version),
9901
9900
  dest: getChainLocation(chain, reserveChain),
9902
9901
  xcm: [{
9903
9902
  BuyExecution: {
@@ -9912,7 +9911,7 @@ var createBaseExecuteXcm = function createBaseExecuteXcm(options) {
9912
9911
  // Use InitiateReserve for non-trusted chains
9913
9912
  mainInstructions = [{
9914
9913
  InitiateReserveWithdraw: {
9915
- assets: createAssetsFilter(assetLocalized),
9914
+ assets: createAssetsFilter(assetLocalized, version),
9916
9915
  reserve: getChainLocation(chain, reserveChain),
9917
9916
  xcm: [{
9918
9917
  BuyExecution: {
@@ -10078,7 +10077,7 @@ var prepareCommonExecuteXcm = function prepareCommonExecuteXcm(options, assetToD
10078
10077
  });
10079
10078
  var depositInstruction = {
10080
10079
  DepositAsset: {
10081
- assets: createAssetsFilter(assetToDeposit !== null && assetToDeposit !== void 0 ? assetToDeposit : assetLocalizedToDest),
10080
+ assets: createAssetsFilter(assetToDeposit !== null && assetToDeposit !== void 0 ? assetToDeposit : assetLocalizedToDest, version),
10082
10081
  beneficiary: beneficiary
10083
10082
  }
10084
10083
  };
@@ -10217,7 +10216,7 @@ var createExchangeInstructions = /*#__PURE__*/function () {
10217
10216
  }
10218
10217
  return _context.a(2, [{
10219
10218
  ExchangeAsset: {
10220
- give: createAssetsFilter(assetFrom),
10219
+ give: createAssetsFilter(assetFrom, version),
10221
10220
  want: [assetTo],
10222
10221
  maximal: false
10223
10222
  }
@@ -10230,13 +10229,13 @@ var createExchangeInstructions = /*#__PURE__*/function () {
10230
10229
  assetNative = createAsset(version, exchangeFee === 0n ? (nativeAmountOut + 1n) / 2n : nativeAmountOut, localizeLocation(exchangeChain, nativeAsset.location));
10231
10230
  return _context.a(2, [{
10232
10231
  ExchangeAsset: {
10233
- give: createAssetsFilter(assetFrom),
10232
+ give: createAssetsFilter(assetFrom, version),
10234
10233
  want: [assetNative],
10235
10234
  maximal: false
10236
10235
  }
10237
10236
  }, {
10238
10237
  ExchangeAsset: {
10239
- give: createAssetsFilter(assetNative),
10238
+ give: createAssetsFilter(assetNative, version),
10240
10239
  want: [assetTo],
10241
10240
  maximal: true
10242
10241
  }
@@ -10639,6 +10638,17 @@ var handleToAhTeleport = /*#__PURE__*/function () {
10639
10638
  };
10640
10639
  }();
10641
10640
 
10641
+ var throwUnsupportedCurrency = function throwUnsupportedCurrency(currency, chain) {
10642
+ var _ref = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {
10643
+ isDestination: false
10644
+ },
10645
+ isDestination = _ref.isDestination;
10646
+ if ('location' in currency) {
10647
+ throw new assets.InvalidCurrencyError("\n Selected chain doesn't support location you provided. Maybe you meant custom location. If so, you need to use override option. Your selection should look like this: {location: Override(".concat(JSON.stringify(currency.location), ")}."));
10648
+ }
10649
+ throw new assets.InvalidCurrencyError("".concat(isDestination ? 'Destination' : 'Origin', " chain ").concat(chain, " does not support currency ").concat(JSON.stringify(currency, sdkCommon.replaceBigInt), "."));
10650
+ };
10651
+
10642
10652
  var AssetHubPolkadot = /*#__PURE__*/function (_Parachain) {
10643
10653
  function AssetHubPolkadot() {
10644
10654
  var chain = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'AssetHubPolkadot';
@@ -14234,6 +14244,7 @@ exports.createChainClient = createChainClient;
14234
14244
  exports.createDirectExecuteXcm = createDirectExecuteXcm;
14235
14245
  exports.createExecuteCall = createExecuteCall;
14236
14246
  exports.createExecuteExchangeXcm = createExecuteExchangeXcm;
14247
+ exports.createId = createId;
14237
14248
  exports.createTx = createTx;
14238
14249
  exports.createTypeAndThenCall = createTypeAndThenCall;
14239
14250
  exports.createTypeThenAutoReserve = createTypeThenAutoReserve;
@@ -14296,6 +14307,7 @@ exports.resolveParaId = resolveParaId;
14296
14307
  exports.reverseTransformLocation = reverseTransformLocation;
14297
14308
  exports.send = send;
14298
14309
  exports.sortAssets = sortAssets;
14310
+ exports.throwUnsupportedCurrency = throwUnsupportedCurrency;
14299
14311
  exports.transferMoonbeamEvm = transferMoonbeamEvm;
14300
14312
  exports.transferMoonbeamToEth = transferMoonbeamToEth;
14301
14313
  exports.transferRelayToPara = transferRelayToPara;
package/dist/index.d.ts CHANGED
@@ -2281,6 +2281,9 @@ declare const assertHasLocation: (asset: TAssetInfo) => asserts asset is TAssetW
2281
2281
  declare const assertHasId: (asset: TAssetInfo) => asserts asset is TForeignAssetWithId;
2282
2282
  declare const assertIsForeign: (asset: TAssetInfo) => asserts asset is TForeignAssetInfo;
2283
2283
 
2284
+ declare const createId: (version: Version, location: TLocation) => TLocation | {
2285
+ Concrete: TLocation;
2286
+ };
2284
2287
  declare const createAsset: (version: Version, amount: bigint, location: TLocation) => TAsset;
2285
2288
  declare const createVersionedAssets: (version: Version, amount: bigint, location: TLocation) => OneKey<Version, TAsset[]>;
2286
2289
 
@@ -2357,10 +2360,12 @@ declare const resolveParaId: (paraId: number | undefined, destination: TDestinat
2357
2360
  declare const abstractDecimals: <TApi, TRes>(amount: TAmount, decimals: number | undefined, api: IPolkadotApi<TApi, TRes>) => bigint;
2358
2361
  declare const applyDecimalAbstraction: (amount: TAmount, decimals: number | undefined, shouldAbstract: boolean) => bigint;
2359
2362
 
2360
- declare const createAssetsFilter: (asset: TAsset) => {
2363
+ declare const createAssetsFilter: (asset: TAsset, version: Version) => {
2361
2364
  Wild: {
2362
2365
  AllOf: {
2363
- id: _paraspell_sdk_common.TLocation;
2366
+ id: _paraspell_sdk_common.TLocation | {
2367
+ Concrete: _paraspell_sdk_common.TLocation;
2368
+ };
2364
2369
  fun: string;
2365
2370
  };
2366
2371
  };
@@ -2382,10 +2387,14 @@ declare const handleSwapExecuteTransfer: <TApi, TRes>(options: TCreateSwapXcmOpt
2382
2387
 
2383
2388
  declare const handleToAhTeleport: <TApi, TRes>(origin: TParachain, input: TPolkadotXCMTransferOptions<TApi, TRes>, defaultTx: TRes) => Promise<TRes>;
2384
2389
 
2390
+ declare const throwUnsupportedCurrency: (currency: TCurrencyInput, chain: string, { isDestination }?: {
2391
+ isDestination: boolean;
2392
+ }) => never;
2393
+
2385
2394
  declare const parseUnits: typeof parseUnits$1;
2386
2395
  declare const formatUnits: typeof formatUnits$1;
2387
2396
 
2388
2397
  declare const validateAddress: <TApi, TRes>(api: IPolkadotApi<TApi, TRes>, address: TAddress, chain: TChain, isDestination?: boolean) => void;
2389
2398
 
2390
- export { AmountTooLowError, AssetClaimBuilder, BaseAssetsPallet, BatchMode, BridgeHaltedError, Builder, ChainNotSupportedError, DRY_RUN_CLIENT_TIMEOUT_MS, DryRunFailedError, ETHEREUM_JUNCTION, ETH_CHAIN_ID, GeneralBuilder, IncompatibleChainsError, InvalidAddressError, InvalidParameterError, MissingChainApiError, NoXCMSupportImplementedError, PolkadotXcmError, PolkadotXcmExecutionError, ScenarioNotSupportedError, TX_CLIENT_TIMEOUT_MS, TransferToAhNotSupported, UnableToComputeError, XTokensError, abstractDecimals, addEthereumBridgeFees, addXcmVersionHeader, applyDecimalAbstraction, assertAddressIsString, assertHasId, assertHasLocation, assertIsForeign, assertSenderAddress, assertToIsString, blake2b256, blake2b512, calcPreviewMintAmount, claimAssets, computeFeeFromDryRun, computeFeeFromDryRunPjs, computeOverridenAmount, constructTypeAndThenCall, convertSs58, createAsset, createAssetsFilter, createBaseExecuteXcm, createBeneficiaryLocXTokens, createBeneficiaryLocation, createChainClient, createDirectExecuteXcm, createExecuteCall, createExecuteExchangeXcm, createTx, createTypeAndThenCall, createTypeThenAutoReserve, createVersionedAssets, createX1Payload, deriveAccountId, dryRun, dryRunInternal, dryRunOrigin, encodeSs58, formatAssetIdToERC20, formatUnits, getAssetBalanceInternal, getAssetReserveChain, getBalance, getBalanceInternal, getBalanceNative, getBridgeStatus, getChain, getChainConfig, getChainLocation, getChainProviders, getChainVersion, getEthErc20Balance, getFailureInfo, getMinTransferableAmount, getMinTransferableAmountInternal, getMoonbeamErc20Balance, getOriginFeeDetails, getOriginFeeDetailsInternal, getOriginXcmFee, getOriginXcmFeeEstimate, getOriginXcmFeeInternal, getParaEthTransferFees, getParaId, getRelayChainOf, getTChain, getTransferInfo, getTransferableAmount, getTransferableAmountInternal, getXcmFee, getXcmFeeEstimate, getXcmFeeInternal, getXcmFeeOnce, handleExecuteTransfer, handleSwapExecuteTransfer, handleToAhTeleport, isConfig, localizeLocation, maybeOverrideAsset, maybeOverrideAssets, normalizeAmount, overrideTxAmount, padFee, padValueBy, parseUnits, resolveDestChain, resolveModuleError, resolveParaId, reverseTransformLocation, send, sortAssets, transferMoonbeamEvm, transferMoonbeamToEth, transferRelayToPara, traverseXcmHops, validateAddress, validateAssetSpecifiers, validateCurrency, validateDestination, verifyEdOnDestination, wrapTxBypass };
2399
+ export { AmountTooLowError, AssetClaimBuilder, BaseAssetsPallet, BatchMode, BridgeHaltedError, Builder, ChainNotSupportedError, DRY_RUN_CLIENT_TIMEOUT_MS, DryRunFailedError, ETHEREUM_JUNCTION, ETH_CHAIN_ID, GeneralBuilder, IncompatibleChainsError, InvalidAddressError, InvalidParameterError, MissingChainApiError, NoXCMSupportImplementedError, PolkadotXcmError, PolkadotXcmExecutionError, ScenarioNotSupportedError, TX_CLIENT_TIMEOUT_MS, TransferToAhNotSupported, UnableToComputeError, XTokensError, abstractDecimals, addEthereumBridgeFees, addXcmVersionHeader, applyDecimalAbstraction, assertAddressIsString, assertHasId, assertHasLocation, assertIsForeign, assertSenderAddress, assertToIsString, blake2b256, blake2b512, calcPreviewMintAmount, claimAssets, computeFeeFromDryRun, computeFeeFromDryRunPjs, computeOverridenAmount, constructTypeAndThenCall, convertSs58, createAsset, createAssetsFilter, createBaseExecuteXcm, createBeneficiaryLocXTokens, createBeneficiaryLocation, createChainClient, createDirectExecuteXcm, createExecuteCall, createExecuteExchangeXcm, createId, createTx, createTypeAndThenCall, createTypeThenAutoReserve, createVersionedAssets, createX1Payload, deriveAccountId, dryRun, dryRunInternal, dryRunOrigin, encodeSs58, formatAssetIdToERC20, formatUnits, getAssetBalanceInternal, getAssetReserveChain, getBalance, getBalanceInternal, getBalanceNative, getBridgeStatus, getChain, getChainConfig, getChainLocation, getChainProviders, getChainVersion, getEthErc20Balance, getFailureInfo, getMinTransferableAmount, getMinTransferableAmountInternal, getMoonbeamErc20Balance, getOriginFeeDetails, getOriginFeeDetailsInternal, getOriginXcmFee, getOriginXcmFeeEstimate, getOriginXcmFeeInternal, getParaEthTransferFees, getParaId, getRelayChainOf, getTChain, getTransferInfo, getTransferableAmount, getTransferableAmountInternal, getXcmFee, getXcmFeeEstimate, getXcmFeeInternal, getXcmFeeOnce, handleExecuteTransfer, handleSwapExecuteTransfer, handleToAhTeleport, isConfig, localizeLocation, maybeOverrideAsset, maybeOverrideAssets, normalizeAmount, overrideTxAmount, padFee, padValueBy, parseUnits, resolveDestChain, resolveModuleError, resolveParaId, reverseTransformLocation, send, sortAssets, throwUnsupportedCurrency, transferMoonbeamEvm, transferMoonbeamToEth, transferRelayToPara, traverseXcmHops, validateAddress, validateAssetSpecifiers, validateCurrency, validateDestination, verifyEdOnDestination, wrapTxBypass };
2391
2400
  export type { BuildHopInfoOptions, HopProcessParams, HopTraversalConfig, HopTraversalResult, IPolkadotApi, IPolkadotXCMTransfer, IXTokensTransfer, IXTransferTransfer, OneKey, TAddress, TApiOrUrl, TAssetClaimInternalOptions, TAssetClaimOptions, TAssetClaimOptionsBase, TBatchOptions, TBatchedSendOptions, TBifrostToken, TBridgeStatus, TBuildDestInfoOptions, TBuildInternalRes, TBuilderConfig, TBuilderOptions, TBypassOptions, TChainConfig, TChainConfigMap, TChainWithApi, TConditionalXcmFeeDetail, TConditionalXcmFeeHopInfo, TCreateBaseSwapXcmOptions, TCreateBaseTransferXcmOptions, TCreateBeneficiaryOptions, TCreateBeneficiaryXTokensOptions, TCreateSwapXcmInternalOptions, TCreateSwapXcmOptions, TCreateTransferXcmOptions, TCreateTxsOptions, TDestWeight, TDestXcmFeeDetail, TDestination, TDryRunBaseOptions, TDryRunBypassOptions, TDryRunCallBaseOptions, TDryRunCallOptions, TDryRunChain, TDryRunChainFailure, TDryRunChainResult, TDryRunChainSuccess, TDryRunError, TDryRunOptions, TDryRunPreviewOptions, TDryRunResBase, TDryRunResult, TDryRunXcmBaseOptions, TDryRunXcmOptions, TEvmBuilderOptions, TEvmBuilderOptionsBase, TEvmChainFrom, TFeeType, TForeignAssetId, TForeignOrNativeAsset, TForeignOrTokenAsset, TGetAssetBalanceOptions, TGetAssetBalanceOptionsBase, TGetBalanceCommonOptions, TGetBalanceForeignByAssetOptions, TGetBalanceForeignOptions, TGetBalanceForeignOptionsBase, TGetBalanceNativeOptions, TGetBalanceNativeOptionsBase, TGetBalanceOptions, TGetBalanceOptionsBase, TGetFeeForDestChainBaseOptions, TGetFeeForDestChainOptions, TGetMinTransferableAmountOptions, TGetOriginFeeDetailsOptions, TGetOriginFeeDetailsOptionsBase, TGetOriginXcmFeeBaseOptions, TGetOriginXcmFeeEstimateOptions, TGetOriginXcmFeeInternalOptions, TGetOriginXcmFeeOptions, TGetReverseTxFeeOptions, TGetTransferInfoOptions, TGetTransferInfoOptionsBase, TGetTransferableAmountOptions, TGetTransferableAmountOptionsBase, TGetXcmFeeBaseOptions, TGetXcmFeeBuilderOptions, TGetXcmFeeEstimateDetail, TGetXcmFeeEstimateOptions, TGetXcmFeeEstimateResult, TGetXcmFeeInternalOptions, TGetXcmFeeOptions, TGetXcmFeeResult, THopInfo, THopTransferInfo, THubKey, TMantaAsset, TModuleError, TNativeTokenAsset, TNodleAsset, TOriginFeeDetails, TOtherReserveAsset, TPolkadotXCMTransferOptions, TPolkadotXcmMethod, TProviderEntry, TRelayToParaDestination, TRelayToParaOptions, TRelayToParaOverrides, TReserveAsset, TResolveHopParams, TScenario, TSelfReserveAsset, TSendBaseOptions, TSendBaseOptionsWithSenderAddress, TSendInternalOptions, TSendOptions, TSerializeEthTransferOptions, TSerializedEthTransfer, TSerializedExtrinsics, TSerializedRuntimeApiQuery, TSerializedStateQuery, TSetBalanceRes, TSwapConfig, TSwapFeeEstimates, TTransferFeeEstimates, TTransferInfo, TTransferLocalOptions, TTxFactory, TTypeAndThenCallContext, TTypeAndThenFees, TUrl, TVerifyEdOnDestinationOptions, TVerifyEdOnDestinationOptionsBase, TWeight, TXTokensCurrencySelection, TXTokensMethod, TXTokensTransferOptions, TXTransferMethod, TXTransferTransferOptions, TXcmAsset, TXcmFeeBase, TXcmFeeChain, TXcmFeeDetail, TXcmFeeDetailError, TXcmFeeDetailSuccess, TXcmFeeDetailWithFallback, TXcmFeeHopInfo, TXcmFeeHopResult, TXcmFeeSwapConfig, TXcmForeignAsset, TXcmPalletMethod, TXcmVersioned, TZeitgeistAsset, WithApi, WithRequiredSenderAddress };
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import { blake2b } from '@noble/hashes/blake2';
2
- import { isChainEvm, getAssetsObject, InvalidCurrencyError, isForeignAsset, extractAssetLocation, findAssetInfoOrThrow, getOtherAssets, isTAsset, findNativeAssetInfoOrThrow, findAssetInfo, getExistentialDepositOrThrow, isSymbolMatch, getNativeAssetSymbol, getEdFromAssetOrThrow, hasDryRunSupport, findAssetOnDestOrThrow, findAssetInfoOnDest, hasSupportForAsset, isAssetEqual, isOverrideLocationSpecifier, getRelayChainSymbol, isSymbolSpecifier, findNativeAssetInfo, isAssetXcEqual, getExistentialDeposit, normalizeLocation, normalizeSymbol, Native, hasXcmPaymentApiSupport, findAssetInfoByLoc } from '@paraspell/assets';
2
+ import { isChainEvm, getAssetsObject, InvalidCurrencyError, isForeignAsset, extractAssetLocation, findAssetInfoOrThrow, getOtherAssets, isTAsset, findNativeAssetInfoOrThrow, findAssetInfo, getExistentialDepositOrThrow, isSymbolMatch, getNativeAssetSymbol, getEdFromAssetOrThrow, hasDryRunSupport, findAssetOnDestOrThrow, findAssetInfoOnDest, isAssetEqual, isOverrideLocationSpecifier, getRelayChainSymbol, isSymbolSpecifier, findNativeAssetInfo, isAssetXcEqual, getExistentialDeposit, normalizeLocation, normalizeSymbol, Native, hasXcmPaymentApiSupport, findAssetInfoByLoc } from '@paraspell/assets';
3
3
  export * from '@paraspell/assets';
4
4
  import { base58 } from '@scure/base';
5
5
  import { isAddress, parseUnits as parseUnits$1, formatUnits as formatUnits$1, getContract, createPublicClient, http, pad, toHex, getAddress, concat, keccak256 } from 'viem';
@@ -752,6 +752,14 @@ var assertIsForeign = function assertIsForeign(asset) {
752
752
  }
753
753
  };
754
754
 
755
+ var createId = function createId(version, location) {
756
+ if (version === Version.V3) {
757
+ return {
758
+ Concrete: location
759
+ };
760
+ }
761
+ return location;
762
+ };
755
763
  var createAsset = function createAsset(version, amount, location) {
756
764
  if (version === Version.V3) {
757
765
  return {
@@ -2775,16 +2783,6 @@ var resolveTChainFromLocation = function resolveTChainFromLocation(relaychain, l
2775
2783
  }
2776
2784
  return chain;
2777
2785
  };
2778
- var throwUnsupportedCurrency = function throwUnsupportedCurrency(currency, chain) {
2779
- var _ref = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {
2780
- isDestination: false
2781
- },
2782
- isDestination = _ref.isDestination;
2783
- if ('location' in currency) {
2784
- throw new InvalidCurrencyError("\n Selected chain doesn't support location you provided. Maybe you meant custom location. If so, you need to use override option. Your selection should look like this: {location: Override(".concat(JSON.stringify(currency.location), ")}."));
2785
- }
2786
- throw new InvalidCurrencyError("".concat(isDestination ? 'Destination' : 'Origin', " chain ").concat(chain, " does not support currency ").concat(JSON.stringify(currency, replaceBigInt), "."));
2787
- };
2788
2786
 
2789
2787
  var buildClaimAssetsParams = function buildClaimAssetsParams(options) {
2790
2788
  var assets = options.assets,
@@ -4552,14 +4550,13 @@ var validateAssetSupport = function validateAssetSupport(_ref, assetCheckEnabled
4552
4550
  var origin = _ref.from,
4553
4551
  destination = _ref.to,
4554
4552
  currency = _ref.currency;
4555
- var isRelayDestination = !isTLocation(destination) && isRelayChain(destination);
4556
4553
  var isLocationDestination = _typeof(destination) === 'object';
4557
- if (!isBridge && !isRelayDestination && !isLocationDestination && (asset === null || asset === void 0 ? void 0 : asset.symbol) !== undefined && assetCheckEnabled && !('id' in currency) && !hasSupportForAsset(destination, asset.symbol)) {
4558
- throw new InvalidCurrencyError("Destination chain ".concat(destination, " does not support currency ").concat(JSON.stringify(currency, replaceBigInt), "."));
4559
- }
4560
4554
  if (asset === null && assetCheckEnabled) {
4561
4555
  throwUnsupportedCurrency(currency, origin);
4562
4556
  }
4557
+ if (!isLocationDestination && assetCheckEnabled && !findAssetInfoOnDest(origin, destination, currency, asset)) {
4558
+ throw new InvalidCurrencyError("Destination chain ".concat(destination, " does not support currency ").concat(JSON.stringify(currency, replaceBigInt), "."));
4559
+ }
4563
4560
  validateBridgeAsset(origin, destination, asset, currency, isBridge);
4564
4561
  validateEthereumAsset(origin, destination, asset);
4565
4562
  };
@@ -9780,11 +9777,13 @@ var applyDecimalAbstraction = function applyDecimalAbstraction(amount, decimals,
9780
9777
  return parseUnits(amount.toString(), decimals);
9781
9778
  };
9782
9779
 
9783
- var createAssetsFilter = function createAssetsFilter(asset) {
9780
+ var createAssetsFilter = function createAssetsFilter(asset, version) {
9781
+ var location = extractAssetLocation(asset);
9782
+ var id = createId(version, location);
9784
9783
  return {
9785
9784
  Wild: {
9786
9785
  AllOf: {
9787
- id: extractAssetLocation(asset),
9786
+ id: id,
9788
9787
  fun: 'Fungible'
9789
9788
  }
9790
9789
  }
@@ -9867,7 +9866,7 @@ var createBaseExecuteXcm = function createBaseExecuteXcm(options) {
9867
9866
  var isReserveDest = reserveChain === destChain;
9868
9867
  var resolvedDepositInstruction = isReserveDest ? suffixXcm : [{
9869
9868
  DepositReserveAsset: {
9870
- assets: createAssetsFilter(assetLocalizedToReserve),
9869
+ assets: createAssetsFilter(assetLocalizedToReserve, version),
9871
9870
  dest: createDestination(version, reserveChain !== null && reserveChain !== void 0 ? reserveChain : chain, destChain, paraIdTo),
9872
9871
  xcm: [{
9873
9872
  BuyExecution: {
@@ -9883,7 +9882,7 @@ var createBaseExecuteXcm = function createBaseExecuteXcm(options) {
9883
9882
  // Use teleport for trusted chains
9884
9883
  mainInstructions = [{
9885
9884
  InitiateTeleport: {
9886
- assets: createAssetsFilter(assetLocalized),
9885
+ assets: createAssetsFilter(assetLocalized, version),
9887
9886
  dest: destLocation,
9888
9887
  xcm: [{
9889
9888
  BuyExecution: {
@@ -9898,7 +9897,7 @@ var createBaseExecuteXcm = function createBaseExecuteXcm(options) {
9898
9897
  // Teleport to reserve chain first
9899
9898
  mainInstructions = [{
9900
9899
  InitiateTeleport: {
9901
- assets: createAssetsFilter(assetLocalized),
9900
+ assets: createAssetsFilter(assetLocalized, version),
9902
9901
  dest: getChainLocation(chain, reserveChain),
9903
9902
  xcm: [{
9904
9903
  BuyExecution: {
@@ -9913,7 +9912,7 @@ var createBaseExecuteXcm = function createBaseExecuteXcm(options) {
9913
9912
  // Use InitiateReserve for non-trusted chains
9914
9913
  mainInstructions = [{
9915
9914
  InitiateReserveWithdraw: {
9916
- assets: createAssetsFilter(assetLocalized),
9915
+ assets: createAssetsFilter(assetLocalized, version),
9917
9916
  reserve: getChainLocation(chain, reserveChain),
9918
9917
  xcm: [{
9919
9918
  BuyExecution: {
@@ -10079,7 +10078,7 @@ var prepareCommonExecuteXcm = function prepareCommonExecuteXcm(options, assetToD
10079
10078
  });
10080
10079
  var depositInstruction = {
10081
10080
  DepositAsset: {
10082
- assets: createAssetsFilter(assetToDeposit !== null && assetToDeposit !== void 0 ? assetToDeposit : assetLocalizedToDest),
10081
+ assets: createAssetsFilter(assetToDeposit !== null && assetToDeposit !== void 0 ? assetToDeposit : assetLocalizedToDest, version),
10083
10082
  beneficiary: beneficiary
10084
10083
  }
10085
10084
  };
@@ -10218,7 +10217,7 @@ var createExchangeInstructions = /*#__PURE__*/function () {
10218
10217
  }
10219
10218
  return _context.a(2, [{
10220
10219
  ExchangeAsset: {
10221
- give: createAssetsFilter(assetFrom),
10220
+ give: createAssetsFilter(assetFrom, version),
10222
10221
  want: [assetTo],
10223
10222
  maximal: false
10224
10223
  }
@@ -10231,13 +10230,13 @@ var createExchangeInstructions = /*#__PURE__*/function () {
10231
10230
  assetNative = createAsset(version, exchangeFee === 0n ? (nativeAmountOut + 1n) / 2n : nativeAmountOut, localizeLocation(exchangeChain, nativeAsset.location));
10232
10231
  return _context.a(2, [{
10233
10232
  ExchangeAsset: {
10234
- give: createAssetsFilter(assetFrom),
10233
+ give: createAssetsFilter(assetFrom, version),
10235
10234
  want: [assetNative],
10236
10235
  maximal: false
10237
10236
  }
10238
10237
  }, {
10239
10238
  ExchangeAsset: {
10240
- give: createAssetsFilter(assetNative),
10239
+ give: createAssetsFilter(assetNative, version),
10241
10240
  want: [assetTo],
10242
10241
  maximal: true
10243
10242
  }
@@ -10640,6 +10639,17 @@ var handleToAhTeleport = /*#__PURE__*/function () {
10640
10639
  };
10641
10640
  }();
10642
10641
 
10642
+ var throwUnsupportedCurrency = function throwUnsupportedCurrency(currency, chain) {
10643
+ var _ref = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {
10644
+ isDestination: false
10645
+ },
10646
+ isDestination = _ref.isDestination;
10647
+ if ('location' in currency) {
10648
+ throw new InvalidCurrencyError("\n Selected chain doesn't support location you provided. Maybe you meant custom location. If so, you need to use override option. Your selection should look like this: {location: Override(".concat(JSON.stringify(currency.location), ")}."));
10649
+ }
10650
+ throw new InvalidCurrencyError("".concat(isDestination ? 'Destination' : 'Origin', " chain ").concat(chain, " does not support currency ").concat(JSON.stringify(currency, replaceBigInt), "."));
10651
+ };
10652
+
10643
10653
  var AssetHubPolkadot = /*#__PURE__*/function (_Parachain) {
10644
10654
  function AssetHubPolkadot() {
10645
10655
  var chain = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'AssetHubPolkadot';
@@ -14187,4 +14197,4 @@ var getMoonbeamErc20Balance = /*#__PURE__*/function () {
14187
14197
  };
14188
14198
  }();
14189
14199
 
14190
- export { AmountTooLowError, AssetClaimBuilder, BaseAssetsPallet, BatchMode, BridgeHaltedError, Builder, ChainNotSupportedError, DRY_RUN_CLIENT_TIMEOUT_MS, DryRunFailedError, ETHEREUM_JUNCTION, ETH_CHAIN_ID, GeneralBuilder, IncompatibleChainsError, InvalidAddressError, InvalidParameterError, MissingChainApiError, NoXCMSupportImplementedError, PolkadotXcmError, PolkadotXcmExecutionError, ScenarioNotSupportedError, TX_CLIENT_TIMEOUT_MS, TransferToAhNotSupported, UnableToComputeError, XTokensError, abstractDecimals, addEthereumBridgeFees, addXcmVersionHeader, applyDecimalAbstraction, assertAddressIsString, assertHasId, assertHasLocation, assertIsForeign, assertSenderAddress, assertToIsString, blake2b256, blake2b512, calcPreviewMintAmount, claimAssets, computeFeeFromDryRun, computeFeeFromDryRunPjs, computeOverridenAmount, constructTypeAndThenCall, convertSs58, createAsset, createAssetsFilter, createBaseExecuteXcm, createBeneficiaryLocXTokens, createBeneficiaryLocation, createChainClient, createDirectExecuteXcm, createExecuteCall, createExecuteExchangeXcm, createTx, createTypeAndThenCall, createTypeThenAutoReserve, createVersionedAssets, createX1Payload, deriveAccountId, dryRun, dryRunInternal, dryRunOrigin, encodeSs58, formatAssetIdToERC20, formatUnits, getAssetBalanceInternal, getAssetReserveChain, getBalance, getBalanceInternal, getBalanceNative, getBridgeStatus, getChain, getChainConfig, getChainLocation, getChainProviders, getChainVersion, getEthErc20Balance, getFailureInfo$1 as getFailureInfo, getMinTransferableAmount, getMinTransferableAmountInternal, getMoonbeamErc20Balance, getOriginFeeDetails, getOriginFeeDetailsInternal, getOriginXcmFee, getOriginXcmFeeEstimate, getOriginXcmFeeInternal, getParaEthTransferFees, getParaId, getRelayChainOf, getTChain, getTransferInfo, getTransferableAmount, getTransferableAmountInternal, getXcmFee, getXcmFeeEstimate, getXcmFeeInternal, getXcmFeeOnce, handleExecuteTransfer, handleSwapExecuteTransfer, handleToAhTeleport, isConfig, localizeLocation, maybeOverrideAsset, maybeOverrideAssets, normalizeAmount, overrideTxAmount, padFee, padValueBy, parseUnits, resolveDestChain, resolveModuleError, resolveParaId, reverseTransformLocation, send, sortAssets, transferMoonbeamEvm, transferMoonbeamToEth, transferRelayToPara, traverseXcmHops, validateAddress, validateAssetSpecifiers, validateCurrency, validateDestination, verifyEdOnDestination, wrapTxBypass };
14200
+ export { AmountTooLowError, AssetClaimBuilder, BaseAssetsPallet, BatchMode, BridgeHaltedError, Builder, ChainNotSupportedError, DRY_RUN_CLIENT_TIMEOUT_MS, DryRunFailedError, ETHEREUM_JUNCTION, ETH_CHAIN_ID, GeneralBuilder, IncompatibleChainsError, InvalidAddressError, InvalidParameterError, MissingChainApiError, NoXCMSupportImplementedError, PolkadotXcmError, PolkadotXcmExecutionError, ScenarioNotSupportedError, TX_CLIENT_TIMEOUT_MS, TransferToAhNotSupported, UnableToComputeError, XTokensError, abstractDecimals, addEthereumBridgeFees, addXcmVersionHeader, applyDecimalAbstraction, assertAddressIsString, assertHasId, assertHasLocation, assertIsForeign, assertSenderAddress, assertToIsString, blake2b256, blake2b512, calcPreviewMintAmount, claimAssets, computeFeeFromDryRun, computeFeeFromDryRunPjs, computeOverridenAmount, constructTypeAndThenCall, convertSs58, createAsset, createAssetsFilter, createBaseExecuteXcm, createBeneficiaryLocXTokens, createBeneficiaryLocation, createChainClient, createDirectExecuteXcm, createExecuteCall, createExecuteExchangeXcm, createId, createTx, createTypeAndThenCall, createTypeThenAutoReserve, createVersionedAssets, createX1Payload, deriveAccountId, dryRun, dryRunInternal, dryRunOrigin, encodeSs58, formatAssetIdToERC20, formatUnits, getAssetBalanceInternal, getAssetReserveChain, getBalance, getBalanceInternal, getBalanceNative, getBridgeStatus, getChain, getChainConfig, getChainLocation, getChainProviders, getChainVersion, getEthErc20Balance, getFailureInfo$1 as getFailureInfo, getMinTransferableAmount, getMinTransferableAmountInternal, getMoonbeamErc20Balance, getOriginFeeDetails, getOriginFeeDetailsInternal, getOriginXcmFee, getOriginXcmFeeEstimate, getOriginXcmFeeInternal, getParaEthTransferFees, getParaId, getRelayChainOf, getTChain, getTransferInfo, getTransferableAmount, getTransferableAmountInternal, getXcmFee, getXcmFeeEstimate, getXcmFeeInternal, getXcmFeeOnce, handleExecuteTransfer, handleSwapExecuteTransfer, handleToAhTeleport, isConfig, localizeLocation, maybeOverrideAsset, maybeOverrideAssets, normalizeAmount, overrideTxAmount, padFee, padValueBy, parseUnits, resolveDestChain, resolveModuleError, resolveParaId, reverseTransformLocation, send, sortAssets, throwUnsupportedCurrency, transferMoonbeamEvm, transferMoonbeamToEth, transferRelayToPara, traverseXcmHops, validateAddress, validateAssetSpecifiers, validateCurrency, validateDestination, verifyEdOnDestination, wrapTxBypass };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paraspell/sdk-core",
3
- "version": "11.14.8",
3
+ "version": "11.14.10",
4
4
  "description": "SDK core for ParaSpell XCM/XCMP tool for developers",
5
5
  "repository": {
6
6
  "type": "git",
@@ -26,9 +26,9 @@
26
26
  "@noble/hashes": "^1.8.0",
27
27
  "@scure/base": "^2.0.0",
28
28
  "viem": "^2.40.3",
29
- "@paraspell/assets": "11.14.8",
30
- "@paraspell/sdk-common": "11.14.8",
31
- "@paraspell/pallets": "11.14.8"
29
+ "@paraspell/assets": "11.14.10",
30
+ "@paraspell/pallets": "11.14.10",
31
+ "@paraspell/sdk-common": "11.14.10"
32
32
  },
33
33
  "devDependencies": {
34
34
  "@babel/plugin-syntax-import-attributes": "^7.27.1",