@paraspell/sdk-core 11.8.3 → 11.8.4

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
@@ -4487,7 +4487,9 @@ var getDestXcmFee = /*#__PURE__*/function () {
4487
4487
  return _context3.a(2, {
4488
4488
  fee: _fee,
4489
4489
  feeType: 'paymentInfo',
4490
- sufficient: sufficient
4490
+ sufficient: sufficient,
4491
+ asset: asset,
4492
+ currency: asset.symbol
4491
4493
  });
4492
4494
  case 3:
4493
4495
  _context3.n = 4;
@@ -4524,7 +4526,9 @@ var getDestXcmFee = /*#__PURE__*/function () {
4524
4526
  fee: _fee2,
4525
4527
  feeType: 'paymentInfo',
4526
4528
  dryRunError: dryRunResult.failureReason,
4527
- sufficient: false
4529
+ sufficient: false,
4530
+ asset: asset,
4531
+ currency: asset.symbol
4528
4532
  });
4529
4533
  case 7:
4530
4534
  fee = dryRunResult.fee, newForwardedXcms = dryRunResult.forwardedXcms, destParaId = dryRunResult.destParaId;
@@ -4533,7 +4537,9 @@ var getDestXcmFee = /*#__PURE__*/function () {
4533
4537
  feeType: 'dryRun',
4534
4538
  sufficient: true,
4535
4539
  forwardedXcms: newForwardedXcms,
4536
- destParaId: destParaId
4540
+ destParaId: destParaId,
4541
+ asset: asset,
4542
+ currency: asset.symbol
4537
4543
  });
4538
4544
  }
4539
4545
  }, _callee3);
@@ -5125,14 +5131,11 @@ var transferMoonbeamToEth = /*#__PURE__*/function () {
5125
5131
  };
5126
5132
  }();
5127
5133
 
5128
- function traverseXcmHops(_x) {
5129
- return _traverseXcmHops.apply(this, arguments);
5130
- }
5131
- function _traverseXcmHops() {
5132
- _traverseXcmHops = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(config) {
5134
+ var traverseXcmHops = /*#__PURE__*/function () {
5135
+ var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(config) {
5133
5136
  var api, origin, destination, currency, initialForwardedXcms, initialDestParaId, swapConfig, processHop, shouldContinue, extractNextHopData, assetHubChain, bridgeHubChain, currentOrigin, forwardedXcms, nextParaId, asset, currentAsset, hasPassedExchange, hops, intermediateResults, destinationResult, nextChain, hopApi, isDestination, isAssetHub, isBridgeHub, hopResult, _extractNextHopData, newXcms, destParaId;
5134
- return _regenerator().w(function (_context2) {
5135
- while (1) switch (_context2.p = _context2.n) {
5137
+ return _regenerator().w(function (_context) {
5138
+ while (1) switch (_context.p = _context.n) {
5136
5139
  case 0:
5137
5140
  api = config.api, origin = config.origin, destination = config.destination, currency = config.currency, initialForwardedXcms = config.initialForwardedXcms, initialDestParaId = config.initialDestParaId, swapConfig = config.swapConfig, processHop = config.processHop, shouldContinue = config.shouldContinue, extractNextHopData = config.extractNextHopData;
5138
5141
  assetHubChain = "AssetHub".concat(getRelayChainOf(origin));
@@ -5147,19 +5150,19 @@ function _traverseXcmHops() {
5147
5150
  intermediateResults = {};
5148
5151
  case 1:
5149
5152
  if (!(Array.isArray(forwardedXcms) && forwardedXcms.length > 0 && forwardedXcms[1].length > 0 && ('disconnect' in api.getApi() ? Object.values(forwardedXcms[1][0]).length : forwardedXcms[1][0].value.length) > 0 && nextParaId !== undefined)) {
5150
- _context2.n = 10;
5153
+ _context.n = 10;
5151
5154
  break;
5152
5155
  }
5153
5156
  nextChain = getTChain(nextParaId, getRelayChainOf(origin));
5154
5157
  if (nextChain) {
5155
- _context2.n = 2;
5158
+ _context.n = 2;
5156
5159
  break;
5157
5160
  }
5158
5161
  throw new InvalidParameterError("Unable to find TChain for paraId ".concat(nextParaId));
5159
5162
  case 2:
5160
5163
  hopApi = api.clone();
5161
- _context2.p = 3;
5162
- _context2.n = 4;
5164
+ _context.p = 3;
5165
+ _context.n = 4;
5163
5166
  return hopApi.init(nextChain, DRY_RUN_CLIENT_TIMEOUT_MS);
5164
5167
  case 4:
5165
5168
  // true if this hop should be treated as the destination
@@ -5168,7 +5171,7 @@ function _traverseXcmHops() {
5168
5171
  isDestination = nextChain === destination && (!swapConfig || hasPassedExchange || nextChain === swapConfig.exchangeChain);
5169
5172
  isAssetHub = nextChain === assetHubChain;
5170
5173
  isBridgeHub = nextChain === bridgeHubChain;
5171
- _context2.n = 5;
5174
+ _context.n = 5;
5172
5175
  return processHop({
5173
5176
  api: hopApi,
5174
5177
  currentChain: nextChain,
@@ -5181,7 +5184,7 @@ function _traverseXcmHops() {
5181
5184
  isBridgeHub: isBridgeHub
5182
5185
  });
5183
5186
  case 5:
5184
- hopResult = _context2.v;
5187
+ hopResult = _context.v;
5185
5188
  if (!isDestination) {
5186
5189
  hops.push({
5187
5190
  chain: nextChain,
@@ -5196,10 +5199,10 @@ function _traverseXcmHops() {
5196
5199
  intermediateResults.bridgeHub = hopResult;
5197
5200
  }
5198
5201
  if (shouldContinue(hopResult)) {
5199
- _context2.n = 6;
5202
+ _context.n = 6;
5200
5203
  break;
5201
5204
  }
5202
- return _context2.a(3, 10);
5205
+ return _context.a(3, 10);
5203
5206
  case 6:
5204
5207
  // Update state for next iteration
5205
5208
  if (swapConfig && nextChain === swapConfig.exchangeChain) {
@@ -5211,16 +5214,16 @@ function _traverseXcmHops() {
5211
5214
  nextParaId = destParaId;
5212
5215
  currentOrigin = nextChain;
5213
5216
  case 7:
5214
- _context2.p = 7;
5215
- _context2.n = 8;
5217
+ _context.p = 7;
5218
+ _context.n = 8;
5216
5219
  return hopApi.disconnect();
5217
5220
  case 8:
5218
- return _context2.f(7);
5221
+ return _context.f(7);
5219
5222
  case 9:
5220
- _context2.n = 1;
5223
+ _context.n = 1;
5221
5224
  break;
5222
5225
  case 10:
5223
- return _context2.a(2, _objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2({
5226
+ return _context.a(2, _objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2({
5224
5227
  hops: hops
5225
5228
  }, intermediateResults.assetHub && {
5226
5229
  assetHub: intermediateResults.assetHub
@@ -5232,40 +5235,42 @@ function _traverseXcmHops() {
5232
5235
  lastProcessedChain: currentOrigin
5233
5236
  }));
5234
5237
  }
5235
- }, _callee2, null, [[3,, 7, 9]]);
5238
+ }, _callee, null, [[3,, 7, 9]]);
5236
5239
  }));
5237
- return _traverseXcmHops.apply(this, arguments);
5238
- }
5240
+ return function traverseXcmHops(_x) {
5241
+ return _ref.apply(this, arguments);
5242
+ };
5243
+ }();
5239
5244
  var addEthereumBridgeFees = /*#__PURE__*/function () {
5240
- var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(api, bridgeHubResult, destination, assetHubChain) {
5245
+ var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(api, bridgeHubResult, destination, assetHubChain) {
5241
5246
  var ahApi, _yield$getParaEthTran, _yield$getParaEthTran2, bridgeFee;
5242
- return _regenerator().w(function (_context) {
5243
- while (1) switch (_context.n) {
5247
+ return _regenerator().w(function (_context2) {
5248
+ while (1) switch (_context2.n) {
5244
5249
  case 0:
5245
5250
  if (!(!bridgeHubResult || !('fee' in bridgeHubResult) || destination !== 'Ethereum')) {
5246
- _context.n = 1;
5251
+ _context2.n = 1;
5247
5252
  break;
5248
5253
  }
5249
- return _context.a(2, bridgeHubResult);
5254
+ return _context2.a(2, bridgeHubResult);
5250
5255
  case 1:
5251
5256
  ahApi = api.clone();
5252
- _context.n = 2;
5257
+ _context2.n = 2;
5253
5258
  return ahApi.init(assetHubChain, DRY_RUN_CLIENT_TIMEOUT_MS);
5254
5259
  case 2:
5255
- _context.n = 3;
5260
+ _context2.n = 3;
5256
5261
  return getParaEthTransferFees(ahApi);
5257
5262
  case 3:
5258
- _yield$getParaEthTran = _context.v;
5263
+ _yield$getParaEthTran = _context2.v;
5259
5264
  _yield$getParaEthTran2 = _slicedToArray(_yield$getParaEthTran, 1);
5260
5265
  bridgeFee = _yield$getParaEthTran2[0];
5261
- return _context.a(2, _objectSpread2(_objectSpread2({}, bridgeHubResult), {}, {
5266
+ return _context2.a(2, _objectSpread2(_objectSpread2({}, bridgeHubResult), {}, {
5262
5267
  fee: bridgeHubResult.fee + bridgeFee
5263
5268
  }));
5264
5269
  }
5265
- }, _callee);
5270
+ }, _callee2);
5266
5271
  }));
5267
5272
  return function addEthereumBridgeFees(_x2, _x3, _x4, _x5) {
5268
- return _ref.apply(this, arguments);
5273
+ return _ref2.apply(this, arguments);
5269
5274
  };
5270
5275
  }();
5271
5276
 
@@ -5315,6 +5320,7 @@ var dryRunInternal = /*#__PURE__*/function () {
5315
5320
  return api.getDryRunCall({
5316
5321
  tx: tx,
5317
5322
  chain: origin,
5323
+ destination: destination,
5318
5324
  address: senderAddress,
5319
5325
  asset: _objectSpread2(_objectSpread2({}, asset), {}, {
5320
5326
  amount: amount
@@ -5344,8 +5350,8 @@ var dryRunInternal = /*#__PURE__*/function () {
5344
5350
  while (1) switch (_context.n) {
5345
5351
  case 0:
5346
5352
  hopApi = params.api, currentChain = params.currentChain, currentOrigin = params.currentOrigin, currentAsset = params.currentAsset, forwardedXcms = params.forwardedXcms, hasPassedExchange = params.hasPassedExchange, isDestination = params.isDestination;
5347
- if (destination === 'Ethereum' && (currentChain.includes('AssetHub') || currentChain.includes('BridgeHub'))) {
5348
- hopAsset = assets.findNativeAssetInfoOrThrow(currentChain);
5353
+ if (asset.location && asset.location.parents === sdkCommon.Parents.TWO) {
5354
+ hopAsset = assets.findNativeAssetInfoOrThrow(getRelayChainOf(currentChain));
5349
5355
  } else if (hasPassedExchange && swapConfig && currentChain !== swapConfig.exchangeChain) {
5350
5356
  hopAsset = assets.findAssetOnDestOrThrow(swapConfig.exchangeChain, currentChain, swapConfig.currencyTo);
5351
5357
  } else if (isDestination) {
@@ -5371,7 +5377,7 @@ var dryRunInternal = /*#__PURE__*/function () {
5371
5377
  xcm: forwardedXcms[1][0],
5372
5378
  chain: currentChain,
5373
5379
  origin: currentOrigin,
5374
- asset: currentAsset,
5380
+ asset: hopAsset,
5375
5381
  feeAsset: resolvedFeeAsset,
5376
5382
  originFee: originDryRun.fee,
5377
5383
  amount: amount
@@ -10104,7 +10110,7 @@ var createMintTxs = function createMintTxs(chain, asset, balance, address, api)
10104
10110
  var nativePallet = pallets.getNativeAssetsPallet(chain);
10105
10111
  var otherPallets = pallets.getOtherAssetsPallets(chain);
10106
10112
  var isMainNativeAsset = assets.isSymbolMatch(asset.symbol, assets.getNativeAssetSymbol(chain));
10107
- var pallet = assets.isForeignAsset(asset) || !isMainNativeAsset ? pickOtherPallet(asset, otherPallets) : nativePallet;
10113
+ var pallet = assets.isForeignAsset(asset) && chain !== 'Mythos' || !isMainNativeAsset ? pickOtherPallet(asset, otherPallets) : nativePallet;
10108
10114
  var palletInstance = getPalletInstance(pallet);
10109
10115
  return palletInstance.mint(address, asset, balance, chain, api);
10110
10116
  };
@@ -10465,6 +10471,7 @@ var getOriginXcmFeeInternal = /*#__PURE__*/function () {
10465
10471
  return api.getDryRunCall({
10466
10472
  tx: tx,
10467
10473
  chain: origin,
10474
+ destination: destination,
10468
10475
  address: senderAddress,
10469
10476
  asset: _objectSpread2(_objectSpread2({}, asset), {}, {
10470
10477
  amount: amount
@@ -10901,11 +10908,22 @@ var getXcmFeeInternal = /*#__PURE__*/function () {
10901
10908
  case 7:
10902
10909
  processHop = /*#__PURE__*/function () {
10903
10910
  var _ref3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(params) {
10904
- var hopApi, currentChain, currentOrigin, currentAsset, forwardedXcms, hasPassedExchange, hopResult, hopAsset;
10911
+ var hopApi, currentChain, currentOrigin, currentAsset, forwardedXcms, hasPassedExchange, hopAsset, hopResult;
10905
10912
  return _regenerator().w(function (_context) {
10906
10913
  while (1) switch (_context.n) {
10907
10914
  case 0:
10908
10915
  hopApi = params.api, currentChain = params.currentChain, currentOrigin = params.currentOrigin, currentAsset = params.currentAsset, forwardedXcms = params.forwardedXcms, hasPassedExchange = params.hasPassedExchange;
10916
+ if (!(currentAsset.location && currentAsset.location.parents === sdkCommon.Parents.TWO)) {
10917
+ if (hasPassedExchange && swapConfig && currentChain !== swapConfig.exchangeChain) {
10918
+ hopAsset = assets.findAssetOnDestOrThrow(swapConfig.exchangeChain, currentChain, swapConfig.currencyTo);
10919
+ } else if (destination === currentChain) {
10920
+ hopAsset = assets.findAssetOnDestOrThrow(origin, currentChain, currency);
10921
+ } else {
10922
+ hopAsset = currentAsset;
10923
+ }
10924
+ } else {
10925
+ hopAsset = assets.findNativeAssetInfoOrThrow(getRelayChainOf(currentChain));
10926
+ }
10909
10927
  _context.n = 1;
10910
10928
  return getDestXcmFee({
10911
10929
  api: hopApi,
@@ -10918,7 +10936,7 @@ var getXcmFeeInternal = /*#__PURE__*/function () {
10918
10936
  }),
10919
10937
  address: address,
10920
10938
  senderAddress: senderAddress,
10921
- asset: currentAsset,
10939
+ asset: hopAsset,
10922
10940
  feeAsset: feeAsset,
10923
10941
  tx: tx,
10924
10942
  originFee: originFee !== null && originFee !== void 0 ? originFee : 0n,
@@ -10928,21 +10946,7 @@ var getXcmFeeInternal = /*#__PURE__*/function () {
10928
10946
  });
10929
10947
  case 1:
10930
10948
  hopResult = _context.v;
10931
- if (hopResult.feeType === 'dryRun' && !(destination === 'Ethereum' && (currentChain.includes('AssetHub') || currentChain.includes('BridgeHub')))) {
10932
- if (hasPassedExchange && swapConfig && currentChain !== swapConfig.exchangeChain) {
10933
- hopAsset = assets.findAssetOnDestOrThrow(swapConfig.exchangeChain, currentChain, swapConfig.currencyTo);
10934
- } else if (destination === currentChain) {
10935
- hopAsset = assets.findAssetOnDestOrThrow(origin, currentChain, currency);
10936
- } else {
10937
- hopAsset = asset;
10938
- }
10939
- } else {
10940
- hopAsset = assets.findNativeAssetInfoOrThrow(currentChain);
10941
- }
10942
- return _context.a(2, _objectSpread2(_objectSpread2({}, hopResult), {}, {
10943
- currency: hopAsset.symbol,
10944
- asset: hopAsset
10945
- }));
10949
+ return _context.a(2, hopResult);
10946
10950
  }
10947
10951
  }, _callee);
10948
10952
  }));
@@ -10996,10 +11000,6 @@ var getXcmFeeInternal = /*#__PURE__*/function () {
10996
11000
  }
10997
11001
  // We failed before reaching destination, use fallback
10998
11002
  _destApi = api.clone();
10999
- if (!(destination !== 'Ethereum')) {
11000
- _context2.n = 10;
11001
- break;
11002
- }
11003
11003
  _context2.n = 10;
11004
11004
  return _destApi.init(destination, DRY_RUN_CLIENT_TIMEOUT_MS);
11005
11005
  case 10:
@@ -12356,12 +12356,14 @@ var createCustomXcm = function createCustomXcm(_ref, isDotAsset) {
12356
12356
  return depositInstruction;
12357
12357
  };
12358
12358
 
12359
- var createRefundInstruction = function createRefundInstruction(api, senderAddress, version) {
12359
+ var createRefundInstruction = function createRefundInstruction(api, senderAddress, version, assetCount) {
12360
12360
  return {
12361
12361
  SetAppendix: [{
12362
12362
  DepositAsset: {
12363
12363
  assets: {
12364
- Wild: 'All'
12364
+ Wild: {
12365
+ AllCounted: assetCount
12366
+ }
12365
12367
  },
12366
12368
  beneficiary: createBeneficiaryLocation({
12367
12369
  api: api,
@@ -12386,7 +12388,7 @@ var buildAssets = function buildAssets(chain, asset, feeAmount, isDotAsset, vers
12386
12388
  */
12387
12389
  var createTypeAndThenCall = /*#__PURE__*/function () {
12388
12390
  var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(chain, options) {
12389
- var api, senderAddress, version, context, assetInfo, isDotAsset, customXcm, refundInstruction, fees, finalCustomXcm, totalFee, assets;
12391
+ var api, senderAddress, version, context, assetInfo, isDotAsset, customXcm, assetCount, refundInstruction, fees, finalCustomXcm, totalFee, assets;
12390
12392
  return _regenerator().w(function (_context) {
12391
12393
  while (1) switch (_context.n) {
12392
12394
  case 0:
@@ -12407,7 +12409,8 @@ var createTypeAndThenCall = /*#__PURE__*/function () {
12407
12409
  }
12408
12410
  });
12409
12411
  customXcm = createCustomXcm(context, isDotAsset);
12410
- refundInstruction = senderAddress ? createRefundInstruction(api, senderAddress, version) : null;
12412
+ assetCount = isDotAsset ? 1 : 2;
12413
+ refundInstruction = senderAddress ? createRefundInstruction(api, senderAddress, version, assetCount) : null;
12411
12414
  _context.n = 2;
12412
12415
  return computeAllFees(context, customXcm, isDotAsset, refundInstruction);
12413
12416
  case 2:
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as _paraspell_sdk_common from '@paraspell/sdk-common';
2
- import { TLocation, TSubstrateChain, TChain, Version, TRelaychain, TParachain, TExternalChain, TJunction, TJunctions } from '@paraspell/sdk-common';
2
+ import { TChain, TLocation, TSubstrateChain, Version, TRelaychain, TParachain, TExternalChain, TJunction, TJunctions } from '@paraspell/sdk-common';
3
3
  export * from '@paraspell/sdk-common';
4
4
  import * as _paraspell_assets from '@paraspell/assets';
5
5
  import { TCurrencyInputWithAmount, TCurrencyInput, WithAmount, TAssetInfo, TAsset, TAssetWithFee, WithComplexAmount, TCurrencyCore, TAmount, TAssetWithLocation, TForeignAssetWithId, TForeignAssetInfo } from '@paraspell/assets';
@@ -635,7 +635,7 @@ type TXcmFeeHopResult = {
635
635
  asset: TAssetInfo;
636
636
  };
637
637
  type TConditionalXcmFeeDetail<TDisableFallback extends boolean> = TDisableFallback extends false ? TXcmFeeDetailWithFallback : TXcmFeeDetail;
638
- type TDestXcmFeeDetail<TDisableFallback extends boolean> = Omit<TConditionalXcmFeeDetail<TDisableFallback>, 'currency'> & {
638
+ type TDestXcmFeeDetail<TDisableFallback extends boolean> = TConditionalXcmFeeDetail<TDisableFallback> & {
639
639
  forwardedXcms?: any;
640
640
  destParaId?: number;
641
641
  };
@@ -978,6 +978,10 @@ type TDryRunCallBaseOptions<TRes> = {
978
978
  * The chain to dry-run on
979
979
  */
980
980
  chain: TSubstrateChain;
981
+ /**
982
+ * The destination chain
983
+ */
984
+ destination: TDestination;
981
985
  /**
982
986
  * The address to dry-run with
983
987
  */
@@ -990,7 +994,7 @@ type TDryRunCallBaseOptions<TRes> = {
990
994
  bypassOptions?: TBypassOptions;
991
995
  feeAsset?: TAssetInfo;
992
996
  };
993
- type TDryRunBypassOptions<TApi, TRes> = WithApi<Omit<TDryRunCallBaseOptions<TRes>, 'useRootOrigin'>, TApi, TRes>;
997
+ type TDryRunBypassOptions<TApi, TRes> = WithApi<Omit<TDryRunCallBaseOptions<TRes>, 'useRootOrigin' | 'destination'>, TApi, TRes>;
994
998
  type TDryRunCallOptions<TApi, TRes> = WithApi<TDryRunCallBaseOptions<TRes>, TApi, TRes>;
995
999
  type TDryRunXcmBaseOptions<TRes> = {
996
1000
  originLocation: any;
@@ -2119,7 +2123,7 @@ declare const dryRunInternal: <TApi, TRes>(options: TDryRunOptions<TApi, TRes>)
2119
2123
 
2120
2124
  declare const dryRunOrigin: <TApi, TRes>(options: TDryRunCallOptions<TApi, TRes>) => Promise<TDryRunChainResult>;
2121
2125
 
2122
- declare function traverseXcmHops<TApi, TRes, THopResult>(config: HopTraversalConfig<TApi, TRes, THopResult>): Promise<HopTraversalResult<THopResult>>;
2126
+ declare const traverseXcmHops: <TApi, TRes, THopResult>(config: HopTraversalConfig<TApi, TRes, THopResult>) => Promise<HopTraversalResult<THopResult>>;
2123
2127
  declare const addEthereumBridgeFees: <TApi, TRes, TResult extends {
2124
2128
  fee?: bigint;
2125
2129
  }>(api: IPolkadotApi<TApi, TRes>, bridgeHubResult: TResult | undefined, destination: TChain, assetHubChain: TSubstrateChain) => Promise<TResult | undefined>;
package/dist/index.mjs CHANGED
@@ -4488,7 +4488,9 @@ var getDestXcmFee = /*#__PURE__*/function () {
4488
4488
  return _context3.a(2, {
4489
4489
  fee: _fee,
4490
4490
  feeType: 'paymentInfo',
4491
- sufficient: sufficient
4491
+ sufficient: sufficient,
4492
+ asset: asset,
4493
+ currency: asset.symbol
4492
4494
  });
4493
4495
  case 3:
4494
4496
  _context3.n = 4;
@@ -4525,7 +4527,9 @@ var getDestXcmFee = /*#__PURE__*/function () {
4525
4527
  fee: _fee2,
4526
4528
  feeType: 'paymentInfo',
4527
4529
  dryRunError: dryRunResult.failureReason,
4528
- sufficient: false
4530
+ sufficient: false,
4531
+ asset: asset,
4532
+ currency: asset.symbol
4529
4533
  });
4530
4534
  case 7:
4531
4535
  fee = dryRunResult.fee, newForwardedXcms = dryRunResult.forwardedXcms, destParaId = dryRunResult.destParaId;
@@ -4534,7 +4538,9 @@ var getDestXcmFee = /*#__PURE__*/function () {
4534
4538
  feeType: 'dryRun',
4535
4539
  sufficient: true,
4536
4540
  forwardedXcms: newForwardedXcms,
4537
- destParaId: destParaId
4541
+ destParaId: destParaId,
4542
+ asset: asset,
4543
+ currency: asset.symbol
4538
4544
  });
4539
4545
  }
4540
4546
  }, _callee3);
@@ -5126,14 +5132,11 @@ var transferMoonbeamToEth = /*#__PURE__*/function () {
5126
5132
  };
5127
5133
  }();
5128
5134
 
5129
- function traverseXcmHops(_x) {
5130
- return _traverseXcmHops.apply(this, arguments);
5131
- }
5132
- function _traverseXcmHops() {
5133
- _traverseXcmHops = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(config) {
5135
+ var traverseXcmHops = /*#__PURE__*/function () {
5136
+ var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(config) {
5134
5137
  var api, origin, destination, currency, initialForwardedXcms, initialDestParaId, swapConfig, processHop, shouldContinue, extractNextHopData, assetHubChain, bridgeHubChain, currentOrigin, forwardedXcms, nextParaId, asset, currentAsset, hasPassedExchange, hops, intermediateResults, destinationResult, nextChain, hopApi, isDestination, isAssetHub, isBridgeHub, hopResult, _extractNextHopData, newXcms, destParaId;
5135
- return _regenerator().w(function (_context2) {
5136
- while (1) switch (_context2.p = _context2.n) {
5138
+ return _regenerator().w(function (_context) {
5139
+ while (1) switch (_context.p = _context.n) {
5137
5140
  case 0:
5138
5141
  api = config.api, origin = config.origin, destination = config.destination, currency = config.currency, initialForwardedXcms = config.initialForwardedXcms, initialDestParaId = config.initialDestParaId, swapConfig = config.swapConfig, processHop = config.processHop, shouldContinue = config.shouldContinue, extractNextHopData = config.extractNextHopData;
5139
5142
  assetHubChain = "AssetHub".concat(getRelayChainOf(origin));
@@ -5148,19 +5151,19 @@ function _traverseXcmHops() {
5148
5151
  intermediateResults = {};
5149
5152
  case 1:
5150
5153
  if (!(Array.isArray(forwardedXcms) && forwardedXcms.length > 0 && forwardedXcms[1].length > 0 && ('disconnect' in api.getApi() ? Object.values(forwardedXcms[1][0]).length : forwardedXcms[1][0].value.length) > 0 && nextParaId !== undefined)) {
5151
- _context2.n = 10;
5154
+ _context.n = 10;
5152
5155
  break;
5153
5156
  }
5154
5157
  nextChain = getTChain(nextParaId, getRelayChainOf(origin));
5155
5158
  if (nextChain) {
5156
- _context2.n = 2;
5159
+ _context.n = 2;
5157
5160
  break;
5158
5161
  }
5159
5162
  throw new InvalidParameterError("Unable to find TChain for paraId ".concat(nextParaId));
5160
5163
  case 2:
5161
5164
  hopApi = api.clone();
5162
- _context2.p = 3;
5163
- _context2.n = 4;
5165
+ _context.p = 3;
5166
+ _context.n = 4;
5164
5167
  return hopApi.init(nextChain, DRY_RUN_CLIENT_TIMEOUT_MS);
5165
5168
  case 4:
5166
5169
  // true if this hop should be treated as the destination
@@ -5169,7 +5172,7 @@ function _traverseXcmHops() {
5169
5172
  isDestination = nextChain === destination && (!swapConfig || hasPassedExchange || nextChain === swapConfig.exchangeChain);
5170
5173
  isAssetHub = nextChain === assetHubChain;
5171
5174
  isBridgeHub = nextChain === bridgeHubChain;
5172
- _context2.n = 5;
5175
+ _context.n = 5;
5173
5176
  return processHop({
5174
5177
  api: hopApi,
5175
5178
  currentChain: nextChain,
@@ -5182,7 +5185,7 @@ function _traverseXcmHops() {
5182
5185
  isBridgeHub: isBridgeHub
5183
5186
  });
5184
5187
  case 5:
5185
- hopResult = _context2.v;
5188
+ hopResult = _context.v;
5186
5189
  if (!isDestination) {
5187
5190
  hops.push({
5188
5191
  chain: nextChain,
@@ -5197,10 +5200,10 @@ function _traverseXcmHops() {
5197
5200
  intermediateResults.bridgeHub = hopResult;
5198
5201
  }
5199
5202
  if (shouldContinue(hopResult)) {
5200
- _context2.n = 6;
5203
+ _context.n = 6;
5201
5204
  break;
5202
5205
  }
5203
- return _context2.a(3, 10);
5206
+ return _context.a(3, 10);
5204
5207
  case 6:
5205
5208
  // Update state for next iteration
5206
5209
  if (swapConfig && nextChain === swapConfig.exchangeChain) {
@@ -5212,16 +5215,16 @@ function _traverseXcmHops() {
5212
5215
  nextParaId = destParaId;
5213
5216
  currentOrigin = nextChain;
5214
5217
  case 7:
5215
- _context2.p = 7;
5216
- _context2.n = 8;
5218
+ _context.p = 7;
5219
+ _context.n = 8;
5217
5220
  return hopApi.disconnect();
5218
5221
  case 8:
5219
- return _context2.f(7);
5222
+ return _context.f(7);
5220
5223
  case 9:
5221
- _context2.n = 1;
5224
+ _context.n = 1;
5222
5225
  break;
5223
5226
  case 10:
5224
- return _context2.a(2, _objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2({
5227
+ return _context.a(2, _objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2({
5225
5228
  hops: hops
5226
5229
  }, intermediateResults.assetHub && {
5227
5230
  assetHub: intermediateResults.assetHub
@@ -5233,40 +5236,42 @@ function _traverseXcmHops() {
5233
5236
  lastProcessedChain: currentOrigin
5234
5237
  }));
5235
5238
  }
5236
- }, _callee2, null, [[3,, 7, 9]]);
5239
+ }, _callee, null, [[3,, 7, 9]]);
5237
5240
  }));
5238
- return _traverseXcmHops.apply(this, arguments);
5239
- }
5241
+ return function traverseXcmHops(_x) {
5242
+ return _ref.apply(this, arguments);
5243
+ };
5244
+ }();
5240
5245
  var addEthereumBridgeFees = /*#__PURE__*/function () {
5241
- var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(api, bridgeHubResult, destination, assetHubChain) {
5246
+ var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(api, bridgeHubResult, destination, assetHubChain) {
5242
5247
  var ahApi, _yield$getParaEthTran, _yield$getParaEthTran2, bridgeFee;
5243
- return _regenerator().w(function (_context) {
5244
- while (1) switch (_context.n) {
5248
+ return _regenerator().w(function (_context2) {
5249
+ while (1) switch (_context2.n) {
5245
5250
  case 0:
5246
5251
  if (!(!bridgeHubResult || !('fee' in bridgeHubResult) || destination !== 'Ethereum')) {
5247
- _context.n = 1;
5252
+ _context2.n = 1;
5248
5253
  break;
5249
5254
  }
5250
- return _context.a(2, bridgeHubResult);
5255
+ return _context2.a(2, bridgeHubResult);
5251
5256
  case 1:
5252
5257
  ahApi = api.clone();
5253
- _context.n = 2;
5258
+ _context2.n = 2;
5254
5259
  return ahApi.init(assetHubChain, DRY_RUN_CLIENT_TIMEOUT_MS);
5255
5260
  case 2:
5256
- _context.n = 3;
5261
+ _context2.n = 3;
5257
5262
  return getParaEthTransferFees(ahApi);
5258
5263
  case 3:
5259
- _yield$getParaEthTran = _context.v;
5264
+ _yield$getParaEthTran = _context2.v;
5260
5265
  _yield$getParaEthTran2 = _slicedToArray(_yield$getParaEthTran, 1);
5261
5266
  bridgeFee = _yield$getParaEthTran2[0];
5262
- return _context.a(2, _objectSpread2(_objectSpread2({}, bridgeHubResult), {}, {
5267
+ return _context2.a(2, _objectSpread2(_objectSpread2({}, bridgeHubResult), {}, {
5263
5268
  fee: bridgeHubResult.fee + bridgeFee
5264
5269
  }));
5265
5270
  }
5266
- }, _callee);
5271
+ }, _callee2);
5267
5272
  }));
5268
5273
  return function addEthereumBridgeFees(_x2, _x3, _x4, _x5) {
5269
- return _ref.apply(this, arguments);
5274
+ return _ref2.apply(this, arguments);
5270
5275
  };
5271
5276
  }();
5272
5277
 
@@ -5316,6 +5321,7 @@ var dryRunInternal = /*#__PURE__*/function () {
5316
5321
  return api.getDryRunCall({
5317
5322
  tx: tx,
5318
5323
  chain: origin,
5324
+ destination: destination,
5319
5325
  address: senderAddress,
5320
5326
  asset: _objectSpread2(_objectSpread2({}, asset), {}, {
5321
5327
  amount: amount
@@ -5345,8 +5351,8 @@ var dryRunInternal = /*#__PURE__*/function () {
5345
5351
  while (1) switch (_context.n) {
5346
5352
  case 0:
5347
5353
  hopApi = params.api, currentChain = params.currentChain, currentOrigin = params.currentOrigin, currentAsset = params.currentAsset, forwardedXcms = params.forwardedXcms, hasPassedExchange = params.hasPassedExchange, isDestination = params.isDestination;
5348
- if (destination === 'Ethereum' && (currentChain.includes('AssetHub') || currentChain.includes('BridgeHub'))) {
5349
- hopAsset = findNativeAssetInfoOrThrow(currentChain);
5354
+ if (asset.location && asset.location.parents === Parents.TWO) {
5355
+ hopAsset = findNativeAssetInfoOrThrow(getRelayChainOf(currentChain));
5350
5356
  } else if (hasPassedExchange && swapConfig && currentChain !== swapConfig.exchangeChain) {
5351
5357
  hopAsset = findAssetOnDestOrThrow(swapConfig.exchangeChain, currentChain, swapConfig.currencyTo);
5352
5358
  } else if (isDestination) {
@@ -5372,7 +5378,7 @@ var dryRunInternal = /*#__PURE__*/function () {
5372
5378
  xcm: forwardedXcms[1][0],
5373
5379
  chain: currentChain,
5374
5380
  origin: currentOrigin,
5375
- asset: currentAsset,
5381
+ asset: hopAsset,
5376
5382
  feeAsset: resolvedFeeAsset,
5377
5383
  originFee: originDryRun.fee,
5378
5384
  amount: amount
@@ -10105,7 +10111,7 @@ var createMintTxs = function createMintTxs(chain, asset, balance, address, api)
10105
10111
  var nativePallet = getNativeAssetsPallet(chain);
10106
10112
  var otherPallets = getOtherAssetsPallets(chain);
10107
10113
  var isMainNativeAsset = isSymbolMatch(asset.symbol, getNativeAssetSymbol(chain));
10108
- var pallet = isForeignAsset(asset) || !isMainNativeAsset ? pickOtherPallet(asset, otherPallets) : nativePallet;
10114
+ var pallet = isForeignAsset(asset) && chain !== 'Mythos' || !isMainNativeAsset ? pickOtherPallet(asset, otherPallets) : nativePallet;
10109
10115
  var palletInstance = getPalletInstance(pallet);
10110
10116
  return palletInstance.mint(address, asset, balance, chain, api);
10111
10117
  };
@@ -10466,6 +10472,7 @@ var getOriginXcmFeeInternal = /*#__PURE__*/function () {
10466
10472
  return api.getDryRunCall({
10467
10473
  tx: tx,
10468
10474
  chain: origin,
10475
+ destination: destination,
10469
10476
  address: senderAddress,
10470
10477
  asset: _objectSpread2(_objectSpread2({}, asset), {}, {
10471
10478
  amount: amount
@@ -10902,11 +10909,22 @@ var getXcmFeeInternal = /*#__PURE__*/function () {
10902
10909
  case 7:
10903
10910
  processHop = /*#__PURE__*/function () {
10904
10911
  var _ref3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(params) {
10905
- var hopApi, currentChain, currentOrigin, currentAsset, forwardedXcms, hasPassedExchange, hopResult, hopAsset;
10912
+ var hopApi, currentChain, currentOrigin, currentAsset, forwardedXcms, hasPassedExchange, hopAsset, hopResult;
10906
10913
  return _regenerator().w(function (_context) {
10907
10914
  while (1) switch (_context.n) {
10908
10915
  case 0:
10909
10916
  hopApi = params.api, currentChain = params.currentChain, currentOrigin = params.currentOrigin, currentAsset = params.currentAsset, forwardedXcms = params.forwardedXcms, hasPassedExchange = params.hasPassedExchange;
10917
+ if (!(currentAsset.location && currentAsset.location.parents === Parents.TWO)) {
10918
+ if (hasPassedExchange && swapConfig && currentChain !== swapConfig.exchangeChain) {
10919
+ hopAsset = findAssetOnDestOrThrow(swapConfig.exchangeChain, currentChain, swapConfig.currencyTo);
10920
+ } else if (destination === currentChain) {
10921
+ hopAsset = findAssetOnDestOrThrow(origin, currentChain, currency);
10922
+ } else {
10923
+ hopAsset = currentAsset;
10924
+ }
10925
+ } else {
10926
+ hopAsset = findNativeAssetInfoOrThrow(getRelayChainOf(currentChain));
10927
+ }
10910
10928
  _context.n = 1;
10911
10929
  return getDestXcmFee({
10912
10930
  api: hopApi,
@@ -10919,7 +10937,7 @@ var getXcmFeeInternal = /*#__PURE__*/function () {
10919
10937
  }),
10920
10938
  address: address,
10921
10939
  senderAddress: senderAddress,
10922
- asset: currentAsset,
10940
+ asset: hopAsset,
10923
10941
  feeAsset: feeAsset,
10924
10942
  tx: tx,
10925
10943
  originFee: originFee !== null && originFee !== void 0 ? originFee : 0n,
@@ -10929,21 +10947,7 @@ var getXcmFeeInternal = /*#__PURE__*/function () {
10929
10947
  });
10930
10948
  case 1:
10931
10949
  hopResult = _context.v;
10932
- if (hopResult.feeType === 'dryRun' && !(destination === 'Ethereum' && (currentChain.includes('AssetHub') || currentChain.includes('BridgeHub')))) {
10933
- if (hasPassedExchange && swapConfig && currentChain !== swapConfig.exchangeChain) {
10934
- hopAsset = findAssetOnDestOrThrow(swapConfig.exchangeChain, currentChain, swapConfig.currencyTo);
10935
- } else if (destination === currentChain) {
10936
- hopAsset = findAssetOnDestOrThrow(origin, currentChain, currency);
10937
- } else {
10938
- hopAsset = asset;
10939
- }
10940
- } else {
10941
- hopAsset = findNativeAssetInfoOrThrow(currentChain);
10942
- }
10943
- return _context.a(2, _objectSpread2(_objectSpread2({}, hopResult), {}, {
10944
- currency: hopAsset.symbol,
10945
- asset: hopAsset
10946
- }));
10950
+ return _context.a(2, hopResult);
10947
10951
  }
10948
10952
  }, _callee);
10949
10953
  }));
@@ -10997,10 +11001,6 @@ var getXcmFeeInternal = /*#__PURE__*/function () {
10997
11001
  }
10998
11002
  // We failed before reaching destination, use fallback
10999
11003
  _destApi = api.clone();
11000
- if (!(destination !== 'Ethereum')) {
11001
- _context2.n = 10;
11002
- break;
11003
- }
11004
11004
  _context2.n = 10;
11005
11005
  return _destApi.init(destination, DRY_RUN_CLIENT_TIMEOUT_MS);
11006
11006
  case 10:
@@ -12357,12 +12357,14 @@ var createCustomXcm = function createCustomXcm(_ref, isDotAsset) {
12357
12357
  return depositInstruction;
12358
12358
  };
12359
12359
 
12360
- var createRefundInstruction = function createRefundInstruction(api, senderAddress, version) {
12360
+ var createRefundInstruction = function createRefundInstruction(api, senderAddress, version, assetCount) {
12361
12361
  return {
12362
12362
  SetAppendix: [{
12363
12363
  DepositAsset: {
12364
12364
  assets: {
12365
- Wild: 'All'
12365
+ Wild: {
12366
+ AllCounted: assetCount
12367
+ }
12366
12368
  },
12367
12369
  beneficiary: createBeneficiaryLocation({
12368
12370
  api: api,
@@ -12387,7 +12389,7 @@ var buildAssets = function buildAssets(chain, asset, feeAmount, isDotAsset, vers
12387
12389
  */
12388
12390
  var createTypeAndThenCall = /*#__PURE__*/function () {
12389
12391
  var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(chain, options) {
12390
- var api, senderAddress, version, context, assetInfo, isDotAsset, customXcm, refundInstruction, fees, finalCustomXcm, totalFee, assets;
12392
+ var api, senderAddress, version, context, assetInfo, isDotAsset, customXcm, assetCount, refundInstruction, fees, finalCustomXcm, totalFee, assets;
12391
12393
  return _regenerator().w(function (_context) {
12392
12394
  while (1) switch (_context.n) {
12393
12395
  case 0:
@@ -12408,7 +12410,8 @@ var createTypeAndThenCall = /*#__PURE__*/function () {
12408
12410
  }
12409
12411
  });
12410
12412
  customXcm = createCustomXcm(context, isDotAsset);
12411
- refundInstruction = senderAddress ? createRefundInstruction(api, senderAddress, version) : null;
12413
+ assetCount = isDotAsset ? 1 : 2;
12414
+ refundInstruction = senderAddress ? createRefundInstruction(api, senderAddress, version, assetCount) : null;
12412
12415
  _context.n = 2;
12413
12416
  return computeAllFees(context, customXcm, isDotAsset, refundInstruction);
12414
12417
  case 2:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paraspell/sdk-core",
3
- "version": "11.8.3",
3
+ "version": "11.8.4",
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.36.0",
29
- "@paraspell/assets": "11.8.3",
30
- "@paraspell/sdk-common": "11.8.3",
31
- "@paraspell/pallets": "11.8.3"
29
+ "@paraspell/assets": "11.8.4",
30
+ "@paraspell/sdk-common": "11.8.4",
31
+ "@paraspell/pallets": "11.8.4"
32
32
  },
33
33
  "devDependencies": {
34
34
  "@babel/plugin-syntax-import-attributes": "^7.27.1",