@paraspell/sdk-core 11.4.2 → 11.5.1

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.
Files changed (4) hide show
  1. package/dist/index.cjs +6976 -6804
  2. package/dist/index.d.ts +504 -497
  3. package/dist/index.mjs +6977 -6808
  4. package/package.json +4 -4
package/dist/index.d.ts CHANGED
@@ -267,10 +267,264 @@ type TAssetClaimInternalOptions<TApi, TRes> = TAssetClaimOptions<TApi, TRes> & {
267
267
  assets: TAsset<bigint>[];
268
268
  };
269
269
 
270
- type TBalanceResponse = {
271
- free?: string;
272
- balance?: string;
273
- };
270
+ /**
271
+ * Builder class for constructing asset claim transactions.
272
+ */
273
+ declare class AssetClaimBuilder<TApi, TRes, T extends Partial<TAssetClaimOptionsBase> = object> {
274
+ readonly api: IPolkadotApi<TApi, TRes>;
275
+ readonly _options: T;
276
+ constructor(api: IPolkadotApi<TApi, TRes>, options?: T);
277
+ /**
278
+ * Specifies the assets to be claimed.
279
+ *
280
+ * @param assets - An array of assets to claim in a multi-asset format.
281
+ * @returns An instance of Builder
282
+ */
283
+ currency(currency: TAssetClaimOptionsBase['currency']): AssetClaimBuilder<TApi, TRes, T & {
284
+ currency: TAssetClaimOptionsBase['currency'];
285
+ }>;
286
+ /**
287
+ * Specifies the account address on which the assets will be claimed.
288
+ *
289
+ * @param address - The destination account address.
290
+ * @returns An instance of Builder
291
+ */
292
+ address(address: TAddress): AssetClaimBuilder<TApi, TRes, T & {
293
+ address: TAddress;
294
+ }>;
295
+ /**
296
+ * Sets the XCM version to be used for the asset claim.
297
+ *
298
+ * @param version - The XCM version.
299
+ * @returns An instance of Builder
300
+ */
301
+ xcmVersion(version: Version): AssetClaimBuilder<TApi, TRes, T & {
302
+ version: Version;
303
+ }>;
304
+ /**
305
+ * Builds and returns the asset claim extrinsic.
306
+ *
307
+ * @returns A Promise that resolves to the asset claim extrinsic.
308
+ */
309
+ build(this: AssetClaimBuilder<TApi, TRes, TAssetClaimOptionsBase>): Promise<TRes>;
310
+ /**
311
+ * Returns the API instance used by the builder.
312
+ *
313
+ * @returns The API instance.
314
+ */
315
+ getApi(): TApi;
316
+ /**
317
+ * Disconnects the API.
318
+ *
319
+ * @returns A Promise that resolves when the API is disconnected.
320
+ */
321
+ disconnect(): Promise<void>;
322
+ }
323
+
324
+ declare class BatchTransactionManager<TApi, TRes> {
325
+ transactionOptions: TSendOptions<TApi, TRes>[];
326
+ addTransaction(options: TSendOptions<TApi, TRes>): void;
327
+ isEmpty(): boolean;
328
+ buildBatch(api: IPolkadotApi<TApi, TRes>, from: TSubstrateChain, options?: TBatchOptions): Promise<TRes>;
329
+ }
330
+
331
+ /**
332
+ * A builder class for constructing Para-to-Para, Para-to-Relay, Relay-to-Para transactions and asset claims.
333
+ */
334
+ declare class GeneralBuilder<TApi, TRes, T extends Partial<TSendBaseOptions> = object> {
335
+ readonly batchManager: BatchTransactionManager<TApi, TRes>;
336
+ readonly api: IPolkadotApi<TApi, TRes>;
337
+ readonly _options: T;
338
+ constructor(api: IPolkadotApi<TApi, TRes>, batchManager: BatchTransactionManager<TApi, TRes>, options?: T);
339
+ /**
340
+ * Specifies the origin chain for the transaction.
341
+ *
342
+ * @param chain - The chain from which the transaction originates.
343
+ * @returns An instance of Builder
344
+ */
345
+ from(chain: TSubstrateChain): GeneralBuilder<TApi, TRes, T & {
346
+ from: TSubstrateChain;
347
+ }>;
348
+ /**
349
+ * Specifies the destination chain for the transaction.
350
+ *
351
+ * @param chain - The chain to which the transaction is sent.
352
+ * @param paraIdTo - (Optional) The parachain ID of the destination chain.
353
+ * @returns An instance of Builder
354
+ */
355
+ to(chain: TDestination, paraIdTo?: number): GeneralBuilder<TApi, TRes, T & {
356
+ to: TDestination;
357
+ }>;
358
+ /**
359
+ * Initiates the process to claim assets from a specified chain.
360
+ *
361
+ * @param chain - The chain from which to claim assets.
362
+ * @returns An instance of Builder
363
+ */
364
+ claimFrom(chain: TSubstrateChain): AssetClaimBuilder<TApi, TRes, {
365
+ chain: TSubstrateChain;
366
+ }>;
367
+ /**
368
+ * Specifies the currency to be used in the transaction. Symbol, ID, location or multi-asset.
369
+ *
370
+ * @param currency - The currency to be transferred.
371
+ * @returns An instance of Builder
372
+ */
373
+ currency(currency: TCurrencyInputWithAmount): GeneralBuilder<TApi, TRes, T & {
374
+ currency: TCurrencyInputWithAmount;
375
+ }>;
376
+ /**
377
+ * Sets the recipient address.
378
+ *
379
+ * @param address - The destination address.
380
+ * @returns An instance of Builder
381
+ */
382
+ address(address: TAddress): GeneralBuilder<TApi, TRes, T & {
383
+ address: TAddress;
384
+ }>;
385
+ /**
386
+ * Sets the sender address.
387
+ *
388
+ * @param address - The sender address.
389
+ * @returns
390
+ */
391
+ senderAddress(address: string): GeneralBuilder<TApi, TRes, T & {
392
+ senderAddress: string;
393
+ }>;
394
+ /**
395
+ * Sets the asset hub address. This is used for transfers that go through the Asset Hub and originate from an EVM chain.
396
+ *
397
+ * @param address - The address to be used.
398
+ * @returns An instance of Builder
399
+ */
400
+ ahAddress(address: string | undefined): GeneralBuilder<TApi, TRes, T & {
401
+ ahAddress: string | undefined;
402
+ }>;
403
+ /**
404
+ * Sets the XCM version to be used for the transfer.
405
+ *
406
+ * @param version - The XCM version.
407
+ * @returns An instance of Builder
408
+ */
409
+ xcmVersion(version: Version): GeneralBuilder<TApi, TRes, T & {
410
+ version: Version;
411
+ }>;
412
+ /**
413
+ * Sets a custom pallet for the transaction.
414
+ *
415
+ * @param palletName - The name of the custom pallet to be used.
416
+ * @returns An instance of the Builder.
417
+ */
418
+ customPallet(pallet: string, method: string): GeneralBuilder<TApi, TRes, T & {
419
+ pallet: string;
420
+ method: string;
421
+ }>;
422
+ /**
423
+ * Optional fee asset for the transaction.
424
+ *
425
+ * @param currency - The currency to be used for the fee.
426
+ * @returns An instance of the Builder
427
+ */
428
+ feeAsset(currency: TCurrencyInput | undefined): GeneralBuilder<TApi, TRes, T & {
429
+ feeAsset: TCurrencyInput | undefined;
430
+ }>;
431
+ /**
432
+ * Adds the transfer transaction to the batch.
433
+ *
434
+ * @returns An instance of Builder
435
+ */
436
+ addToBatch(this: GeneralBuilder<TApi, TRes, TSendBaseOptions>): GeneralBuilder<TApi, TRes, T & {
437
+ from: TSubstrateChain;
438
+ }>;
439
+ /**
440
+ * Builds and returns the batched transaction based on the configured parameters.
441
+ *
442
+ * @param options - (Optional) Options to customize the batch transaction.
443
+ * @returns A Extrinsic representing the batched transactions.
444
+ */
445
+ buildBatch(this: GeneralBuilder<TApi, TRes, TSendBaseOptions>, options?: TBatchOptions): Promise<TRes>;
446
+ /**
447
+ * Builds and returns the transfer extrinsic.
448
+ *
449
+ * @returns A Promise that resolves to the transfer extrinsic.
450
+ */
451
+ build(this: GeneralBuilder<TApi, TRes, TSendBaseOptions>): Promise<TRes>;
452
+ dryRun(this: GeneralBuilder<TApi, TRes, TSendBaseOptionsWithSenderAddress>): Promise<TDryRunResult>;
453
+ dryRunPreview(this: GeneralBuilder<TApi, TRes, TSendBaseOptionsWithSenderAddress>, options?: TDryRunPreviewOptions): Promise<TDryRunResult>;
454
+ /**
455
+ * Returns the XCM fee for the transfer using dryRun or paymentInfo function.
456
+ *
457
+ * @returns An origin and destination fee.
458
+ */
459
+ getXcmFee<TDisableFallback extends boolean = false>(this: GeneralBuilder<TApi, TRes, TSendBaseOptionsWithSenderAddress>, options?: TGetXcmFeeBuilderOptions & {
460
+ disableFallback: TDisableFallback;
461
+ }): Promise<TGetXcmFeeResult<TDisableFallback>>;
462
+ /**
463
+ * Returns the origin XCM fee for the transfer using dryRun or paymentInfo function.
464
+ *
465
+ * @returns An origin fee.
466
+ */
467
+ getOriginXcmFee(this: GeneralBuilder<TApi, TRes, TSendBaseOptionsWithSenderAddress>, { disableFallback }?: TGetXcmFeeBuilderOptions): Promise<TXcmFeeDetail & {
468
+ forwardedXcms?: any;
469
+ destParaId?: number;
470
+ }>;
471
+ /**
472
+ * Estimates the origin and destination XCM fee using paymentInfo function.
473
+ *
474
+ * @returns An origin and destination fee estimate.
475
+ */
476
+ getXcmFeeEstimate(this: GeneralBuilder<TApi, TRes, TSendBaseOptionsWithSenderAddress>): Promise<TGetXcmFeeEstimateResult>;
477
+ /**
478
+ * Estimates the origin XCM fee using paymentInfo function.
479
+ *
480
+ * @returns An origin fee estimate.
481
+ */
482
+ getOriginXcmFeeEstimate(this: GeneralBuilder<TApi, TRes, TSendBaseOptionsWithSenderAddress>): Promise<TGetXcmFeeEstimateDetail>;
483
+ /**
484
+ * Returns the max transferable amount for the transfer
485
+ *
486
+ * @returns The max transferable amount.
487
+ */
488
+ getTransferableAmount(this: GeneralBuilder<TApi, TRes, TSendBaseOptionsWithSenderAddress>): Promise<bigint>;
489
+ /**
490
+ * Returns the min transferable amount for the transfer
491
+ *
492
+ * @returns The min transferable amount.
493
+ */
494
+ getMinTransferableAmount(this: GeneralBuilder<TApi, TRes, TSendBaseOptionsWithSenderAddress>): Promise<bigint>;
495
+ /**
496
+ * Returns the max transferable amount for the transfer
497
+ *
498
+ * @returns The max transferable amount.
499
+ */
500
+ verifyEdOnDestination(this: GeneralBuilder<TApi, TRes, TSendBaseOptionsWithSenderAddress>): Promise<boolean>;
501
+ /**
502
+ * Returns the transfer info for the transfer
503
+ *
504
+ * @returns The transfer info.
505
+ */
506
+ getTransferInfo(this: GeneralBuilder<TApi, TRes, TSendBaseOptionsWithSenderAddress>): Promise<TTransferInfo>;
507
+ /**
508
+ * Returns the API instance used by the builder.
509
+ *
510
+ * @returns The API instance.
511
+ */
512
+ getApi(): TApi;
513
+ /**
514
+ * Disconnects the API.
515
+ *
516
+ * @returns A Promise that resolves when the API is disconnected.
517
+ */
518
+ disconnect(): Promise<void>;
519
+ }
520
+ /**
521
+ * Creates a new Builder instance.
522
+ *
523
+ * @param api - The API instance to use for building transactions. If not provided, a new instance will be created.
524
+ * @returns A new Builder instance.
525
+ */
526
+ declare const Builder: <TApi, TRes>(api: IPolkadotApi<TApi, TRes>) => GeneralBuilder<TApi, TRes, object>;
527
+
274
528
  /**
275
529
  * Retrieves the native asset balance for a given account on a specified chain.
276
530
  */
@@ -362,38 +616,6 @@ type TGetOriginFeeDetailsOptionsBase = {
362
616
  feeMarginPercentage?: number;
363
617
  };
364
618
  type TGetOriginFeeDetailsOptions<TApi, TRes> = WithApi<TGetOriginFeeDetailsOptionsBase, TApi, TRes>;
365
- type TGetMaxNativeTransferableAmountOptionsBase = {
366
- /**
367
- * The address of the account.
368
- */
369
- address: string;
370
- /**
371
- * The chain on which to query the balance.
372
- */
373
- chain: TSubstrateChain;
374
- /**
375
- * The currency to query.
376
- */
377
- currency?: {
378
- symbol: string;
379
- };
380
- };
381
- type TGetMaxNativeTransferableAmountOptions<TApi, TRes> = WithApi<TGetMaxNativeTransferableAmountOptionsBase, TApi, TRes>;
382
- type TGetMaxForeignTransferableAmountOptionsBase = {
383
- /**
384
- * The address of the account.
385
- */
386
- address: string;
387
- /**
388
- * The chain on which to query the balance.
389
- */
390
- chain: TParachain;
391
- /**
392
- * The currency to query.
393
- */
394
- currency: TCurrencyCore;
395
- };
396
- type TGetMaxForeignTransferableAmountOptions<TApi, TRes> = WithApi<TGetMaxForeignTransferableAmountOptionsBase, TApi, TRes>;
397
619
  type TGetTransferableAmountOptionsBase<TRes> = {
398
620
  /**
399
621
  * The sender address of the account.
@@ -418,6 +640,10 @@ type TGetTransferableAmountOptionsBase<TRes> = {
418
640
  feeAsset?: TCurrencyInput;
419
641
  };
420
642
  type TGetTransferableAmountOptions<TApi, TRes> = WithApi<TGetTransferableAmountOptionsBase<TRes>, TApi, TRes>;
643
+ type TGetMinTransferableAmountOptions<TApi, TRes> = WithApi<TGetTransferableAmountOptionsBase<TRes> & {
644
+ address: string;
645
+ builder: GeneralBuilder<TApi, TRes, TSendBaseOptions>;
646
+ }, TApi, TRes>;
421
647
  type TVerifyEdOnDestinationOptionsBase<TRes> = {
422
648
  /**
423
649
  * The origin chain.
@@ -620,12 +846,14 @@ type TDryRunCallBaseOptions<TRes> = {
620
846
  };
621
847
  type TDryRunBypassOptions<TApi, TRes> = WithApi<Omit<TDryRunCallBaseOptions<TRes>, 'useRootOrigin'>, TApi, TRes>;
622
848
  type TDryRunCallOptions<TApi, TRes> = WithApi<TDryRunCallBaseOptions<TRes>, TApi, TRes>;
623
- type TDryRunXcmBaseOptions = {
849
+ type TDryRunXcmBaseOptions<TRes> = {
624
850
  originLocation: any;
625
851
  /**
626
852
  * The XCM instructions
627
853
  */
628
854
  xcm: any;
855
+ /** The transaction to dry-run */
856
+ tx: TRes;
629
857
  /**
630
858
  * The chain to dry-run on
631
859
  */
@@ -639,7 +867,7 @@ type TDryRunXcmBaseOptions = {
639
867
  amount: bigint;
640
868
  originFee: bigint;
641
869
  };
642
- type TDryRunXcmOptions<TApi, TRes> = WithApi<TDryRunXcmBaseOptions, TApi, TRes>;
870
+ type TDryRunXcmOptions<TApi, TRes> = WithApi<TDryRunXcmBaseOptions<TRes>, TApi, TRes>;
643
871
  type TDryRunResBase = {
644
872
  /** @deprecated Use `asset` property instead. */
645
873
  currency: string;
@@ -793,472 +1021,117 @@ declare class BridgeHaltedError extends Error {
793
1021
  */
794
1022
  declare class ChainNotSupportedError extends Error {
795
1023
  /**
796
- * Constructs a new ChainNotSupportedError.
797
- *
798
- * @param message - Optional custom error message.
799
- */
800
- constructor(message?: string);
801
- }
802
-
803
- /**
804
- * Error thrown when the Dry Run fails.
805
- */
806
- declare class DryRunFailedError extends Error {
807
- readonly reason: string;
808
- readonly dryRunType?: 'origin' | 'destination' | 'assetHub' | 'bridgeHub';
809
- /**
810
- * Constructs a new DryRunFailedError.
811
- *
812
- * @param reason - The reason why the dry run failed.
813
- * @param dryRunType - Optional. Specifies if the error is related to the 'origin' or 'destination' dry run.
814
- */
815
- constructor(reason: string, dryRunType?: 'origin' | 'destination' | 'assetHub' | 'bridgeHub');
816
- }
817
-
818
- /**
819
- * Error thrown when chains from different relay chains are incompatible.
820
- */
821
- declare class IncompatibleChainsError extends Error {
822
- /**
823
- * Constructs a new IncompatibleChainsError.
824
- *
825
- * @param message - Optional custom error message.
826
- */
827
- constructor(message?: string);
828
- }
829
-
830
- /**
831
- * Error thrown when an invalid address is provided.
832
- */
833
- declare class InvalidAddressError extends Error {
834
- /**
835
- * Constructs a new InvalidAddressError.
836
- *
837
- * @param message - The error message.
838
- */
839
- constructor(message: string);
840
- }
841
-
842
- /**
843
- * Error thrown when the Dry Run fails.
844
- */
845
- declare class InvalidParameterError extends Error {
846
- /**
847
- * Constructs a new InvalidParameterError.
848
- *
849
- * @param message - Required error message.
850
- */
851
- constructor(message: string);
852
- }
853
-
854
- /**
855
- * Error development mode is on and no API override is provided for a specific chain.
856
- */
857
- declare class MissingChainApiError extends Error {
858
- /**
859
- * Constructs a new MissingChainApiError.
860
- *
861
- * @param chain - The chain for which the API is missing.
862
- */
863
- constructor(chain: TChain);
864
- }
865
-
866
- /**
867
- * Used to inform user, that Parachain they wish to use has not yet implemented full XCM Support
868
- */
869
- declare class NoXCMSupportImplementedError extends Error {
870
- /**
871
- * Constructs a new NoXCMSupportImplementedError.
872
- *
873
- * @param chain - The chain for which XCM support is not implemented.
874
- */
875
- constructor(chain: TChain);
876
- }
877
-
878
- /**
879
- * Used to inform user, that Parachain they wish to use does not support scenario they wish to use yet
880
- */
881
- declare class ScenarioNotSupportedError extends Error {
882
- /**
883
- * Constructs a new ScenarioNotSupportedError.
884
- *
885
- * @param chain - The chain where the scenario is not supported.
886
- * @param scenario - The scenario that is not supported.
887
- * @param message - Optional custom error message.
888
- */
889
- constructor(chain: TChain, scenario: TScenario, message?: string);
890
- }
891
-
892
- declare class TransferToAhNotSupported extends Error {
893
- constructor(message?: string);
894
- }
895
-
896
- /**
897
- * UnableToComputeError is thrown when a computation cannot be performed.
898
- */
899
- declare class UnableToComputeError extends Error {
900
- /**
901
- * Constructs a new UnableToComputeError.
902
- *
903
- * @param message - Required error message.
904
- */
905
- constructor(message: string);
906
- }
907
-
908
- type THopTransferInfo = {
909
- chain: TChain;
910
- result: {
911
- xcmFee: TXcmFeeBase$1;
912
- balance?: bigint;
913
- existentialDeposit?: bigint;
914
- /** @deprecated use `asset` property instead */
915
- currencySymbol: string;
916
- asset: TAssetInfo;
917
- };
918
- };
919
- type TXcmFeeBase$1 = {
920
- fee: bigint;
921
- balance: bigint;
922
- /** @deprecated use `asset` property instead */
923
- currencySymbol: string;
924
- asset: TAssetInfo;
925
- };
926
- type TTransferInfo = {
927
- chain: {
928
- origin: TChain;
929
- destination: TChain;
930
- ecosystem: string;
931
- };
932
- origin: {
933
- selectedCurrency: {
934
- sufficient: boolean;
935
- balance: bigint;
936
- balanceAfter: bigint;
937
- /** @deprecated use `asset` property instead */
938
- currencySymbol: string;
939
- asset: TAssetInfo;
940
- existentialDeposit: bigint;
941
- };
942
- xcmFee: TXcmFeeBase$1 & {
943
- sufficient: boolean;
944
- balanceAfter: bigint;
945
- };
946
- };
947
- assetHub?: {
948
- balance: bigint;
949
- /** @deprecated use `asset` property instead */
950
- currencySymbol: string;
951
- asset: TAssetInfo;
952
- existentialDeposit: bigint;
953
- xcmFee: TXcmFeeBase$1;
954
- };
955
- bridgeHub?: {
956
- /** @deprecated use `asset` property instead */
957
- currencySymbol: string;
958
- asset: TAssetInfo;
959
- xcmFee: TXcmFeeBase$1;
960
- };
961
- hops?: THopTransferInfo[];
962
- destination: {
963
- receivedCurrency: {
964
- sufficient: boolean | UnableToComputeError;
965
- receivedAmount: bigint | UnableToComputeError;
966
- balance: bigint;
967
- balanceAfter: bigint | UnableToComputeError;
968
- /** @deprecated use `asset` property instead */
969
- currencySymbol: string;
970
- asset: TAssetInfo;
971
- existentialDeposit: bigint;
972
- };
973
- xcmFee: TXcmFeeBase$1 & {
974
- balanceAfter: bigint | UnableToComputeError;
975
- };
976
- };
977
- };
978
- type TOriginFeeDetails = {
979
- sufficientForXCM: boolean;
980
- xcmFee: bigint;
981
- };
982
- type TGetTransferInfoOptionsBase<TRes> = {
983
- tx: TRes;
984
- origin: TSubstrateChain;
985
- destination: TChain;
986
- senderAddress: string;
987
- ahAddress?: string;
988
- address: string;
989
- currency: WithAmount<TCurrencyCore>;
990
- feeAsset?: TCurrencyCore;
991
- };
992
- type TGetTransferInfoOptions<TApi, TRes> = WithApi<TGetTransferInfoOptionsBase<TRes>, TApi, TRes>;
993
-
994
- type TChainWithApi<TApi, TRes, T = TSubstrateChain> = {
995
- api: IPolkadotApi<TApi, TRes>;
996
- chain: T;
997
- };
998
- type TTypeAndThenCallContext<TApi, TRes> = {
999
- origin: TChainWithApi<TApi, TRes>;
1000
- dest: TChainWithApi<TApi, TRes>;
1001
- reserve: TChainWithApi<TApi, TRes, TSubstrateChain>;
1002
- assetInfo: WithAmount<TAssetWithLocation>;
1003
- options: TPolkadotXCMTransferOptions<TApi, TRes>;
1004
- };
1005
- type TTypeAndThenFees = {
1006
- reserveFee: bigint;
1007
- refundFee: bigint;
1008
- destFee: bigint;
1009
- };
1010
-
1011
- /**
1012
- * Builder class for constructing asset claim transactions.
1013
- */
1014
- declare class AssetClaimBuilder<TApi, TRes, T extends Partial<TAssetClaimOptionsBase> = object> {
1015
- readonly api: IPolkadotApi<TApi, TRes>;
1016
- readonly _options: T;
1017
- constructor(api: IPolkadotApi<TApi, TRes>, options?: T);
1018
- /**
1019
- * Specifies the assets to be claimed.
1020
- *
1021
- * @param assets - An array of assets to claim in a multi-asset format.
1022
- * @returns An instance of Builder
1023
- */
1024
- currency(currency: TAssetClaimOptionsBase['currency']): AssetClaimBuilder<TApi, TRes, T & {
1025
- currency: TAssetClaimOptionsBase['currency'];
1026
- }>;
1027
- /**
1028
- * Specifies the account address on which the assets will be claimed.
1029
- *
1030
- * @param address - The destination account address.
1031
- * @returns An instance of Builder
1032
- */
1033
- address(address: TAddress): AssetClaimBuilder<TApi, TRes, T & {
1034
- address: TAddress;
1035
- }>;
1036
- /**
1037
- * Sets the XCM version to be used for the asset claim.
1038
- *
1039
- * @param version - The XCM version.
1040
- * @returns An instance of Builder
1041
- */
1042
- xcmVersion(version: Version): AssetClaimBuilder<TApi, TRes, T & {
1043
- version: Version;
1044
- }>;
1045
- /**
1046
- * Builds and returns the asset claim extrinsic.
1047
- *
1048
- * @returns A Promise that resolves to the asset claim extrinsic.
1049
- */
1050
- build(this: AssetClaimBuilder<TApi, TRes, TAssetClaimOptionsBase>): Promise<TRes>;
1051
- /**
1052
- * Returns the API instance used by the builder.
1053
- *
1054
- * @returns The API instance.
1055
- */
1056
- getApi(): TApi;
1057
- /**
1058
- * Disconnects the API.
1059
- *
1060
- * @returns A Promise that resolves when the API is disconnected.
1061
- */
1062
- disconnect(): Promise<void>;
1063
- }
1064
-
1065
- declare class BatchTransactionManager<TApi, TRes> {
1066
- transactionOptions: TSendOptions<TApi, TRes>[];
1067
- addTransaction(options: TSendOptions<TApi, TRes>): void;
1068
- isEmpty(): boolean;
1069
- buildBatch(api: IPolkadotApi<TApi, TRes>, from: TSubstrateChain, options?: TBatchOptions): Promise<TRes>;
1070
- }
1071
-
1072
- /**
1073
- * A builder class for constructing Para-to-Para, Para-to-Relay, Relay-to-Para transactions and asset claims.
1074
- */
1075
- declare class GeneralBuilder<TApi, TRes, T extends Partial<TSendBaseOptions> = object> {
1076
- readonly batchManager: BatchTransactionManager<TApi, TRes>;
1077
- readonly api: IPolkadotApi<TApi, TRes>;
1078
- readonly _options: T;
1079
- constructor(api: IPolkadotApi<TApi, TRes>, batchManager: BatchTransactionManager<TApi, TRes>, options?: T);
1080
- /**
1081
- * Specifies the origin chain for the transaction.
1082
- *
1083
- * @param chain - The chain from which the transaction originates.
1084
- * @returns An instance of Builder
1085
- */
1086
- from(chain: TSubstrateChain): GeneralBuilder<TApi, TRes, T & {
1087
- from: TSubstrateChain;
1088
- }>;
1089
- /**
1090
- * Specifies the destination chain for the transaction.
1091
- *
1092
- * @param chain - The chain to which the transaction is sent.
1093
- * @param paraIdTo - (Optional) The parachain ID of the destination chain.
1094
- * @returns An instance of Builder
1095
- */
1096
- to(chain: TDestination, paraIdTo?: number): GeneralBuilder<TApi, TRes, T & {
1097
- to: TDestination;
1098
- }>;
1099
- /**
1100
- * Initiates the process to claim assets from a specified chain.
1101
- *
1102
- * @param chain - The chain from which to claim assets.
1103
- * @returns An instance of Builder
1104
- */
1105
- claimFrom(chain: TSubstrateChain): AssetClaimBuilder<TApi, TRes, {
1106
- chain: TSubstrateChain;
1107
- }>;
1108
- /**
1109
- * Specifies the currency to be used in the transaction. Symbol, ID, location or multi-asset.
1110
- *
1111
- * @param currency - The currency to be transferred.
1112
- * @returns An instance of Builder
1113
- */
1114
- currency(currency: TCurrencyInputWithAmount): GeneralBuilder<TApi, TRes, T & {
1115
- currency: TCurrencyInputWithAmount;
1116
- }>;
1117
- /**
1118
- * Sets the recipient address.
1119
- *
1120
- * @param address - The destination address.
1121
- * @returns An instance of Builder
1122
- */
1123
- address(address: TAddress): GeneralBuilder<TApi, TRes, T & {
1124
- address: TAddress;
1125
- }>;
1126
- /**
1127
- * Sets the sender address.
1128
- *
1129
- * @param address - The sender address.
1130
- * @returns
1131
- */
1132
- senderAddress(address: string): GeneralBuilder<TApi, TRes, T & {
1133
- senderAddress: string;
1134
- }>;
1135
- /**
1136
- * Sets the asset hub address. This is used for transfers that go through the Asset Hub and originate from an EVM chain.
1137
- *
1138
- * @param address - The address to be used.
1139
- * @returns An instance of Builder
1140
- */
1141
- ahAddress(address: string | undefined): GeneralBuilder<TApi, TRes, T & {
1142
- ahAddress: string | undefined;
1143
- }>;
1144
- /**
1145
- * Sets the XCM version to be used for the transfer.
1146
- *
1147
- * @param version - The XCM version.
1148
- * @returns An instance of Builder
1149
- */
1150
- xcmVersion(version: Version): GeneralBuilder<TApi, TRes, T & {
1151
- version: Version;
1152
- }>;
1153
- /**
1154
- * Sets a custom pallet for the transaction.
1155
- *
1156
- * @param palletName - The name of the custom pallet to be used.
1157
- * @returns An instance of the Builder.
1158
- */
1159
- customPallet(pallet: string, method: string): GeneralBuilder<TApi, TRes, T & {
1160
- pallet: string;
1161
- method: string;
1162
- }>;
1163
- /**
1164
- * Optional fee asset for the transaction.
1165
- *
1166
- * @param currency - The currency to be used for the fee.
1167
- * @returns An instance of the Builder
1168
- */
1169
- feeAsset(currency: TCurrencyInput | undefined): GeneralBuilder<TApi, TRes, T & {
1170
- feeAsset: TCurrencyInput | undefined;
1171
- }>;
1172
- /**
1173
- * Adds the transfer transaction to the batch.
1174
- *
1175
- * @returns An instance of Builder
1176
- */
1177
- addToBatch(this: GeneralBuilder<TApi, TRes, TSendBaseOptions>): GeneralBuilder<TApi, TRes, T & {
1178
- from: TSubstrateChain;
1179
- }>;
1180
- /**
1181
- * Builds and returns the batched transaction based on the configured parameters.
1182
- *
1183
- * @param options - (Optional) Options to customize the batch transaction.
1184
- * @returns A Extrinsic representing the batched transactions.
1185
- */
1186
- buildBatch(this: GeneralBuilder<TApi, TRes, TSendBaseOptions>, options?: TBatchOptions): Promise<TRes>;
1187
- /**
1188
- * Builds and returns the transfer extrinsic.
1189
- *
1190
- * @returns A Promise that resolves to the transfer extrinsic.
1191
- */
1192
- build(this: GeneralBuilder<TApi, TRes, TSendBaseOptions>): Promise<TRes>;
1193
- dryRun(this: GeneralBuilder<TApi, TRes, TSendBaseOptionsWithSenderAddress>): Promise<TDryRunResult>;
1194
- dryRunPreview(this: GeneralBuilder<TApi, TRes, TSendBaseOptionsWithSenderAddress>, options?: TDryRunPreviewOptions): Promise<TDryRunResult>;
1195
- /**
1196
- * Returns the XCM fee for the transfer using dryRun or paymentInfo function.
1197
- *
1198
- * @returns An origin and destination fee.
1199
- */
1200
- getXcmFee<TDisableFallback extends boolean = false>(this: GeneralBuilder<TApi, TRes, TSendBaseOptionsWithSenderAddress>, options?: TGetXcmFeeBuilderOptions & {
1201
- disableFallback: TDisableFallback;
1202
- }): Promise<TGetXcmFeeResult<TDisableFallback>>;
1203
- /**
1204
- * Returns the origin XCM fee for the transfer using dryRun or paymentInfo function.
1024
+ * Constructs a new ChainNotSupportedError.
1205
1025
  *
1206
- * @returns An origin fee.
1026
+ * @param message - Optional custom error message.
1207
1027
  */
1208
- getOriginXcmFee(this: GeneralBuilder<TApi, TRes, TSendBaseOptionsWithSenderAddress>, { disableFallback }?: TGetXcmFeeBuilderOptions): Promise<TXcmFeeDetail & {
1209
- forwardedXcms?: any;
1210
- destParaId?: number;
1211
- }>;
1028
+ constructor(message?: string);
1029
+ }
1030
+
1031
+ /**
1032
+ * Error thrown when the Dry Run fails.
1033
+ */
1034
+ declare class DryRunFailedError extends Error {
1035
+ readonly reason: string;
1036
+ readonly dryRunType?: 'origin' | 'destination' | 'assetHub' | 'bridgeHub';
1212
1037
  /**
1213
- * Estimates the origin and destination XCM fee using paymentInfo function.
1038
+ * Constructs a new DryRunFailedError.
1214
1039
  *
1215
- * @returns An origin and destination fee estimate.
1040
+ * @param reason - The reason why the dry run failed.
1041
+ * @param dryRunType - Optional. Specifies if the error is related to the 'origin' or 'destination' dry run.
1216
1042
  */
1217
- getXcmFeeEstimate(this: GeneralBuilder<TApi, TRes, TSendBaseOptionsWithSenderAddress>): Promise<TGetXcmFeeEstimateResult>;
1043
+ constructor(reason: string, dryRunType?: 'origin' | 'destination' | 'assetHub' | 'bridgeHub');
1044
+ }
1045
+
1046
+ /**
1047
+ * Error thrown when chains from different relay chains are incompatible.
1048
+ */
1049
+ declare class IncompatibleChainsError extends Error {
1218
1050
  /**
1219
- * Estimates the origin XCM fee using paymentInfo function.
1051
+ * Constructs a new IncompatibleChainsError.
1220
1052
  *
1221
- * @returns An origin fee estimate.
1053
+ * @param message - Optional custom error message.
1222
1054
  */
1223
- getOriginXcmFeeEstimate(this: GeneralBuilder<TApi, TRes, TSendBaseOptionsWithSenderAddress>): Promise<TGetXcmFeeEstimateDetail>;
1055
+ constructor(message?: string);
1056
+ }
1057
+
1058
+ /**
1059
+ * Error thrown when an invalid address is provided.
1060
+ */
1061
+ declare class InvalidAddressError extends Error {
1224
1062
  /**
1225
- * Returns the max transferable amount for the transfer
1063
+ * Constructs a new InvalidAddressError.
1226
1064
  *
1227
- * @returns The max transferable amount.
1065
+ * @param message - The error message.
1228
1066
  */
1229
- getTransferableAmount(this: GeneralBuilder<TApi, TRes, TSendBaseOptionsWithSenderAddress>): Promise<bigint>;
1067
+ constructor(message: string);
1068
+ }
1069
+
1070
+ /**
1071
+ * Error thrown when the Dry Run fails.
1072
+ */
1073
+ declare class InvalidParameterError extends Error {
1230
1074
  /**
1231
- * Returns the max transferable amount for the transfer
1075
+ * Constructs a new InvalidParameterError.
1232
1076
  *
1233
- * @returns The max transferable amount.
1077
+ * @param message - Required error message.
1234
1078
  */
1235
- verifyEdOnDestination(this: GeneralBuilder<TApi, TRes, TSendBaseOptionsWithSenderAddress>): Promise<boolean>;
1079
+ constructor(message: string);
1080
+ }
1081
+
1082
+ /**
1083
+ * Error development mode is on and no API override is provided for a specific chain.
1084
+ */
1085
+ declare class MissingChainApiError extends Error {
1236
1086
  /**
1237
- * Returns the transfer info for the transfer
1087
+ * Constructs a new MissingChainApiError.
1238
1088
  *
1239
- * @returns The transfer info.
1089
+ * @param chain - The chain for which the API is missing.
1240
1090
  */
1241
- getTransferInfo(this: GeneralBuilder<TApi, TRes, TSendBaseOptionsWithSenderAddress>): Promise<TTransferInfo>;
1091
+ constructor(chain: TChain);
1092
+ }
1093
+
1094
+ /**
1095
+ * Used to inform user, that Parachain they wish to use has not yet implemented full XCM Support
1096
+ */
1097
+ declare class NoXCMSupportImplementedError extends Error {
1242
1098
  /**
1243
- * Returns the API instance used by the builder.
1099
+ * Constructs a new NoXCMSupportImplementedError.
1244
1100
  *
1245
- * @returns The API instance.
1101
+ * @param chain - The chain for which XCM support is not implemented.
1246
1102
  */
1247
- getApi(): TApi;
1103
+ constructor(chain: TChain);
1104
+ }
1105
+
1106
+ /**
1107
+ * Used to inform user, that Parachain they wish to use does not support scenario they wish to use yet
1108
+ */
1109
+ declare class ScenarioNotSupportedError extends Error {
1248
1110
  /**
1249
- * Disconnects the API.
1111
+ * Constructs a new ScenarioNotSupportedError.
1250
1112
  *
1251
- * @returns A Promise that resolves when the API is disconnected.
1113
+ * @param chain - The chain where the scenario is not supported.
1114
+ * @param scenario - The scenario that is not supported.
1115
+ * @param message - Optional custom error message.
1252
1116
  */
1253
- disconnect(): Promise<void>;
1117
+ constructor(chain: TChain, scenario: TScenario, message?: string);
1118
+ }
1119
+
1120
+ declare class TransferToAhNotSupported extends Error {
1121
+ constructor(message?: string);
1254
1122
  }
1123
+
1255
1124
  /**
1256
- * Creates a new Builder instance.
1257
- *
1258
- * @param api - The API instance to use for building transactions. If not provided, a new instance will be created.
1259
- * @returns A new Builder instance.
1125
+ * UnableToComputeError is thrown when a computation cannot be performed.
1260
1126
  */
1261
- declare const Builder: <TApi, TRes>(api: IPolkadotApi<TApi, TRes>) => GeneralBuilder<TApi, TRes, object>;
1127
+ declare class UnableToComputeError extends Error {
1128
+ /**
1129
+ * Constructs a new UnableToComputeError.
1130
+ *
1131
+ * @param message - Required error message.
1132
+ */
1133
+ constructor(message: string);
1134
+ }
1262
1135
 
1263
1136
  type TGetXcmFeeBaseOptions<TRes, TDisableFallback extends boolean = boolean> = {
1264
1137
  /**
@@ -1306,7 +1179,7 @@ type TGetOriginXcmFeeOptions<TApi, TRes> = WithApi<TGetOriginXcmFeeBaseOptions<T
1306
1179
  type TAttemptDryRunFeeOptions<TApi, TRes> = Omit<TGetOriginXcmFeeOptions<TApi, TRes>, 'tx'> & {
1307
1180
  builder: GeneralBuilder<TApi, TRes, TSendBaseOptions>;
1308
1181
  };
1309
- type TGetFeeForDestChainBaseOptions = {
1182
+ type TGetFeeForDestChainBaseOptions<TRes> = {
1310
1183
  prevChain: TSubstrateChain;
1311
1184
  origin: TSubstrateChain;
1312
1185
  destination: TChain;
@@ -1314,31 +1187,32 @@ type TGetFeeForDestChainBaseOptions = {
1314
1187
  address: string;
1315
1188
  currency: WithAmount<TCurrencyCore>;
1316
1189
  forwardedXcms: any;
1190
+ tx: TRes;
1317
1191
  asset: TAssetInfo;
1318
1192
  originFee: bigint;
1319
1193
  feeAsset?: TCurrencyInput;
1320
1194
  disableFallback: boolean;
1321
1195
  };
1322
- type TGetFeeForDestChainOptions<TApi, TRes> = WithApi<TGetFeeForDestChainBaseOptions, TApi, TRes>;
1196
+ type TGetFeeForDestChainOptions<TApi, TRes> = WithApi<TGetFeeForDestChainBaseOptions<TRes>, TApi, TRes>;
1323
1197
  type TGetReverseTxFeeOptions<TApi, TRes> = Omit<TGetFeeForDestChainOptions<TApi, TRes>, 'destination' | 'disableFallback' | 'forwardedXcms' | 'asset' | 'originFee' | 'prevChain'> & {
1324
1198
  destination: TSubstrateChain;
1325
1199
  };
1326
1200
  type THubKey = 'assetHub' | 'bridgeHub';
1327
1201
  type TFeeType = 'dryRun' | 'paymentInfo' | 'noFeeRequired';
1328
- type TXcmFeeBase = {
1202
+ type TXcmFeeBase$1 = {
1329
1203
  /** @deprecated Use `asset` property instead. */
1330
1204
  currency: string;
1331
1205
  asset: TAssetInfo;
1332
1206
  weight?: TWeight;
1333
1207
  sufficient?: boolean;
1334
1208
  };
1335
- type TXcmFeeDetailSuccess = TXcmFeeBase & {
1209
+ type TXcmFeeDetailSuccess = TXcmFeeBase$1 & {
1336
1210
  fee: bigint;
1337
1211
  feeType: TFeeType;
1338
1212
  dryRunError?: string;
1339
1213
  };
1340
1214
  type TXcmFeeDetailWithFallback = TXcmFeeDetailSuccess;
1341
- type TXcmFeeDetailError = TXcmFeeBase & {
1215
+ type TXcmFeeDetailError = TXcmFeeBase$1 & {
1342
1216
  fee?: bigint;
1343
1217
  feeType?: TFeeType;
1344
1218
  dryRunError: string;
@@ -1390,6 +1264,134 @@ type TGetXcmFeeEstimateResult = {
1390
1264
  destination: TGetXcmFeeEstimateDetail;
1391
1265
  };
1392
1266
 
1267
+ type THopTransferInfo = {
1268
+ chain: TChain;
1269
+ result: {
1270
+ xcmFee: TXcmFeeBase;
1271
+ balance?: bigint;
1272
+ existentialDeposit?: bigint;
1273
+ /** @deprecated use `asset` property instead */
1274
+ currencySymbol: string;
1275
+ asset: TAssetInfo;
1276
+ };
1277
+ };
1278
+ type TXcmFeeBase = {
1279
+ fee: bigint;
1280
+ balance: bigint;
1281
+ /** @deprecated use `asset` property instead */
1282
+ currencySymbol: string;
1283
+ asset: TAssetInfo;
1284
+ };
1285
+ type TTransferInfo = {
1286
+ chain: {
1287
+ origin: TChain;
1288
+ destination: TChain;
1289
+ ecosystem: string;
1290
+ };
1291
+ origin: {
1292
+ selectedCurrency: {
1293
+ sufficient: boolean;
1294
+ balance: bigint;
1295
+ balanceAfter: bigint;
1296
+ /** @deprecated use `asset` property instead */
1297
+ currencySymbol: string;
1298
+ asset: TAssetInfo;
1299
+ existentialDeposit: bigint;
1300
+ };
1301
+ xcmFee: TXcmFeeBase & {
1302
+ sufficient: boolean;
1303
+ balanceAfter: bigint;
1304
+ };
1305
+ };
1306
+ assetHub?: {
1307
+ balance: bigint;
1308
+ /** @deprecated use `asset` property instead */
1309
+ currencySymbol: string;
1310
+ asset: TAssetInfo;
1311
+ existentialDeposit: bigint;
1312
+ xcmFee: TXcmFeeBase;
1313
+ };
1314
+ bridgeHub?: {
1315
+ /** @deprecated use `asset` property instead */
1316
+ currencySymbol: string;
1317
+ asset: TAssetInfo;
1318
+ xcmFee: TXcmFeeBase;
1319
+ };
1320
+ hops?: THopTransferInfo[];
1321
+ destination: {
1322
+ receivedCurrency: {
1323
+ sufficient: boolean | UnableToComputeError;
1324
+ receivedAmount: bigint | UnableToComputeError;
1325
+ balance: bigint;
1326
+ balanceAfter: bigint | UnableToComputeError;
1327
+ /** @deprecated use `asset` property instead */
1328
+ currencySymbol: string;
1329
+ asset: TAssetInfo;
1330
+ existentialDeposit: bigint;
1331
+ };
1332
+ xcmFee: TXcmFeeBase & {
1333
+ balanceAfter: bigint | UnableToComputeError;
1334
+ };
1335
+ };
1336
+ };
1337
+ type BuildHopInfoOptions<TApi, TRes> = {
1338
+ api: IPolkadotApi<TApi, TRes>;
1339
+ chain: TSubstrateChain;
1340
+ feeData: {
1341
+ fee: bigint;
1342
+ currency: string;
1343
+ };
1344
+ originChain: TSubstrateChain;
1345
+ currency: TCurrencyCore;
1346
+ asset: TAssetInfo;
1347
+ senderAddress: string;
1348
+ ahAddress?: string;
1349
+ };
1350
+ type TBuildDestInfoOptions<TApi, TRes> = {
1351
+ api: IPolkadotApi<TApi, TRes>;
1352
+ origin: TSubstrateChain;
1353
+ destination: TChain;
1354
+ address: string;
1355
+ currency: WithAmount<TCurrencyCore>;
1356
+ originFee: bigint;
1357
+ isFeeAssetAh: boolean;
1358
+ destFeeDetail: TXcmFeeDetail;
1359
+ totalHopFee: bigint;
1360
+ bridgeFee?: bigint;
1361
+ };
1362
+ type TOriginFeeDetails = {
1363
+ sufficientForXCM: boolean;
1364
+ xcmFee: bigint;
1365
+ };
1366
+ type TGetTransferInfoOptionsBase<TRes> = {
1367
+ tx: TRes;
1368
+ origin: TSubstrateChain;
1369
+ destination: TChain;
1370
+ senderAddress: string;
1371
+ ahAddress?: string;
1372
+ address: string;
1373
+ currency: WithAmount<TCurrencyCore>;
1374
+ feeAsset?: TCurrencyCore;
1375
+ };
1376
+ type TGetTransferInfoOptions<TApi, TRes> = WithApi<TGetTransferInfoOptionsBase<TRes>, TApi, TRes>;
1377
+
1378
+ type TChainWithApi<TApi, TRes, T = TSubstrateChain> = {
1379
+ api: IPolkadotApi<TApi, TRes>;
1380
+ chain: T;
1381
+ };
1382
+ type TTypeAndThenCallContext<TApi, TRes> = {
1383
+ origin: TChainWithApi<TApi, TRes>;
1384
+ dest: TChainWithApi<TApi, TRes>;
1385
+ reserve: TChainWithApi<TApi, TRes, TSubstrateChain>;
1386
+ assetInfo: WithAmount<TAssetWithLocation>;
1387
+ options: TPolkadotXCMTransferOptions<TApi, TRes>;
1388
+ };
1389
+ type TTypeAndThenFees = {
1390
+ reserveFee: bigint;
1391
+ refundFee: bigint;
1392
+ destFee: bigint;
1393
+ };
1394
+
1393
1395
  interface IPolkadotApi<TApi, TRes> {
1394
1396
  getConfig(): TBuilderOptions<TApiOrUrl<TApi>> | undefined;
1395
1397
  getApi(): TApi;
@@ -1424,7 +1426,7 @@ interface IPolkadotApi<TApi, TRes> {
1424
1426
  clone(): IPolkadotApi<TApi, TRes>;
1425
1427
  createApiForChain(chain: TSubstrateChain): Promise<IPolkadotApi<TApi, TRes>>;
1426
1428
  getDryRunCall(options: TDryRunCallBaseOptions<TRes>): Promise<TDryRunChainResult>;
1427
- getDryRunXcm(options: TDryRunXcmBaseOptions): Promise<TDryRunChainResult>;
1429
+ getDryRunXcm(options: TDryRunXcmBaseOptions<TRes>): Promise<TDryRunChainResult>;
1428
1430
  getBridgeStatus(): Promise<TBridgeStatus>;
1429
1431
  setDisconnectAllowed(allowed: boolean): void;
1430
1432
  getDisconnectAllowed(): boolean;
@@ -2058,8 +2060,6 @@ declare const ETHEREUM_JUNCTION: TJunction;
2058
2060
  declare const TX_CLIENT_TIMEOUT_MS: number;
2059
2061
  declare const DRY_RUN_CLIENT_TIMEOUT_MS: number;
2060
2062
 
2061
- declare const claimAssets: <TApi, TRes>(options: TAssetClaimOptions<TApi, TRes>) => Promise<TRes>;
2062
-
2063
2063
  type TSetBalanceRes = {
2064
2064
  assetStatusTx?: TSerializedApiCall;
2065
2065
  balanceTx: TSerializedApiCall;
@@ -2084,15 +2084,12 @@ declare const getBalanceNative: <TApi, TRes>(options: TGetBalanceNativeOptions<T
2084
2084
  declare const getOriginFeeDetailsInternal: <TApi, TRes>({ api, account, accountDestination, ahAddress, currency, origin, destination, feeMarginPercentage }: TGetOriginFeeDetailsOptions<TApi, TRes>) => Promise<TOriginFeeDetails>;
2085
2085
  declare const getOriginFeeDetails: <TApi, TRes>(options: TGetOriginFeeDetailsOptions<TApi, TRes>) => Promise<TOriginFeeDetails>;
2086
2086
 
2087
- declare const getTransferableAmountInternal: <TApi, TRes>({ api, senderAddress, origin: chain, destination, currency, tx, feeAsset }: TGetTransferableAmountOptions<TApi, TRes>) => Promise<bigint>;
2088
- declare const getTransferableAmount: <TApi, TRes>(options: TGetTransferableAmountOptions<TApi, TRes>) => Promise<bigint>;
2089
-
2090
- declare const getTransferInfo: <TApi, TRes>({ api, tx, origin, destination, senderAddress, ahAddress, address, currency, feeAsset }: TGetTransferInfoOptions<TApi, TRes>) => Promise<TTransferInfo>;
2091
-
2092
- declare const verifyEdOnDestination: <TApi, TRes>(options: TVerifyEdOnDestinationOptions<TApi, TRes>) => Promise<boolean>;
2087
+ declare const claimAssets: <TApi, TRes>(options: TAssetClaimOptions<TApi, TRes>) => Promise<TRes>;
2093
2088
 
2094
2089
  declare const dryRun: <TApi, TRes>(options: TDryRunOptions<TApi, TRes>) => Promise<TDryRunResult>;
2095
2090
 
2091
+ declare const dryRunInternal: <TApi, TRes>(options: TDryRunOptions<TApi, TRes>) => Promise<TDryRunResult>;
2092
+
2096
2093
  declare const dryRunOrigin: <TApi, TRes>(options: TDryRunCallOptions<TApi, TRes>) => Promise<TDryRunChainResult>;
2097
2094
 
2098
2095
  declare function traverseXcmHops<TApi, TRes, THopResult>(config: HopTraversalConfig<TApi, TRes, THopResult>): Promise<HopTraversalResult<THopResult>>;
@@ -2126,13 +2123,18 @@ declare const getXcmFee: <TApi, TRes, TDisableFallback extends boolean>(options:
2126
2123
 
2127
2124
  declare const getXcmFeeEstimate: <TApi, TRes>(options: TGetXcmFeeEstimateOptions<TApi, TRes>) => Promise<TGetXcmFeeEstimateResult>;
2128
2125
 
2129
- declare const padFee: (raw: bigint, origin: TSubstrateChain, dest: TChain, side: "origin" | "destination") => bigint;
2130
- declare const padFeeBy: (amount: bigint, percent: number) => bigint;
2131
-
2132
2126
  declare const getBridgeStatus: <TApi, TRes>(api: IPolkadotApi<TApi, TRes>) => Promise<TBridgeStatus>;
2133
2127
 
2134
2128
  declare const send: <TApi, TRes>(options: TSendOptions<TApi, TRes>) => Promise<TRes>;
2135
2129
 
2130
+ declare const getTransferInfo: <TApi, TRes>({ api, tx, origin, destination, senderAddress, ahAddress, address, currency, feeAsset }: TGetTransferInfoOptions<TApi, TRes>) => Promise<TTransferInfo>;
2131
+
2132
+ declare const getMinTransferableAmountInternal: <TApi, TRes>({ api, origin, senderAddress, address, origin: chain, destination, currency, tx, feeAsset, builder }: TGetMinTransferableAmountOptions<TApi, TRes>) => Promise<bigint>;
2133
+ declare const getMinTransferableAmount: <TApi, TRes>(options: TGetMinTransferableAmountOptions<TApi, TRes>) => Promise<bigint>;
2134
+
2135
+ declare const getTransferableAmountInternal: <TApi, TRes>({ api, senderAddress, origin: chain, destination, currency, tx, feeAsset }: TGetTransferableAmountOptions<TApi, TRes>) => Promise<bigint>;
2136
+ declare const getTransferableAmount: <TApi, TRes>(options: TGetTransferableAmountOptions<TApi, TRes>) => Promise<bigint>;
2137
+
2136
2138
  declare const transferRelayToPara: <TApi, TRes>(options: TRelayToParaOptions<TApi, TRes>) => Promise<TRes>;
2137
2139
 
2138
2140
  /**
@@ -2140,6 +2142,8 @@ declare const transferRelayToPara: <TApi, TRes>(options: TRelayToParaOptions<TAp
2140
2142
  */
2141
2143
  declare const createTypeAndThenCall: <TApi, TRes>(chain: TSubstrateChain, options: TPolkadotXCMTransferOptions<TApi, TRes>) => Promise<TSerializedApiCall>;
2142
2144
 
2145
+ declare const verifyEdOnDestination: <TApi, TRes>(options: TVerifyEdOnDestinationOptions<TApi, TRes>) => Promise<boolean>;
2146
+
2143
2147
  declare const addXcmVersionHeader: <T, V extends Version>(obj: T, version: V) => OneKey<V, T>;
2144
2148
 
2145
2149
  declare const assertToIsString: (to: TDestination, overrideMsg?: string) => asserts to is Exclude<TDestination, TLocation>;
@@ -2176,6 +2180,9 @@ declare const computeFeeFromDryRunPjs: (dryRun: any, chain: TSubstrateChain, exe
2176
2180
 
2177
2181
  declare const resolveModuleError: (chain: TSubstrateChain, error: TModuleError) => XTokensError | PolkadotXcmError;
2178
2182
 
2183
+ declare const padFee: (raw: bigint, origin: TSubstrateChain, dest: TChain, side: "origin" | "destination") => bigint;
2184
+ declare const padFeeBy: (amount: bigint, percent: number) => bigint;
2185
+
2179
2186
  /**
2180
2187
  * Retrieves the chain instance for a given chain.
2181
2188
  *
@@ -2240,5 +2247,5 @@ declare const handleToAhTeleport: <TApi, TRes>(origin: TParachain, input: TPolka
2240
2247
 
2241
2248
  declare const validateAddress: (address: TAddress, chain: TChain, isDestination?: boolean) => void;
2242
2249
 
2243
- export { AmountTooLowError, AssetClaimBuilder, AssetsPallet, BatchMode, BridgeHaltedError, Builder, ChainNotSupportedError, DRY_RUN_CLIENT_TIMEOUT_MS, DryRunFailedError, ETHEREUM_JUNCTION, ETH_CHAIN_ID, GeneralBuilder, IncompatibleChainsError, InvalidAddressError, InvalidParameterError, MissingChainApiError, NoXCMSupportImplementedError, PolkadotXcmError, ScenarioNotSupportedError, TX_CLIENT_TIMEOUT_MS, TransferToAhNotSupported, UnableToComputeError, XTokensError, abstractDecimals, addEthereumBridgeFees, addXcmVersionHeader, applyDecimalAbstraction, assertAddressIsString, assertHasId, assertHasLocation, assertIsForeign, assertToIsString, blake2b256, blake2b512, calcPreviewMintAmount, claimAssets, computeFeeFromDryRun, computeFeeFromDryRunPjs, convertSs58, createAsset, createAssetsFilter, createBaseExecuteXcm, createBeneficiaryLocXTokens, createBeneficiaryLocation, createChainClient, createDirectExecuteXcm, createExecuteCall, createExecuteExchangeXcm, createTypeAndThenCall, createVersionedAssets, createX1Payload, deriveAccountId, dryRun, dryRunOrigin, encodeSs58, getAssetBalance, getAssetBalanceInternal, getAssetReserveChain, getBalanceForeign, getBalanceForeignInternal, getBalanceNative, getBalanceNativeInternal, getBridgeStatus, getChain, getChainConfig, getChainLocation, getChainProviders, getChainVersion, getCurrencySelection, getOriginFeeDetails, getOriginFeeDetailsInternal, getOriginXcmFee, getOriginXcmFeeEstimate, getOriginXcmFeeInternal, getParaEthTransferFees, getParaId, getRelayChainOf, getTChain, getTransferInfo, getTransferableAmount, getTransferableAmountInternal, getXcmFee, getXcmFeeEstimate, handleExecuteTransfer, handleSwapExecuteTransfer, handleToAhTeleport, isConfig, localizeLocation, maybeOverrideAsset, maybeOverrideAssets, padFee, padFeeBy, resolveDestChain, resolveModuleError, resolveParaId, reverseTransformLocation, send, sortAssets, transferMoonbeamEvm, transferMoonbeamToEth, transferRelayToPara, traverseXcmHops, validateAddress, verifyEdOnDestination, wrapTxBypass };
2244
- export type { HopProcessParams, HopTraversalConfig, HopTraversalResult, IPolkadotApi, IPolkadotXCMTransfer, IXTokensTransfer, IXTransferTransfer, OneKey, TAddress, TApiOrUrl, TAssetClaimInternalOptions, TAssetClaimOptions, TAssetClaimOptionsBase, TAttemptDryRunFeeOptions, TBalanceResponse, TBatchOptions, TBifrostToken, TBridgeStatus, TBuilderConfig, TBuilderOptions, TBypassOptions, TChainConfig, TChainConfigMap, TChainWithApi, TConditionalXcmFeeDetail, TConditionalXcmFeeHopInfo, TCreateBaseSwapXcmOptions, TCreateBaseTransferXcmOptions, TCreateBeneficiaryOptions, TCreateBeneficiaryXTokensOptions, TCreateSwapXcmInternalOptions, TCreateSwapXcmOptions, TCreateTransferXcmOptions, TDestWeight, TDestXcmFeeDetail, TDestination, TDryRunBaseOptions, TDryRunBypassOptions, TDryRunCallBaseOptions, TDryRunCallOptions, TDryRunChain, TDryRunChainFailure, TDryRunChainResult, TDryRunChainSuccess, TDryRunOptions, TDryRunPreviewOptions, TDryRunResBase, TDryRunResult, TDryRunXcmBaseOptions, TDryRunXcmOptions, TEvmBuilderOptions, TEvmBuilderOptionsBase, TEvmChainFrom, TFeeType, TForeignAssetId, TForeignOrNativeAsset, TForeignOrTokenAsset, TGetAssetBalanceOptions, TGetAssetBalanceOptionsBase, TGetBalanceForeignByAssetOptions, TGetBalanceForeignOptions, TGetBalanceForeignOptionsBase, TGetBalanceNativeOptions, TGetBalanceNativeOptionsBase, TGetFeeForDestChainBaseOptions, TGetFeeForDestChainOptions, 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, TNodleAsset, TOriginFeeDetails, TOtherReserveAsset, TPolkadotXCMTransferOptions, TPolkadotXcmMethod, TProviderEntry, TRelayToParaDestination, TRelayToParaOptions, TRelayToParaOverrides, TReserveAsset, TScenario, TSelfReserveAsset, TSendBaseOptions, TSendBaseOptionsWithSenderAddress, TSendInternalOptions, TSendOptions, TSerializeEthTransferOptions, TSerializedApiCall, TSerializedEthTransfer, TSwapFeeEstimates, TTransferFeeEstimates, TTransferInfo, TTransferLocalOptions, TTypeAndThenCallContext, TTypeAndThenFees, TVerifyEdOnDestinationOptions, TVerifyEdOnDestinationOptionsBase, TWeight, TXTokensCurrencySelection, TXTokensMethod, TXTokensTransferOptions, TXTransferMethod, TXTransferTransferOptions, TXcmAsset, TXcmFeeBase$1 as TXcmFeeBase, TXcmFeeChain, TXcmFeeDetail, TXcmFeeDetailError, TXcmFeeDetailSuccess, TXcmFeeDetailWithFallback, TXcmFeeHopInfo, TXcmFeeHopResult, TXcmForeignAsset, TXcmPalletMethod, TXcmVersioned, TZeitgeistAsset, WithApi, WithRequiredSenderAddress };
2250
+ export { AmountTooLowError, AssetClaimBuilder, AssetsPallet, BatchMode, BridgeHaltedError, Builder, ChainNotSupportedError, DRY_RUN_CLIENT_TIMEOUT_MS, DryRunFailedError, ETHEREUM_JUNCTION, ETH_CHAIN_ID, GeneralBuilder, IncompatibleChainsError, InvalidAddressError, InvalidParameterError, MissingChainApiError, NoXCMSupportImplementedError, PolkadotXcmError, ScenarioNotSupportedError, TX_CLIENT_TIMEOUT_MS, TransferToAhNotSupported, UnableToComputeError, XTokensError, abstractDecimals, addEthereumBridgeFees, addXcmVersionHeader, applyDecimalAbstraction, assertAddressIsString, assertHasId, assertHasLocation, assertIsForeign, assertToIsString, blake2b256, blake2b512, calcPreviewMintAmount, claimAssets, computeFeeFromDryRun, computeFeeFromDryRunPjs, convertSs58, createAsset, createAssetsFilter, createBaseExecuteXcm, createBeneficiaryLocXTokens, createBeneficiaryLocation, createChainClient, createDirectExecuteXcm, createExecuteCall, createExecuteExchangeXcm, createTypeAndThenCall, createVersionedAssets, createX1Payload, deriveAccountId, dryRun, dryRunInternal, dryRunOrigin, encodeSs58, getAssetBalance, getAssetBalanceInternal, getAssetReserveChain, getBalanceForeign, getBalanceForeignInternal, getBalanceNative, getBalanceNativeInternal, getBridgeStatus, getChain, getChainConfig, getChainLocation, getChainProviders, getChainVersion, getCurrencySelection, getMinTransferableAmount, getMinTransferableAmountInternal, getOriginFeeDetails, getOriginFeeDetailsInternal, getOriginXcmFee, getOriginXcmFeeEstimate, getOriginXcmFeeInternal, getParaEthTransferFees, getParaId, getRelayChainOf, getTChain, getTransferInfo, getTransferableAmount, getTransferableAmountInternal, getXcmFee, getXcmFeeEstimate, handleExecuteTransfer, handleSwapExecuteTransfer, handleToAhTeleport, isConfig, localizeLocation, maybeOverrideAsset, maybeOverrideAssets, padFee, padFeeBy, resolveDestChain, resolveModuleError, resolveParaId, reverseTransformLocation, send, sortAssets, transferMoonbeamEvm, transferMoonbeamToEth, transferRelayToPara, traverseXcmHops, validateAddress, verifyEdOnDestination, wrapTxBypass };
2251
+ export type { BuildHopInfoOptions, HopProcessParams, HopTraversalConfig, HopTraversalResult, IPolkadotApi, IPolkadotXCMTransfer, IXTokensTransfer, IXTransferTransfer, OneKey, TAddress, TApiOrUrl, TAssetClaimInternalOptions, TAssetClaimOptions, TAssetClaimOptionsBase, TAttemptDryRunFeeOptions, TBatchOptions, TBifrostToken, TBridgeStatus, TBuildDestInfoOptions, TBuilderConfig, TBuilderOptions, TBypassOptions, TChainConfig, TChainConfigMap, TChainWithApi, TConditionalXcmFeeDetail, TConditionalXcmFeeHopInfo, TCreateBaseSwapXcmOptions, TCreateBaseTransferXcmOptions, TCreateBeneficiaryOptions, TCreateBeneficiaryXTokensOptions, TCreateSwapXcmInternalOptions, TCreateSwapXcmOptions, TCreateTransferXcmOptions, TDestWeight, TDestXcmFeeDetail, TDestination, TDryRunBaseOptions, TDryRunBypassOptions, TDryRunCallBaseOptions, TDryRunCallOptions, TDryRunChain, TDryRunChainFailure, TDryRunChainResult, TDryRunChainSuccess, TDryRunOptions, TDryRunPreviewOptions, TDryRunResBase, TDryRunResult, TDryRunXcmBaseOptions, TDryRunXcmOptions, TEvmBuilderOptions, TEvmBuilderOptionsBase, TEvmChainFrom, TFeeType, TForeignAssetId, TForeignOrNativeAsset, TForeignOrTokenAsset, TGetAssetBalanceOptions, TGetAssetBalanceOptionsBase, TGetBalanceForeignByAssetOptions, TGetBalanceForeignOptions, TGetBalanceForeignOptionsBase, TGetBalanceNativeOptions, TGetBalanceNativeOptionsBase, TGetFeeForDestChainBaseOptions, TGetFeeForDestChainOptions, TGetMinTransferableAmountOptions, TGetOriginFeeDetailsOptions, TGetOriginFeeDetailsOptionsBase, TGetOriginXcmFeeBaseOptions, TGetOriginXcmFeeEstimateOptions, TGetOriginXcmFeeOptions, TGetReverseTxFeeOptions, TGetTransferInfoOptions, TGetTransferInfoOptionsBase, TGetTransferableAmountOptions, TGetTransferableAmountOptionsBase, TGetXcmFeeBaseOptions, TGetXcmFeeBuilderOptions, TGetXcmFeeEstimateDetail, TGetXcmFeeEstimateOptions, TGetXcmFeeEstimateResult, TGetXcmFeeOptions, TGetXcmFeeResult, THopInfo, THopTransferInfo, THubKey, TMantaAsset, TModuleError, TNativeTokenAsset, TNodleAsset, TOriginFeeDetails, TOtherReserveAsset, TPolkadotXCMTransferOptions, TPolkadotXcmMethod, TProviderEntry, TRelayToParaDestination, TRelayToParaOptions, TRelayToParaOverrides, TReserveAsset, TScenario, TSelfReserveAsset, TSendBaseOptions, TSendBaseOptionsWithSenderAddress, TSendInternalOptions, TSendOptions, TSerializeEthTransferOptions, TSerializedApiCall, TSerializedEthTransfer, TSwapFeeEstimates, TTransferFeeEstimates, TTransferInfo, TTransferLocalOptions, TTypeAndThenCallContext, TTypeAndThenFees, TVerifyEdOnDestinationOptions, TVerifyEdOnDestinationOptionsBase, TWeight, TXTokensCurrencySelection, TXTokensMethod, TXTokensTransferOptions, TXTransferMethod, TXTransferTransferOptions, TXcmAsset, TXcmFeeBase, TXcmFeeChain, TXcmFeeDetail, TXcmFeeDetailError, TXcmFeeDetailSuccess, TXcmFeeDetailWithFallback, TXcmFeeHopInfo, TXcmFeeHopResult, TXcmForeignAsset, TXcmPalletMethod, TXcmVersioned, TZeitgeistAsset, WithApi, WithRequiredSenderAddress };