@paraspell/sdk-core 12.7.1 → 12.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -825,12 +825,14 @@ type TCreateBaseSwapXcmOptions = {
825
825
  assetInfoFrom: WithAmount<TAssetInfo>;
826
826
  assetInfoTo: WithAmount<TAssetInfo>;
827
827
  currencyTo: TCurrencyInput;
828
+ feeAssetInfo?: TAssetInfo;
828
829
  senderAddress: string;
829
830
  recipientAddress: string;
830
831
  calculateMinAmountOut: (amountIn: bigint, assetTo?: TAssetInfo) => Promise<bigint>;
831
832
  };
832
833
  type TCreateSwapXcmOptions<TApi, TRes, TSigner> = WithApi<TCreateBaseSwapXcmOptions, TApi, TRes, TSigner>;
833
834
  type TSwapFeeEstimates = {
835
+ originFee: bigint;
834
836
  originReserveFee: bigint;
835
837
  exchangeFee: bigint;
836
838
  destReserveFee: bigint;
@@ -2150,7 +2152,7 @@ declare const wrapTxBypass: <TApi, TRes, TSigner>(dryRunOptions: TDryRunBypassOp
2150
2152
 
2151
2153
  declare const getParaEthTransferFees: <TApi, TRes, TSigner>(ahApi: IPolkadotApi<TApi, TRes, TSigner>, shouldDisconnect?: boolean) => Promise<[bigint, bigint]>;
2152
2154
 
2153
- declare const transferMoonbeamEvm: <TApi, TRes, TSigner>({ api, from, to, signer, address, currency }: TEvmBuilderOptions<TApi, TRes, TSigner>) => Promise<string>;
2155
+ declare const transferMoonbeamEvm: <TApi, TRes, TSigner>(options: TEvmBuilderOptions<TApi, TRes, TSigner>) => Promise<string>;
2154
2156
 
2155
2157
  declare const transferMoonbeamToEth: <TApi, TRes, TSigner>(from: TSubstrateChain, { api, to, signer, address, ahAddress, currency }: TEvmBuilderOptions<TApi, TRes, TSigner>) => Promise<`0x${string}`>;
2156
2158
 
package/dist/index.mjs CHANGED
@@ -1138,26 +1138,19 @@ var getAssetReserveChain = function getAssetReserveChain(chain, assetLocation) {
1138
1138
  return chain;
1139
1139
  };
1140
1140
 
1141
- var createPayFees = function createPayFees(version, asset, weight) {
1142
- if (version < Version.V5) {
1143
- return [{
1144
- BuyExecution: {
1145
- fees: asset,
1146
- weight_limit: weight ? {
1147
- Limited: {
1148
- ref_time: weight.refTime,
1149
- proof_size: weight.proofSize
1150
- }
1151
- } : 'Unlimited'
1152
- }
1153
- }];
1154
- }
1141
+ // PayFees instruction is removed temporarily in favor of BuyExecution everywhere,
1142
+ // but we keep this function for now in case we need to add it back in the future
1143
+ var createPayFees = function createPayFees(_version, asset, weight) {
1155
1144
  return [{
1156
- PayFees: {
1157
- asset: asset
1145
+ BuyExecution: {
1146
+ fees: asset,
1147
+ weight_limit: weight ? {
1148
+ Limited: {
1149
+ ref_time: weight.refTime,
1150
+ proof_size: weight.proofSize
1151
+ }
1152
+ } : 'Unlimited'
1158
1153
  }
1159
- }, {
1160
- RefundSurplus: undefined
1161
1154
  }];
1162
1155
  };
1163
1156
 
@@ -5018,7 +5011,7 @@ var getParaEthTransferFees = /*#__PURE__*/function () {
5018
5011
  };
5019
5012
  }();
5020
5013
 
5021
- var abi$1 = [
5014
+ var abi$2 = [
5022
5015
  {
5023
5016
  inputs: [
5024
5017
  {
@@ -5128,18 +5121,62 @@ var getDestinationLocation = function getDestinationLocation(api, address, desti
5128
5121
  return [1, paraId ? ["0x0000000".concat(paraId.toString(16)), acc] : [acc]];
5129
5122
  };
5130
5123
 
5124
+ var abi$1 = [{
5125
+ inputs: [{
5126
+ internalType: 'address',
5127
+ name: 'recipient_',
5128
+ type: 'address'
5129
+ }, {
5130
+ internalType: 'uint256',
5131
+ name: 'amount_',
5132
+ type: 'uint256'
5133
+ }],
5134
+ name: 'transfer',
5135
+ outputs: [{
5136
+ internalType: 'bool',
5137
+ name: '',
5138
+ type: 'bool'
5139
+ }],
5140
+ stateMutability: 'nonpayable',
5141
+ type: 'function'
5142
+ }];
5143
+ var transferMoonbeamLocal = /*#__PURE__*/function () {
5144
+ var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(client, assetInfo, _ref) {
5145
+ var signer, address, contract;
5146
+ return _regenerator().w(function (_context) {
5147
+ while (1) switch (_context.n) {
5148
+ case 0:
5149
+ signer = _ref.signer, address = _ref.address;
5150
+ assertHasId(assetInfo);
5151
+ contract = getContract({
5152
+ abi: abi$1,
5153
+ address: assetInfo.assetId,
5154
+ client: {
5155
+ "public": client,
5156
+ wallet: signer
5157
+ }
5158
+ });
5159
+ return _context.a(2, contract.write.transfer([address, assetInfo.amount]));
5160
+ }
5161
+ }, _callee);
5162
+ }));
5163
+ return function transferMoonbeamLocal(_x, _x2, _x3) {
5164
+ return _ref2.apply(this, arguments);
5165
+ };
5166
+ }();
5167
+
5131
5168
  var U_64_MAX = 18446744073709551615n;
5132
5169
  var CONTRACT_ADDRESS = '0x0000000000000000000000000000000000000804';
5133
5170
  var NATIVE_ASSET_ID = '0x0000000000000000000000000000000000000802';
5134
5171
  // Partially inspired by Moonbeam XCM-SDK
5135
5172
  var transferMoonbeamEvm = /*#__PURE__*/function () {
5136
- var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(_ref) {
5173
+ var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(options) {
5137
5174
  var _usdtAsset$assetId;
5138
- var api, from, to, signer, address, currency, contract, foundAsset, amount, asset, destLocation, weight, createTx, multiCurrencySymbols, useMultiAssets, usdtAsset, tx, _t;
5175
+ var api, from, to, signer, address, currency, foundAsset, amount, client, contract, asset, destLocation, weight, createTx, multiCurrencySymbols, useMultiAssets, usdtAsset, tx, _t;
5139
5176
  return _regenerator().w(function (_context) {
5140
5177
  while (1) switch (_context.n) {
5141
5178
  case 0:
5142
- api = _ref.api, from = _ref.from, to = _ref.to, signer = _ref.signer, address = _ref.address, currency = _ref.currency;
5179
+ api = options.api, from = options.from, to = options.to, signer = options.signer, address = options.address, currency = options.currency;
5143
5180
  if (!Array.isArray(currency)) {
5144
5181
  _context.n = 1;
5145
5182
  break;
@@ -5152,35 +5189,44 @@ var transferMoonbeamEvm = /*#__PURE__*/function () {
5152
5189
  }
5153
5190
  throw new UnsupportedOperationError('Override location is not supported for EVM transfers');
5154
5191
  case 2:
5192
+ foundAsset = findAssetInfoOrThrow(from, currency, to);
5193
+ amount = abstractDecimals(currency.amount, foundAsset.decimals, api);
5194
+ client = createPublicClient({
5195
+ chain: signer.chain,
5196
+ transport: http()
5197
+ });
5198
+ if (!(from === to)) {
5199
+ _context.n = 3;
5200
+ break;
5201
+ }
5202
+ return _context.a(2, transferMoonbeamLocal(client, _objectSpread2(_objectSpread2({}, foundAsset), {}, {
5203
+ amount: amount
5204
+ }), options));
5205
+ case 3:
5155
5206
  contract = getContract({
5156
- abi: abi$1,
5207
+ abi: abi$2,
5157
5208
  address: CONTRACT_ADDRESS,
5158
5209
  client: {
5159
- "public": createPublicClient({
5160
- chain: signer.chain,
5161
- transport: http()
5162
- }),
5210
+ "public": client,
5163
5211
  wallet: signer
5164
5212
  }
5165
5213
  });
5166
- foundAsset = findAssetInfoOrThrow(from, currency, to);
5167
- amount = abstractDecimals(currency.amount, foundAsset.decimals, api);
5168
5214
  if (!(foundAsset.symbol === getNativeAssetSymbol(from))) {
5169
- _context.n = 3;
5215
+ _context.n = 4;
5170
5216
  break;
5171
5217
  }
5172
5218
  asset = NATIVE_ASSET_ID;
5173
- _context.n = 5;
5219
+ _context.n = 6;
5174
5220
  break;
5175
- case 3:
5221
+ case 4:
5176
5222
  if (!(foundAsset.assetId === undefined)) {
5177
- _context.n = 4;
5223
+ _context.n = 5;
5178
5224
  break;
5179
5225
  }
5180
5226
  throw new InvalidCurrencyError('Currency must be a foreign asset with valid assetId');
5181
- case 4:
5182
- asset = formatAssetIdToERC20(foundAsset.assetId);
5183
5227
  case 5:
5228
+ asset = formatAssetIdToERC20(foundAsset.assetId);
5229
+ case 6:
5184
5230
  destLocation = getDestinationLocation(api, address, to);
5185
5231
  weight = U_64_MAX; // Partially inspired by Moonbeam XCM-SDK
5186
5232
  // https://github.com/moonbeam-foundation/xcm-sdk/blob/ab835c15bf41612604b1c858d956a9f07705ed65/packages/sdk/src/contract/contracts/Xtokens/Xtokens.ts#L53
@@ -5195,30 +5241,30 @@ var transferMoonbeamEvm = /*#__PURE__*/function () {
5195
5241
  }, to);
5196
5242
  assertHasId(usdtAsset);
5197
5243
  if (!useMultiAssets) {
5198
- _context.n = 7;
5244
+ _context.n = 8;
5199
5245
  break;
5200
5246
  }
5201
- _context.n = 6;
5247
+ _context.n = 7;
5202
5248
  return createTx('transferMultiCurrencies', [[[asset, amount.toString()], [formatAssetIdToERC20((_usdtAsset$assetId = usdtAsset.assetId) !== null && _usdtAsset$assetId !== void 0 ? _usdtAsset$assetId : ''), '200000']], 1,
5203
5249
  // index of the fee asset
5204
5250
  destLocation, weight]);
5205
- case 6:
5251
+ case 7:
5206
5252
  _t = _context.v;
5207
- _context.n = 9;
5253
+ _context.n = 10;
5208
5254
  break;
5209
- case 7:
5210
- _context.n = 8;
5211
- return createTx('transfer', [asset, amount.toString(), destLocation, weight]);
5212
5255
  case 8:
5213
- _t = _context.v;
5256
+ _context.n = 9;
5257
+ return createTx('transfer', [asset, amount.toString(), destLocation, weight]);
5214
5258
  case 9:
5259
+ _t = _context.v;
5260
+ case 10:
5215
5261
  tx = _t;
5216
5262
  return _context.a(2, tx);
5217
5263
  }
5218
5264
  }, _callee);
5219
5265
  }));
5220
5266
  return function transferMoonbeamEvm(_x) {
5221
- return _ref2.apply(this, arguments);
5267
+ return _ref.apply(this, arguments);
5222
5268
  };
5223
5269
  }();
5224
5270
 
@@ -9061,6 +9107,9 @@ var createBaseExecuteXcm = function createBaseExecuteXcm(options) {
9061
9107
  reserveChain = _prepareExecuteContex.reserveChain;
9062
9108
  var hopFeeAssetToReserve = useFeeAssetOnHops ? feeAssetLocalizedToReserve : undefined;
9063
9109
  var hopFeeAssetToDest = useFeeAssetOnHops ? feeAssetLocalizedToDest : undefined;
9110
+ // When fees are paid in a separate asset, originFee is denominated in that asset's
9111
+ // currency and must not be subtracted from the transfer amount.
9112
+ var originFeeDeduction = feeAsset ? 0n : originFee;
9064
9113
  var destLocation = createDestination(version, chain, destChain, paraIdTo);
9065
9114
  if (chain !== 'AssetHubPolkadot' && reserveChain === undefined) {
9066
9115
  throw new UnsupportedOperationError('Sending local reserve assets with custom fee asset is not yet supported for this chain.');
@@ -9076,7 +9125,7 @@ var createBaseExecuteXcm = function createBaseExecuteXcm(options) {
9076
9125
  DepositReserveAsset: {
9077
9126
  assets: createAssetsFilter(assetLocalizedToReserve, version),
9078
9127
  dest: createDestination(version, reserveChain !== null && reserveChain !== void 0 ? reserveChain : chain, destChain, paraIdTo),
9079
- xcm: [].concat(_toConsumableArray(createPayFees(version, hopFeeAssetToDest !== null && hopFeeAssetToDest !== void 0 ? hopFeeAssetToDest : updateAsset(assetLocalizedToDest, reserveFee === 1000n ? amount / 2n : amount - originFee - reserveFee))), _toConsumableArray(suffixXcm))
9128
+ xcm: [].concat(_toConsumableArray(createPayFees(version, hopFeeAssetToDest !== null && hopFeeAssetToDest !== void 0 ? hopFeeAssetToDest : updateAsset(assetLocalizedToDest, reserveFee === 1000n ? amount / 2n : amount - originFeeDeduction - reserveFee))), _toConsumableArray(suffixXcm))
9080
9129
  }
9081
9130
  }];
9082
9131
  var mainInstructions;
@@ -9103,7 +9152,7 @@ var createBaseExecuteXcm = function createBaseExecuteXcm(options) {
9103
9152
  InitiateTeleport: {
9104
9153
  assets: routingAssetsFilter,
9105
9154
  dest: destLocation,
9106
- xcm: [].concat(_toConsumableArray(createPayFees(version, hopFeeAssetToDest !== null && hopFeeAssetToDest !== void 0 ? hopFeeAssetToDest : updateAsset(assetLocalizedToDest, amount - originFee))), _toConsumableArray(suffixXcm))
9155
+ xcm: [].concat(_toConsumableArray(createPayFees(version, hopFeeAssetToDest !== null && hopFeeAssetToDest !== void 0 ? hopFeeAssetToDest : updateAsset(assetLocalizedToDest, amount - originFeeDeduction))), _toConsumableArray(suffixXcm))
9107
9156
  }
9108
9157
  }];
9109
9158
  break;
@@ -9113,7 +9162,7 @@ var createBaseExecuteXcm = function createBaseExecuteXcm(options) {
9113
9162
  InitiateTeleport: {
9114
9163
  assets: routingAssetsFilter,
9115
9164
  dest: getChainLocation(chain, reserveChain),
9116
- xcm: [].concat(_toConsumableArray(createPayFees(version, hopFeeAssetToReserve !== null && hopFeeAssetToReserve !== void 0 ? hopFeeAssetToReserve : updateAsset(assetLocalizedToReserve, amount - originFee))), _toConsumableArray(resolvedDepositInstruction))
9165
+ xcm: [].concat(_toConsumableArray(createPayFees(version, hopFeeAssetToReserve !== null && hopFeeAssetToReserve !== void 0 ? hopFeeAssetToReserve : updateAsset(assetLocalizedToReserve, amount - originFeeDeduction))), _toConsumableArray(resolvedDepositInstruction))
9117
9166
  }
9118
9167
  }];
9119
9168
  break;
@@ -9479,11 +9528,11 @@ var createExchangeInstructions = /*#__PURE__*/function () {
9479
9528
  var createSwapExecuteXcm = /*#__PURE__*/function () {
9480
9529
  var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(options) {
9481
9530
  var _ref3, _ref4;
9482
- var api, chain, exchangeChain, destChain, assetInfoFrom, assetInfoTo, _options$fees2, originReserveFee, destReserveFee, senderAddress, recipientAddress, version, paraIdTo, isEthereumDest, resolvedDestChain, assetFrom, amountOut, assetTo, assetToLocalizedToDest, ethFeeAssetInfo, ethBridgeFee, isMainAssetDot, nativeFeeAssetInfo, ahApi, _yield$getParaEthTran, _yield$getParaEthTran2, bridgeFee, executionFee, hasSeparateFeeAsset, _prepareCommonExecute, prefix, depositInstruction, exchangeInstructions, exchangeToDestXcm, ethAsset, messageId, snowbridgeInstructions, finalXcm, fullXcm;
9531
+ var api, chain, exchangeChain, destChain, assetInfoFrom, assetInfoTo, feeAssetInfo, _options$fees2, originFee, originReserveFee, destReserveFee, senderAddress, recipientAddress, version, paraIdTo, isEthereumDest, resolvedDestChain, assetFrom, amountOut, assetTo, assetToLocalizedToDest, ethFeeAssetInfo, ethBridgeFee, isMainAssetDot, nativeFeeAssetInfo, ahApi, _yield$getParaEthTran, _yield$getParaEthTran2, bridgeFee, executionFee, resolvedFeeAssetInfo, hasSeparateFeeAsset, _prepareCommonExecute, prefix, depositInstruction, exchangeInstructions, exchangeToDestXcm, ethAsset, messageId, snowbridgeInstructions, finalXcm, fullXcm;
9483
9532
  return _regenerator().w(function (_context2) {
9484
9533
  while (1) switch (_context2.n) {
9485
9534
  case 0:
9486
- api = options.api, chain = options.chain, exchangeChain = options.exchangeChain, destChain = options.destChain, assetInfoFrom = options.assetInfoFrom, assetInfoTo = options.assetInfoTo, _options$fees2 = options.fees, originReserveFee = _options$fees2.originReserveFee, destReserveFee = _options$fees2.destReserveFee, senderAddress = options.senderAddress, recipientAddress = options.recipientAddress, version = options.version, paraIdTo = options.paraIdTo;
9535
+ api = options.api, chain = options.chain, exchangeChain = options.exchangeChain, destChain = options.destChain, assetInfoFrom = options.assetInfoFrom, assetInfoTo = options.assetInfoTo, feeAssetInfo = options.feeAssetInfo, _options$fees2 = options.fees, originFee = _options$fees2.originFee, originReserveFee = _options$fees2.originReserveFee, destReserveFee = _options$fees2.destReserveFee, senderAddress = options.senderAddress, recipientAddress = options.recipientAddress, version = options.version, paraIdTo = options.paraIdTo;
9487
9536
  isEthereumDest = destChain !== undefined && isExternalChain(destChain); // For Ethereum destination, the actual hop target is AssetHub (bridge hub)
9488
9537
  resolvedDestChain = isEthereumDest ? "AssetHub".concat(getRelayChainOf(chain !== null && chain !== void 0 ? chain : exchangeChain)) : undefined;
9489
9538
  assetFrom = createAsset(version, assetInfoFrom.amount, localizeLocation(exchangeChain, assetInfoFrom.location));
@@ -9514,23 +9563,25 @@ var createSwapExecuteXcm = /*#__PURE__*/function () {
9514
9563
  ethFeeAssetInfo = nativeFeeAssetInfo;
9515
9564
  }
9516
9565
  case 3:
9517
- hasSeparateFeeAsset = isEthereumDest && !isMainAssetDot;
9566
+ // Ethereum fee asset takes precedence over user-provided feeAssetInfo
9567
+ resolvedFeeAssetInfo = ethFeeAssetInfo !== null && ethFeeAssetInfo !== void 0 ? ethFeeAssetInfo : feeAssetInfo;
9568
+ hasSeparateFeeAsset = isEthereumDest && !isMainAssetDot || !!feeAssetInfo;
9518
9569
  _prepareCommonExecute = prepareCommonExecuteXcm({
9519
9570
  api: api,
9520
9571
  chain: chain !== null && chain !== void 0 ? chain : exchangeChain,
9521
9572
  destChain: (_ref4 = resolvedDestChain !== null && resolvedDestChain !== void 0 ? resolvedDestChain : destChain) !== null && _ref4 !== void 0 ? _ref4 : exchangeChain,
9522
9573
  assetInfo: assetInfoFrom,
9523
- feeAssetInfo: ethFeeAssetInfo,
9574
+ feeAssetInfo: resolvedFeeAssetInfo,
9524
9575
  useJitWithdraw: isEthereumDest,
9525
9576
  recipientAddress: recipientAddress,
9526
9577
  fees: {
9527
- originFee: hasSeparateFeeAsset ? ethBridgeFee : 0n,
9578
+ originFee: hasSeparateFeeAsset ? ethBridgeFee || originFee : originFee,
9528
9579
  reserveFee: originReserveFee
9529
9580
  },
9530
9581
  version: version
9531
9582
  }, assetToLocalizedToDest), prefix = _prepareCommonExecute.prefix, depositInstruction = _prepareCommonExecute.depositInstruction;
9532
9583
  _context2.n = 4;
9533
- return createExchangeInstructions(options, assetFrom, assetTo, hasSeparateFeeAsset);
9584
+ return createExchangeInstructions(options, assetFrom, assetTo, isEthereumDest && hasSeparateFeeAsset);
9534
9585
  case 4:
9535
9586
  exchangeInstructions = _context2.v;
9536
9587
  if (!isEthereumDest) {
@@ -9663,6 +9714,7 @@ var findExchangeHopIndex = function findExchangeHopIndex(chain, dryRunResult, ex
9663
9714
  var extractFeesFromDryRun = function extractFeesFromDryRun(chain, dryRunResult, exchangeHopIndex, destChain) {
9664
9715
  var requireHopsSuccess = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
9665
9716
  var fees = {
9717
+ originFee: 0n,
9666
9718
  originReserveFee: 0n,
9667
9719
  exchangeFee: 0n,
9668
9720
  destReserveFee: 0n
@@ -9770,11 +9822,11 @@ var createXcmAndCall = /*#__PURE__*/function () {
9770
9822
  }();
9771
9823
  var handleSwapExecuteTransfer = /*#__PURE__*/function () {
9772
9824
  var _ref3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(options) {
9773
- var api, chain, exchangeChain, destChain, assetFrom, assetTo, currencyTo, senderAddress, recipientAddress, calculateMinAmountOut, version, isEthereumDest, hasSeparateFeeAsset, internalOptions, dryRunParams, fees, totalFeesPre, _yield$createXcmAndCa, initialCall, firstDryRunResult, exchangeHopIndex, extractedFees, totalFees, updatedAssetTo, amountAvailableForSwap, recalculatedMinAmountOut, _yield$createXcmAndCa2, finalCall;
9825
+ var api, chain, exchangeChain, destChain, assetFrom, assetTo, currencyTo, feeAssetInfo, senderAddress, recipientAddress, calculateMinAmountOut, version, isEthereumDest, hasSeparateFeeAsset, internalOptions, dryRunParams, FEE_ASSET_AMOUNT, dummyOriginFee, fees, totalFeesPre, _yield$createXcmAndCa, initialCall, firstDryRunResult, exchangeHopIndex, extractedFees, totalFees, updatedAssetTo, amountAvailableForSwap, recalculatedMinAmountOut, _yield$createXcmAndCa2, finalCall;
9774
9826
  return _regenerator().w(function (_context3) {
9775
9827
  while (1) switch (_context3.n) {
9776
9828
  case 0:
9777
- api = options.api, chain = options.chain, exchangeChain = options.exchangeChain, destChain = options.destChain, assetFrom = options.assetInfoFrom, assetTo = options.assetInfoTo, currencyTo = options.currencyTo, senderAddress = options.senderAddress, recipientAddress = options.recipientAddress, calculateMinAmountOut = options.calculateMinAmountOut;
9829
+ api = options.api, chain = options.chain, exchangeChain = options.exchangeChain, destChain = options.destChain, assetFrom = options.assetInfoFrom, assetTo = options.assetInfoTo, currencyTo = options.currencyTo, feeAssetInfo = options.feeAssetInfo, senderAddress = options.senderAddress, recipientAddress = options.recipientAddress, calculateMinAmountOut = options.calculateMinAmountOut;
9778
9830
  _context3.n = 1;
9779
9831
  return api.init(chain !== null && chain !== void 0 ? chain : exchangeChain);
9780
9832
  case 1:
@@ -9798,6 +9850,9 @@ var handleSwapExecuteTransfer = /*#__PURE__*/function () {
9798
9850
  location: assetFrom.location,
9799
9851
  amount: assetFrom.amount
9800
9852
  },
9853
+ feeAsset: feeAssetInfo ? {
9854
+ location: feeAssetInfo.location
9855
+ } : undefined,
9801
9856
  swapConfig: {
9802
9857
  currencyTo: currencyTo,
9803
9858
  exchangeChain: exchangeChain,
@@ -9805,7 +9860,10 @@ var handleSwapExecuteTransfer = /*#__PURE__*/function () {
9805
9860
  },
9806
9861
  useRootOrigin: true
9807
9862
  };
9863
+ FEE_ASSET_AMOUNT = 100;
9864
+ dummyOriginFee = feeAssetInfo ? parseUnits(FEE_ASSET_AMOUNT.toString(), feeAssetInfo.decimals) : 0n;
9808
9865
  fees = {
9866
+ originFee: dummyOriginFee,
9809
9867
  originReserveFee: MIN_FEE,
9810
9868
  exchangeFee: 0n,
9811
9869
  destReserveFee: MIN_FEE
@@ -9839,7 +9897,8 @@ var handleSwapExecuteTransfer = /*#__PURE__*/function () {
9839
9897
  throw new AmountTooLowError("Asset amount is too low to cover the fees, please increase the amount.");
9840
9898
  case 4:
9841
9899
  exchangeHopIndex = findExchangeHopIndex(chain, firstDryRunResult, exchangeChain, destChain);
9842
- extractedFees = extractFeesFromDryRun(chain, firstDryRunResult, exchangeHopIndex, destChain, false);
9900
+ extractedFees = extractFeesFromDryRun(chain, firstDryRunResult, exchangeHopIndex, destChain, false); // Set originFee from dry run origin fee (padded), same as handleExecuteTransfer
9901
+ extractedFees.originFee = feeAssetInfo && firstDryRunResult.origin.success ? padValueBy(firstDryRunResult.origin.fee, FEE_PADDING_PERCENTAGE) : 0n;
9843
9902
  if (extractedFees.exchangeFee === 0n) {
9844
9903
  // We set the exchange fee to non-zero value to prevent creating dummy tx
9845
9904
  extractedFees.exchangeFee = MIN_FEE;
@@ -11250,11 +11309,11 @@ var Hydration = /*#__PURE__*/function (_Chain) {
11250
11309
  key: "transferPolkadotXCM",
11251
11310
  value: function () {
11252
11311
  var _transferPolkadotXCM = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(input) {
11253
- var api, destination, feeAsset, asset, overriddenAsset, isMoonbeamWhAsset, isNativeAsset, isNativeFeeAsset, _t;
11312
+ var destination, asset, isMoonbeamWhAsset;
11254
11313
  return _regenerator().w(function (_context) {
11255
11314
  while (1) switch (_context.n) {
11256
11315
  case 0:
11257
- api = input.api, destination = input.destination, feeAsset = input.feeAssetInfo, asset = input.assetInfo, overriddenAsset = input.overriddenAsset;
11316
+ destination = input.destination, asset = input.assetInfo;
11258
11317
  if (!(destination === 'Ethereum')) {
11259
11318
  _context.n = 1;
11260
11319
  break;
@@ -11268,28 +11327,6 @@ var Hydration = /*#__PURE__*/function (_Chain) {
11268
11327
  }
11269
11328
  return _context.a(2, this.transferMoonbeamWhAsset(input));
11270
11329
  case 2:
11271
- if (!feeAsset) {
11272
- _context.n = 5;
11273
- break;
11274
- }
11275
- if (!overriddenAsset) {
11276
- _context.n = 3;
11277
- break;
11278
- }
11279
- throw new InvalidCurrencyError('Cannot use overridden assets with XCM execute');
11280
- case 3:
11281
- isNativeAsset = isSymbolMatch(asset.symbol, this.getNativeAssetSymbol());
11282
- isNativeFeeAsset = isSymbolMatch(feeAsset.symbol, this.getNativeAssetSymbol());
11283
- if (!(!isNativeAsset || !isNativeFeeAsset)) {
11284
- _context.n = 5;
11285
- break;
11286
- }
11287
- _t = api;
11288
- _context.n = 4;
11289
- return handleExecuteTransfer(input);
11290
- case 4:
11291
- return _context.a(2, _t.deserializeExtrinsics.call(_t, _context.v));
11292
- case 5:
11293
11330
  return _context.a(2, transferPolkadotXcm(input));
11294
11331
  }
11295
11332
  }, _callee, this);
@@ -12405,7 +12442,7 @@ var Moonbeam = /*#__PURE__*/function (_Chain) {
12405
12442
  }, {
12406
12443
  key: "transferLocalNonNativeAsset",
12407
12444
  value: function transferLocalNonNativeAsset(_options) {
12408
- throw new ScenarioNotSupportedError("".concat(this.chain, " local transfers are temporarily disabled"));
12445
+ throw new ScenarioNotSupportedError("".concat(this.chain, " local transfers are supported only from EVM Builder"));
12409
12446
  }
12410
12447
  }, {
12411
12448
  key: "getBalanceForeign",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paraspell/sdk-core",
3
- "version": "12.7.1",
3
+ "version": "12.8.0",
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": "^2.0.1",
27
27
  "@scure/base": "^2.0.0",
28
28
  "viem": "2.45.0",
29
- "@paraspell/pallets": "12.7.1",
30
- "@paraspell/sdk-common": "12.7.1",
31
- "@paraspell/assets": "12.7.1"
29
+ "@paraspell/pallets": "12.8.0",
30
+ "@paraspell/sdk-common": "12.8.0",
31
+ "@paraspell/assets": "12.8.0"
32
32
  },
33
33
  "devDependencies": {
34
34
  "@babel/plugin-syntax-import-attributes": "^7.28.6",