@paraspell/sdk-core 10.10.8 → 10.10.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/README.md CHANGED
@@ -38,13 +38,19 @@ This package serves as a `core` component for both `@paraspell/sdk` and `@parasp
38
38
 
39
39
  XCM SDK can be tested in [Playground](https://playground.paraspell.xyz/xcm-sdk/xcm-transfer).
40
40
 
41
+ ## Get Support 🚑
42
+
43
+ - Contact form on our [landing page](https://paraspell.xyz/#contact-us).
44
+ - Message us on our [X](https://x.com/paraspell).
45
+ - Support channel on [telegram](https://t.me/paraspell).
46
+
41
47
  ## License
42
48
 
43
49
  Made with 💛 by [ParaSpell✨](https://paraspell.xyz/)
44
50
 
45
51
  Published under [MIT License](https://github.com/paraspell/xcm-tools/blob/main/packages/sdk-core/LICENSE).
46
52
 
47
- ## Support
53
+ ## Supported by
48
54
 
49
55
  <div align="center">
50
56
  <p align="center">
package/dist/index.cjs CHANGED
@@ -3970,6 +3970,22 @@ var resolveFeeAsset = function resolveFeeAsset(feeAsset, origin, destination, cu
3970
3970
  return asset !== null && asset !== void 0 ? asset : undefined;
3971
3971
  };
3972
3972
 
3973
+ var validateAddress = function validateAddress(address, node) {
3974
+ var isDestination = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
3975
+ if (sdkCommon.isTMultiLocation(address)) return;
3976
+ var isEvm = assets.isNodeEvm(node);
3977
+ var isEthereumAddress = viem.isAddress(address);
3978
+ if (isEvm) {
3979
+ if (!isEthereumAddress) {
3980
+ throw new InvalidAddressError("".concat(isDestination ? 'Destination node' : 'Node', " is an EVM chain, but the address provided is not a valid Ethereum address."));
3981
+ }
3982
+ } else {
3983
+ if (isEthereumAddress) {
3984
+ throw new InvalidAddressError("EVM address provided but ".concat(isDestination ? 'destination ' : '', "node is not an EVM chain."));
3985
+ }
3986
+ }
3987
+ };
3988
+
3973
3989
  var isAssetHub = function isAssetHub(chain) {
3974
3990
  return chain === 'AssetHubPolkadot' || chain === 'AssetHubKusama';
3975
3991
  };
@@ -5101,7 +5117,9 @@ var dryRunInternal = /*#__PURE__*/function () {
5101
5117
  _context.n = 3;
5102
5118
  break;
5103
5119
  }
5104
- if (hasPassedExchange && swapConfig && currentChain !== swapConfig.exchangeChain) {
5120
+ if (destination === 'Ethereum' && (currentChain.includes('AssetHub') || currentChain.includes('BridgeHub'))) {
5121
+ hopCurrency = assets.getNativeAssetSymbol(currentChain);
5122
+ } else if (hasPassedExchange && swapConfig && currentChain !== swapConfig.exchangeChain) {
5105
5123
  hopCurrency = assets.findAssetOnDestOrThrow(swapConfig.exchangeChain, currentChain, swapConfig.currencyTo).symbol;
5106
5124
  } else if (isDestination) {
5107
5125
  hopCurrency = assets.findAssetOnDestOrThrow(origin, currentChain, currency).symbol;
@@ -5473,22 +5491,6 @@ var shouldPerformAssetCheck = function shouldPerformAssetCheck(origin, currency)
5473
5491
  return !(hasMultiAsset || hasOverriddenMultilocation);
5474
5492
  };
5475
5493
 
5476
- var validateAddress = function validateAddress(address, node) {
5477
- var isDestination = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
5478
- if (sdkCommon.isTMultiLocation(address)) return;
5479
- var isEvm = assets.isNodeEvm(node);
5480
- var isEthereumAddress = viem.isAddress(address);
5481
- if (isEvm) {
5482
- if (!isEthereumAddress) {
5483
- throw new InvalidAddressError("".concat(isDestination ? 'Destination node' : 'Node', " is an EVM chain, but the address provided is not a valid Ethereum address."));
5484
- }
5485
- } else {
5486
- if (isEthereumAddress) {
5487
- throw new InvalidAddressError("EVM address provided but ".concat(isDestination ? 'destination ' : '', "node is not an EVM chain."));
5488
- }
5489
- }
5490
- };
5491
-
5492
5494
  var validateDestinationAddress = function validateDestinationAddress(address, destination) {
5493
5495
  if (typeof address === 'string' && !sdkCommon.isTMultiLocation(destination)) {
5494
5496
  validateAddress(address, destination);
@@ -5733,7 +5735,7 @@ var getXcmFee = /*#__PURE__*/function () {
5733
5735
  });
5734
5736
  case 1:
5735
5737
  hopResult = _context.v;
5736
- if (hopResult.feeType === 'dryRun') {
5738
+ if (hopResult.feeType === 'dryRun' && !(destination === 'Ethereum' && (currentChain.includes('AssetHub') || currentChain.includes('BridgeHub')))) {
5737
5739
  if (hasPassedExchange && swapConfig && currentChain !== swapConfig.exchangeChain) {
5738
5740
  hopCurrency = assets.findAssetOnDestOrThrow(swapConfig.exchangeChain, currentChain, swapConfig.currencyTo).symbol;
5739
5741
  } else if (destination === currentChain) {
@@ -6165,13 +6167,68 @@ var send = /*#__PURE__*/function () {
6165
6167
  };
6166
6168
  }();
6167
6169
 
6170
+ var attemptDryRunFee = /*#__PURE__*/function () {
6171
+ var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(options) {
6172
+ var origin, currency, builder, reductionPcts, lastReduction, result, _i, _reductionPcts, percentage, modifiedBuilder, _t, _t2, _t3, _t4, _t5, _t6, _t7;
6173
+ return _regenerator().w(function (_context) {
6174
+ while (1) switch (_context.n) {
6175
+ case 0:
6176
+ origin = options.origin, currency = options.currency, builder = options.builder;
6177
+ reductionPcts = [0, 10, 20, 30, 40, 50];
6178
+ lastReduction = reductionPcts[reductionPcts.length - 1];
6179
+ result = null;
6180
+ _i = 0, _reductionPcts = reductionPcts;
6181
+ case 1:
6182
+ if (!(_i < _reductionPcts.length)) {
6183
+ _context.n = 5;
6184
+ break;
6185
+ }
6186
+ percentage = _reductionPcts[_i];
6187
+ modifiedBuilder = builder.currency(_objectSpread2(_objectSpread2({}, currency), {}, {
6188
+ amount: padFeeBy(BigInt(currency.amount), -percentage)
6189
+ }));
6190
+ _t = getOriginXcmFee;
6191
+ _t2 = _objectSpread2;
6192
+ _t3 = _objectSpread2({}, options);
6193
+ _t4 = {};
6194
+ _context.n = 2;
6195
+ return modifiedBuilder.build();
6196
+ case 2:
6197
+ _t5 = _context.v;
6198
+ _t6 = {
6199
+ tx: _t5
6200
+ };
6201
+ _t7 = _t2(_t3, _t4, _t6);
6202
+ _context.n = 3;
6203
+ return _t(_t7);
6204
+ case 3:
6205
+ result = _context.v;
6206
+ if (!(result.feeType === 'dryRun' || percentage === lastReduction || !assets.hasDryRunSupport(origin))) {
6207
+ _context.n = 4;
6208
+ break;
6209
+ }
6210
+ return _context.a(2, result);
6211
+ case 4:
6212
+ _i++;
6213
+ _context.n = 1;
6214
+ break;
6215
+ case 5:
6216
+ return _context.a(2, result);
6217
+ }
6218
+ }, _callee);
6219
+ }));
6220
+ return function attemptDryRunFee(_x) {
6221
+ return _ref.apply(this, arguments);
6222
+ };
6223
+ }();
6224
+
6168
6225
  var getTransferableAmountInternal = /*#__PURE__*/function () {
6169
6226
  var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(_ref) {
6170
- var api, senderAddress, node, destination, currency, tx, feeAsset, resolvedFeeAsset, asset, balance, ed, isNativeAsset, shouldSubstractFee, feeToSubtract, _yield$getOriginXcmFe, fee, transferable;
6227
+ var api, senderAddress, node, destination, currency, builder, feeAsset, resolvedFeeAsset, asset, balance, ed, isNativeAsset, shouldSubstractFee, feeToSubtract, _yield$attemptDryRunF, fee, transferable;
6171
6228
  return _regenerator().w(function (_context) {
6172
6229
  while (1) switch (_context.n) {
6173
6230
  case 0:
6174
- api = _ref.api, senderAddress = _ref.senderAddress, node = _ref.origin, destination = _ref.destination, currency = _ref.currency, tx = _ref.tx, feeAsset = _ref.feeAsset;
6231
+ api = _ref.api, senderAddress = _ref.senderAddress, node = _ref.origin, destination = _ref.destination, currency = _ref.currency, builder = _ref.builder, feeAsset = _ref.feeAsset;
6175
6232
  validateAddress(senderAddress, node, false);
6176
6233
  resolvedFeeAsset = feeAsset ? resolveFeeAsset(feeAsset, node, destination, currency) : undefined;
6177
6234
  asset = assets.findAssetForNodeOrThrow(node, currency, null);
@@ -6193,9 +6250,9 @@ var getTransferableAmountInternal = /*#__PURE__*/function () {
6193
6250
  break;
6194
6251
  }
6195
6252
  _context.n = 2;
6196
- return getOriginXcmFee({
6253
+ return attemptDryRunFee({
6197
6254
  api: api,
6198
- tx: tx,
6255
+ builder: builder,
6199
6256
  origin: node,
6200
6257
  destination: node,
6201
6258
  senderAddress: senderAddress,
@@ -6204,8 +6261,8 @@ var getTransferableAmountInternal = /*#__PURE__*/function () {
6204
6261
  disableFallback: false
6205
6262
  });
6206
6263
  case 2:
6207
- _yield$getOriginXcmFe = _context.v;
6208
- fee = _yield$getOriginXcmFe.fee;
6264
+ _yield$attemptDryRunF = _context.v;
6265
+ fee = _yield$attemptDryRunF.fee;
6209
6266
  if (!(fee === undefined)) {
6210
6267
  _context.n = 3;
6211
6268
  break;
@@ -11856,27 +11913,23 @@ var GeneralBuilder = /*#__PURE__*/function () {
11856
11913
  key: "getTransferableAmount",
11857
11914
  value: (function () {
11858
11915
  var _getTransferableAmount2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee8() {
11859
- var _this$_options7, from, to, senderAddress, currency, feeAsset, tx;
11916
+ var _this$_options7, from, to, senderAddress, currency, feeAsset;
11860
11917
  return _regenerator().w(function (_context8) {
11861
11918
  while (1) switch (_context8.n) {
11862
11919
  case 0:
11863
11920
  _this$_options7 = this._options, from = _this$_options7.from, to = _this$_options7.to, senderAddress = _this$_options7.senderAddress, currency = _this$_options7.currency, feeAsset = _this$_options7.feeAsset;
11864
11921
  assertToIsString(to);
11865
11922
  _context8.n = 1;
11866
- return this.build();
11867
- case 1:
11868
- tx = _context8.v;
11869
- _context8.n = 2;
11870
11923
  return getTransferableAmount({
11871
11924
  api: this.api,
11872
- tx: tx,
11925
+ builder: this,
11873
11926
  origin: from,
11874
11927
  destination: to,
11875
11928
  senderAddress: senderAddress,
11876
11929
  feeAsset: feeAsset,
11877
11930
  currency: currency
11878
11931
  });
11879
- case 2:
11932
+ case 1:
11880
11933
  return _context8.a(2, _context8.v);
11881
11934
  }
11882
11935
  }, _callee8, this);
package/dist/index.d.ts CHANGED
@@ -258,6 +258,257 @@ type TAssetClaimOptionsBase = {
258
258
  };
259
259
  type TAssetClaimOptions<TApi, TRes> = WithApi<TAssetClaimOptionsBase, TApi, TRes>;
260
260
 
261
+ /**
262
+ * Builder class for constructing asset claim transactions.
263
+ */
264
+ declare class AssetClaimBuilder<TApi, TRes, T extends Partial<TAssetClaimOptionsBase> = object> {
265
+ readonly api: IPolkadotApi<TApi, TRes>;
266
+ readonly _options: T;
267
+ constructor(api: IPolkadotApi<TApi, TRes>, options?: T);
268
+ /**
269
+ * Specifies the assets to be claimed.
270
+ *
271
+ * @param multiAssets - An array of assets to claim in a multi-asset format.
272
+ * @returns An instance of Builder
273
+ */
274
+ fungible(multiAssets: TMultiAsset[]): AssetClaimBuilder<TApi, TRes, T & {
275
+ multiAssets: TMultiAsset[];
276
+ }>;
277
+ /**
278
+ * Specifies the account address on which the assets will be claimed.
279
+ *
280
+ * @param address - The destination account address.
281
+ * @returns An instance of Builder
282
+ */
283
+ account(address: TAddress): AssetClaimBuilder<TApi, TRes, T & {
284
+ address: TAddress;
285
+ }>;
286
+ /**
287
+ * Sets the XCM version to be used for the asset claim.
288
+ *
289
+ * @param version - The XCM version.
290
+ * @returns An instance of Builder
291
+ */
292
+ xcmVersion(version: Version): AssetClaimBuilder<TApi, TRes, T & {
293
+ version: Version;
294
+ }>;
295
+ /**
296
+ * Builds and returns the asset claim extrinsic.
297
+ *
298
+ * @returns A Promise that resolves to the asset claim extrinsic.
299
+ */
300
+ build(this: AssetClaimBuilder<TApi, TRes, TAssetClaimOptionsBase>): Promise<TRes>;
301
+ /**
302
+ * Returns the API instance used by the builder.
303
+ *
304
+ * @returns The API instance.
305
+ */
306
+ getApi(): TApi;
307
+ /**
308
+ * Disconnects the API.
309
+ *
310
+ * @returns A Promise that resolves when the API is disconnected.
311
+ */
312
+ disconnect(): Promise<void>;
313
+ }
314
+
315
+ declare class BatchTransactionManager<TApi, TRes> {
316
+ transactionOptions: TSendOptions<TApi, TRes>[];
317
+ addTransaction(options: TSendOptions<TApi, TRes>): void;
318
+ isEmpty(): boolean;
319
+ buildBatch(api: IPolkadotApi<TApi, TRes>, from: TNodeDotKsmWithRelayChains, options?: TBatchOptions): Promise<TRes>;
320
+ }
321
+
322
+ /**
323
+ * A builder class for constructing Para-to-Para, Para-to-Relay, Relay-to-Para transactions and asset claims.
324
+ */
325
+ declare class GeneralBuilder<TApi, TRes, T extends Partial<TSendBaseOptions> = object> {
326
+ readonly batchManager: BatchTransactionManager<TApi, TRes>;
327
+ readonly api: IPolkadotApi<TApi, TRes>;
328
+ readonly _options: T;
329
+ constructor(api: IPolkadotApi<TApi, TRes>, batchManager: BatchTransactionManager<TApi, TRes>, options?: T);
330
+ /**
331
+ * Specifies the origin node for the transaction.
332
+ *
333
+ * @param node - The node from which the transaction originates.
334
+ * @returns An instance of Builder
335
+ */
336
+ from(node: TNodeDotKsmWithRelayChains): GeneralBuilder<TApi, TRes, T & {
337
+ from: TNodeDotKsmWithRelayChains;
338
+ }>;
339
+ /**
340
+ * Specifies the destination node for the transaction.
341
+ *
342
+ * @param node - The node to which the transaction is sent.
343
+ * @param paraIdTo - (Optional) The parachain ID of the destination node.
344
+ * @returns An instance of Builder
345
+ */
346
+ to(node: TDestination, paraIdTo?: number): GeneralBuilder<TApi, TRes, T & {
347
+ to: TDestination;
348
+ }>;
349
+ /**
350
+ * Initiates the process to claim assets from a specified node.
351
+ *
352
+ * @param node - The node from which to claim assets.
353
+ * @returns An instance of Builder
354
+ */
355
+ claimFrom(node: TNodeWithRelayChains): AssetClaimBuilder<TApi, TRes, {
356
+ node: TNodeWithRelayChains;
357
+ }>;
358
+ /**
359
+ * Specifies the currency to be used in the transaction. Symbol, ID, multi-location or multi-asset.
360
+ *
361
+ * @param currency - The currency to be transferred.
362
+ * @returns An instance of Builder
363
+ */
364
+ currency(currency: TCurrencyInputWithAmount): GeneralBuilder<TApi, TRes, T & {
365
+ currency: TCurrencyInputWithAmount;
366
+ }>;
367
+ /**
368
+ * Sets the recipient address.
369
+ *
370
+ * @param address - The destination address.
371
+ * @returns An instance of Builder
372
+ */
373
+ address(address: TAddress): GeneralBuilder<TApi, TRes, T & {
374
+ address: TAddress;
375
+ }>;
376
+ /**
377
+ * Sets the sender address.
378
+ *
379
+ * @param address - The sender address.
380
+ * @returns
381
+ */
382
+ senderAddress(address: string): GeneralBuilder<TApi, TRes, T & {
383
+ senderAddress: string;
384
+ }>;
385
+ /**
386
+ * Sets the asset hub address. This is used for transfers that go through the Asset Hub and originate from an EVM chain.
387
+ *
388
+ * @param address - The address to be used.
389
+ * @returns An instance of Builder
390
+ */
391
+ ahAddress(address: string | undefined): GeneralBuilder<TApi, TRes, T & {
392
+ ahAddress: string | undefined;
393
+ }>;
394
+ /**
395
+ * Sets the XCM version to be used for the transfer.
396
+ *
397
+ * @param version - The XCM version.
398
+ * @returns An instance of Builder
399
+ */
400
+ xcmVersion(version: Version): GeneralBuilder<TApi, TRes, T & {
401
+ version: Version;
402
+ }>;
403
+ /**
404
+ * Sets a custom pallet for the transaction.
405
+ *
406
+ * @param palletName - The name of the custom pallet to be used.
407
+ * @returns An instance of the Builder.
408
+ */
409
+ customPallet(pallet: string, method: string): GeneralBuilder<TApi, TRes, T & {
410
+ pallet: string;
411
+ method: string;
412
+ }>;
413
+ /**
414
+ * Optional fee asset for the transaction.
415
+ *
416
+ * @param currency - The currency to be used for the fee.
417
+ * @returns An instance of the Builder
418
+ */
419
+ feeAsset(currency: TCurrencyInput | undefined): GeneralBuilder<TApi, TRes, T & {
420
+ feeAsset: TCurrencyInput | undefined;
421
+ }>;
422
+ /**
423
+ * Adds the transfer transaction to the batch.
424
+ *
425
+ * @returns An instance of Builder
426
+ */
427
+ addToBatch(this: GeneralBuilder<TApi, TRes, TSendBaseOptions>): GeneralBuilder<TApi, TRes, T & {
428
+ from: TNodeDotKsmWithRelayChains;
429
+ }>;
430
+ /**
431
+ * Builds and returns the batched transaction based on the configured parameters.
432
+ *
433
+ * @param options - (Optional) Options to customize the batch transaction.
434
+ * @returns A Extrinsic representing the batched transactions.
435
+ */
436
+ buildBatch(this: GeneralBuilder<TApi, TRes, TSendBaseOptions>, options?: TBatchOptions): Promise<TRes>;
437
+ /**
438
+ * Builds and returns the transfer extrinsic.
439
+ *
440
+ * @returns A Promise that resolves to the transfer extrinsic.
441
+ */
442
+ build(this: GeneralBuilder<TApi, TRes, TSendBaseOptions>): Promise<TRes>;
443
+ dryRun(this: GeneralBuilder<TApi, TRes, TSendBaseOptionsWithSenderAddress>): Promise<TDryRunResult>;
444
+ /**
445
+ * Returns the XCM fee for the transfer using dryRun or paymentInfo function.
446
+ *
447
+ * @returns An origin and destination fee.
448
+ */
449
+ getXcmFee<TDisableFallback extends boolean = false>(this: GeneralBuilder<TApi, TRes, TSendBaseOptionsWithSenderAddress>, options?: TGetXcmFeeBuilderOptions & {
450
+ disableFallback: TDisableFallback;
451
+ }): Promise<TGetXcmFeeResult<TDisableFallback>>;
452
+ /**
453
+ * Returns the origin XCM fee for the transfer using dryRun or paymentInfo function.
454
+ *
455
+ * @returns An origin fee.
456
+ */
457
+ getOriginXcmFee(this: GeneralBuilder<TApi, TRes, TSendBaseOptionsWithSenderAddress>, { disableFallback }?: TGetXcmFeeBuilderOptions): Promise<TXcmFeeDetail & {
458
+ forwardedXcms?: any;
459
+ destParaId?: number;
460
+ }>;
461
+ /**
462
+ * Estimates the origin and destination XCM fee using paymentInfo function.
463
+ *
464
+ * @returns An origin and destination fee estimate.
465
+ */
466
+ getXcmFeeEstimate(this: GeneralBuilder<TApi, TRes, TSendBaseOptionsWithSenderAddress>): Promise<TGetXcmFeeEstimateResult>;
467
+ /**
468
+ * Estimates the origin XCM fee using paymentInfo function.
469
+ *
470
+ * @returns An origin fee estimate.
471
+ */
472
+ getOriginXcmFeeEstimate(this: GeneralBuilder<TApi, TRes, TSendBaseOptionsWithSenderAddress>): Promise<TGetXcmFeeEstimateDetail>;
473
+ /**
474
+ * Returns the max transferable amount for the transfer
475
+ *
476
+ * @returns The max transferable amount.
477
+ */
478
+ getTransferableAmount(this: GeneralBuilder<TApi, TRes, TSendBaseOptionsWithSenderAddress>): Promise<bigint>;
479
+ /**
480
+ * Returns the max transferable amount for the transfer
481
+ *
482
+ * @returns The max transferable amount.
483
+ */
484
+ verifyEdOnDestination(this: GeneralBuilder<TApi, TRes, TSendBaseOptionsWithSenderAddress>): Promise<boolean>;
485
+ /**
486
+ * Returns the transfer info for the transfer
487
+ *
488
+ * @returns The transfer info.
489
+ */
490
+ getTransferInfo(this: GeneralBuilder<TApi, TRes, TSendBaseOptionsWithSenderAddress>): Promise<TTransferInfo>;
491
+ /**
492
+ * Returns the API instance used by the builder.
493
+ *
494
+ * @returns The API instance.
495
+ */
496
+ getApi(): TApi;
497
+ /**
498
+ * Disconnects the API.
499
+ *
500
+ * @returns A Promise that resolves when the API is disconnected.
501
+ */
502
+ disconnect(): Promise<void>;
503
+ }
504
+ /**
505
+ * Creates a new Builder instance.
506
+ *
507
+ * @param api - The API instance to use for building transactions. If not provided, a new instance will be created.
508
+ * @returns A new Builder instance.
509
+ */
510
+ declare const Builder: <TApi, TRes>(api: IPolkadotApi<TApi, TRes>) => GeneralBuilder<TApi, TRes, object>;
511
+
261
512
  type TBalanceResponse = {
262
513
  free?: string;
263
514
  balance?: string;
@@ -378,7 +629,7 @@ type TGetMaxForeignTransferableAmountOptionsBase = {
378
629
  currency: TCurrencyCore;
379
630
  };
380
631
  type TGetMaxForeignTransferableAmountOptions<TApi, TRes> = WithApi<TGetMaxForeignTransferableAmountOptionsBase, TApi, TRes>;
381
- type TGetTransferableAmountOptionsBase<TRes> = {
632
+ type TGetTransferableAmountOptionsBase<TApi, TRes> = {
382
633
  /**
383
634
  * The sender address of the account.
384
635
  */
@@ -396,12 +647,12 @@ type TGetTransferableAmountOptionsBase<TRes> = {
396
647
  */
397
648
  currency: WithAmount<TCurrencyCore>;
398
649
  /**
399
- * The transaction to calculate the fee for
650
+ * The transaction builder
400
651
  */
401
- tx: TRes;
652
+ builder: GeneralBuilder<TApi, TRes, TSendBaseOptions>;
402
653
  feeAsset?: TCurrencyInput;
403
654
  };
404
- type TGetTransferableAmountOptions<TApi, TRes> = WithApi<TGetTransferableAmountOptionsBase<TRes>, TApi, TRes>;
655
+ type TGetTransferableAmountOptions<TApi, TRes> = WithApi<TGetTransferableAmountOptionsBase<TApi, TRes>, TApi, TRes>;
405
656
  type TVerifyEdOnDestinationOptionsBase<TRes> = {
406
657
  /**
407
658
  * The origin node.
@@ -965,6 +1216,9 @@ type TGetOriginXcmFeeBaseOptions<TRes> = {
965
1216
  disableFallback: boolean;
966
1217
  };
967
1218
  type TGetOriginXcmFeeOptions<TApi, TRes> = WithApi<TGetOriginXcmFeeBaseOptions<TRes>, TApi, TRes>;
1219
+ type TAttemptDryRunFeeOptions<TApi, TRes> = Omit<TGetOriginXcmFeeOptions<TApi, TRes>, 'tx'> & {
1220
+ builder: GeneralBuilder<TApi, TRes, TSendBaseOptions>;
1221
+ };
968
1222
  type TGetFeeForDestNodeBaseOptions = {
969
1223
  prevNode: TNodeDotKsmWithRelayChains;
970
1224
  origin: TNodeDotKsmWithRelayChains;
@@ -1084,257 +1338,6 @@ declare const deriveAccountId: (raw: Uint8Array) => Uint8Array;
1084
1338
  declare const encodeSs58: (payload: Uint8Array, network: number) => string;
1085
1339
  declare const convertSs58: <TApi, TRes>(api: IPolkadotApi<TApi, TRes>, address: string, node: TNodeDotKsmWithRelayChains) => string;
1086
1340
 
1087
- /**
1088
- * Builder class for constructing asset claim transactions.
1089
- */
1090
- declare class AssetClaimBuilder<TApi, TRes, T extends Partial<TAssetClaimOptionsBase> = object> {
1091
- readonly api: IPolkadotApi<TApi, TRes>;
1092
- readonly _options: T;
1093
- constructor(api: IPolkadotApi<TApi, TRes>, options?: T);
1094
- /**
1095
- * Specifies the assets to be claimed.
1096
- *
1097
- * @param multiAssets - An array of assets to claim in a multi-asset format.
1098
- * @returns An instance of Builder
1099
- */
1100
- fungible(multiAssets: TMultiAsset[]): AssetClaimBuilder<TApi, TRes, T & {
1101
- multiAssets: TMultiAsset[];
1102
- }>;
1103
- /**
1104
- * Specifies the account address on which the assets will be claimed.
1105
- *
1106
- * @param address - The destination account address.
1107
- * @returns An instance of Builder
1108
- */
1109
- account(address: TAddress): AssetClaimBuilder<TApi, TRes, T & {
1110
- address: TAddress;
1111
- }>;
1112
- /**
1113
- * Sets the XCM version to be used for the asset claim.
1114
- *
1115
- * @param version - The XCM version.
1116
- * @returns An instance of Builder
1117
- */
1118
- xcmVersion(version: Version): AssetClaimBuilder<TApi, TRes, T & {
1119
- version: Version;
1120
- }>;
1121
- /**
1122
- * Builds and returns the asset claim extrinsic.
1123
- *
1124
- * @returns A Promise that resolves to the asset claim extrinsic.
1125
- */
1126
- build(this: AssetClaimBuilder<TApi, TRes, TAssetClaimOptionsBase>): Promise<TRes>;
1127
- /**
1128
- * Returns the API instance used by the builder.
1129
- *
1130
- * @returns The API instance.
1131
- */
1132
- getApi(): TApi;
1133
- /**
1134
- * Disconnects the API.
1135
- *
1136
- * @returns A Promise that resolves when the API is disconnected.
1137
- */
1138
- disconnect(): Promise<void>;
1139
- }
1140
-
1141
- declare class BatchTransactionManager<TApi, TRes> {
1142
- transactionOptions: TSendOptions<TApi, TRes>[];
1143
- addTransaction(options: TSendOptions<TApi, TRes>): void;
1144
- isEmpty(): boolean;
1145
- buildBatch(api: IPolkadotApi<TApi, TRes>, from: TNodeDotKsmWithRelayChains, options?: TBatchOptions): Promise<TRes>;
1146
- }
1147
-
1148
- /**
1149
- * A builder class for constructing Para-to-Para, Para-to-Relay, Relay-to-Para transactions and asset claims.
1150
- */
1151
- declare class GeneralBuilder<TApi, TRes, T extends Partial<TSendBaseOptions> = object> {
1152
- readonly batchManager: BatchTransactionManager<TApi, TRes>;
1153
- readonly api: IPolkadotApi<TApi, TRes>;
1154
- readonly _options: T;
1155
- constructor(api: IPolkadotApi<TApi, TRes>, batchManager: BatchTransactionManager<TApi, TRes>, options?: T);
1156
- /**
1157
- * Specifies the origin node for the transaction.
1158
- *
1159
- * @param node - The node from which the transaction originates.
1160
- * @returns An instance of Builder
1161
- */
1162
- from(node: TNodeDotKsmWithRelayChains): GeneralBuilder<TApi, TRes, T & {
1163
- from: TNodeDotKsmWithRelayChains;
1164
- }>;
1165
- /**
1166
- * Specifies the destination node for the transaction.
1167
- *
1168
- * @param node - The node to which the transaction is sent.
1169
- * @param paraIdTo - (Optional) The parachain ID of the destination node.
1170
- * @returns An instance of Builder
1171
- */
1172
- to(node: TDestination, paraIdTo?: number): GeneralBuilder<TApi, TRes, T & {
1173
- to: TDestination;
1174
- }>;
1175
- /**
1176
- * Initiates the process to claim assets from a specified node.
1177
- *
1178
- * @param node - The node from which to claim assets.
1179
- * @returns An instance of Builder
1180
- */
1181
- claimFrom(node: TNodeWithRelayChains): AssetClaimBuilder<TApi, TRes, {
1182
- node: TNodeWithRelayChains;
1183
- }>;
1184
- /**
1185
- * Specifies the currency to be used in the transaction. Symbol, ID, multi-location or multi-asset.
1186
- *
1187
- * @param currency - The currency to be transferred.
1188
- * @returns An instance of Builder
1189
- */
1190
- currency(currency: TCurrencyInputWithAmount): GeneralBuilder<TApi, TRes, T & {
1191
- currency: TCurrencyInputWithAmount;
1192
- }>;
1193
- /**
1194
- * Sets the recipient address.
1195
- *
1196
- * @param address - The destination address.
1197
- * @returns An instance of Builder
1198
- */
1199
- address(address: TAddress): GeneralBuilder<TApi, TRes, T & {
1200
- address: TAddress;
1201
- }>;
1202
- /**
1203
- * Sets the sender address.
1204
- *
1205
- * @param address - The sender address.
1206
- * @returns
1207
- */
1208
- senderAddress(address: string): GeneralBuilder<TApi, TRes, T & {
1209
- senderAddress: string;
1210
- }>;
1211
- /**
1212
- * Sets the asset hub address. This is used for transfers that go through the Asset Hub and originate from an EVM chain.
1213
- *
1214
- * @param address - The address to be used.
1215
- * @returns An instance of Builder
1216
- */
1217
- ahAddress(address: string | undefined): GeneralBuilder<TApi, TRes, T & {
1218
- ahAddress: string | undefined;
1219
- }>;
1220
- /**
1221
- * Sets the XCM version to be used for the transfer.
1222
- *
1223
- * @param version - The XCM version.
1224
- * @returns An instance of Builder
1225
- */
1226
- xcmVersion(version: Version): GeneralBuilder<TApi, TRes, T & {
1227
- version: Version;
1228
- }>;
1229
- /**
1230
- * Sets a custom pallet for the transaction.
1231
- *
1232
- * @param palletName - The name of the custom pallet to be used.
1233
- * @returns An instance of the Builder.
1234
- */
1235
- customPallet(pallet: string, method: string): GeneralBuilder<TApi, TRes, T & {
1236
- pallet: string;
1237
- method: string;
1238
- }>;
1239
- /**
1240
- * Optional fee asset for the transaction.
1241
- *
1242
- * @param currency - The currency to be used for the fee.
1243
- * @returns An instance of the Builder
1244
- */
1245
- feeAsset(currency: TCurrencyInput | undefined): GeneralBuilder<TApi, TRes, T & {
1246
- feeAsset: TCurrencyInput | undefined;
1247
- }>;
1248
- /**
1249
- * Adds the transfer transaction to the batch.
1250
- *
1251
- * @returns An instance of Builder
1252
- */
1253
- addToBatch(this: GeneralBuilder<TApi, TRes, TSendBaseOptions>): GeneralBuilder<TApi, TRes, T & {
1254
- from: TNodeDotKsmWithRelayChains;
1255
- }>;
1256
- /**
1257
- * Builds and returns the batched transaction based on the configured parameters.
1258
- *
1259
- * @param options - (Optional) Options to customize the batch transaction.
1260
- * @returns A Extrinsic representing the batched transactions.
1261
- */
1262
- buildBatch(this: GeneralBuilder<TApi, TRes, TSendBaseOptions>, options?: TBatchOptions): Promise<TRes>;
1263
- /**
1264
- * Builds and returns the transfer extrinsic.
1265
- *
1266
- * @returns A Promise that resolves to the transfer extrinsic.
1267
- */
1268
- build(this: GeneralBuilder<TApi, TRes, TSendBaseOptions>): Promise<TRes>;
1269
- dryRun(this: GeneralBuilder<TApi, TRes, TSendBaseOptionsWithSenderAddress>): Promise<TDryRunResult>;
1270
- /**
1271
- * Returns the XCM fee for the transfer using dryRun or paymentInfo function.
1272
- *
1273
- * @returns An origin and destination fee.
1274
- */
1275
- getXcmFee<TDisableFallback extends boolean = false>(this: GeneralBuilder<TApi, TRes, TSendBaseOptionsWithSenderAddress>, options?: TGetXcmFeeBuilderOptions & {
1276
- disableFallback: TDisableFallback;
1277
- }): Promise<TGetXcmFeeResult<TDisableFallback>>;
1278
- /**
1279
- * Returns the origin XCM fee for the transfer using dryRun or paymentInfo function.
1280
- *
1281
- * @returns An origin fee.
1282
- */
1283
- getOriginXcmFee(this: GeneralBuilder<TApi, TRes, TSendBaseOptionsWithSenderAddress>, { disableFallback }?: TGetXcmFeeBuilderOptions): Promise<TXcmFeeDetail & {
1284
- forwardedXcms?: any;
1285
- destParaId?: number;
1286
- }>;
1287
- /**
1288
- * Estimates the origin and destination XCM fee using paymentInfo function.
1289
- *
1290
- * @returns An origin and destination fee estimate.
1291
- */
1292
- getXcmFeeEstimate(this: GeneralBuilder<TApi, TRes, TSendBaseOptionsWithSenderAddress>): Promise<TGetXcmFeeEstimateResult>;
1293
- /**
1294
- * Estimates the origin XCM fee using paymentInfo function.
1295
- *
1296
- * @returns An origin fee estimate.
1297
- */
1298
- getOriginXcmFeeEstimate(this: GeneralBuilder<TApi, TRes, TSendBaseOptionsWithSenderAddress>): Promise<TGetXcmFeeEstimateDetail>;
1299
- /**
1300
- * Returns the max transferable amount for the transfer
1301
- *
1302
- * @returns The max transferable amount.
1303
- */
1304
- getTransferableAmount(this: GeneralBuilder<TApi, TRes, TSendBaseOptionsWithSenderAddress>): Promise<bigint>;
1305
- /**
1306
- * Returns the max transferable amount for the transfer
1307
- *
1308
- * @returns The max transferable amount.
1309
- */
1310
- verifyEdOnDestination(this: GeneralBuilder<TApi, TRes, TSendBaseOptionsWithSenderAddress>): Promise<boolean>;
1311
- /**
1312
- * Returns the transfer info for the transfer
1313
- *
1314
- * @returns The transfer info.
1315
- */
1316
- getTransferInfo(this: GeneralBuilder<TApi, TRes, TSendBaseOptionsWithSenderAddress>): Promise<TTransferInfo>;
1317
- /**
1318
- * Returns the API instance used by the builder.
1319
- *
1320
- * @returns The API instance.
1321
- */
1322
- getApi(): TApi;
1323
- /**
1324
- * Disconnects the API.
1325
- *
1326
- * @returns A Promise that resolves when the API is disconnected.
1327
- */
1328
- disconnect(): Promise<void>;
1329
- }
1330
- /**
1331
- * Creates a new Builder instance.
1332
- *
1333
- * @param api - The API instance to use for building transactions. If not provided, a new instance will be created.
1334
- * @returns A new Builder instance.
1335
- */
1336
- declare const Builder: <TApi, TRes>(api: IPolkadotApi<TApi, TRes>) => GeneralBuilder<TApi, TRes, object>;
1337
-
1338
1341
  declare const ETH_CHAIN_ID: bigint;
1339
1342
  declare const ETHEREUM_JUNCTION: TJunction;
1340
1343
  declare const TX_CLIENT_TIMEOUT_MS: number;
@@ -1940,7 +1943,7 @@ declare const getBalanceNative: <TApi, TRes>(options: TGetBalanceNativeOptions<T
1940
1943
  declare const getOriginFeeDetailsInternal: <TApi, TRes>({ api, account, accountDestination, ahAddress, currency, origin, destination, feeMarginPercentage }: TGetOriginFeeDetailsOptions<TApi, TRes>) => Promise<TOriginFeeDetails>;
1941
1944
  declare const getOriginFeeDetails: <TApi, TRes>(options: TGetOriginFeeDetailsOptions<TApi, TRes>) => Promise<TOriginFeeDetails>;
1942
1945
 
1943
- declare const getTransferableAmountInternal: <TApi, TRes>({ api, senderAddress, origin: node, destination, currency, tx, feeAsset }: TGetTransferableAmountOptions<TApi, TRes>) => Promise<bigint>;
1946
+ declare const getTransferableAmountInternal: <TApi, TRes>({ api, senderAddress, origin: node, destination, currency, builder, feeAsset }: TGetTransferableAmountOptions<TApi, TRes>) => Promise<bigint>;
1944
1947
  declare const getTransferableAmount: <TApi, TRes>(options: TGetTransferableAmountOptions<TApi, TRes>) => Promise<bigint>;
1945
1948
 
1946
1949
  declare const getTransferInfo: <TApi, TRes>({ api, tx, origin, destination, senderAddress, ahAddress, address, currency, feeAsset }: TGetTransferInfoOptions<TApi, TRes>) => Promise<TTransferInfo>;
@@ -2081,4 +2084,4 @@ declare const handleToAhTeleport: <TApi, TRes>(origin: TNodePolkadotKusama, inpu
2081
2084
  declare const validateAddress: (address: TAddress, node: TNodeWithRelayChains, isDestination?: boolean) => void;
2082
2085
 
2083
2086
  export { AssetClaimBuilder, BatchMode, BridgeHaltedError, Builder, DRY_RUN_CLIENT_TIMEOUT_MS, DryRunFailedError, ETHEREUM_JUNCTION, ETH_CHAIN_ID, GeneralBuilder, IncompatibleNodesError, InvalidAddressError, InvalidParameterError, NoXCMSupportImplementedError, NodeNotSupportedError, PolkadotXcmError, ScenarioNotSupportedError, TX_CLIENT_TIMEOUT_MS, TransferToAhNotSupported, UnableToComputeError, XTokensError, addEthereumBridgeFees, addXcmVersionHeader, assertAddressIsString, assertHasLocation, assertToIsString, blake2b256, blake2b512, claimAssets, computeFeeFromDryRun, computeFeeFromDryRunPjs, convertSs58, createApiInstanceForNode, createAssetsFilter, createBaseExecuteXcm, createBeneficiaryLocXTokens, createBeneficiaryLocation, createDirectExecuteXcm, createExecuteCall, createExecuteExchangeXcm, createMultiAsset, createVersionedMultiAssets, createX1Payload, deriveAccountId, dryRun, dryRunOrigin, encodeSs58, getAssetBalance, getAssetBalanceInternal, getBalanceForeign, getBalanceForeignInternal, getBalanceNative, getBalanceNativeInternal, getBridgeStatus, getChainLocation, getChainVersion, getNode, getNodeConfig, getNodeProviders, getOriginFeeDetails, getOriginFeeDetailsInternal, getOriginXcmFee, getOriginXcmFeeEstimate, getParaEthTransferFees, getParaId, getRelayChainOf, getTNode, getTransferInfo, getTransferableAmount, getTransferableAmountInternal, getXcmFee, getXcmFeeEstimate, handleExecuteTransfer, handleSwapExecuteTransfer, handleToAhTeleport, localizeLocation, maybeOverrideMultiAsset, maybeOverrideMultiAssets, padFee, padFeeBy, resolveModuleError, resolveParaId, reverseTransformMultiLocation, send, sortMultiAssets, transferMoonbeamEvm, transferMoonbeamToEth, transferRelayToPara, traverseXcmHops, validateAddress, verifyEdOnDestination };
2084
- export type { HopProcessParams, HopTraversalConfig, HopTraversalResult, IPolkadotApi, IPolkadotXCMTransfer, IXTokensTransfer, IXTransferTransfer, OneKey, TAddress, TApiOrUrl, TAssetClaimOptions, TAssetClaimOptionsBase, TBalanceResponse, TBatchOptions, TBifrostToken, TBridgeStatus, TConditionalXcmFeeDetail, TConditionalXcmFeeHopInfo, TCreateBaseSwapXcmOptions, TCreateBaseTransferXcmOptions, TCreateBeneficiaryOptions, TCreateBeneficiaryXTokensOptions, TCreateSwapXcmInternalOptions, TCreateSwapXcmOptions, TCreateTransferXcmOptions, TDestWeight, TDestXcmFeeDetail, TDestination, TDryRunBaseOptions, TDryRunCallBaseOptions, TDryRunCallOptions, TDryRunChain, TDryRunNodeFailure, TDryRunNodeResult, TDryRunNodeResultInternal, TDryRunNodeSuccess, TDryRunOptions, TDryRunResult, TDryRunXcmBaseOptions, TDryRunXcmOptions, TEdJsonMap, TEvmBuilderOptions, TEvmBuilderOptionsBase, TEvmNodeFrom, TFeeType, TForeignAssetId, TForeignOrNativeAsset, TForeignOrTokenAsset, TGetAssetBalanceOptions, TGetAssetBalanceOptionsBase, TGetBalanceForeignOptions, TGetBalanceForeignOptionsBase, TGetBalanceNativeOptions, TGetBalanceNativeOptionsBase, TGetFeeForDestNodeBaseOptions, TGetFeeForDestNodeOptions, TGetMaxForeignTransferableAmountOptions, TGetMaxForeignTransferableAmountOptionsBase, TGetMaxNativeTransferableAmountOptions, TGetMaxNativeTransferableAmountOptionsBase, TGetOriginFeeDetailsOptions, TGetOriginFeeDetailsOptionsBase, TGetOriginXcmFeeBaseOptions, TGetOriginXcmFeeEstimateOptions, TGetOriginXcmFeeOptions, TGetReverseTxFeeOptions, TGetTransferInfoOptions, TGetTransferInfoOptionsBase, TGetTransferableAmountOptions, TGetTransferableAmountOptionsBase, TGetXcmFeeBaseOptions, TGetXcmFeeBuilderOptions, TGetXcmFeeEstimateDetail, TGetXcmFeeEstimateOptions, TGetXcmFeeEstimateResult, TGetXcmFeeOptions, TGetXcmFeeResult, THopInfo, THopTransferInfo, THubKey, TMantaAsset, TModuleError, TNativeTokenAsset, TNodeConfig, TNodeConfigMap, TNodleAsset, TOriginFeeDetails, TOtherReserveAsset, TPolkadotXCMTransferOptions, TPolkadotXcmMethod, TProviderEntry, TRelayToParaDestination, TRelayToParaOptions, TRelayToParaOverrides, TReserveAsset, TScenario, TSelfReserveAsset, TSendBaseOptions, TSendBaseOptionsWithSenderAddress, TSendInternalOptions, TSendOptions, TSerializeEthTransferOptions, TSerializedApiCall, TSerializedEthTransfer, TSwapFeeEstimates, TTransferFeeEstimates, TTransferInfo, TTransferLocalOptions, TVerifyEdOnDestinationOptions, TVerifyEdOnDestinationOptionsBase, TWeight, TXTokensCurrencySelection, TXTokensMethod, TXTokensTransferOptions, TXTransferMethod, TXTransferTransferOptions, TXcmAsset, TXcmFeeBase, TXcmFeeChain, TXcmFeeDetail, TXcmFeeDetailWithFallback, TXcmFeeHopInfo, TXcmForeignAsset, TXcmPalletMethod, TXcmVersioned, TZeitgeistAsset, WithApi, WithRequiredSenderAddress, XcmFeeHopResult };
2087
+ export type { HopProcessParams, HopTraversalConfig, HopTraversalResult, IPolkadotApi, IPolkadotXCMTransfer, IXTokensTransfer, IXTransferTransfer, OneKey, TAddress, TApiOrUrl, TAssetClaimOptions, TAssetClaimOptionsBase, TAttemptDryRunFeeOptions, TBalanceResponse, TBatchOptions, TBifrostToken, TBridgeStatus, TConditionalXcmFeeDetail, TConditionalXcmFeeHopInfo, TCreateBaseSwapXcmOptions, TCreateBaseTransferXcmOptions, TCreateBeneficiaryOptions, TCreateBeneficiaryXTokensOptions, TCreateSwapXcmInternalOptions, TCreateSwapXcmOptions, TCreateTransferXcmOptions, TDestWeight, TDestXcmFeeDetail, TDestination, TDryRunBaseOptions, TDryRunCallBaseOptions, TDryRunCallOptions, TDryRunChain, TDryRunNodeFailure, TDryRunNodeResult, TDryRunNodeResultInternal, TDryRunNodeSuccess, TDryRunOptions, TDryRunResult, TDryRunXcmBaseOptions, TDryRunXcmOptions, TEdJsonMap, TEvmBuilderOptions, TEvmBuilderOptionsBase, TEvmNodeFrom, TFeeType, TForeignAssetId, TForeignOrNativeAsset, TForeignOrTokenAsset, TGetAssetBalanceOptions, TGetAssetBalanceOptionsBase, TGetBalanceForeignOptions, TGetBalanceForeignOptionsBase, TGetBalanceNativeOptions, TGetBalanceNativeOptionsBase, TGetFeeForDestNodeBaseOptions, TGetFeeForDestNodeOptions, TGetMaxForeignTransferableAmountOptions, TGetMaxForeignTransferableAmountOptionsBase, TGetMaxNativeTransferableAmountOptions, TGetMaxNativeTransferableAmountOptionsBase, TGetOriginFeeDetailsOptions, TGetOriginFeeDetailsOptionsBase, TGetOriginXcmFeeBaseOptions, TGetOriginXcmFeeEstimateOptions, TGetOriginXcmFeeOptions, TGetReverseTxFeeOptions, TGetTransferInfoOptions, TGetTransferInfoOptionsBase, TGetTransferableAmountOptions, TGetTransferableAmountOptionsBase, TGetXcmFeeBaseOptions, TGetXcmFeeBuilderOptions, TGetXcmFeeEstimateDetail, TGetXcmFeeEstimateOptions, TGetXcmFeeEstimateResult, TGetXcmFeeOptions, TGetXcmFeeResult, THopInfo, THopTransferInfo, THubKey, TMantaAsset, TModuleError, TNativeTokenAsset, TNodeConfig, TNodeConfigMap, TNodleAsset, TOriginFeeDetails, TOtherReserveAsset, TPolkadotXCMTransferOptions, TPolkadotXcmMethod, TProviderEntry, TRelayToParaDestination, TRelayToParaOptions, TRelayToParaOverrides, TReserveAsset, TScenario, TSelfReserveAsset, TSendBaseOptions, TSendBaseOptionsWithSenderAddress, TSendInternalOptions, TSendOptions, TSerializeEthTransferOptions, TSerializedApiCall, TSerializedEthTransfer, TSwapFeeEstimates, TTransferFeeEstimates, TTransferInfo, TTransferLocalOptions, TVerifyEdOnDestinationOptions, TVerifyEdOnDestinationOptionsBase, TWeight, TXTokensCurrencySelection, TXTokensMethod, TXTokensTransferOptions, TXTransferMethod, TXTransferTransferOptions, TXcmAsset, TXcmFeeBase, TXcmFeeChain, TXcmFeeDetail, TXcmFeeDetailWithFallback, TXcmFeeHopInfo, TXcmForeignAsset, TXcmPalletMethod, TXcmVersioned, TZeitgeistAsset, WithApi, WithRequiredSenderAddress, XcmFeeHopResult };
package/dist/index.mjs CHANGED
@@ -3971,6 +3971,22 @@ var resolveFeeAsset = function resolveFeeAsset(feeAsset, origin, destination, cu
3971
3971
  return asset !== null && asset !== void 0 ? asset : undefined;
3972
3972
  };
3973
3973
 
3974
+ var validateAddress = function validateAddress(address, node) {
3975
+ var isDestination = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
3976
+ if (isTMultiLocation(address)) return;
3977
+ var isEvm = isNodeEvm(node);
3978
+ var isEthereumAddress = isAddress(address);
3979
+ if (isEvm) {
3980
+ if (!isEthereumAddress) {
3981
+ throw new InvalidAddressError("".concat(isDestination ? 'Destination node' : 'Node', " is an EVM chain, but the address provided is not a valid Ethereum address."));
3982
+ }
3983
+ } else {
3984
+ if (isEthereumAddress) {
3985
+ throw new InvalidAddressError("EVM address provided but ".concat(isDestination ? 'destination ' : '', "node is not an EVM chain."));
3986
+ }
3987
+ }
3988
+ };
3989
+
3974
3990
  var isAssetHub = function isAssetHub(chain) {
3975
3991
  return chain === 'AssetHubPolkadot' || chain === 'AssetHubKusama';
3976
3992
  };
@@ -5102,7 +5118,9 @@ var dryRunInternal = /*#__PURE__*/function () {
5102
5118
  _context.n = 3;
5103
5119
  break;
5104
5120
  }
5105
- if (hasPassedExchange && swapConfig && currentChain !== swapConfig.exchangeChain) {
5121
+ if (destination === 'Ethereum' && (currentChain.includes('AssetHub') || currentChain.includes('BridgeHub'))) {
5122
+ hopCurrency = getNativeAssetSymbol(currentChain);
5123
+ } else if (hasPassedExchange && swapConfig && currentChain !== swapConfig.exchangeChain) {
5106
5124
  hopCurrency = findAssetOnDestOrThrow(swapConfig.exchangeChain, currentChain, swapConfig.currencyTo).symbol;
5107
5125
  } else if (isDestination) {
5108
5126
  hopCurrency = findAssetOnDestOrThrow(origin, currentChain, currency).symbol;
@@ -5474,22 +5492,6 @@ var shouldPerformAssetCheck = function shouldPerformAssetCheck(origin, currency)
5474
5492
  return !(hasMultiAsset || hasOverriddenMultilocation);
5475
5493
  };
5476
5494
 
5477
- var validateAddress = function validateAddress(address, node) {
5478
- var isDestination = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
5479
- if (isTMultiLocation(address)) return;
5480
- var isEvm = isNodeEvm(node);
5481
- var isEthereumAddress = isAddress(address);
5482
- if (isEvm) {
5483
- if (!isEthereumAddress) {
5484
- throw new InvalidAddressError("".concat(isDestination ? 'Destination node' : 'Node', " is an EVM chain, but the address provided is not a valid Ethereum address."));
5485
- }
5486
- } else {
5487
- if (isEthereumAddress) {
5488
- throw new InvalidAddressError("EVM address provided but ".concat(isDestination ? 'destination ' : '', "node is not an EVM chain."));
5489
- }
5490
- }
5491
- };
5492
-
5493
5495
  var validateDestinationAddress = function validateDestinationAddress(address, destination) {
5494
5496
  if (typeof address === 'string' && !isTMultiLocation(destination)) {
5495
5497
  validateAddress(address, destination);
@@ -5734,7 +5736,7 @@ var getXcmFee = /*#__PURE__*/function () {
5734
5736
  });
5735
5737
  case 1:
5736
5738
  hopResult = _context.v;
5737
- if (hopResult.feeType === 'dryRun') {
5739
+ if (hopResult.feeType === 'dryRun' && !(destination === 'Ethereum' && (currentChain.includes('AssetHub') || currentChain.includes('BridgeHub')))) {
5738
5740
  if (hasPassedExchange && swapConfig && currentChain !== swapConfig.exchangeChain) {
5739
5741
  hopCurrency = findAssetOnDestOrThrow(swapConfig.exchangeChain, currentChain, swapConfig.currencyTo).symbol;
5740
5742
  } else if (destination === currentChain) {
@@ -6166,13 +6168,68 @@ var send = /*#__PURE__*/function () {
6166
6168
  };
6167
6169
  }();
6168
6170
 
6171
+ var attemptDryRunFee = /*#__PURE__*/function () {
6172
+ var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(options) {
6173
+ var origin, currency, builder, reductionPcts, lastReduction, result, _i, _reductionPcts, percentage, modifiedBuilder, _t, _t2, _t3, _t4, _t5, _t6, _t7;
6174
+ return _regenerator().w(function (_context) {
6175
+ while (1) switch (_context.n) {
6176
+ case 0:
6177
+ origin = options.origin, currency = options.currency, builder = options.builder;
6178
+ reductionPcts = [0, 10, 20, 30, 40, 50];
6179
+ lastReduction = reductionPcts[reductionPcts.length - 1];
6180
+ result = null;
6181
+ _i = 0, _reductionPcts = reductionPcts;
6182
+ case 1:
6183
+ if (!(_i < _reductionPcts.length)) {
6184
+ _context.n = 5;
6185
+ break;
6186
+ }
6187
+ percentage = _reductionPcts[_i];
6188
+ modifiedBuilder = builder.currency(_objectSpread2(_objectSpread2({}, currency), {}, {
6189
+ amount: padFeeBy(BigInt(currency.amount), -percentage)
6190
+ }));
6191
+ _t = getOriginXcmFee;
6192
+ _t2 = _objectSpread2;
6193
+ _t3 = _objectSpread2({}, options);
6194
+ _t4 = {};
6195
+ _context.n = 2;
6196
+ return modifiedBuilder.build();
6197
+ case 2:
6198
+ _t5 = _context.v;
6199
+ _t6 = {
6200
+ tx: _t5
6201
+ };
6202
+ _t7 = _t2(_t3, _t4, _t6);
6203
+ _context.n = 3;
6204
+ return _t(_t7);
6205
+ case 3:
6206
+ result = _context.v;
6207
+ if (!(result.feeType === 'dryRun' || percentage === lastReduction || !hasDryRunSupport(origin))) {
6208
+ _context.n = 4;
6209
+ break;
6210
+ }
6211
+ return _context.a(2, result);
6212
+ case 4:
6213
+ _i++;
6214
+ _context.n = 1;
6215
+ break;
6216
+ case 5:
6217
+ return _context.a(2, result);
6218
+ }
6219
+ }, _callee);
6220
+ }));
6221
+ return function attemptDryRunFee(_x) {
6222
+ return _ref.apply(this, arguments);
6223
+ };
6224
+ }();
6225
+
6169
6226
  var getTransferableAmountInternal = /*#__PURE__*/function () {
6170
6227
  var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(_ref) {
6171
- var api, senderAddress, node, destination, currency, tx, feeAsset, resolvedFeeAsset, asset, balance, ed, isNativeAsset, shouldSubstractFee, feeToSubtract, _yield$getOriginXcmFe, fee, transferable;
6228
+ var api, senderAddress, node, destination, currency, builder, feeAsset, resolvedFeeAsset, asset, balance, ed, isNativeAsset, shouldSubstractFee, feeToSubtract, _yield$attemptDryRunF, fee, transferable;
6172
6229
  return _regenerator().w(function (_context) {
6173
6230
  while (1) switch (_context.n) {
6174
6231
  case 0:
6175
- api = _ref.api, senderAddress = _ref.senderAddress, node = _ref.origin, destination = _ref.destination, currency = _ref.currency, tx = _ref.tx, feeAsset = _ref.feeAsset;
6232
+ api = _ref.api, senderAddress = _ref.senderAddress, node = _ref.origin, destination = _ref.destination, currency = _ref.currency, builder = _ref.builder, feeAsset = _ref.feeAsset;
6176
6233
  validateAddress(senderAddress, node, false);
6177
6234
  resolvedFeeAsset = feeAsset ? resolveFeeAsset(feeAsset, node, destination, currency) : undefined;
6178
6235
  asset = findAssetForNodeOrThrow(node, currency, null);
@@ -6194,9 +6251,9 @@ var getTransferableAmountInternal = /*#__PURE__*/function () {
6194
6251
  break;
6195
6252
  }
6196
6253
  _context.n = 2;
6197
- return getOriginXcmFee({
6254
+ return attemptDryRunFee({
6198
6255
  api: api,
6199
- tx: tx,
6256
+ builder: builder,
6200
6257
  origin: node,
6201
6258
  destination: node,
6202
6259
  senderAddress: senderAddress,
@@ -6205,8 +6262,8 @@ var getTransferableAmountInternal = /*#__PURE__*/function () {
6205
6262
  disableFallback: false
6206
6263
  });
6207
6264
  case 2:
6208
- _yield$getOriginXcmFe = _context.v;
6209
- fee = _yield$getOriginXcmFe.fee;
6265
+ _yield$attemptDryRunF = _context.v;
6266
+ fee = _yield$attemptDryRunF.fee;
6210
6267
  if (!(fee === undefined)) {
6211
6268
  _context.n = 3;
6212
6269
  break;
@@ -11857,27 +11914,23 @@ var GeneralBuilder = /*#__PURE__*/function () {
11857
11914
  key: "getTransferableAmount",
11858
11915
  value: (function () {
11859
11916
  var _getTransferableAmount2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee8() {
11860
- var _this$_options7, from, to, senderAddress, currency, feeAsset, tx;
11917
+ var _this$_options7, from, to, senderAddress, currency, feeAsset;
11861
11918
  return _regenerator().w(function (_context8) {
11862
11919
  while (1) switch (_context8.n) {
11863
11920
  case 0:
11864
11921
  _this$_options7 = this._options, from = _this$_options7.from, to = _this$_options7.to, senderAddress = _this$_options7.senderAddress, currency = _this$_options7.currency, feeAsset = _this$_options7.feeAsset;
11865
11922
  assertToIsString(to);
11866
11923
  _context8.n = 1;
11867
- return this.build();
11868
- case 1:
11869
- tx = _context8.v;
11870
- _context8.n = 2;
11871
11924
  return getTransferableAmount({
11872
11925
  api: this.api,
11873
- tx: tx,
11926
+ builder: this,
11874
11927
  origin: from,
11875
11928
  destination: to,
11876
11929
  senderAddress: senderAddress,
11877
11930
  feeAsset: feeAsset,
11878
11931
  currency: currency
11879
11932
  });
11880
- case 2:
11933
+ case 1:
11881
11934
  return _context8.a(2, _context8.v);
11882
11935
  }
11883
11936
  }, _callee8, this);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paraspell/sdk-core",
3
- "version": "10.10.8",
3
+ "version": "10.10.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": "^1.2.6",
28
28
  "viem": "^2.31.6",
29
- "@paraspell/assets": "10.10.8",
30
- "@paraspell/sdk-common": "10.10.8",
31
- "@paraspell/pallets": "10.10.8"
29
+ "@paraspell/assets": "10.10.10",
30
+ "@paraspell/pallets": "10.10.10",
31
+ "@paraspell/sdk-common": "10.10.10"
32
32
  },
33
33
  "devDependencies": {
34
34
  "@babel/plugin-syntax-import-attributes": "^7.27.1",