@paraspell/sdk-core 13.2.1 → 13.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. package/README.md +1 -1
  2. package/dist/index.d.ts +1041 -1032
  3. package/dist/index.mjs +322 -109
  4. package/package.json +6 -15
package/dist/index.d.ts CHANGED
@@ -1,14 +1,12 @@
1
1
  import * as _paraspell_sdk_common from '@paraspell/sdk-common';
2
- import { TSubstrateChain as TSubstrateChain$1, TChain as TChain$1, Version, TLocation, TRelaychain, TParachain, TExternalChain, TJunction, Parents, TJunctions } from '@paraspell/sdk-common';
2
+ import { TSubstrateChain, TChain, Version, TRelaychain, TParachain, TLocation, TExternalChain, TJunction, Parents, TJunctions } from '@paraspell/sdk-common';
3
3
  export * from '@paraspell/sdk-common';
4
4
  import * as _paraspell_assets from '@paraspell/assets';
5
- import { TAssetInfo, WithAmount, TAsset, TCurrencyCore, TCurrencyInputWithAmount, TCurrencyInput as TCurrencyInput$1, TAssetWithFee, WithComplexAmount, TAmount as TAmount$1, TAssetInfoWithId } from '@paraspell/assets';
5
+ import { TAssetInfo, WithAmount, TAsset, TCurrencyCore, TCurrencyInputWithAmount, TCurrencyInput, TAmount, TAssetWithFee, WithComplexAmount, TAssetInfoWithId } from '@paraspell/assets';
6
6
  export * from '@paraspell/assets';
7
7
  import { TPallet, TAssetsPallet } from '@paraspell/pallets';
8
8
  export * from '@paraspell/pallets';
9
9
  import { WalletClient, formatUnits as formatUnits$1, parseUnits as parseUnits$1 } from 'viem';
10
- import * as _paraspell_swap from '@paraspell/swap';
11
- import { RouterBuilder } from '@paraspell/swap';
12
10
 
13
11
  type WithApi<TBase, TApi, TRes, TSigner> = TBase & {
14
12
  api: PolkadotApi<TApi, TRes, TSigner>;
@@ -42,7 +40,7 @@ type TApiType = (typeof API_TYPES)[number];
42
40
 
43
41
  declare abstract class PolkadotApi<TApi, TRes, TSigner> {
44
42
  _api?: TApi;
45
- _chain?: TSubstrateChain$1;
43
+ _chain?: TSubstrateChain;
46
44
  readonly _config?: TBuilderOptions<TApiOrUrl<TApi>>;
47
45
  _ttlMs: number;
48
46
  _disconnectAllowed: boolean;
@@ -52,12 +50,14 @@ declare abstract class PolkadotApi<TApi, TRes, TSigner> {
52
50
  set disconnectAllowed(allowed: boolean);
53
51
  get disconnectAllowed(): boolean;
54
52
  get config(): TBuilderOptions<TApiOrUrl<TApi>> | undefined;
55
- abstract init(chain: TChain$1, clientTtlMs?: number): Promise<void>;
56
- abstract createApiInstance(wsUrl: TUrl, chain: TSubstrateChain$1): Promise<TApi>;
53
+ init(chain: TChain, clientTtlMs?: number): Promise<void>;
54
+ abstract leaseClient(wsUrl: TUrl, ttlMs: number): Promise<TApi>;
57
55
  abstract accountToHex(address: string, isPrefixed?: boolean): string;
58
56
  abstract accountToUint8a(address: string): Uint8Array;
59
57
  abstract deserializeExtrinsics(serialized: TSerializedExtrinsics): TRes;
60
58
  abstract txFromHex(hex: string): Promise<TRes>;
59
+ abstract txToHex(tx: TRes): Promise<string>;
60
+ abstract encodeTx(hex: string): unknown;
61
61
  abstract queryState<T>(serialized: TSerializedStateQuery): Promise<T>;
62
62
  abstract queryRuntimeApi<T>(serialized: TSerializedRuntimeApiQuery): Promise<T>;
63
63
  abstract callBatchMethod(calls: TRes[], mode: BatchMode): TRes;
@@ -72,14 +72,13 @@ declare abstract class PolkadotApi<TApi, TRes, TSigner> {
72
72
  partialFee: bigint;
73
73
  weight: TWeight;
74
74
  }>;
75
- abstract quoteAhPrice(fromMl: TLocation, toMl: TLocation, amountIn: bigint, includeFee?: boolean): Promise<bigint | undefined>;
76
75
  abstract getXcmWeight(xcm: any): Promise<TWeight>;
77
- abstract getXcmPaymentApiFee(chain: TSubstrateChain$1, localXcm: any, forwardedXcm: any, asset: TAssetInfo, version: Version, transformXcm: boolean): Promise<bigint>;
76
+ abstract getXcmPaymentApiFee(chain: TSubstrateChain, localXcm: any, forwardedXcm: any, asset: TAssetInfo, version: Version, transformXcm: boolean): Promise<bigint>;
78
77
  abstract getEvmStorage(contract: string, slot: string): Promise<string>;
79
78
  abstract getFromRpc(module: string, method: string, key: string): Promise<string>;
80
79
  abstract blake2AsHex(data: Uint8Array): string;
81
80
  abstract clone(): PolkadotApi<TApi, TRes, TSigner>;
82
- abstract createApiForChain(chain: TSubstrateChain$1): Promise<PolkadotApi<TApi, TRes, TSigner>>;
81
+ abstract createApiForChain(chain: TSubstrateChain): Promise<PolkadotApi<TApi, TRes, TSigner>>;
83
82
  abstract getDryRunCall(options: TDryRunCallBaseOptions<TRes>): Promise<TDryRunChainResult>;
84
83
  abstract getDryRunXcm(options: TDryRunXcmBaseOptions<TRes>): Promise<TDryRunChainResult>;
85
84
  abstract getBridgeStatus(): Promise<TBridgeStatus>;
@@ -96,18 +95,18 @@ declare abstract class Chain<TApi, TRes, TSigner> {
96
95
  private readonly _info;
97
96
  private readonly _ecosystem;
98
97
  private readonly _version;
99
- constructor(chain: TSubstrateChain$1, info: string, ecosystem: TRelaychain, version: Version);
98
+ constructor(chain: TSubstrateChain, info: string, ecosystem: TRelaychain, version: Version);
100
99
  get info(): string;
101
100
  get ecosystem(): TRelaychain;
102
- get chain(): TSubstrateChain$1;
101
+ get chain(): TSubstrateChain;
103
102
  get version(): Version;
104
103
  transfer(transferOptions: TTransferInternalOptions<TApi, TRes, TSigner>): Promise<TRes>;
105
104
  isRelayToParaEnabled(): boolean;
106
- throwIfCantReceive(destChain: TChain$1 | undefined): void;
107
- throwIfTempDisabled(options: TTransferInternalOptions<TApi, TRes, TSigner>, destChain?: TChain$1): void;
105
+ throwIfCantReceive(destChain: TChain | undefined): void;
106
+ throwIfTempDisabled(options: TTransferInternalOptions<TApi, TRes, TSigner>, destChain?: TChain): void;
108
107
  isSendingTempDisabled(_options: TTransferInternalOptions<TApi, TRes, TSigner>): boolean;
109
108
  isReceivingTempDisabled(_scenario: TScenario): boolean;
110
- canReceiveFrom(_origin: TChain$1): boolean;
109
+ canReceiveFrom(_origin: TChain): boolean;
111
110
  shouldUseNativeAssetTeleport({ assetInfo: asset, to }: TTransferInternalOptions<TApi, TRes, TSigner>): boolean;
112
111
  createAsset(asset: WithAmount<TAssetInfo>, version: Version): TAsset;
113
112
  getNativeAssetSymbol(): string;
@@ -286,7 +285,7 @@ declare class CoretimeKusama<TApi, TRes, TSigner> extends Chain<TApi, TRes, TSig
286
285
  declare class CoretimePolkadot<TApi, TRes, TSigner> extends Chain<TApi, TRes, TSigner> implements IPolkadotXCMTransfer<TApi, TRes, TSigner> {
287
286
  constructor(chain?: TParachain, info?: string, ecosystem?: TRelaychain, version?: Version);
288
287
  transferPolkadotXCM(input: TPolkadotXCMTransferOptions<TApi, TRes, TSigner>): Promise<TRes>;
289
- canReceiveFrom(origin: TChain$1): boolean;
288
+ canReceiveFrom(origin: TChain): boolean;
290
289
  }
291
290
 
292
291
  declare class CoretimePaseo<TApi, TRes, TSigner> extends CoretimePolkadot<TApi, TRes, TSigner> {
@@ -388,7 +387,7 @@ declare class Kintsugi<TApi, TRes, TSigner> extends Chain<TApi, TRes, TSigner> i
388
387
  }
389
388
 
390
389
  declare class Polkadot<TApi, TRes, TSigner> extends Chain<TApi, TRes, TSigner> implements IPolkadotXCMTransfer<TApi, TRes, TSigner> {
391
- constructor(chain?: TSubstrateChain$1, info?: string, ecosystem?: TRelaychain, version?: Version);
390
+ constructor(chain?: TSubstrateChain, info?: string, ecosystem?: TRelaychain, version?: Version);
392
391
  transferPolkadotXCM(input: TPolkadotXCMTransferOptions<TApi, TRes, TSigner>): Promise<TRes>;
393
392
  }
394
393
 
@@ -515,14 +514,14 @@ declare class Westend<TApi, TRes, TSigner> extends Polkadot<TApi, TRes, TSigner>
515
514
  declare class Xode<TApi, TRes, TSigner> extends Chain<TApi, TRes, TSigner> implements IPolkadotXCMTransfer<TApi, TRes, TSigner> {
516
515
  constructor();
517
516
  transferPolkadotXCM(options: TPolkadotXCMTransferOptions<TApi, TRes, TSigner>): Promise<TRes>;
518
- canReceiveFrom(origin: TChain$1): boolean;
517
+ canReceiveFrom(origin: TChain): boolean;
519
518
  }
520
519
 
521
520
  declare class Zeitgeist<TApi, TRes, TSigner> extends Chain<TApi, TRes, TSigner> implements IPolkadotXCMTransfer<TApi, TRes, TSigner> {
522
521
  constructor(chain?: TParachain, info?: string, ecosystem?: TRelaychain, version?: Version);
523
522
  getCustomCurrencyId(asset: TAssetInfo): TZeitgeistAsset | TXcmForeignAsset;
524
523
  transferPolkadotXCM(input: TPolkadotXCMTransferOptions<TApi, TRes, TSigner>): Promise<TRes>;
525
- canReceiveFrom(origin: TChain$1): boolean;
524
+ canReceiveFrom(origin: TChain): boolean;
526
525
  transferLocalNonNativeAsset(options: TTransferLocalOptions<TApi, TRes, TSigner>): TRes;
527
526
  }
528
527
 
@@ -611,1005 +610,1045 @@ declare const TRANSACT_ORIGINS: readonly ["Native", "SovereignAccount", "Superus
611
610
  */
612
611
  declare const EXCHANGE_CHAINS: readonly ["AssetHubPolkadot", "AssetHubKusama", "AssetHubPaseo", "AssetHubWestend", "Hydration", "Karura", "Acala", "BifrostKusama", "BifrostPolkadot"];
613
612
 
614
- type TExchangeChain = (typeof EXCHANGE_CHAINS)[number];
615
- type TExchangeInput = TExchangeChain | TExchangeChain[] | undefined;
616
- type TSwapOptions<TApi, TRes, TSigner> = {
613
+ type TSwapConfig = {
617
614
  currencyTo: TCurrencyCore;
618
- exchange?: TExchangeInput;
619
- slippage?: number;
620
- evmSenderAddress?: string;
621
- evmSigner?: TSigner;
622
- onStatusChange?: TStatusChangeCallback<TApi, TRes>;
615
+ exchangeChain: TParachain;
623
616
  };
624
- type TTransactionContext<TApi, TRes> = {
625
- type: TTransactionType;
626
- api: TApi;
627
- chain: TSubstrateChain$1;
617
+ type TDryRunBaseOptions<TRes> = {
628
618
  tx: TRes;
629
- };
630
- type TTransactionType = 'TRANSFER' | 'SWAP' | 'SWAP_AND_TRANSFER';
631
- type TSwapEventType = TTransactionType | 'SELECTING_EXCHANGE' | 'COMPLETED';
632
- /**
633
- * The transaction progress information.
634
- */
635
- type TSwapEvent<TApi, TRes> = {
636
- /**
637
- * Current execution phase type
638
- */
639
- type: TSwapEventType;
640
- /**
641
- * Full transaction plan for visualization
642
- */
643
- routerPlan?: TTransactionContext<TApi, TRes>[];
644
- /**
645
- * Current transaction's origin chain
646
- */
647
- chain?: TSubstrateChain$1;
648
- /**
649
- * Current transaction's destination chain
650
- */
651
- destinationChain?: TChain$1;
652
- /**
653
- * 0-based step index of current operation
654
- */
655
- currentStep?: number;
656
- };
657
- type TStatusChangeCallback<TApi, TRes> = (info: TSwapEvent<TApi, TRes>) => void;
658
-
659
- type TPolkadotXCMTransferOptions<TApi, TRes, TSigner> = {
660
- api: PolkadotApi<TApi, TRes, TSigner>;
661
- chain: TSubstrateChain$1;
662
- beneficiaryLocation: TLocation;
663
- recipient: TAddress;
664
- asset: TAsset;
665
- overriddenAsset?: TLocation | TAssetWithFee[];
666
- scenario: TScenario;
667
- assetInfo: WithAmount<TAssetInfo>;
619
+ origin: TSubstrateChain;
620
+ destination: TChain;
621
+ sender: string;
668
622
  currency: TCurrencyInputWithAmount;
669
- feeAssetInfo?: TAssetInfo;
670
- feeCurrency?: TCurrencyInput$1;
671
- destination: TDestination;
672
- destChain?: TChain$1;
673
- paraIdTo?: number;
674
- version: Version;
675
- sender?: string;
676
- ahAddress?: string;
677
- pallet?: string;
678
- method?: string;
679
- transactOptions?: TTransactOptions<TRes>;
680
- };
681
- type TXTokensTransferOptions<TApi, TRes, TSigner> = {
682
- api: PolkadotApi<TApi, TRes, TSigner>;
683
- asset: WithAmount<TAssetInfo>;
684
- recipient: TAddress;
685
- scenario: TScenario;
686
- origin: TSubstrateChain$1;
687
- destination: TDestination;
688
- paraIdTo?: number;
689
- version: Version;
690
- overriddenAsset?: TLocation | TAssetWithFee[];
691
- pallet?: string;
692
- method?: string;
693
- useMultiAssetTransfer?: boolean;
623
+ version?: Version;
624
+ feeAsset?: TCurrencyInput;
625
+ swapConfig?: TSwapConfig;
626
+ useRootOrigin?: boolean;
627
+ bypassOptions?: TBypassOptions;
694
628
  };
695
- interface IPolkadotXCMTransfer<TApi, TRes, TSigner> {
696
- transferPolkadotXCM: (input: TPolkadotXCMTransferOptions<TApi, TRes, TSigner>) => Promise<TRes>;
697
- }
698
- interface IXTokensTransfer<TApi, TRes, TSigner> {
699
- transferXTokens: (input: TXTokensTransferOptions<TApi, TRes, TSigner>) => TRes;
700
- }
701
- type TScenario = 'ParaToRelay' | 'ParaToPara' | 'RelayToPara';
702
- type TAddress = string | TLocation;
703
- type TDestination = TChain$1 | TLocation;
704
- type TTransferBaseOptions<TApi, TRes, TSigner> = {
705
- /**
706
- * The origin chain
707
- */
708
- from: TSubstrateChain$1;
709
- /**
710
- * The destination address. A SS58 or H160 format.
711
- */
712
- recipient: TAddress;
713
- /**
714
- * The optional sender address. A SS58 or H160 format.
715
- */
716
- sender?: string;
717
- /**
718
- * The optional asset hub address. A SS58 format only.
719
- */
720
- ahAddress?: string;
721
- /**
722
- * The destination chain or XCM location
723
- */
724
- to: TDestination;
725
- /**
726
- * The currency to transfer. Either ID, symbol, location, or multi-asset
727
- */
728
- currency: TCurrencyInputWithAmount;
629
+ type TDryRunOptions<TApi, TRes, TSigner> = WithApi<TDryRunBaseOptions<TRes>, TApi, TRes, TSigner>;
630
+ type TDryRunCallBaseOptions<TRes> = {
729
631
  /**
730
- * The optional fee asset. Either ID, symbol, or location
632
+ * The transaction to dry-run
731
633
  */
732
- feeAsset?: TCurrencyInput$1;
634
+ tx: TRes;
733
635
  /**
734
- * The optional destination parachain ID
636
+ * The chain to dry-run on
735
637
  */
736
- paraIdTo?: number;
638
+ chain: TSubstrateChain;
737
639
  /**
738
- * The optional overrided XCM version
640
+ * The destination chain
739
641
  */
740
- version?: Version;
642
+ destination: TDestination;
741
643
  /**
742
- * The optional pallet override
644
+ * The address to dry-run with
743
645
  */
744
- pallet?: string;
646
+ address: string;
745
647
  /**
746
- * Whether to keep the account alive after the transfer.
648
+ * Whether to use the root origin
747
649
  */
748
- keepAlive?: boolean;
650
+ useRootOrigin?: boolean;
749
651
  /**
750
- * The optional pallet method override
652
+ * XCM version to use for the dry-run parameters
751
653
  */
752
- method?: string;
654
+ version: Version;
655
+ asset: WithAmount<TAssetInfo>;
656
+ bypassOptions?: TBypassOptions;
657
+ feeAsset?: TAssetInfo;
658
+ };
659
+ type TDryRunBypassOptions<TApi, TRes, TSigner> = WithApi<Omit<TDryRunCallBaseOptions<TRes>, 'useRootOrigin' | 'destination'>, TApi, TRes, TSigner>;
660
+ type TDryRunCallOptions<TApi, TRes, TSigner> = WithApi<TDryRunCallBaseOptions<TRes>, TApi, TRes, TSigner>;
661
+ type TDryRunXcmBaseOptions<TRes> = {
662
+ originLocation: any;
753
663
  /**
754
- * Hex of the encoded transaction call to apply on the destination chain
664
+ * The XCM instructions
755
665
  */
756
- transactOptions?: TTransactOptions<TRes>;
666
+ xcm: any;
667
+ /** The transaction to dry-run */
668
+ tx: TRes;
757
669
  /**
758
- * The optional swap options
670
+ * The chain to dry-run on
759
671
  */
760
- swapOptions?: TSwapOptions<TApi, TRes, TSigner>;
761
- };
762
- /**
763
- * Options for transferring from a parachain to another parachain or relay chain
764
- */
765
- type TTransferOptions<TApi, TRes, TSigner> = WithApi<TTransferBaseOptions<TApi, TRes, TSigner>, TApi, TRes, TSigner> & {
766
- isAmountAll: boolean;
767
- };
768
- type WithRequiredSender<TBase> = Omit<TBase, 'sender'> & {
672
+ chain: TSubstrateChain;
769
673
  /**
770
- * The sender address. A SS58 or H160 format.
674
+ * The origin chain
771
675
  */
772
- sender: string;
773
- };
774
- type WithRequiredSwapOptions<TBase, TApi, TRes, TSigner> = Omit<TBase, 'swapOptions'> & {
775
- swapOptions: TSwapOptions<TApi, TRes, TSigner>;
776
- };
777
- type TTransferOptionsWithSwap<TApi, TRes, TSigner> = WithRequiredSwapOptions<Omit<TTransferOptions<TApi, TRes, TSigner>, 'isAmountAll'>, TApi, TRes, TSigner>;
778
- type TTransferBaseOptionsWithSwap<TApi, TRes, TSigner> = WithRequiredSwapOptions<TTransferBaseOptions<TApi, TRes, TSigner>, TApi, TRes, TSigner>;
779
- type TTransferBaseOptionsWithSender<TApi, TRes, TSigner> = WithRequiredSender<TTransferBaseOptions<TApi, TRes, TSigner>>;
780
- type TTransferInternalOptions<TApi, TRes, TSigner> = Omit<TTransferBaseOptions<TApi, TRes, TSigner>, 'from' | 'feeAsset' | 'version'> & {
781
- api: PolkadotApi<TApi, TRes, TSigner>;
782
- assetInfo: WithAmount<TAssetInfo>;
783
- feeAsset?: TAssetInfo;
784
- feeCurrency?: TCurrencyInput$1;
785
- overriddenAsset?: TLocation | TAssetWithFee[];
676
+ origin: TSubstrateChain;
677
+ asset: TAssetInfo;
786
678
  version: Version;
787
- isAmountAll: boolean;
788
- };
789
- type TTransactOrigin = (typeof TRANSACT_ORIGINS)[number];
790
- type TTransactOptions<TRes, TWeightType = bigint> = {
791
- call: string | TRes;
792
- originKind?: TTransactOrigin;
793
- maxWeight?: TWeight<TWeightType>;
794
- };
795
- type TSerializedExtrinsics = {
796
- module: TPallet;
797
- method: string;
798
- params: Record<string, unknown>;
679
+ feeAsset?: TAssetInfo;
680
+ amount: bigint;
681
+ originFee: bigint;
799
682
  };
800
- type TSerializedStateQuery = {
801
- module: TAssetsPallet;
802
- method: string;
803
- params: unknown[];
683
+ type TDryRunXcmOptions<TApi, TRes, TSigner> = WithApi<TDryRunXcmBaseOptions<TRes>, TApi, TRes, TSigner>;
684
+ type TDryRunResBase = {
685
+ asset: TAssetInfo;
686
+ isExchange?: boolean;
804
687
  };
805
- type TSerializedRuntimeApiQuery = {
806
- module: string;
807
- method: string;
808
- params: unknown[];
688
+ type TDryRunChainSuccess = TDryRunResBase & {
689
+ success: true;
690
+ fee: bigint;
691
+ weight?: TWeight;
692
+ forwardedXcms: any;
693
+ destParaId?: number;
809
694
  };
810
- type TDestWeight = {
811
- ref_time: bigint;
812
- proof_size: bigint;
695
+ type TDryRunChainFailure = TDryRunResBase & {
696
+ success: false;
697
+ failureReason: string;
698
+ failureSubReason?: string;
813
699
  };
814
- type TXTokensMethod = 'transfer' | 'transfer_multiasset' | 'transfer_multiassets';
815
- type TPolkadotXcmMethod = 'limited_teleport_assets' | 'limited_reserve_transfer_assets' | 'reserve_transfer_assets' | 'reserve_withdraw_assets' | 'transfer_assets' | 'transfer_assets_using_type_and_then';
816
- type TXcmPalletMethod = 'limited_teleport_assets' | 'limited_reserve_transfer_assets' | 'transfer_assets_using_type_and_then';
817
- type TWeight<TWeightType = bigint> = {
818
- refTime: TWeightType;
819
- proofSize: TWeightType;
700
+ type TDryRunChainResult = TDryRunChainSuccess | TDryRunChainFailure;
701
+ type THopInfo = {
702
+ chain: TChain;
703
+ result: TDryRunChainResult;
820
704
  };
821
- type TCreateBeneficiaryOptions<TApi, TRes, TSigner> = {
822
- api: PolkadotApi<TApi, TRes, TSigner>;
823
- address: TAddress;
824
- version: Version;
705
+ type TChainEndpoint = 'origin' | 'destination' | TChain;
706
+ type TDryRunResult = {
707
+ failureReason?: string;
708
+ failureSubReason?: string;
709
+ failureChain?: TChainEndpoint;
710
+ origin: TDryRunChainResult;
711
+ destination?: TDryRunChainResult;
712
+ hops: THopInfo[];
825
713
  };
826
- type TCreateBeneficiaryXTokensOptions<TApi, TRes, TSigner> = {
714
+ type TResolveHopParams<TApi, TRes, TSigner> = {
827
715
  api: PolkadotApi<TApi, TRes, TSigner>;
828
- origin: TSubstrateChain$1;
716
+ tx: TRes;
717
+ originChain: TSubstrateChain;
718
+ currentChain: TSubstrateChain;
829
719
  destination: TDestination;
830
- recipient: TAddress;
831
- version: Version;
832
- paraId?: number;
720
+ asset: TAssetInfo;
721
+ currency: TCurrencyInputWithAmount;
722
+ swapConfig?: TSwapConfig;
723
+ hasPassedExchange: boolean;
833
724
  };
834
- type TBridgeStatus = 'Normal' | 'Halted';
835
- type TTransferLocalOptions<TApi, TRes, TSigner> = Omit<TTransferInternalOptions<TApi, TRes, TSigner>, 'recipient'> & {
836
- recipient: string;
837
- balance: bigint;
725
+ type HopProcessParams<TApi, TRes, TSigner> = {
726
+ api: PolkadotApi<TApi, TRes, TSigner>;
727
+ currentChain: TSubstrateChain;
728
+ currentOrigin: TSubstrateChain;
729
+ currentAsset: TAssetInfo;
730
+ forwardedXcms: any;
731
+ hasPassedExchange: boolean;
732
+ isDestination: boolean;
838
733
  };
839
- type TTransferFeeEstimates = {
840
- originFee: bigint;
841
- reserveFee: bigint;
842
- };
843
- type TCreateBaseTransferXcmOptions<TRes> = {
844
- chain: TSubstrateChain$1;
845
- destChain: TChain$1;
846
- assetInfo: WithAmount<TAssetInfo>;
847
- feeAssetInfo?: TAssetInfo;
848
- fees: TTransferFeeEstimates;
849
- recipient: string;
850
- sender?: string;
851
- version: Version;
852
- useJitWithdraw?: boolean;
853
- useFeeAssetOnHops?: boolean;
854
- paraIdTo?: number;
855
- transactOptions?: TTransactOptions<TRes>;
856
- };
857
- type TCreateTransferXcmOptions<TApi, TRes, TSigner> = WithApi<TCreateBaseTransferXcmOptions<TRes>, TApi, TRes, TSigner>;
858
- type TCreateBaseSwapXcmOptions = {
859
- chain?: TSubstrateChain$1;
860
- exchangeChain: TExchangeChain;
861
- destChain?: TChain$1;
862
- assetInfoFrom: WithAmount<TAssetInfo>;
863
- assetInfoTo: WithAmount<TAssetInfo>;
864
- currencyTo: TCurrencyInput$1;
865
- feeAssetInfo?: TAssetInfo;
866
- sender: string;
867
- recipient: string;
868
- calculateMinAmountOut: (amountIn: bigint, assetTo?: TAssetInfo) => Promise<bigint>;
869
- };
870
- type TCreateSwapXcmOptions<TApi, TRes, TSigner> = WithApi<TCreateBaseSwapXcmOptions, TApi, TRes, TSigner>;
871
- type TSwapFeeEstimates = {
872
- originFee: bigint;
873
- originReserveFee: bigint;
874
- exchangeFee: bigint;
875
- destReserveFee: bigint;
734
+ type HopTraversalConfig<TApi, TRes, TSigner, THopResult> = {
735
+ api: PolkadotApi<TApi, TRes, TSigner>;
736
+ origin: TSubstrateChain;
737
+ destination: TChain;
738
+ currency: TCurrencyCore;
739
+ initialForwardedXcms: any;
740
+ initialDestParaId: number | undefined;
741
+ swapConfig?: TSwapConfig;
742
+ processHop: (params: HopProcessParams<TApi, TRes, TSigner>) => Promise<THopResult>;
743
+ shouldContinue: (hopResult: THopResult) => boolean;
744
+ extractNextHopData: (hopResult: THopResult) => {
745
+ forwardedXcms: any;
746
+ destParaId: number | undefined;
747
+ };
876
748
  };
877
- type TCreateSwapXcmInternalOptions<TApi, TRes, TSigner> = WithApi<TCreateBaseSwapXcmOptions, TApi, TRes, TSigner> & {
878
- version: Version;
879
- fees: TSwapFeeEstimates;
880
- paraIdTo?: number;
749
+ type HopTraversalResult<THopResult> = {
750
+ hops: Array<{
751
+ chain: TSubstrateChain;
752
+ result: THopResult;
753
+ }>;
754
+ destination?: THopResult;
755
+ lastProcessedChain?: TSubstrateChain;
881
756
  };
882
- type TCreateEthBridgeInstructionsOptions<TApi, TRes, TSigner> = {
883
- api: PolkadotApi<TApi, TRes, TSigner>;
884
- recipient: TAddress;
885
- assetInfo: TAssetInfo;
886
- sender: string;
887
- ahAddress?: string;
888
- version: Version;
757
+ type TBypassOptions = {
758
+ mintFeeAssets?: boolean;
759
+ sentAssetMintMode?: 'preview' | 'bypass';
889
760
  };
890
-
891
- /** @deprecated Asset claim functionality is deprecated and will be removed in v14. */
892
- type TAssetClaimOptionsBase = {
893
- chain: TSubstrateChain$1;
894
- currency: WithComplexAmount<TCurrencyCore> | TAsset<TAmount$1>[] | WithComplexAmount<TCurrencyCore>[];
895
- address: TAddress;
896
- version?: Version;
761
+ declare enum XTokensError {
762
+ AssetHasNoReserve = "AssetHasNoReserve",
763
+ NotCrossChainTransfer = "NotCrossChainTransfer",
764
+ InvalidDest = "InvalidDest",
765
+ NotCrossChainTransferableCurrency = "NotCrossChainTransferableCurrency",
766
+ UnweighableMessage = "UnweighableMessage",
767
+ XcmExecutionFailed = "XcmExecutionFailed",
768
+ CannotReanchor = "CannotReanchor",
769
+ InvalidAncestry = "InvalidAncestry",
770
+ InvalidAsset = "InvalidAsset",
771
+ DestinationNotInvertible = "DestinationNotInvertible",
772
+ BadVersion = "BadVersion",
773
+ DistinctReserveForAssetAndFee = "DistinctReserveForAssetAndFee",
774
+ ZeroFee = "ZeroFee",
775
+ ZeroAmount = "ZeroAmount",
776
+ TooManyAssetsBeingSent = "TooManyAssetsBeingSent",
777
+ AssetIndexNonExistent = "AssetIndexNonExistent",
778
+ FeeNotEnough = "FeeNotEnough",
779
+ NotSupportedLocation = "NotSupportedLocation",
780
+ MinXcmFeeNotDefined = "MinXcmFeeNotDefined",
781
+ RateLimited = "RateLimited"
782
+ }
783
+ declare enum PolkadotXcmError {
784
+ Unreachable = "Unreachable",
785
+ SendFailure = "SendFailure",
786
+ Filtered = "Filtered",
787
+ UnweighableMessage = "UnweighableMessage",
788
+ DestinationNotInvertible = "DestinationNotInvertible",
789
+ Empty = "Empty",
790
+ CannotReanchor = "CannotReanchor",
791
+ TooManyAssets = "TooManyAssets",
792
+ InvalidOrigin = "InvalidOrigin",
793
+ BadVersion = "BadVersion",
794
+ BadLocation = "BadLocation",
795
+ NoSubscription = "NoSubscription",
796
+ AlreadySubscribed = "AlreadySubscribed",
797
+ CannotCheckOutTeleport = "CannotCheckOutTeleport",
798
+ LowBalance = "LowBalance",
799
+ TooManyLocks = "TooManyLocks",
800
+ AccountNotSovereign = "AccountNotSovereign",
801
+ FeesNotMet = "FeesNotMet",
802
+ LockNotFound = "LockNotFound",
803
+ InUse = "InUse",
804
+ REMOVED = "REMOVED",
805
+ InvalidAssetUnknownReserve = "InvalidAssetUnknownReserve",
806
+ InvalidAssetUnsupportedReserve = "InvalidAssetUnsupportedReserve",
807
+ TooManyReserves = "TooManyReserves",
808
+ LocalExecutionIncomplete = "LocalExecutionIncomplete",
809
+ TooManyAuthorizedAliases = "TooManyAuthorizedAliases",
810
+ ExpiresInPast = "ExpiresInPast",
811
+ AliasNotFound = "AliasNotFound",
812
+ LocalExecutionIncompleteWithError = "LocalExecutionIncompleteWithError"
813
+ }
814
+ declare enum PolkadotXcmExecutionError {
815
+ Overflow = "Overflow",
816
+ Unimplemented = "Unimplemented",
817
+ UntrustedReserveLocation = "UntrustedReserveLocation",
818
+ UntrustedTeleportLocation = "UntrustedTeleportLocation",
819
+ LocationFull = "LocationFull",
820
+ LocationNotInvertible = "LocationNotInvertible",
821
+ BadOrigin = "BadOrigin",
822
+ InvalidLocation = "InvalidLocation",
823
+ AssetNotFound = "AssetNotFound",
824
+ FailedToTransactAsset = "FailedToTransactAsset",
825
+ NotWithdrawable = "NotWithdrawable",
826
+ LocationCannotHold = "LocationCannotHold",
827
+ ExceedsMaxMessageSize = "ExceedsMaxMessageSize",
828
+ DestinationUnsupported = "DestinationUnsupported",
829
+ Transport = "Transport",
830
+ Unroutable = "Unroutable",
831
+ UnknownClaim = "UnknownClaim",
832
+ FailedToDecode = "FailedToDecode",
833
+ MaxWeightInvalid = "MaxWeightInvalid",
834
+ NotHoldingFees = "NotHoldingFees",
835
+ TooExpensive = "TooExpensive",
836
+ Trap = "Trap",
837
+ ExpectationFalse = "ExpectationFalse",
838
+ PalletNotFound = "PalletNotFound",
839
+ NameMismatch = "NameMismatch",
840
+ VersionIncompatible = "VersionIncompatible",
841
+ HoldingWouldOverflow = "HoldingWouldOverflow",
842
+ ExportError = "ExportError",
843
+ ReanchorFailed = "ReanchorFailed",
844
+ NoDeal = "NoDeal",
845
+ FeesNotMet = "FeesNotMet",
846
+ LockError = "LockError",
847
+ NoPermission = "NoPermission",
848
+ Unanchored = "Unanchored",
849
+ NotDepositable = "NotDepositable",
850
+ TooManyAssets = "TooManyAssets",
851
+ UnhandledXcmVersion = "UnhandledXcmVersion",
852
+ WeightLimitReached = "WeightLimitReached",
853
+ Barrier = "Barrier",
854
+ WeightNotComputable = "WeightNotComputable",
855
+ ExceedsStackLimit = "ExceedsStackLimit"
856
+ }
857
+ type TModuleError = {
858
+ index: string;
859
+ error: string;
897
860
  };
898
- type TAssetClaimOptions<TApi, TRes, TSigner> = WithApi<TAssetClaimOptionsBase, TApi, TRes, TSigner>;
899
- type TAssetClaimInternalOptions<TApi, TRes, TSigner> = TAssetClaimOptions<TApi, TRes, TSigner> & {
900
- version: Version;
901
- assets: TAsset<bigint>[];
861
+ type TDryRunError = {
862
+ failureReason: string;
863
+ failureSubReason?: string;
902
864
  };
903
865
 
904
- type TSetBalanceRes = {
905
- assetStatusTx?: TSerializedExtrinsics;
906
- balanceTx: TSerializedExtrinsics;
866
+ type TXcmFeeSwapConfig = TSwapConfig & {
867
+ amountOut: bigint;
907
868
  };
908
- declare abstract class BaseAssetsPallet {
909
- protected palletName: TAssetsPallet;
910
- constructor(palletName: TAssetsPallet);
911
- abstract mint<TApi, TRes, TSigner>(address: string, assetInfo: WithAmount<TAssetInfo>, balance: bigint, chain: TSubstrateChain$1, api: PolkadotApi<TApi, TRes, TSigner>): Promise<TSetBalanceRes>;
912
- abstract getBalance<TApi, TRes, TSigner>(api: PolkadotApi<TApi, TRes, TSigner>, address: string, asset: TAssetInfo, customCurrencyId?: unknown): Promise<bigint>;
913
- }
914
-
915
- /**
916
- * Builder class for constructing asset claim transactions.
917
- *
918
- * @deprecated Asset claim functionality is deprecated and will be removed in v14.
919
- */
920
- declare class AssetClaimBuilder<TApi, TRes, TSigner, T extends Partial<TAssetClaimOptionsBase & TBuilderInternalOptions<TSigner>> = object> {
921
- readonly api: PolkadotApi<TApi, TRes, TSigner>;
922
- readonly _options: T;
923
- constructor(api: PolkadotApi<TApi, TRes, TSigner>, options?: T);
924
- /**
925
- * Specifies the assets to be claimed.
926
- *
927
- * @param assets - An array of assets to claim in a multi-asset format.
928
- * @returns An instance of Builder
929
- */
930
- currency(currency: TAssetClaimOptionsBase['currency']): AssetClaimBuilder<TApi, TRes, TSigner, T & {
931
- currency: TAssetClaimOptionsBase['currency'];
932
- }>;
933
- /**
934
- * Sets the sender address.
935
- *
936
- * @param address - The sender address.
937
- * @returns
938
- */
939
- sender(sender: TSender<TSigner>): AssetClaimBuilder<TApi, TRes, TSigner, T & {
940
- sender: string;
941
- }>;
942
- /**
943
- * Specifies the account address on which the assets will be claimed.
944
- *
945
- * @param address - The destination account address.
946
- * @returns An instance of Builder
947
- */
948
- address(address: TAddress): AssetClaimBuilder<TApi, TRes, TSigner, T & {
949
- address: TAddress;
950
- }>;
869
+ type TTxFactory<TRes> = (amount?: string, relative?: boolean) => Promise<TRes>;
870
+ type TGetXcmFeeBaseOptions<TRes, TDisableFallback extends boolean = boolean> = {
951
871
  /**
952
- * Sets the XCM version to be used for the asset claim.
953
- *
954
- * @param version - The XCM version.
955
- * @returns An instance of Builder
872
+ * The transaction factory
956
873
  */
957
- xcmVersion(version: Version): AssetClaimBuilder<TApi, TRes, TSigner, T & {
958
- version: Version;
959
- }>;
874
+ buildTx: TTxFactory<TRes>;
960
875
  /**
961
- * Builds and returns the asset claim extrinsic.
962
- *
963
- * @returns A Promise that resolves to the asset claim extrinsic.
876
+ * The origin chain
964
877
  */
965
- build(this: AssetClaimBuilder<TApi, TRes, TSigner, TAssetClaimOptionsBase>): Promise<TRes>;
966
- signAndSubmit(this: AssetClaimBuilder<TApi, TRes, TSigner, TAssetClaimOptionsBase & TBuilderInternalOptions<TSigner>>): Promise<string>;
878
+ origin: TSubstrateChain;
967
879
  /**
968
- * Returns the API instance used by the builder.
969
- *
970
- * @returns The API instance.
880
+ * The destination chain
971
881
  */
972
- getApi(): TApi;
882
+ destination: TChain;
973
883
  /**
974
- * Disconnects the API.
975
- *
976
- * @returns A Promise that resolves when the API is disconnected.
884
+ * The sender address
977
885
  */
978
- disconnect(): Promise<void>;
979
- }
980
-
981
- declare class BatchTransactionManager<TApi, TRes, TSigner> {
982
- transactionOptions: TBatchedTransferOptions<TApi, TRes, TSigner>[];
983
- addTransaction(options: TBatchedTransferOptions<TApi, TRes, TSigner>): void;
984
- isEmpty(): boolean;
985
- buildBatch(api: PolkadotApi<TApi, TRes, TSigner>, from: TSubstrateChain$1, options?: TBatchOptions): Promise<TRes>;
986
- }
987
-
988
- /**
989
- * A builder class for constructing Para-to-Para, Para-to-Relay, Relay-to-Para transactions and asset claims.
990
- */
991
- declare class GeneralBuilder<TApi, TRes, TSigner, T extends Partial<TTransferBaseOptions<TApi, TRes, TSigner> & TBuilderInternalOptions<TSigner>> = object> {
992
- readonly batchManager: BatchTransactionManager<TApi, TRes, TSigner>;
993
- readonly api: PolkadotApi<TApi, TRes, TSigner>;
994
- readonly _options: T;
995
- constructor(api: PolkadotApi<TApi, TRes, TSigner>, batchManager: BatchTransactionManager<TApi, TRes, TSigner>, options?: T);
886
+ sender: string;
887
+ recipient: string;
888
+ currency: WithAmount<TCurrencyCore>;
889
+ version?: Version;
890
+ feeAsset?: TCurrencyInput;
891
+ disableFallback: TDisableFallback;
892
+ swapConfig?: TXcmFeeSwapConfig;
893
+ skipReverseFeeCalculation?: boolean;
894
+ };
895
+ type TGetXcmFeeOptions<TApi, TRes, TSigner, TDisableFallback extends boolean = boolean> = WithApi<TGetXcmFeeBaseOptions<TRes, TDisableFallback>, TApi, TRes, TSigner>;
896
+ type TGetXcmFeeInternalOptions<TApi, TRes, TSigner, TDisableFallback extends boolean = boolean> = Omit<TGetXcmFeeOptions<TApi, TRes, TSigner, TDisableFallback>, 'buildTx'> & {
897
+ tx: TRes;
898
+ useRootOrigin: boolean;
899
+ };
900
+ type TGetXcmFeeBuilderOptions = {
901
+ disableFallback: boolean;
902
+ };
903
+ type TGetOriginXcmFeeBaseOptions<TRes> = {
904
+ buildTx: TTxFactory<TRes>;
905
+ origin: TSubstrateChain;
906
+ destination: TChain;
907
+ sender: string;
908
+ currency: WithAmount<TCurrencyCore>;
909
+ version?: Version;
910
+ feeAsset?: TCurrencyInput;
911
+ disableFallback: boolean;
912
+ useRootOrigin?: boolean;
913
+ };
914
+ type TGetOriginXcmFeeOptions<TApi, TRes, TSigner> = WithApi<TGetOriginXcmFeeBaseOptions<TRes>, TApi, TRes, TSigner>;
915
+ type TGetOriginXcmFeeInternalOptions<TApi, TRes, TSigner> = Omit<TGetOriginXcmFeeOptions<TApi, TRes, TSigner>, 'buildTx'> & {
916
+ tx: TRes;
917
+ };
918
+ type TGetFeeForDestChainBaseOptions<TRes> = {
919
+ prevChain: TSubstrateChain;
920
+ origin: TSubstrateChain;
921
+ destination: TChain;
922
+ sender: string;
923
+ recipient: string;
924
+ currency: WithAmount<TCurrencyCore>;
925
+ forwardedXcms: any;
926
+ tx: TRes;
927
+ asset: TAssetInfo;
928
+ version: Version;
929
+ originFee: bigint;
930
+ feeAsset?: TCurrencyInput;
931
+ disableFallback: boolean;
932
+ hasPassedExchange?: boolean;
933
+ swapConfig?: TXcmFeeSwapConfig;
934
+ skipReverseFeeCalculation?: boolean;
935
+ };
936
+ type TGetFeeForDestChainOptions<TApi, TRes, TSigner> = WithApi<TGetFeeForDestChainBaseOptions<TRes>, TApi, TRes, TSigner>;
937
+ type TGetReverseTxFeeOptions<TApi, TRes, TSigner> = Omit<TGetFeeForDestChainOptions<TApi, TRes, TSigner>, 'destination' | 'disableFallback' | 'forwardedXcms' | 'asset' | 'originFee' | 'prevChain' | 'version'> & {
938
+ destination: TSubstrateChain;
939
+ };
940
+ type TFeeType = 'dryRun' | 'paymentInfo' | 'noFeeRequired';
941
+ type TXcmFeeBase$1 = {
942
+ asset: TAssetInfo;
943
+ weight?: TWeight;
944
+ sufficient?: boolean;
945
+ isExchange?: boolean;
946
+ };
947
+ type TXcmFeeDetailSuccess = TXcmFeeBase$1 & {
948
+ fee: bigint;
949
+ feeType: TFeeType;
950
+ dryRunError?: string;
951
+ dryRunSubError?: string;
952
+ };
953
+ type TXcmFeeDetailWithFallback = TXcmFeeDetailSuccess;
954
+ type TXcmFeeDetailError = TXcmFeeBase$1 & {
955
+ fee?: bigint;
956
+ feeType?: TFeeType;
957
+ dryRunError: string;
958
+ dryRunSubError?: string;
959
+ };
960
+ type TXcmFeeDetail = TXcmFeeDetailSuccess | TXcmFeeDetailError;
961
+ type TXcmFeeHopResult = {
962
+ fee?: bigint;
963
+ feeType?: TFeeType;
964
+ sufficient?: boolean;
965
+ dryRunError?: string;
966
+ dryRunSubError?: string;
967
+ forwardedXcms?: any;
968
+ destParaId?: number;
969
+ asset: TAssetInfo;
970
+ };
971
+ type TConditionalXcmFeeDetail<TDisableFallback extends boolean> = TDisableFallback extends false ? TXcmFeeDetailWithFallback : TXcmFeeDetail;
972
+ type TDestXcmFeeDetail<TDisableFallback extends boolean> = TConditionalXcmFeeDetail<TDisableFallback> & {
973
+ forwardedXcms?: any;
974
+ destParaId?: number;
975
+ };
976
+ type TConditionalXcmFeeHopInfo<TDisableFallback extends boolean> = {
977
+ chain: TChain;
978
+ result: TConditionalXcmFeeDetail<TDisableFallback>;
979
+ };
980
+ type TXcmFeeHopInfo = {
981
+ chain: TChain;
982
+ result: TXcmFeeDetail;
983
+ };
984
+ type TGetXcmFeeResult<TDisableFallback extends boolean = boolean> = {
985
+ failureReason?: string;
986
+ failureChain?: TChainEndpoint;
987
+ origin: TConditionalXcmFeeDetail<TDisableFallback>;
988
+ destination: TConditionalXcmFeeDetail<TDisableFallback>;
989
+ hops: TConditionalXcmFeeHopInfo<TDisableFallback>[];
990
+ };
991
+ type TPaymentInfo = {
992
+ partialFee: bigint;
993
+ weight: TWeight;
994
+ };
995
+
996
+ type TExchangeChain = (typeof EXCHANGE_CHAINS)[number];
997
+ type TExchangeInput = TExchangeChain | TExchangeChain[] | undefined;
998
+ type TSwapOptions<TApi, TRes, TSigner> = {
999
+ currencyTo: TCurrencyCore;
1000
+ exchange?: TExchangeInput;
1001
+ slippage?: number;
1002
+ evmSenderAddress?: string;
1003
+ evmSigner?: TSigner;
1004
+ onStatusChange?: TStatusChangeCallback<TApi, TRes>;
1005
+ };
1006
+ type TTransactionContext<TApi, TRes> = {
1007
+ type: TTransactionType;
1008
+ api: TApi;
1009
+ chain: TSubstrateChain;
1010
+ tx: TRes;
1011
+ };
1012
+ type TTransactionType = 'TRANSFER' | 'SWAP' | 'SWAP_AND_TRANSFER';
1013
+ type TSwapEventType = TTransactionType | 'SELECTING_EXCHANGE' | 'COMPLETED';
1014
+ /**
1015
+ * The transaction progress information.
1016
+ */
1017
+ type TSwapEvent<TApi, TRes> = {
996
1018
  /**
997
- * Specifies the origin chain for the transaction.
998
- *
999
- * @param chain - The chain from which the transaction originates.
1000
- * @returns An instance of Builder
1019
+ * Current execution phase type
1001
1020
  */
1002
- from(chain: TSubstrateChain$1): GeneralBuilder<TApi, TRes, TSigner, T & {
1003
- from: TSubstrateChain$1;
1004
- }>;
1021
+ type: TSwapEventType;
1005
1022
  /**
1006
- * Specifies the destination chain for the transaction.
1007
- *
1008
- * @param chain - The chain to which the transaction is sent.
1009
- * @param paraIdTo - (Optional) The parachain ID of the destination chain.
1010
- * @returns An instance of Builder
1023
+ * Full transaction plan for visualization
1011
1024
  */
1012
- to(chain: TDestination, paraIdTo?: number): GeneralBuilder<TApi, TRes, TSigner, T & {
1013
- to: TDestination;
1014
- }>;
1025
+ routerPlan?: TTransactionContext<TApi, TRes>[];
1015
1026
  /**
1016
- * Initiates the process to claim assets from a specified chain.
1017
- *
1018
- * @deprecated Asset claim functionality is deprecated and will be removed in v14.
1019
- * @param chain - The chain from which to claim assets.
1020
- * @returns An instance of Builder
1027
+ * Current transaction's origin chain
1021
1028
  */
1022
- claimFrom(chain: TSubstrateChain$1): AssetClaimBuilder<TApi, TRes, TSigner, {
1023
- chain: TSubstrateChain$1;
1024
- }>;
1029
+ chain?: TSubstrateChain;
1025
1030
  /**
1026
- * Specifies the currency to be used in the transaction. Symbol, ID, location or multi-asset.
1027
- *
1028
- * @param currency - The currency to be transferred.
1029
- * @returns An instance of Builder
1031
+ * Current transaction's destination chain
1030
1032
  */
1031
- currency(currency: TCurrencyInputWithAmount): GeneralBuilder<TApi, TRes, TSigner, T & {
1032
- currency: TCurrencyInputWithAmount;
1033
- }>;
1033
+ destinationChain?: TChain;
1034
1034
  /**
1035
- * Sets the recipient address.
1036
- *
1037
- * @param address - The recipient address on the destination chain.
1038
- * @returns An instance of Builder
1035
+ * 0-based step index of current operation
1039
1036
  */
1040
- recipient(address: TAddress): GeneralBuilder<TApi, TRes, TSigner, T & {
1041
- recipient: TAddress;
1037
+ currentStep?: number;
1038
+ };
1039
+ type TStatusChangeCallback<TApi, TRes> = (info: TSwapEvent<TApi, TRes>) => void;
1040
+ interface TSwapBuilder<TApi, TRes, TSigner> {
1041
+ from(chain: TSubstrateChain | undefined): TSwapBuilder<TApi, TRes, TSigner>;
1042
+ to(chain: TChain | undefined): TSwapBuilder<TApi, TRes, TSigner>;
1043
+ exchange(chain: TExchangeInput): TSwapBuilder<TApi, TRes, TSigner>;
1044
+ currencyFrom(currency: TCurrencyInput): TSwapBuilder<TApi, TRes, TSigner>;
1045
+ currencyTo(currency: TCurrencyInput): TSwapBuilder<TApi, TRes, TSigner>;
1046
+ feeAsset(currency: TCurrencyInput | undefined): TSwapBuilder<TApi, TRes, TSigner>;
1047
+ amount(amount: TAmount): TSwapBuilder<TApi, TRes, TSigner>;
1048
+ recipient(address: string | undefined): TSwapBuilder<TApi, TRes, TSigner>;
1049
+ sender(address: string): TSwapBuilder<TApi, TRes, TSigner>;
1050
+ signer(signer: TSigner): TSwapBuilder<TApi, TRes, TSigner>;
1051
+ evmSenderAddress(address: string | undefined): TSwapBuilder<TApi, TRes, TSigner>;
1052
+ evmSigner(signer: TSigner | undefined): TSwapBuilder<TApi, TRes, TSigner>;
1053
+ slippagePct(pct: string): TSwapBuilder<TApi, TRes, TSigner>;
1054
+ onStatusChange(callback: TStatusChangeCallback<TApi, TRes>): TSwapBuilder<TApi, TRes, TSigner>;
1055
+ getXcmFees<TDisableFallback extends boolean = false>(options?: TGetXcmFeeBuilderOptions & {
1056
+ disableFallback: TDisableFallback;
1057
+ }): Promise<TGetXcmFeeResult<TDisableFallback>>;
1058
+ getTransferableAmount(): Promise<bigint>;
1059
+ getMinTransferableAmount(): Promise<bigint>;
1060
+ getBestAmountOut(): Promise<{
1061
+ exchange: TExchangeChain;
1062
+ amountOut: bigint;
1042
1063
  }>;
1064
+ dryRun(): Promise<TDryRunResult>;
1065
+ build(): Promise<TTransactionContext<TApi, TRes>[]>;
1066
+ signAndSubmit(): Promise<string[]>;
1067
+ }
1068
+ type TSwapBuilderFactory = <TApi, TRes, TSigner>(api: PolkadotApi<TApi, TRes, TSigner>) => TSwapBuilder<TApi, TRes, TSigner>;
1069
+
1070
+ type TPolkadotXCMTransferOptions<TApi, TRes, TSigner> = {
1071
+ api: PolkadotApi<TApi, TRes, TSigner>;
1072
+ chain: TSubstrateChain;
1073
+ beneficiaryLocation: TLocation;
1074
+ recipient: TAddress;
1075
+ asset: TAsset;
1076
+ overriddenAsset?: TLocation | TAssetWithFee[];
1077
+ scenario: TScenario;
1078
+ assetInfo: WithAmount<TAssetInfo>;
1079
+ currency: TCurrencyInputWithAmount;
1080
+ feeAssetInfo?: TAssetInfo;
1081
+ feeCurrency?: TCurrencyInput;
1082
+ destination: TDestination;
1083
+ destChain?: TChain;
1084
+ paraIdTo?: number;
1085
+ version: Version;
1086
+ sender?: string;
1087
+ ahAddress?: string;
1088
+ pallet?: string;
1089
+ method?: string;
1090
+ transactOptions?: TTransactOptions<TRes>;
1091
+ };
1092
+ type TXTokensTransferOptions<TApi, TRes, TSigner> = {
1093
+ api: PolkadotApi<TApi, TRes, TSigner>;
1094
+ asset: WithAmount<TAssetInfo>;
1095
+ recipient: TAddress;
1096
+ scenario: TScenario;
1097
+ origin: TSubstrateChain;
1098
+ destination: TDestination;
1099
+ paraIdTo?: number;
1100
+ version: Version;
1101
+ overriddenAsset?: TLocation | TAssetWithFee[];
1102
+ pallet?: string;
1103
+ method?: string;
1104
+ useMultiAssetTransfer?: boolean;
1105
+ };
1106
+ interface IPolkadotXCMTransfer<TApi, TRes, TSigner> {
1107
+ transferPolkadotXCM: (input: TPolkadotXCMTransferOptions<TApi, TRes, TSigner>) => Promise<TRes>;
1108
+ }
1109
+ interface IXTokensTransfer<TApi, TRes, TSigner> {
1110
+ transferXTokens: (input: TXTokensTransferOptions<TApi, TRes, TSigner>) => TRes;
1111
+ }
1112
+ type TScenario = 'ParaToRelay' | 'ParaToPara' | 'RelayToPara';
1113
+ type TAddress = string | TLocation;
1114
+ type TDestination = TChain | TLocation;
1115
+ type TTransferBaseOptions<TApi, TRes, TSigner> = {
1043
1116
  /**
1044
- * Sets the sender address.
1045
- *
1046
- * @param sender - The sender address or signer.
1047
- * @returns An instance of Builder
1117
+ * The origin chain
1048
1118
  */
1049
- sender(sender: TSender<TSigner>): GeneralBuilder<TApi, TRes, TSigner, T & {
1050
- sender: string;
1051
- }>;
1119
+ from: TChain;
1052
1120
  /**
1053
- * Sets the asset hub address. This is used for transfers that go through the Asset Hub and originate from an EVM chain.
1054
- *
1055
- * @param address - The address to be used.
1056
- * @returns An instance of Builder
1121
+ * The destination address. A SS58 or H160 format.
1057
1122
  */
1058
- ahAddress(address: string | undefined): GeneralBuilder<TApi, TRes, TSigner, T & {
1059
- ahAddress: string | undefined;
1060
- }>;
1123
+ recipient: TAddress;
1061
1124
  /**
1062
- * Sets the XCM version to be used for the transfer.
1063
- *
1064
- * @param version - The XCM version.
1065
- * @returns An instance of Builder
1125
+ * The optional sender address. A SS58 or H160 format.
1066
1126
  */
1067
- xcmVersion(version: Version): GeneralBuilder<TApi, TRes, TSigner, T & {
1068
- version: Version;
1069
- }>;
1127
+ sender?: string;
1070
1128
  /**
1071
- * Whether to keep the account alive after the transfer.
1072
- *
1073
- * @param value - A boolean indicating whether to keep the account alive.
1074
- * @returns An instance of Builder
1129
+ * The optional asset hub address. A SS58 format only.
1075
1130
  */
1076
- keepAlive(keepAlive: boolean): GeneralBuilder<TApi, TRes, TSigner, T & {
1077
- keepAlive: boolean;
1078
- }>;
1131
+ ahAddress?: string;
1079
1132
  /**
1080
- * Sets a custom pallet for the transaction.
1081
- *
1082
- * @param pallet - The name of the custom pallet to be used.
1083
- * @param method - The name of the method to be used.
1084
- * @returns An instance of the Builder.
1133
+ * The destination chain or XCM location
1085
1134
  */
1086
- customPallet(pallet: string | undefined, method: string | undefined): GeneralBuilder<TApi, TRes, TSigner, T & {
1087
- pallet: string | undefined;
1088
- method: string | undefined;
1089
- }>;
1135
+ to: TDestination;
1090
1136
  /**
1091
- * Optional fee asset for the transaction.
1092
- *
1093
- * @param currency - The currency to be used for the fee.
1094
- * @returns An instance of the Builder
1095
- */
1096
- feeAsset(currency: TCurrencyInput$1 | undefined): GeneralBuilder<TApi, TRes, TSigner, T & {
1097
- feeAsset: TCurrencyInput$1 | undefined;
1098
- }>;
1099
- /**
1100
- * Sets the hex of the encoded transaction call to apply on the destination chain
1101
- *
1102
- * @param hex - The encoded call hex or extrinsics.
1103
- * @param originKind - (Optional) The means of expressing the message origin as a dispatch origin.
1104
- * @param maxWeight - (Optional) The weight of the call. If not provided, the weight will be estimated.
1105
- * @returns An instance of the Builder.
1106
- */
1107
- transact(call: string | TRes, originKind?: TTransactOrigin, maxWeight?: TWeight): GeneralBuilder<TApi, TRes, TSigner, T & {
1108
- transactOptions: {
1109
- call: string | TRes;
1110
- originKind: "Native" | "SovereignAccount" | "Superuser" | "Xcm" | undefined;
1111
- maxWeight: TWeight | undefined;
1112
- };
1113
- }>;
1114
- /**
1115
- * Performs a token swap as part of the transfer, using the specified exchange and destination currency.
1116
- *
1117
- * @param options - The swap options.
1118
- * @returns An instance of the Builder.
1119
- */
1120
- swap(options: TSwapOptions<TApi, TRes, TSigner>): GeneralBuilder<TApi, TRes, TSigner, T & {
1121
- swapOptions: TSwapOptions<TApi, TRes, TSigner>;
1122
- }>;
1123
- /**
1124
- * Adds the transfer transaction to the batch.
1125
- *
1126
- * @returns An instance of Builder
1127
- */
1128
- addToBatch(this: GeneralBuilder<TApi, TRes, TSigner, TTransferBaseOptions<TApi, TRes, TSigner>>): GeneralBuilder<TApi, TRes, TSigner, T & {
1129
- from: TSubstrateChain$1;
1130
- }>;
1131
- /**
1132
- * Builds and returns the batched transaction based on the configured parameters.
1133
- *
1134
- * @param options - (Optional) Options to customize the batch transaction.
1135
- * @returns A Extrinsic representing the batched transactions.
1136
- */
1137
- buildBatch(this: GeneralBuilder<TApi, TRes, TSigner, TTransferBaseOptions<TApi, TRes, TSigner>>, options?: TBatchOptions): Promise<TRes>;
1138
- protected buildInternal<TOptions extends TTransferBaseOptions<TApi, TRes, TSigner>>(this: GeneralBuilder<TApi, TRes, TSigner, TOptions>): Promise<TBuildInternalRes<TApi, TRes, TSigner, TOptions>>;
1139
- private prepareNormalizedOptions;
1140
- /**
1141
- * Builds and returns the transfer extrinsic.
1142
- *
1143
- * @returns A Promise that resolves to the transfer extrinsic.
1144
- */
1145
- build(this: GeneralBuilder<TApi, TRes, TSigner, TTransferBaseOptions<TApi, TRes, TSigner>>): Promise<TRes>;
1146
- /**
1147
- * Builds and returns multiple transfer or swap extrinsics
1148
- *
1149
- * @returns A Promise that resolves to the transfer extrinsic contexts
1150
- */
1151
- buildAll(this: GeneralBuilder<TApi, TRes, TSigner, TTransferBaseOptions<TApi, TRes, TSigner>>): Promise<TTransactionContext<TApi, TRes>[]>;
1152
- private validateBatchState;
1153
- private buildCommon;
1154
- private buildCommonAll;
1155
- private maybePerformXcmFormatCheck;
1156
- dryRun(this: GeneralBuilder<TApi, TRes, TSigner, TTransferBaseOptionsWithSender<TApi, TRes, TSigner>>): Promise<TDryRunResult>;
1157
- dryRunPreview(this: GeneralBuilder<TApi, TRes, TSigner, TTransferBaseOptionsWithSender<TApi, TRes, TSigner>>, dryRunOptions?: TDryRunPreviewOptions): Promise<TDryRunResult>;
1158
- protected createTxFactory<TOptions extends TTransferBaseOptions<TApi, TRes, TSigner>>(this: GeneralBuilder<TApi, TRes, TSigner, TOptions>): TTxFactory<TRes>;
1159
- /**
1160
- * Returns the XCM fee for the transfer using dryRun or paymentInfo function.
1161
- *
1162
- * @returns An origin and destination fee.
1137
+ * The currency to transfer. Either ID, symbol, location, or multi-asset
1163
1138
  */
1164
- getXcmFee<TDisableFallback extends boolean = false>(this: GeneralBuilder<TApi, TRes, TSigner, TTransferBaseOptionsWithSender<TApi, TRes, TSigner>>, options?: TGetXcmFeeBuilderOptions & {
1165
- disableFallback: TDisableFallback;
1166
- }): Promise<TGetXcmFeeResult<TDisableFallback>>;
1139
+ currency: TCurrencyInputWithAmount;
1167
1140
  /**
1168
- * Returns the origin XCM fee for the transfer using dryRun or paymentInfo function.
1169
- *
1170
- * @returns An origin fee.
1141
+ * The optional fee asset. Either ID, symbol, or location
1171
1142
  */
1172
- getOriginXcmFee(this: GeneralBuilder<TApi, TRes, TSigner, TTransferBaseOptionsWithSender<TApi, TRes, TSigner>>, { disableFallback }?: TGetXcmFeeBuilderOptions): Promise<TXcmFeeDetail & {
1173
- forwardedXcms?: unknown;
1174
- destParaId?: number;
1175
- }>;
1143
+ feeAsset?: TCurrencyInput;
1176
1144
  /**
1177
- * Returns the max transferable amount for the transfer
1178
- *
1179
- * @returns The max transferable amount.
1145
+ * The optional destination parachain ID
1180
1146
  */
1181
- getTransferableAmount(this: GeneralBuilder<TApi, TRes, TSigner, TTransferBaseOptionsWithSender<TApi, TRes, TSigner>>): Promise<bigint>;
1147
+ paraIdTo?: number;
1182
1148
  /**
1183
- * Returns the min transferable amount for the transfer
1184
- *
1185
- * @returns The min transferable amount.
1149
+ * The optional overrided XCM version
1186
1150
  */
1187
- getMinTransferableAmount(this: GeneralBuilder<TApi, TRes, TSigner, TTransferBaseOptionsWithSender<TApi, TRes, TSigner>>): Promise<bigint>;
1151
+ version?: Version;
1188
1152
  /**
1189
- * Returns the max transferable amount for the transfer
1190
- *
1191
- * @returns The max transferable amount.
1153
+ * The optional pallet override
1192
1154
  */
1193
- verifyEdOnDestination(this: GeneralBuilder<TApi, TRes, TSigner, TTransferBaseOptionsWithSender<TApi, TRes, TSigner>>): Promise<boolean>;
1155
+ pallet?: string;
1194
1156
  /**
1195
- * Returns the transfer info for the transfer
1196
- *
1197
- * @returns The transfer info.
1157
+ * Whether to keep the account alive after the transfer.
1198
1158
  */
1199
- getTransferInfo(this: GeneralBuilder<TApi, TRes, TSigner, TTransferBaseOptionsWithSender<TApi, TRes, TSigner>>): Promise<TTransferInfo>;
1159
+ keepAlive?: boolean;
1200
1160
  /**
1201
- * Returns the receivable amount on the destination after the transfer
1202
- *
1203
- * @returns The computed receivable amount.
1204
- * @throws \{UnableToComputeError\} Thrown when the receivable amount cannot be determined.
1161
+ * The optional pallet method override
1205
1162
  */
1206
- getReceivableAmount(this: GeneralBuilder<TApi, TRes, TSigner, TTransferBaseOptionsWithSender<TApi, TRes, TSigner>>): Promise<bigint>;
1207
- getBestAmountOut(this: GeneralBuilder<TApi, TRes, TSigner, TTransferBaseOptionsWithSwap<TApi, TRes, TSigner>>): Promise<_paraspell_swap.TGetBestAmountOutResult>;
1208
- signAndSubmit(this: GeneralBuilder<TApi, TRes, TSigner, TTransferBaseOptionsWithSender<TApi, TRes, TSigner> & TBuilderInternalOptions<TSigner>>): Promise<string>;
1209
- signAndSubmitAll(this: GeneralBuilder<TApi, TRes, TSigner, TTransferBaseOptionsWithSender<TApi, TRes, TSigner> & TBuilderInternalOptions<TSigner>>): Promise<string[]>;
1163
+ method?: string;
1210
1164
  /**
1211
- * Returns the API instance used by the builder.
1212
- *
1213
- * @returns The API instance.
1165
+ * Hex of the encoded transaction call to apply on the destination chain
1214
1166
  */
1215
- getApi(): TApi;
1167
+ transactOptions?: TTransactOptions<TRes>;
1216
1168
  /**
1217
- * Disconnects the API.
1218
- *
1219
- * @returns A Promise that resolves when the API is disconnected.
1169
+ * The optional swap options
1220
1170
  */
1221
- disconnect(): Promise<void>;
1222
- }
1171
+ swapOptions?: TSwapOptions<TApi, TRes, TSigner>;
1172
+ };
1223
1173
  /**
1224
- * Creates a new Builder instance.
1225
- *
1226
- * @param api - The API instance to use for building transactions. If not provided, a new instance will be created.
1227
- * @returns A new Builder instance.
1174
+ * Options for transferring from a parachain to another parachain or relay chain
1228
1175
  */
1229
- declare const Builder: <TApi, TRes, TSigner>(api: PolkadotApi<TApi, TRes, TSigner>) => GeneralBuilder<TApi, TRes, TSigner, object>;
1230
-
1231
- type TSwapConfig = {
1232
- currencyTo: TCurrencyCore;
1233
- exchangeChain: TParachain;
1176
+ type TTransferOptions<TApi, TRes, TSigner> = WithApi<TTransferBaseOptions<TApi, TRes, TSigner>, TApi, TRes, TSigner> & {
1177
+ isAmountAll: boolean;
1234
1178
  };
1235
- type TDryRunBaseOptions<TRes> = {
1236
- tx: TRes;
1237
- origin: TSubstrateChain$1;
1238
- destination: TChain$1;
1239
- sender: string;
1240
- currency: TCurrencyInputWithAmount;
1241
- version?: Version;
1242
- feeAsset?: TCurrencyInput$1;
1243
- swapConfig?: TSwapConfig;
1244
- useRootOrigin?: boolean;
1245
- bypassOptions?: TBypassOptions;
1179
+ type TSubstrateTransferBaseOptions<TApi, TRes, TSigner> = Omit<TTransferBaseOptions<TApi, TRes, TSigner>, 'from'> & {
1180
+ from: TSubstrateChain;
1246
1181
  };
1247
- type TDryRunOptions<TApi, TRes, TSigner> = WithApi<TDryRunBaseOptions<TRes>, TApi, TRes, TSigner>;
1248
- type TDryRunCallBaseOptions<TRes> = {
1249
- /**
1250
- * The transaction to dry-run
1251
- */
1252
- tx: TRes;
1253
- /**
1254
- * The chain to dry-run on
1255
- */
1256
- chain: TSubstrateChain$1;
1257
- /**
1258
- * The destination chain
1259
- */
1260
- destination: TDestination;
1261
- /**
1262
- * The address to dry-run with
1263
- */
1264
- address: string;
1265
- /**
1266
- * Whether to use the root origin
1267
- */
1268
- useRootOrigin?: boolean;
1269
- /**
1270
- * XCM version to use for the dry-run parameters
1271
- */
1272
- version: Version;
1273
- asset: WithAmount<TAssetInfo>;
1274
- bypassOptions?: TBypassOptions;
1275
- feeAsset?: TAssetInfo;
1182
+ type TSubstrateTransferOptions<TApi, TRes, TSigner> = Omit<TTransferOptions<TApi, TRes, TSigner>, 'from'> & {
1183
+ from: TSubstrateChain;
1276
1184
  };
1277
- type TDryRunBypassOptions<TApi, TRes, TSigner> = WithApi<Omit<TDryRunCallBaseOptions<TRes>, 'useRootOrigin' | 'destination'>, TApi, TRes, TSigner>;
1278
- type TDryRunCallOptions<TApi, TRes, TSigner> = WithApi<TDryRunCallBaseOptions<TRes>, TApi, TRes, TSigner>;
1279
- type TDryRunXcmBaseOptions<TRes> = {
1280
- originLocation: any;
1281
- /**
1282
- * The XCM instructions
1283
- */
1284
- xcm: any;
1285
- /** The transaction to dry-run */
1286
- tx: TRes;
1287
- /**
1288
- * The chain to dry-run on
1289
- */
1290
- chain: TSubstrateChain$1;
1185
+ type WithRequiredSender<TBase> = Omit<TBase, 'sender'> & {
1291
1186
  /**
1292
- * The origin chain
1187
+ * The sender address. A SS58 or H160 format.
1293
1188
  */
1294
- origin: TSubstrateChain$1;
1295
- asset: TAssetInfo;
1296
- version: Version;
1189
+ sender: string;
1190
+ };
1191
+ type WithRequiredSwapOptions<TBase, TApi, TRes, TSigner> = Omit<TBase, 'swapOptions'> & {
1192
+ swapOptions: TSwapOptions<TApi, TRes, TSigner>;
1193
+ };
1194
+ type TTransferOptionsWithSwap<TApi, TRes, TSigner> = WithRequiredSwapOptions<Omit<TSubstrateTransferOptions<TApi, TRes, TSigner>, 'isAmountAll'>, TApi, TRes, TSigner>;
1195
+ type TTransferBaseOptionsWithSwap<TApi, TRes, TSigner> = WithRequiredSwapOptions<TTransferBaseOptions<TApi, TRes, TSigner>, TApi, TRes, TSigner>;
1196
+ type TTransferBaseOptionsWithSender<TApi, TRes, TSigner> = WithRequiredSender<TTransferBaseOptions<TApi, TRes, TSigner>>;
1197
+ type TSubstrateTransferBaseOptionsWithSender<TApi, TRes, TSigner> = WithRequiredSender<TSubstrateTransferBaseOptions<TApi, TRes, TSigner>>;
1198
+ type TTransferInternalOptions<TApi, TRes, TSigner> = Omit<TTransferBaseOptions<TApi, TRes, TSigner>, 'from' | 'feeAsset' | 'version'> & {
1199
+ api: PolkadotApi<TApi, TRes, TSigner>;
1200
+ assetInfo: WithAmount<TAssetInfo>;
1297
1201
  feeAsset?: TAssetInfo;
1298
- amount: bigint;
1299
- originFee: bigint;
1202
+ feeCurrency?: TCurrencyInput;
1203
+ overriddenAsset?: TLocation | TAssetWithFee[];
1204
+ version: Version;
1205
+ isAmountAll: boolean;
1300
1206
  };
1301
- type TDryRunXcmOptions<TApi, TRes, TSigner> = WithApi<TDryRunXcmBaseOptions<TRes>, TApi, TRes, TSigner>;
1302
- type TDryRunResBase = {
1303
- asset: TAssetInfo;
1304
- isExchange?: boolean;
1207
+ type TTransactOrigin = (typeof TRANSACT_ORIGINS)[number];
1208
+ type TTransactOptions<TRes, TWeightType = bigint> = {
1209
+ call: string | TRes;
1210
+ originKind?: TTransactOrigin;
1211
+ maxWeight?: TWeight<TWeightType>;
1305
1212
  };
1306
- type TDryRunChainSuccess = TDryRunResBase & {
1307
- success: true;
1308
- fee: bigint;
1309
- weight?: TWeight;
1310
- forwardedXcms: any;
1311
- destParaId?: number;
1213
+ type TSerializedExtrinsics = {
1214
+ module: TPallet;
1215
+ method: string;
1216
+ params: Record<string, unknown>;
1312
1217
  };
1313
- type TDryRunChainFailure = TDryRunResBase & {
1314
- success: false;
1315
- failureReason: string;
1316
- failureSubReason?: string;
1218
+ type TSerializedStateQuery = {
1219
+ module: TAssetsPallet;
1220
+ method: string;
1221
+ params: unknown[];
1317
1222
  };
1318
- type TDryRunChainResult = TDryRunChainSuccess | TDryRunChainFailure;
1319
- type THopInfo = {
1320
- chain: TChain$1;
1321
- result: TDryRunChainResult;
1223
+ type TSerializedRuntimeApiQuery = {
1224
+ module: string;
1225
+ method: string;
1226
+ params: unknown[];
1322
1227
  };
1323
- type TChainEndpoint = 'origin' | 'destination' | TChain$1;
1324
- type TDryRunResult = {
1325
- failureReason?: string;
1326
- failureSubReason?: string;
1327
- failureChain?: TChainEndpoint;
1328
- origin: TDryRunChainResult;
1329
- destination?: TDryRunChainResult;
1330
- hops: THopInfo[];
1228
+ type TDestWeight = {
1229
+ ref_time: bigint;
1230
+ proof_size: bigint;
1331
1231
  };
1332
- type TResolveHopParams<TApi, TRes, TSigner> = {
1232
+ type TXTokensMethod = 'transfer' | 'transfer_multiasset' | 'transfer_multiassets';
1233
+ type TPolkadotXcmMethod = 'limited_teleport_assets' | 'limited_reserve_transfer_assets' | 'reserve_transfer_assets' | 'reserve_withdraw_assets' | 'transfer_assets' | 'transfer_assets_using_type_and_then';
1234
+ type TXcmPalletMethod = 'limited_teleport_assets' | 'limited_reserve_transfer_assets' | 'transfer_assets_using_type_and_then';
1235
+ type TWeight<TWeightType = bigint> = {
1236
+ refTime: TWeightType;
1237
+ proofSize: TWeightType;
1238
+ };
1239
+ type TCreateBeneficiaryOptions<TApi, TRes, TSigner> = {
1333
1240
  api: PolkadotApi<TApi, TRes, TSigner>;
1334
- tx: TRes;
1335
- originChain: TSubstrateChain$1;
1336
- currentChain: TSubstrateChain$1;
1241
+ address: TAddress;
1242
+ version: Version;
1243
+ };
1244
+ type TCreateBeneficiaryXTokensOptions<TApi, TRes, TSigner> = {
1245
+ api: PolkadotApi<TApi, TRes, TSigner>;
1246
+ origin: TSubstrateChain;
1337
1247
  destination: TDestination;
1338
- asset: TAssetInfo;
1339
- currency: TCurrencyInputWithAmount;
1340
- swapConfig?: TSwapConfig;
1341
- hasPassedExchange: boolean;
1248
+ recipient: TAddress;
1249
+ version: Version;
1250
+ paraId?: number;
1342
1251
  };
1343
- type HopProcessParams<TApi, TRes, TSigner> = {
1344
- api: PolkadotApi<TApi, TRes, TSigner>;
1345
- currentChain: TSubstrateChain$1;
1346
- currentOrigin: TSubstrateChain$1;
1347
- currentAsset: TAssetInfo;
1348
- forwardedXcms: any;
1349
- hasPassedExchange: boolean;
1350
- isDestination: boolean;
1252
+ type TBridgeStatus = 'Normal' | 'Halted';
1253
+ type TTransferLocalOptions<TApi, TRes, TSigner> = Omit<TTransferInternalOptions<TApi, TRes, TSigner>, 'recipient'> & {
1254
+ recipient: string;
1255
+ balance: bigint;
1351
1256
  };
1352
- type HopTraversalConfig<TApi, TRes, TSigner, THopResult> = {
1257
+ type TTransferFeeEstimates = {
1258
+ originFee: bigint;
1259
+ reserveFee: bigint;
1260
+ };
1261
+ type TCreateBaseTransferXcmOptions<TRes> = {
1262
+ chain: TSubstrateChain;
1263
+ destChain: TChain;
1264
+ assetInfo: WithAmount<TAssetInfo>;
1265
+ feeAssetInfo?: TAssetInfo;
1266
+ fees: TTransferFeeEstimates;
1267
+ recipient: string;
1268
+ sender?: string;
1269
+ version: Version;
1270
+ useJitWithdraw?: boolean;
1271
+ useFeeAssetOnHops?: boolean;
1272
+ paraIdTo?: number;
1273
+ transactOptions?: TTransactOptions<TRes>;
1274
+ };
1275
+ type TCreateTransferXcmOptions<TApi, TRes, TSigner> = WithApi<TCreateBaseTransferXcmOptions<TRes>, TApi, TRes, TSigner>;
1276
+ type TCreateBaseSwapXcmOptions = {
1277
+ chain?: TSubstrateChain;
1278
+ exchangeChain: TExchangeChain;
1279
+ destChain?: TChain;
1280
+ assetInfoFrom: WithAmount<TAssetInfo>;
1281
+ assetInfoTo: WithAmount<TAssetInfo>;
1282
+ currencyTo: TCurrencyInput;
1283
+ feeAssetInfo?: TAssetInfo;
1284
+ sender: string;
1285
+ recipient: string;
1286
+ calculateMinAmountOut: (amountIn: bigint, assetTo?: TAssetInfo) => Promise<bigint>;
1287
+ };
1288
+ type TCreateSwapXcmOptions<TApi, TRes, TSigner> = WithApi<TCreateBaseSwapXcmOptions, TApi, TRes, TSigner>;
1289
+ type TSwapFeeEstimates = {
1290
+ originFee: bigint;
1291
+ originReserveFee: bigint;
1292
+ exchangeFee: bigint;
1293
+ destReserveFee: bigint;
1294
+ };
1295
+ type TCreateSwapXcmInternalOptions<TApi, TRes, TSigner> = WithApi<TCreateBaseSwapXcmOptions, TApi, TRes, TSigner> & {
1296
+ version: Version;
1297
+ fees: TSwapFeeEstimates;
1298
+ paraIdTo?: number;
1299
+ };
1300
+ type TCreateEthBridgeInstructionsOptions<TApi, TRes, TSigner> = {
1353
1301
  api: PolkadotApi<TApi, TRes, TSigner>;
1354
- origin: TSubstrateChain$1;
1355
- destination: TChain$1;
1356
- currency: TCurrencyCore;
1357
- initialForwardedXcms: any;
1358
- initialDestParaId: number | undefined;
1359
- swapConfig?: TSwapConfig;
1360
- processHop: (params: HopProcessParams<TApi, TRes, TSigner>) => Promise<THopResult>;
1361
- shouldContinue: (hopResult: THopResult) => boolean;
1362
- extractNextHopData: (hopResult: THopResult) => {
1363
- forwardedXcms: any;
1364
- destParaId: number | undefined;
1365
- };
1302
+ recipient: TAddress;
1303
+ assetInfo: TAssetInfo;
1304
+ sender: string;
1305
+ ahAddress?: string;
1306
+ version: Version;
1366
1307
  };
1367
- type HopTraversalResult<THopResult> = {
1368
- hops: Array<{
1369
- chain: TSubstrateChain$1;
1370
- result: THopResult;
1371
- }>;
1372
- destination?: THopResult;
1373
- lastProcessedChain?: TSubstrateChain$1;
1308
+
1309
+ /** @deprecated Asset claim functionality is deprecated and will be removed in v14. */
1310
+ type TAssetClaimOptionsBase = {
1311
+ chain: TSubstrateChain;
1312
+ currency: WithComplexAmount<TCurrencyCore> | TAsset<TAmount>[] | WithComplexAmount<TCurrencyCore>[];
1313
+ address: TAddress;
1314
+ version?: Version;
1374
1315
  };
1375
- type TBypassOptions = {
1376
- mintFeeAssets?: boolean;
1377
- sentAssetMintMode?: 'preview' | 'bypass';
1316
+ type TAssetClaimOptions<TApi, TRes, TSigner> = WithApi<TAssetClaimOptionsBase, TApi, TRes, TSigner>;
1317
+ type TAssetClaimInternalOptions<TApi, TRes, TSigner> = TAssetClaimOptions<TApi, TRes, TSigner> & {
1318
+ version: Version;
1319
+ assets: TAsset<bigint>[];
1378
1320
  };
1379
- declare enum XTokensError {
1380
- AssetHasNoReserve = "AssetHasNoReserve",
1381
- NotCrossChainTransfer = "NotCrossChainTransfer",
1382
- InvalidDest = "InvalidDest",
1383
- NotCrossChainTransferableCurrency = "NotCrossChainTransferableCurrency",
1384
- UnweighableMessage = "UnweighableMessage",
1385
- XcmExecutionFailed = "XcmExecutionFailed",
1386
- CannotReanchor = "CannotReanchor",
1387
- InvalidAncestry = "InvalidAncestry",
1388
- InvalidAsset = "InvalidAsset",
1389
- DestinationNotInvertible = "DestinationNotInvertible",
1390
- BadVersion = "BadVersion",
1391
- DistinctReserveForAssetAndFee = "DistinctReserveForAssetAndFee",
1392
- ZeroFee = "ZeroFee",
1393
- ZeroAmount = "ZeroAmount",
1394
- TooManyAssetsBeingSent = "TooManyAssetsBeingSent",
1395
- AssetIndexNonExistent = "AssetIndexNonExistent",
1396
- FeeNotEnough = "FeeNotEnough",
1397
- NotSupportedLocation = "NotSupportedLocation",
1398
- MinXcmFeeNotDefined = "MinXcmFeeNotDefined",
1399
- RateLimited = "RateLimited"
1321
+
1322
+ type TSetBalanceRes = {
1323
+ assetStatusTx?: TSerializedExtrinsics;
1324
+ balanceTx: TSerializedExtrinsics;
1325
+ };
1326
+ declare abstract class BaseAssetsPallet {
1327
+ protected palletName: TAssetsPallet;
1328
+ constructor(palletName: TAssetsPallet);
1329
+ abstract mint<TApi, TRes, TSigner>(address: string, assetInfo: WithAmount<TAssetInfo>, balance: bigint, chain: TSubstrateChain, api: PolkadotApi<TApi, TRes, TSigner>): Promise<TSetBalanceRes>;
1330
+ abstract getBalance<TApi, TRes, TSigner>(api: PolkadotApi<TApi, TRes, TSigner>, address: string, asset: TAssetInfo, customCurrencyId?: unknown): Promise<bigint>;
1400
1331
  }
1401
- declare enum PolkadotXcmError {
1402
- Unreachable = "Unreachable",
1403
- SendFailure = "SendFailure",
1404
- Filtered = "Filtered",
1405
- UnweighableMessage = "UnweighableMessage",
1406
- DestinationNotInvertible = "DestinationNotInvertible",
1407
- Empty = "Empty",
1408
- CannotReanchor = "CannotReanchor",
1409
- TooManyAssets = "TooManyAssets",
1410
- InvalidOrigin = "InvalidOrigin",
1411
- BadVersion = "BadVersion",
1412
- BadLocation = "BadLocation",
1413
- NoSubscription = "NoSubscription",
1414
- AlreadySubscribed = "AlreadySubscribed",
1415
- CannotCheckOutTeleport = "CannotCheckOutTeleport",
1416
- LowBalance = "LowBalance",
1417
- TooManyLocks = "TooManyLocks",
1418
- AccountNotSovereign = "AccountNotSovereign",
1419
- FeesNotMet = "FeesNotMet",
1420
- LockNotFound = "LockNotFound",
1421
- InUse = "InUse",
1422
- REMOVED = "REMOVED",
1423
- InvalidAssetUnknownReserve = "InvalidAssetUnknownReserve",
1424
- InvalidAssetUnsupportedReserve = "InvalidAssetUnsupportedReserve",
1425
- TooManyReserves = "TooManyReserves",
1426
- LocalExecutionIncomplete = "LocalExecutionIncomplete",
1427
- TooManyAuthorizedAliases = "TooManyAuthorizedAliases",
1428
- ExpiresInPast = "ExpiresInPast",
1429
- AliasNotFound = "AliasNotFound",
1430
- LocalExecutionIncompleteWithError = "LocalExecutionIncompleteWithError"
1332
+
1333
+ /**
1334
+ * Builder class for constructing asset claim transactions.
1335
+ *
1336
+ * @deprecated Asset claim functionality is deprecated and will be removed in v14.
1337
+ */
1338
+ declare class AssetClaimBuilder<TApi, TRes, TSigner, T extends Partial<TAssetClaimOptionsBase & TBuilderInternalOptions<TSigner>> = object> {
1339
+ readonly api: PolkadotApi<TApi, TRes, TSigner>;
1340
+ readonly _options: T;
1341
+ constructor(api: PolkadotApi<TApi, TRes, TSigner>, options?: T);
1342
+ /**
1343
+ * Specifies the assets to be claimed.
1344
+ *
1345
+ * @param assets - An array of assets to claim in a multi-asset format.
1346
+ * @returns An instance of Builder
1347
+ */
1348
+ currency(currency: TAssetClaimOptionsBase['currency']): AssetClaimBuilder<TApi, TRes, TSigner, T & {
1349
+ currency: TAssetClaimOptionsBase['currency'];
1350
+ }>;
1351
+ /**
1352
+ * Sets the sender address.
1353
+ *
1354
+ * @param address - The sender address.
1355
+ * @returns
1356
+ */
1357
+ sender(sender: TSender<TSigner>): AssetClaimBuilder<TApi, TRes, TSigner, T & {
1358
+ sender: string;
1359
+ }>;
1360
+ /**
1361
+ * Specifies the account address on which the assets will be claimed.
1362
+ *
1363
+ * @param address - The destination account address.
1364
+ * @returns An instance of Builder
1365
+ */
1366
+ address(address: TAddress): AssetClaimBuilder<TApi, TRes, TSigner, T & {
1367
+ address: TAddress;
1368
+ }>;
1369
+ /**
1370
+ * Sets the XCM version to be used for the asset claim.
1371
+ *
1372
+ * @param version - The XCM version.
1373
+ * @returns An instance of Builder
1374
+ */
1375
+ xcmVersion(version: Version): AssetClaimBuilder<TApi, TRes, TSigner, T & {
1376
+ version: Version;
1377
+ }>;
1378
+ /**
1379
+ * Builds and returns the asset claim extrinsic.
1380
+ *
1381
+ * @returns A Promise that resolves to the asset claim extrinsic.
1382
+ */
1383
+ build(this: AssetClaimBuilder<TApi, TRes, TSigner, TAssetClaimOptionsBase>): Promise<TRes>;
1384
+ signAndSubmit(this: AssetClaimBuilder<TApi, TRes, TSigner, TAssetClaimOptionsBase & TBuilderInternalOptions<TSigner>>): Promise<string>;
1385
+ /**
1386
+ * Returns the API instance used by the builder.
1387
+ *
1388
+ * @returns The API instance.
1389
+ */
1390
+ getApi(): TApi;
1391
+ /**
1392
+ * Disconnects the API.
1393
+ *
1394
+ * @returns A Promise that resolves when the API is disconnected.
1395
+ */
1396
+ disconnect(): Promise<void>;
1431
1397
  }
1432
- declare enum PolkadotXcmExecutionError {
1433
- Overflow = "Overflow",
1434
- Unimplemented = "Unimplemented",
1435
- UntrustedReserveLocation = "UntrustedReserveLocation",
1436
- UntrustedTeleportLocation = "UntrustedTeleportLocation",
1437
- LocationFull = "LocationFull",
1438
- LocationNotInvertible = "LocationNotInvertible",
1439
- BadOrigin = "BadOrigin",
1440
- InvalidLocation = "InvalidLocation",
1441
- AssetNotFound = "AssetNotFound",
1442
- FailedToTransactAsset = "FailedToTransactAsset",
1443
- NotWithdrawable = "NotWithdrawable",
1444
- LocationCannotHold = "LocationCannotHold",
1445
- ExceedsMaxMessageSize = "ExceedsMaxMessageSize",
1446
- DestinationUnsupported = "DestinationUnsupported",
1447
- Transport = "Transport",
1448
- Unroutable = "Unroutable",
1449
- UnknownClaim = "UnknownClaim",
1450
- FailedToDecode = "FailedToDecode",
1451
- MaxWeightInvalid = "MaxWeightInvalid",
1452
- NotHoldingFees = "NotHoldingFees",
1453
- TooExpensive = "TooExpensive",
1454
- Trap = "Trap",
1455
- ExpectationFalse = "ExpectationFalse",
1456
- PalletNotFound = "PalletNotFound",
1457
- NameMismatch = "NameMismatch",
1458
- VersionIncompatible = "VersionIncompatible",
1459
- HoldingWouldOverflow = "HoldingWouldOverflow",
1460
- ExportError = "ExportError",
1461
- ReanchorFailed = "ReanchorFailed",
1462
- NoDeal = "NoDeal",
1463
- FeesNotMet = "FeesNotMet",
1464
- LockError = "LockError",
1465
- NoPermission = "NoPermission",
1466
- Unanchored = "Unanchored",
1467
- NotDepositable = "NotDepositable",
1468
- TooManyAssets = "TooManyAssets",
1469
- UnhandledXcmVersion = "UnhandledXcmVersion",
1470
- WeightLimitReached = "WeightLimitReached",
1471
- Barrier = "Barrier",
1472
- WeightNotComputable = "WeightNotComputable",
1473
- ExceedsStackLimit = "ExceedsStackLimit"
1398
+
1399
+ declare class BatchTransactionManager<TApi, TRes, TSigner> {
1400
+ transactionOptions: TBatchedTransferOptions<TApi, TRes, TSigner>[];
1401
+ addTransaction(options: TBatchedTransferOptions<TApi, TRes, TSigner>): void;
1402
+ isEmpty(): boolean;
1403
+ buildBatch(api: PolkadotApi<TApi, TRes, TSigner>, from: TSubstrateChain, options?: TBatchOptions): Promise<TRes>;
1474
1404
  }
1475
- type TModuleError = {
1476
- index: string;
1477
- error: string;
1478
- };
1479
- type TDryRunError = {
1480
- failureReason: string;
1481
- failureSubReason?: string;
1482
- };
1483
1405
 
1484
- type TXcmFeeSwapConfig = TSwapConfig & {
1485
- amountOut: bigint;
1486
- };
1487
- type TTxFactory<TRes> = (amount?: string, relative?: boolean) => Promise<TRes>;
1488
- type TGetXcmFeeBaseOptions<TRes, TDisableFallback extends boolean = boolean> = {
1406
+ /**
1407
+ * A builder class for constructing Para-to-Para, Para-to-Relay, Relay-to-Para transactions and asset claims.
1408
+ */
1409
+ declare class GeneralBuilder<TApi, TRes, TSigner, T extends Partial<TTransferBaseOptions<TApi, TRes, TSigner> & TBuilderInternalOptions<TSigner>> = object> {
1410
+ readonly batchManager: BatchTransactionManager<TApi, TRes, TSigner>;
1411
+ readonly api: PolkadotApi<TApi, TRes, TSigner>;
1412
+ readonly _options: T;
1413
+ constructor(api: PolkadotApi<TApi, TRes, TSigner>, batchManager: BatchTransactionManager<TApi, TRes, TSigner>, options?: T);
1414
+ /**
1415
+ * Specifies the origin chain for the transaction.
1416
+ *
1417
+ * @param chain - The chain from which the transaction originates.
1418
+ * @returns An instance of Builder
1419
+ */
1420
+ from(chain: TChain): GeneralBuilder<TApi, TRes, TSigner, T & {
1421
+ from: TChain;
1422
+ }>;
1423
+ /**
1424
+ * Specifies the destination chain for the transaction.
1425
+ *
1426
+ * @param chain - The chain to which the transaction is sent.
1427
+ * @param paraIdTo - (Optional) The parachain ID of the destination chain.
1428
+ * @returns An instance of Builder
1429
+ */
1430
+ to(chain: TDestination, paraIdTo?: number): GeneralBuilder<TApi, TRes, TSigner, T & {
1431
+ to: TDestination;
1432
+ }>;
1433
+ /**
1434
+ * Initiates the process to claim assets from a specified chain.
1435
+ *
1436
+ * @deprecated Asset claim functionality is deprecated and will be removed in v14.
1437
+ * @param chain - The chain from which to claim assets.
1438
+ * @returns An instance of Builder
1439
+ */
1440
+ claimFrom(chain: TSubstrateChain): AssetClaimBuilder<TApi, TRes, TSigner, {
1441
+ chain: TSubstrateChain;
1442
+ }>;
1443
+ /**
1444
+ * Specifies the currency to be used in the transaction. Symbol, ID, location or multi-asset.
1445
+ *
1446
+ * @param currency - The currency to be transferred.
1447
+ * @returns An instance of Builder
1448
+ */
1449
+ currency(currency: TCurrencyInputWithAmount): GeneralBuilder<TApi, TRes, TSigner, T & {
1450
+ currency: TCurrencyInputWithAmount;
1451
+ }>;
1452
+ /**
1453
+ * Sets the recipient address.
1454
+ *
1455
+ * @param address - The recipient address on the destination chain.
1456
+ * @returns An instance of Builder
1457
+ */
1458
+ recipient(address: TAddress): GeneralBuilder<TApi, TRes, TSigner, T & {
1459
+ recipient: TAddress;
1460
+ }>;
1461
+ /**
1462
+ * Sets the sender address or signer.
1463
+ *
1464
+ * @param sender - The sender address, substrate signer, or viem `WalletClient`.
1465
+ * @returns An instance of Builder
1466
+ */
1467
+ sender(sender: TSender<TSigner> | WalletClient): GeneralBuilder<TApi, TRes, TSigner, T & {
1468
+ sender: string;
1469
+ }>;
1470
+ /**
1471
+ * Sets the asset hub address. This is used for transfers that go through the Asset Hub and originate from an EVM chain.
1472
+ *
1473
+ * @param address - The address to be used.
1474
+ * @returns An instance of Builder
1475
+ */
1476
+ ahAddress(address: string | undefined): GeneralBuilder<TApi, TRes, TSigner, T & {
1477
+ ahAddress: string | undefined;
1478
+ }>;
1479
+ /**
1480
+ * Sets the XCM version to be used for the transfer.
1481
+ *
1482
+ * @param version - The XCM version.
1483
+ * @returns An instance of Builder
1484
+ */
1485
+ xcmVersion(version: Version): GeneralBuilder<TApi, TRes, TSigner, T & {
1486
+ version: Version;
1487
+ }>;
1488
+ /**
1489
+ * Whether to keep the account alive after the transfer.
1490
+ *
1491
+ * @param value - A boolean indicating whether to keep the account alive.
1492
+ * @returns An instance of Builder
1493
+ */
1494
+ keepAlive(keepAlive: boolean): GeneralBuilder<TApi, TRes, TSigner, T & {
1495
+ keepAlive: boolean;
1496
+ }>;
1497
+ /**
1498
+ * Sets a custom pallet for the transaction.
1499
+ *
1500
+ * @param pallet - The name of the custom pallet to be used.
1501
+ * @param method - The name of the method to be used.
1502
+ * @returns An instance of the Builder.
1503
+ */
1504
+ customPallet(pallet: string | undefined, method: string | undefined): GeneralBuilder<TApi, TRes, TSigner, T & {
1505
+ pallet: string | undefined;
1506
+ method: string | undefined;
1507
+ }>;
1508
+ /**
1509
+ * Optional fee asset for the transaction.
1510
+ *
1511
+ * @param currency - The currency to be used for the fee.
1512
+ * @returns An instance of the Builder
1513
+ */
1514
+ feeAsset(currency: TCurrencyInput | undefined): GeneralBuilder<TApi, TRes, TSigner, T & {
1515
+ feeAsset: TCurrencyInput | undefined;
1516
+ }>;
1489
1517
  /**
1490
- * The transaction factory
1518
+ * Sets the hex of the encoded transaction call to apply on the destination chain
1519
+ *
1520
+ * @param hex - The encoded call hex or extrinsics.
1521
+ * @param originKind - (Optional) The means of expressing the message origin as a dispatch origin.
1522
+ * @param maxWeight - (Optional) The weight of the call. If not provided, the weight will be estimated.
1523
+ * @returns An instance of the Builder.
1491
1524
  */
1492
- buildTx: TTxFactory<TRes>;
1525
+ transact(call: string | TRes, originKind?: TTransactOrigin, maxWeight?: TWeight): GeneralBuilder<TApi, TRes, TSigner, T & {
1526
+ transactOptions: {
1527
+ call: string | TRes;
1528
+ originKind: "Native" | "SovereignAccount" | "Superuser" | "Xcm" | undefined;
1529
+ maxWeight: TWeight | undefined;
1530
+ };
1531
+ }>;
1493
1532
  /**
1494
- * The origin chain
1533
+ * Performs a token swap as part of the transfer, using the specified exchange and destination currency.
1534
+ *
1535
+ * @param options - The swap options.
1536
+ * @returns An instance of the Builder.
1495
1537
  */
1496
- origin: TSubstrateChain$1;
1538
+ swap(options: TSwapOptions<TApi, TRes, TSigner>): GeneralBuilder<TApi, TRes, TSigner, T & {
1539
+ swapOptions: TSwapOptions<TApi, TRes, TSigner>;
1540
+ }>;
1497
1541
  /**
1498
- * The destination chain
1542
+ * Adds the transfer transaction to the batch.
1543
+ *
1544
+ * @returns An instance of Builder
1499
1545
  */
1500
- destination: TChain$1;
1546
+ addToBatch(this: GeneralBuilder<TApi, TRes, TSigner, TTransferBaseOptions<TApi, TRes, TSigner> & TBuilderInternalOptions<TSigner>>): GeneralBuilder<TApi, TRes, TSigner, T & {
1547
+ from: TSubstrateChain;
1548
+ }>;
1501
1549
  /**
1502
- * The sender address
1550
+ * Builds and returns the batched transaction based on the configured parameters.
1551
+ *
1552
+ * @param options - (Optional) Options to customize the batch transaction.
1553
+ * @returns A Extrinsic representing the batched transactions.
1503
1554
  */
1504
- sender: string;
1505
- recipient: string;
1506
- currency: WithAmount<TCurrencyCore>;
1507
- version?: Version;
1508
- feeAsset?: TCurrencyInput$1;
1509
- disableFallback: TDisableFallback;
1510
- swapConfig?: TXcmFeeSwapConfig;
1511
- skipReverseFeeCalculation?: boolean;
1512
- };
1513
- type TGetXcmFeeOptions<TApi, TRes, TSigner, TDisableFallback extends boolean = boolean> = WithApi<TGetXcmFeeBaseOptions<TRes, TDisableFallback>, TApi, TRes, TSigner>;
1514
- type TGetXcmFeeInternalOptions<TApi, TRes, TSigner, TDisableFallback extends boolean = boolean> = Omit<TGetXcmFeeOptions<TApi, TRes, TSigner, TDisableFallback>, 'buildTx'> & {
1515
- tx: TRes;
1516
- useRootOrigin: boolean;
1517
- };
1518
- type TGetXcmFeeBuilderOptions = {
1519
- disableFallback: boolean;
1520
- };
1521
- type TGetOriginXcmFeeBaseOptions<TRes> = {
1522
- buildTx: TTxFactory<TRes>;
1523
- origin: TSubstrateChain$1;
1524
- destination: TChain$1;
1525
- sender: string;
1526
- currency: WithAmount<TCurrencyCore>;
1527
- version?: Version;
1528
- feeAsset?: TCurrencyInput$1;
1529
- disableFallback: boolean;
1530
- useRootOrigin?: boolean;
1531
- };
1532
- type TGetOriginXcmFeeOptions<TApi, TRes, TSigner> = WithApi<TGetOriginXcmFeeBaseOptions<TRes>, TApi, TRes, TSigner>;
1533
- type TGetOriginXcmFeeInternalOptions<TApi, TRes, TSigner> = Omit<TGetOriginXcmFeeOptions<TApi, TRes, TSigner>, 'buildTx'> & {
1534
- tx: TRes;
1535
- };
1536
- type TGetFeeForDestChainBaseOptions<TRes> = {
1537
- prevChain: TSubstrateChain$1;
1538
- origin: TSubstrateChain$1;
1539
- destination: TChain$1;
1540
- sender: string;
1541
- recipient: string;
1542
- currency: WithAmount<TCurrencyCore>;
1543
- forwardedXcms: any;
1544
- tx: TRes;
1545
- asset: TAssetInfo;
1546
- version: Version;
1547
- originFee: bigint;
1548
- feeAsset?: TCurrencyInput$1;
1549
- disableFallback: boolean;
1550
- hasPassedExchange?: boolean;
1551
- swapConfig?: TXcmFeeSwapConfig;
1552
- skipReverseFeeCalculation?: boolean;
1553
- };
1554
- type TGetFeeForDestChainOptions<TApi, TRes, TSigner> = WithApi<TGetFeeForDestChainBaseOptions<TRes>, TApi, TRes, TSigner>;
1555
- type TGetReverseTxFeeOptions<TApi, TRes, TSigner> = Omit<TGetFeeForDestChainOptions<TApi, TRes, TSigner>, 'destination' | 'disableFallback' | 'forwardedXcms' | 'asset' | 'originFee' | 'prevChain' | 'version'> & {
1556
- destination: TSubstrateChain$1;
1557
- };
1558
- type TFeeType = 'dryRun' | 'paymentInfo' | 'noFeeRequired';
1559
- type TXcmFeeBase$1 = {
1560
- asset: TAssetInfo;
1561
- weight?: TWeight;
1562
- sufficient?: boolean;
1563
- isExchange?: boolean;
1564
- };
1565
- type TXcmFeeDetailSuccess = TXcmFeeBase$1 & {
1566
- fee: bigint;
1567
- feeType: TFeeType;
1568
- dryRunError?: string;
1569
- dryRunSubError?: string;
1570
- };
1571
- type TXcmFeeDetailWithFallback = TXcmFeeDetailSuccess;
1572
- type TXcmFeeDetailError = TXcmFeeBase$1 & {
1573
- fee?: bigint;
1574
- feeType?: TFeeType;
1575
- dryRunError: string;
1576
- dryRunSubError?: string;
1577
- };
1578
- type TXcmFeeDetail = TXcmFeeDetailSuccess | TXcmFeeDetailError;
1579
- type TXcmFeeHopResult = {
1580
- fee?: bigint;
1581
- feeType?: TFeeType;
1582
- sufficient?: boolean;
1583
- dryRunError?: string;
1584
- dryRunSubError?: string;
1585
- forwardedXcms?: any;
1586
- destParaId?: number;
1587
- asset: TAssetInfo;
1588
- };
1589
- type TConditionalXcmFeeDetail<TDisableFallback extends boolean> = TDisableFallback extends false ? TXcmFeeDetailWithFallback : TXcmFeeDetail;
1590
- type TDestXcmFeeDetail<TDisableFallback extends boolean> = TConditionalXcmFeeDetail<TDisableFallback> & {
1591
- forwardedXcms?: any;
1592
- destParaId?: number;
1593
- };
1594
- type TConditionalXcmFeeHopInfo<TDisableFallback extends boolean> = {
1595
- chain: TChain$1;
1596
- result: TConditionalXcmFeeDetail<TDisableFallback>;
1597
- };
1598
- type TXcmFeeHopInfo = {
1599
- chain: TChain$1;
1600
- result: TXcmFeeDetail;
1601
- };
1602
- type TGetXcmFeeResult<TDisableFallback extends boolean = boolean> = {
1603
- failureReason?: string;
1604
- failureChain?: TChainEndpoint;
1605
- origin: TConditionalXcmFeeDetail<TDisableFallback>;
1606
- destination: TConditionalXcmFeeDetail<TDisableFallback>;
1607
- hops: TConditionalXcmFeeHopInfo<TDisableFallback>[];
1608
- };
1609
- type TPaymentInfo = {
1610
- partialFee: bigint;
1611
- weight: TWeight;
1612
- };
1555
+ buildBatch(this: GeneralBuilder<TApi, TRes, TSigner, TTransferBaseOptions<TApi, TRes, TSigner> & TBuilderInternalOptions<TSigner>>, options?: TBatchOptions): Promise<TRes>;
1556
+ protected buildInternal<TOptions extends TTransferBaseOptions<TApi, TRes, TSigner>>(this: GeneralBuilder<TApi, TRes, TSigner, TOptions>): Promise<TBuildInternalRes<TApi, TRes, TSigner, TOptions>>;
1557
+ private prepareNormalizedOptions;
1558
+ /**
1559
+ * Builds and returns the transfer extrinsic.
1560
+ *
1561
+ * @returns A Promise that resolves to the transfer extrinsic.
1562
+ */
1563
+ build(this: GeneralBuilder<TApi, TRes, TSigner, TTransferBaseOptions<TApi, TRes, TSigner> & TBuilderInternalOptions<TSigner>>): Promise<TRes>;
1564
+ /**
1565
+ * Builds and returns multiple transfer or swap extrinsics
1566
+ *
1567
+ * @returns A Promise that resolves to the transfer extrinsic contexts
1568
+ */
1569
+ buildAll(this: GeneralBuilder<TApi, TRes, TSigner, TTransferBaseOptions<TApi, TRes, TSigner> & TBuilderInternalOptions<TSigner>>): Promise<TTransactionContext<TApi, TRes>[]>;
1570
+ private validateBatchState;
1571
+ private buildCommon;
1572
+ private buildCommonAll;
1573
+ private maybePerformXcmFormatCheck;
1574
+ dryRun(this: GeneralBuilder<TApi, TRes, TSigner, TTransferBaseOptionsWithSender<TApi, TRes, TSigner> & TBuilderInternalOptions<TSigner>>): Promise<TDryRunResult>;
1575
+ dryRunPreview(this: GeneralBuilder<TApi, TRes, TSigner, TTransferBaseOptionsWithSender<TApi, TRes, TSigner> & TBuilderInternalOptions<TSigner>>, dryRunOptions?: TDryRunPreviewOptions): Promise<TDryRunResult>;
1576
+ protected createTxFactory<TOptions extends TTransferBaseOptions<TApi, TRes, TSigner>>(this: GeneralBuilder<TApi, TRes, TSigner, TOptions>): TTxFactory<TRes>;
1577
+ /**
1578
+ * Returns the XCM fee for the transfer using dryRun or paymentInfo function.
1579
+ *
1580
+ * @returns An origin and destination fee.
1581
+ */
1582
+ getXcmFee<TDisableFallback extends boolean = false>(this: GeneralBuilder<TApi, TRes, TSigner, TTransferBaseOptionsWithSender<TApi, TRes, TSigner> & TBuilderInternalOptions<TSigner>>, options?: TGetXcmFeeBuilderOptions & {
1583
+ disableFallback: TDisableFallback;
1584
+ }): Promise<TGetXcmFeeResult<TDisableFallback>>;
1585
+ /**
1586
+ * Returns the origin XCM fee for the transfer using dryRun or paymentInfo function.
1587
+ *
1588
+ * @returns An origin fee.
1589
+ */
1590
+ getOriginXcmFee(this: GeneralBuilder<TApi, TRes, TSigner, TTransferBaseOptionsWithSender<TApi, TRes, TSigner> & TBuilderInternalOptions<TSigner>>, { disableFallback }?: TGetXcmFeeBuilderOptions): Promise<TXcmFeeDetail & {
1591
+ forwardedXcms?: unknown;
1592
+ destParaId?: number;
1593
+ }>;
1594
+ /**
1595
+ * Returns the max transferable amount for the transfer
1596
+ *
1597
+ * @returns The max transferable amount.
1598
+ */
1599
+ getTransferableAmount(this: GeneralBuilder<TApi, TRes, TSigner, TTransferBaseOptionsWithSender<TApi, TRes, TSigner> & TBuilderInternalOptions<TSigner>>): Promise<bigint>;
1600
+ /**
1601
+ * Returns the min transferable amount for the transfer
1602
+ *
1603
+ * @returns The min transferable amount.
1604
+ */
1605
+ getMinTransferableAmount(this: GeneralBuilder<TApi, TRes, TSigner, TTransferBaseOptionsWithSender<TApi, TRes, TSigner> & TBuilderInternalOptions<TSigner>>): Promise<bigint>;
1606
+ /**
1607
+ * Returns the max transferable amount for the transfer
1608
+ *
1609
+ * @returns The max transferable amount.
1610
+ */
1611
+ verifyEdOnDestination(this: GeneralBuilder<TApi, TRes, TSigner, TTransferBaseOptionsWithSender<TApi, TRes, TSigner> & TBuilderInternalOptions<TSigner>>): Promise<boolean>;
1612
+ /**
1613
+ * Returns the transfer info for the transfer
1614
+ *
1615
+ * @returns The transfer info.
1616
+ */
1617
+ getTransferInfo(this: GeneralBuilder<TApi, TRes, TSigner, TTransferBaseOptionsWithSender<TApi, TRes, TSigner> & TBuilderInternalOptions<TSigner>>): Promise<TTransferInfo>;
1618
+ /**
1619
+ * Returns the receivable amount on the destination after the transfer
1620
+ *
1621
+ * @returns The computed receivable amount.
1622
+ * @throws \{UnableToComputeError\} Thrown when the receivable amount cannot be determined.
1623
+ */
1624
+ getReceivableAmount(this: GeneralBuilder<TApi, TRes, TSigner, TTransferBaseOptionsWithSender<TApi, TRes, TSigner> & TBuilderInternalOptions<TSigner>>): Promise<bigint>;
1625
+ getBestAmountOut(this: GeneralBuilder<TApi, TRes, TSigner, TTransferBaseOptionsWithSwap<TApi, TRes, TSigner> & TBuilderInternalOptions<TSigner>>): Promise<{
1626
+ exchange: TExchangeChain;
1627
+ amountOut: bigint;
1628
+ }>;
1629
+ signAndSubmit(this: GeneralBuilder<TApi, TRes, TSigner, TTransferBaseOptionsWithSender<TApi, TRes, TSigner> & TBuilderInternalOptions<TSigner>>): Promise<string>;
1630
+ signAndSubmitAll(this: GeneralBuilder<TApi, TRes, TSigner, TTransferBaseOptionsWithSender<TApi, TRes, TSigner> & TBuilderInternalOptions<TSigner>>): Promise<string[]>;
1631
+ private executeWithEvmSigner;
1632
+ /**
1633
+ * Returns the API instance used by the builder.
1634
+ *
1635
+ * @returns The API instance.
1636
+ */
1637
+ getApi(): TApi;
1638
+ /**
1639
+ * Disconnects the API.
1640
+ *
1641
+ * @returns A Promise that resolves when the API is disconnected.
1642
+ */
1643
+ disconnect(): Promise<void>;
1644
+ }
1645
+ /**
1646
+ * Creates a new Builder instance.
1647
+ *
1648
+ * @param api - The API instance to use for building transactions. If not provided, a new instance will be created.
1649
+ * @returns A new Builder instance.
1650
+ */
1651
+ declare const Builder: <TApi, TRes, TSigner>(api: PolkadotApi<TApi, TRes, TSigner>) => GeneralBuilder<TApi, TRes, TSigner, object>;
1613
1652
 
1614
1653
  type TGetBalanceCommonOptions = {
1615
1654
  /**
@@ -1619,7 +1658,7 @@ type TGetBalanceCommonOptions = {
1619
1658
  /**
1620
1659
  * The chain on which to query the balance.
1621
1660
  */
1622
- chain: TChain$1;
1661
+ chain: TChain;
1623
1662
  };
1624
1663
  /**
1625
1664
  * Retrieves the asset balance for a given account on a specified chain.
@@ -1649,18 +1688,18 @@ type TGetTransferableAmountOptionsBase<TRes> = {
1649
1688
  /**
1650
1689
  * The chain on which to query the balance.
1651
1690
  */
1652
- origin: TSubstrateChain$1;
1691
+ origin: TSubstrateChain;
1653
1692
  /**
1654
1693
  * The destination chain.
1655
1694
  */
1656
- destination: TChain$1;
1695
+ destination: TChain;
1657
1696
  /**
1658
1697
  * The currency to query.
1659
1698
  */
1660
1699
  currency: WithAmount<TCurrencyCore>;
1661
1700
  version: Version | undefined;
1662
1701
  buildTx: TTxFactory<TRes>;
1663
- feeAsset?: TCurrencyInput$1;
1702
+ feeAsset?: TCurrencyInput;
1664
1703
  };
1665
1704
  type TGetTransferableAmountOptions<TApi, TRes, TSigner> = WithApi<TGetTransferableAmountOptionsBase<TRes>, TApi, TRes, TSigner>;
1666
1705
  type TGetMinTransferableAmountOptions<TApi, TRes, TSigner> = WithApi<TGetTransferableAmountOptionsBase<TRes> & {
@@ -1671,11 +1710,11 @@ type TVerifyEdOnDestinationOptionsBase<TRes> = {
1671
1710
  /**
1672
1711
  * The origin chain.
1673
1712
  */
1674
- origin: TSubstrateChain$1;
1713
+ origin: TSubstrateChain;
1675
1714
  /**
1676
1715
  * The destination chain.
1677
1716
  */
1678
- destination: TChain$1;
1717
+ destination: TChain;
1679
1718
  /**
1680
1719
  * The address of the account.
1681
1720
  */
@@ -1690,51 +1729,19 @@ type TVerifyEdOnDestinationOptionsBase<TRes> = {
1690
1729
  currency: WithAmount<TCurrencyCore>;
1691
1730
  version: Version | undefined;
1692
1731
  buildTx: TTxFactory<TRes>;
1693
- feeAsset?: TCurrencyInput$1;
1732
+ feeAsset?: TCurrencyInput;
1694
1733
  };
1695
1734
  type TVerifyEdOnDestinationOptions<TApi, TRes, TSigner> = WithApi<TVerifyEdOnDestinationOptionsBase<TRes>, TApi, TRes, TSigner>;
1696
1735
 
1697
- type TEvmChainFrom = Extract<TChain$1, 'Ethereum' | 'Moonbeam' | 'Moonriver' | 'Darwinia'>;
1698
- /**
1699
- * The options for the Ethereum to Polkadot transfer builder.
1700
- */
1701
- type TEvmBuilderOptionsBase = {
1702
- /**
1703
- * The source chain. Can be either 'Ethereum', 'Moonbeam', 'Moonriver', or 'Darwinia'.
1704
- */
1705
- from: TEvmChainFrom;
1706
- /**
1707
- * The destination chain on Polkadot network.
1708
- */
1709
- to: TChain$1;
1710
- /**
1711
- * The currency to transfer. Symbol or ID.
1712
- */
1736
+ type TEvmTransferOptionsBase = {
1737
+ from: TChain;
1738
+ to: TChain;
1713
1739
  currency: TCurrencyInputWithAmount;
1714
- /**
1715
- * The Polkadot destination address.
1716
- */
1717
1740
  recipient: string;
1718
- /**
1719
- * The AssetHub address
1720
- */
1721
1741
  ahAddress?: string;
1722
- /**
1723
- * The Ethereum signer.
1724
- */
1725
1742
  signer: WalletClient;
1726
1743
  };
1727
- type TEvmBuilderOptions<TApi, TRes, TSigner> = WithApi<TEvmBuilderOptionsBase, TApi, TRes, TSigner>;
1728
- type TSerializeEthTransferOptions = Omit<TEvmBuilderOptionsBase, 'signer'> & {
1729
- destAddress: string;
1730
- };
1731
- type TSerializedEthTransfer = {
1732
- token: string;
1733
- destinationParaId: number;
1734
- destinationFee: bigint;
1735
- amount: bigint;
1736
- fee: bigint;
1737
- };
1744
+ type TEvmTransferOptions<TApi, TRes, TSigner> = WithApi<TEvmTransferOptionsBase, TApi, TRes, TSigner>;
1738
1745
  /**
1739
1746
  * The options for the batch builder.
1740
1747
  */
@@ -1764,14 +1771,14 @@ type TDryRunPreviewOptions = {
1764
1771
  };
1765
1772
  type TBuilderOptions<TApi> = TApi | TBuilderConfig<TApi>;
1766
1773
  type TBuilderConfig<TApi> = Partial<{
1767
- apiOverrides: Partial<Record<TChain$1, TApi>>;
1774
+ apiOverrides: Partial<Record<TChain, TApi>>;
1768
1775
  development: boolean;
1769
1776
  abstractDecimals: boolean;
1770
1777
  xcmFormatCheck: boolean;
1771
1778
  }>;
1772
1779
  type TCreateTxsOptions<TApi, TRes, TSigner> = Pick<TTransferOptions<TApi, TRes, TSigner>, 'api' | 'from' | 'to' | 'currency'>;
1773
- type TBatchedTransferOptions<TApi, TRes, TSigner> = Omit<TTransferOptions<TApi, TRes, TSigner>, 'isAmountAll'> & {
1774
- builder: GeneralBuilder<TApi, TRes, TSigner, TTransferBaseOptions<TApi, TRes, TSigner>>;
1780
+ type TBatchedTransferOptions<TApi, TRes, TSigner> = Omit<TSubstrateTransferOptions<TApi, TRes, TSigner>, 'isAmountAll'> & {
1781
+ builder: GeneralBuilder<TApi, TRes, TSigner, TTransferBaseOptions<TApi, TRes, TSigner> & TBuilderInternalOptions<TSigner>>;
1775
1782
  };
1776
1783
  type TBuildInternalResBase<TApi, TRes, TSigner, TOptions extends TTransferBaseOptions<TApi, TRes, TSigner> = TTransferBaseOptions<TApi, TRes, TSigner>> = {
1777
1784
  options: TTransferOptions<TApi, TRes, TSigner> & TOptions;
@@ -1784,7 +1791,7 @@ type TBuildAllInternalRes<TApi, TRes, TSigner, TOptions extends TTransferBaseOpt
1784
1791
  };
1785
1792
  type TSender<TSigner> = string | TSigner;
1786
1793
  type TBuilderInternalOptions<TSigner> = {
1787
- senderSource?: TSender<TSigner>;
1794
+ senderSource?: TSender<TSigner> | WalletClient;
1788
1795
  };
1789
1796
 
1790
1797
  type TProviderEntry = {
@@ -1797,7 +1804,7 @@ type TChainConfig = {
1797
1804
  paraId: number;
1798
1805
  providers: TProviderEntry[];
1799
1806
  };
1800
- type TChainConfigMap = Record<TSubstrateChain$1, TChainConfig>;
1807
+ type TChainConfigMap = Record<TSubstrateChain, TChainConfig>;
1801
1808
 
1802
1809
  type OneKey<K extends string, V = unknown> = {
1803
1810
  [P in K]: Record<P, V> & Partial<Record<Exclude<K, P>, never>> extends infer O ? {
@@ -1930,7 +1937,7 @@ declare class MissingChainApiError extends Error {
1930
1937
  *
1931
1938
  * @param chain - The chain for which the API is missing.
1932
1939
  */
1933
- constructor(chain: TChain$1);
1940
+ constructor(chain: TChain);
1934
1941
  }
1935
1942
 
1936
1943
  /**
@@ -1949,7 +1956,7 @@ declare class NoXCMSupportImplementedError extends Error {
1949
1956
  *
1950
1957
  * @param chain - The chain for which XCM support is not implemented.
1951
1958
  */
1952
- constructor(chain: TChain$1);
1959
+ constructor(chain: TChain);
1953
1960
  }
1954
1961
 
1955
1962
  /**
@@ -1995,7 +2002,7 @@ declare class RuntimeApiUnavailableError extends Error {
1995
2002
  }
1996
2003
 
1997
2004
  type TScenarioNotSupportedContext = {
1998
- chain: TChain$1;
2005
+ chain: TChain;
1999
2006
  scenario: TScenario;
2000
2007
  };
2001
2008
  /**
@@ -2053,7 +2060,7 @@ declare class ValidationError extends Error {
2053
2060
  }
2054
2061
 
2055
2062
  type THopTransferInfo = {
2056
- chain: TChain$1;
2063
+ chain: TChain;
2057
2064
  result: {
2058
2065
  xcmFee: TXcmFeeBase;
2059
2066
  asset: TAssetInfo;
@@ -2065,8 +2072,8 @@ type TXcmFeeBase = {
2065
2072
  };
2066
2073
  type TTransferInfo = {
2067
2074
  chain: {
2068
- origin: TChain$1;
2069
- destination: TChain$1;
2075
+ origin: TChain;
2076
+ destination: TChain;
2070
2077
  ecosystem: string;
2071
2078
  };
2072
2079
  origin: {
@@ -2098,9 +2105,9 @@ type TTransferInfo = {
2098
2105
  };
2099
2106
  type BuildHopInfoOptions<TApi, TRes, TSigner> = {
2100
2107
  api: PolkadotApi<TApi, TRes, TSigner>;
2101
- chain: TSubstrateChain$1;
2108
+ chain: TSubstrateChain;
2102
2109
  fee: bigint;
2103
- originChain: TSubstrateChain$1;
2110
+ originChain: TSubstrateChain;
2104
2111
  currency: TCurrencyCore;
2105
2112
  asset: TAssetInfo;
2106
2113
  sender: string;
@@ -2108,8 +2115,8 @@ type BuildHopInfoOptions<TApi, TRes, TSigner> = {
2108
2115
  };
2109
2116
  type TBuildDestInfoOptions<TApi, TRes, TSigner> = {
2110
2117
  api: PolkadotApi<TApi, TRes, TSigner>;
2111
- origin: TSubstrateChain$1;
2112
- destination: TChain$1;
2118
+ origin: TSubstrateChain;
2119
+ destination: TChain;
2113
2120
  recipient: string;
2114
2121
  currency: WithAmount<TCurrencyCore>;
2115
2122
  originFee: bigint;
@@ -2124,8 +2131,8 @@ type TOriginFeeDetails = {
2124
2131
  };
2125
2132
  type TGetTransferInfoOptionsBase<TRes> = {
2126
2133
  buildTx: TTxFactory<TRes>;
2127
- origin: TSubstrateChain$1;
2128
- destination: TChain$1;
2134
+ origin: TSubstrateChain;
2135
+ destination: TChain;
2129
2136
  sender: string;
2130
2137
  ahAddress?: string;
2131
2138
  recipient: string;
@@ -2135,14 +2142,14 @@ type TGetTransferInfoOptionsBase<TRes> = {
2135
2142
  };
2136
2143
  type TGetTransferInfoOptions<TApi, TRes, TSigner> = WithApi<TGetTransferInfoOptionsBase<TRes>, TApi, TRes, TSigner>;
2137
2144
 
2138
- type TChainWithApi<TApi, TRes, TSigner, T = TSubstrateChain$1> = {
2145
+ type TChainWithApi<TApi, TRes, TSigner, T = TSubstrateChain> = {
2139
2146
  api: PolkadotApi<TApi, TRes, TSigner>;
2140
2147
  chain: T;
2141
2148
  };
2142
2149
  type TTypeAndThenCallContext<TApi, TRes, TSigner> = {
2143
2150
  origin: TChainWithApi<TApi, TRes, TSigner>;
2144
2151
  dest: TChainWithApi<TApi, TRes, TSigner>;
2145
- reserve: TChainWithApi<TApi, TRes, TSigner, TChain$1>;
2152
+ reserve: TChainWithApi<TApi, TRes, TSigner, TChain>;
2146
2153
  isSubBridge: boolean;
2147
2154
  isSnowbridge: boolean;
2148
2155
  isRelayAsset: boolean;
@@ -2155,7 +2162,7 @@ type TTypeAndThenFees = {
2155
2162
  destFee: bigint;
2156
2163
  };
2157
2164
  type TTypeAndThenOverrides = {
2158
- reserveChain?: TSubstrateChain$1;
2165
+ reserveChain?: TSubstrateChain;
2159
2166
  noFeeAsset?: boolean;
2160
2167
  };
2161
2168
 
@@ -2165,15 +2172,13 @@ declare const createClientPoolHelpers: <TClient>(clientPool: ClientCache<TClient
2165
2172
  releaseClient: (ws: TUrl) => void;
2166
2173
  };
2167
2174
 
2168
- declare const resolveChainApi: <TApi>(config: TBuilderOptions<TApiOrUrl<TApi>> | undefined, chain: TSubstrateChain$1, createApiInstance: (wsUrl: TUrl) => Promise<TApi>) => Promise<TApi>;
2169
-
2170
2175
  declare const createClientCache: <T>(maxSize: number, pingClient: (client: T) => Promise<void>, onEviction?: (key: TClientKey, value: TClientEntry<T>) => void, extensionMs?: number) => ClientCache<T>;
2171
2176
 
2172
- declare const blake2b256: (msg: Uint8Array) => Uint8Array<ArrayBufferLike>;
2173
- declare const blake2b512: (msg: Uint8Array) => Uint8Array<ArrayBufferLike>;
2177
+ declare const blake2b256: (msg: Uint8Array) => Uint8Array<ArrayBufferLike> & Uint8Array<ArrayBuffer>;
2178
+ declare const blake2b512: (msg: Uint8Array) => Uint8Array<ArrayBufferLike> & Uint8Array<ArrayBuffer>;
2174
2179
  declare const deriveAccountId: (raw: Uint8Array) => Uint8Array;
2175
2180
  declare const encodeSs58: (payload: Uint8Array, network: number) => string;
2176
- declare const convertSs58: <TApi, TRes, TSigner>(api: PolkadotApi<TApi, TRes, TSigner>, address: string, chain: TSubstrateChain$1) => string;
2181
+ declare const convertSs58: <TApi, TRes, TSigner>(api: PolkadotApi<TApi, TRes, TSigner>, address: string, chain: TSubstrateChain) => string;
2177
2182
 
2178
2183
  declare const getAssetBalanceInternal: <TApi, TRes, TSigner>({ api, address, chain, asset }: TGetAssetBalanceOptions<TApi, TRes, TSigner>) => Promise<bigint>;
2179
2184
  declare const getBalanceInternal: <TApi, TRes, TSigner>(options: TGetBalanceOptions<TApi, TRes, TSigner>) => Promise<bigint>;
@@ -2181,11 +2186,11 @@ declare const getBalance: <TApi, TRes, TSigner>(options: TGetBalanceOptions<TApi
2181
2186
 
2182
2187
  declare const getEthErc20Balance: (chain: TExternalChain, asset: TAssetInfo, address: string) => Promise<bigint>;
2183
2188
 
2184
- declare const getMoonbeamErc20Balance: (chain: TSubstrateChain$1, assetId: string, address: string) => Promise<bigint>;
2189
+ declare const getMoonbeamErc20Balance: (chain: TSubstrateChain, assetId: string, address: string) => Promise<bigint>;
2185
2190
 
2186
- declare const getChainConfig: (chain: TSubstrateChain$1) => TChainConfig;
2191
+ declare const getChainConfig: (chain: TSubstrateChain) => TChainConfig;
2187
2192
 
2188
- declare const getChainProviders: (chain: TSubstrateChain$1) => string[];
2193
+ declare const getChainProviders: (chain: TSubstrateChain) => string[];
2189
2194
 
2190
2195
  /**
2191
2196
  * Retrieves the parachain ID for a specified chain.
@@ -2193,7 +2198,7 @@ declare const getChainProviders: (chain: TSubstrateChain$1) => string[];
2193
2198
  * @param chain - The chain for which to get the paraId.
2194
2199
  * @returns The parachain ID of the chain.
2195
2200
  */
2196
- declare const getParaId: (chain: TChain$1) => number;
2201
+ declare const getParaId: (chain: TChain) => number;
2197
2202
 
2198
2203
  /**
2199
2204
  * Retrieves the chain name corresponding to a specified parachain ID.
@@ -2201,14 +2206,32 @@ declare const getParaId: (chain: TChain$1) => number;
2201
2206
  * @param paraId - The parachain ID.
2202
2207
  * @returns The chain name if found; otherwise, null.
2203
2208
  */
2204
- declare const getTChain: (paraId: number, ecosystem: TRelaychain | TExternalChain) => TChain$1 | null;
2209
+ declare const getTChain: (paraId: number, ecosystem: TRelaychain | TExternalChain) => TChain | null;
2210
+
2211
+ interface TEvmExtension {
2212
+ executeEvmTransfer: <TApi, TRes, TSigner>(options: TEvmTransferOptions<TApi, TRes, TSigner>) => Promise<string>;
2213
+ }
2214
+ declare const registerEvmExtension: (extension: TEvmExtension | undefined) => void;
2215
+ declare const getEvmExtensionOrThrow: () => TEvmExtension;
2216
+
2217
+ interface TEvmSnowbridgeExtension {
2218
+ executeEvmSnowbridgeTransfer: <TApi, TRes, TSigner>(options: TEvmTransferOptions<TApi, TRes, TSigner>) => Promise<string>;
2219
+ }
2220
+ declare const registerEvmSnowbridgeExtension: (extension: TEvmSnowbridgeExtension | undefined) => void;
2221
+ declare const getEvmSnowbridgeExtensionOrThrow: () => TEvmSnowbridgeExtension;
2222
+
2223
+ interface TSwapExtension {
2224
+ SwapBuilder: TSwapBuilderFactory;
2225
+ }
2226
+ declare const registerSwapExtension: (extension: TSwapExtension | undefined) => void;
2227
+ declare const getSwapExtensionOrThrow: () => TSwapExtension;
2205
2228
 
2206
2229
  /**
2207
2230
  * @deprecated Asset claim functionality is deprecated and will be removed in v14.
2208
2231
  */
2209
2232
  declare const claimAssets: <TApi, TRes, TSigner>(options: TAssetClaimOptions<TApi, TRes, TSigner>) => Promise<TRes>;
2210
2233
 
2211
- declare const resolveTransferParams: <TApi, TRes, TSigner>(options: TTransferOptions<TApi, TRes, TSigner>) => {
2234
+ declare const resolveTransferParams: <TApi, TRes, TSigner>(options: TSubstrateTransferOptions<TApi, TRes, TSigner>) => {
2212
2235
  resolvedFeeAsset: TAssetInfo | undefined;
2213
2236
  resolvedVersion: _paraspell_sdk_common.Version;
2214
2237
  overriddenAsset: _paraspell_sdk_common.TLocation | _paraspell_assets.TAssetWithFee[] | undefined;
@@ -2224,7 +2247,7 @@ declare const resolveTransferParams: <TApi, TRes, TSigner>(options: TTransferOpt
2224
2247
  alias?: string;
2225
2248
  };
2226
2249
  };
2227
- declare const createTransfer: <TApi, TRes, TSigner>(options: TTransferOptions<TApi, TRes, TSigner>) => Promise<TRes>;
2250
+ declare const createTransfer: <TApi, TRes, TSigner>(options: TSubstrateTransferOptions<TApi, TRes, TSigner>) => Promise<TRes>;
2228
2251
 
2229
2252
  declare const dryRun: <TApi, TRes, TSigner>(options: TDryRunOptions<TApi, TRes, TSigner>) => Promise<TDryRunResult>;
2230
2253
 
@@ -2237,16 +2260,16 @@ declare const getFailureInfo: (result: TDryRunResult) => Pick<TDryRunResult, "fa
2237
2260
  declare const traverseXcmHops: <TApi, TRes, TSigner, THopResult>(config: HopTraversalConfig<TApi, TRes, TSigner, THopResult>) => Promise<HopTraversalResult<THopResult>>;
2238
2261
  declare const addEthereumBridgeFees: <TApi, TRes, TSigner, TResult extends {
2239
2262
  fee?: bigint;
2240
- }>(api: PolkadotApi<TApi, TRes, TSigner>, bridgeHubResult: TResult | undefined, destination: TChain$1, assetHubChain: TSubstrateChain$1) => Promise<TResult | undefined>;
2263
+ }>(api: PolkadotApi<TApi, TRes, TSigner>, bridgeHubResult: TResult | undefined, destination: TChain, assetHubChain: TSubstrateChain) => Promise<TResult | undefined>;
2241
2264
 
2242
2265
  declare const calcPreviewMintAmount: (balance: bigint, desired: bigint) => bigint | null;
2243
2266
  declare const wrapTxBypass: <TApi, TRes, TSigner>(dryRunOptions: TDryRunBypassOptions<TApi, TRes, TSigner>, options?: TBypassOptions) => Promise<TRes>;
2244
2267
 
2245
2268
  declare const getParaEthTransferFees: <TApi, TRes, TSigner>(ahApi: PolkadotApi<TApi, TRes, TSigner>, shouldDisconnect?: boolean) => Promise<[bigint, bigint]>;
2246
2269
 
2247
- declare const transferMoonbeamEvm: <TApi, TRes, TSigner>(options: TEvmBuilderOptions<TApi, TRes, TSigner>) => Promise<string>;
2270
+ declare const transferMoonbeamEvm: <TApi, TRes, TSigner>(options: TEvmTransferOptions<TApi, TRes, TSigner>) => Promise<string>;
2248
2271
 
2249
- declare const transferMoonbeamToEth: <TApi, TRes, TSigner>(from: TSubstrateChain$1, { api, to, signer, recipient, ahAddress, currency }: TEvmBuilderOptions<TApi, TRes, TSigner>) => Promise<`0x${string}`>;
2272
+ declare const transferMoonbeamToEth: <TApi, TRes, TSigner>(from: TSubstrateChain, { api, to, signer, recipient, ahAddress, currency }: TEvmTransferOptions<TApi, TRes, TSigner>) => Promise<`0x${string}`>;
2250
2273
 
2251
2274
  declare const getOriginXcmFee: <TApi, TRes, TSigner>(options: TGetOriginXcmFeeOptions<TApi, TRes, TSigner>) => Promise<TXcmFeeDetail & {
2252
2275
  forwardedXcms?: unknown;
@@ -2285,18 +2308,18 @@ declare const createTypeAndThenCall: <TApi, TRes, TSigner>(options: TPolkadotXCM
2285
2308
  * by dry-running both variants and preferring the one that succeeds. If both fail, returns the
2286
2309
  * AssetHub variant. Supports only relaychain assets.
2287
2310
  */
2288
- declare const createTypeThenAutoReserve: <TApi, TRes, TSigner>(chain: TSubstrateChain$1, options: TPolkadotXCMTransferOptions<TApi, TRes, TSigner>) => Promise<TSerializedExtrinsics>;
2311
+ declare const createTypeThenAutoReserve: <TApi, TRes, TSigner>(chain: TSubstrateChain, options: TPolkadotXCMTransferOptions<TApi, TRes, TSigner>) => Promise<TSerializedExtrinsics>;
2289
2312
 
2290
- declare const validateCurrency: (currency: TCurrencyInput$1, feeAsset?: TCurrencyInput$1) => void;
2291
- declare const validateDestination: (origin: TSubstrateChain$1, destination: TDestination) => void;
2292
- declare const validateAssetSpecifiers: (assetCheckEnabled: boolean, currency: TCurrencyInput$1) => void;
2293
- declare const validateTransact: <TApi, TRes, TSigner>({ api, from, to, sender, recipient: address, transactOptions }: TTransferOptions<TApi, TRes, TSigner>) => ValidationError | undefined;
2313
+ declare const validateCurrency: (currency: TCurrencyInput, feeAsset?: TCurrencyInput) => void;
2314
+ declare const validateDestination: (origin: TSubstrateChain, destination: TDestination) => void;
2315
+ declare const validateAssetSpecifiers: (assetCheckEnabled: boolean, currency: TCurrencyInput) => void;
2316
+ declare const validateTransact: <TApi, TRes, TSigner>({ api, from, to, sender, recipient: address, transactOptions }: TSubstrateTransferOptions<TApi, TRes, TSigner>) => ValidationError | undefined;
2294
2317
 
2295
2318
  declare const verifyEdOnDestination: <TApi, TRes, TSigner>(options: TVerifyEdOnDestinationOptions<TApi, TRes, TSigner>) => Promise<boolean>;
2296
2319
 
2297
2320
  declare const compareAddresses: <TApi, TRes, TSigner>(api: PolkadotApi<TApi, TRes, TSigner>, addr1: string, addr2: string) => boolean;
2298
2321
 
2299
- declare const validateAddress: <TApi, TRes, TSigner>(api: PolkadotApi<TApi, TRes, TSigner>, address: TAddress, chain: TChain$1, isDestination?: boolean) => void;
2322
+ declare const validateAddress: <TApi, TRes, TSigner>(api: PolkadotApi<TApi, TRes, TSigner>, address: TAddress, chain: TChain, isDestination?: boolean) => void;
2300
2323
 
2301
2324
  declare const validateDestinationAddress: <TApi, TRes, TSigner>(address: TAddress, destination: TDestination, api: PolkadotApi<TApi, TRes, TSigner>) => void;
2302
2325
 
@@ -2307,6 +2330,9 @@ declare const assertHasId: (asset: TAssetInfo) => asserts asset is TAssetInfoWit
2307
2330
  declare const assertSenderSource: <TSigner>(sender?: TSender<TSigner>) => asserts sender is TSender<TSigner>;
2308
2331
  declare const isSenderSigner: <TSigner>(sender: TSender<TSigner>) => sender is TSigner;
2309
2332
  declare const assertSwapSupport: <TApi, TRes, TSigner>(options: TSwapOptions<TApi, TRes, TSigner> | undefined) => void;
2333
+ declare const assertSubstrateOrigin: (chain: TChain) => asserts chain is TSubstrateChain;
2334
+ declare const assertNotEvmTransfer: <TSigner>(from: TChain, senderSource?: TSender<TSigner> | WalletClient) => asserts from is TSubstrateChain;
2335
+ declare const assertExtensionInstalled: <T>(extension: T | undefined, extensionName: string, packageName: string, usage: string) => asserts extension is T;
2310
2336
 
2311
2337
  declare const createAssetId: (version: Version, location: TLocation) => TLocation | {
2312
2338
  Concrete: TLocation;
@@ -2324,14 +2350,12 @@ declare const sortAssets: (assets: TAsset[]) => TAsset[];
2324
2350
  declare const computeOverridenAmount: <TApi, TRes, TSigner>(options: TCreateTxsOptions<TApi, TRes, TSigner>, increaseAmount: string, relative?: boolean) => number | bigint;
2325
2351
  declare const overrideTxAmount: <TApi, TRes, TSigner>(options: TCreateTxsOptions<TApi, TRes, TSigner>, builder: GeneralBuilder<TApi, TRes, TSigner, TTransferBaseOptions<TApi, TRes, TSigner>>, amount: string, relative?: boolean) => Promise<TRes>;
2326
2352
  declare const createTxOverrideAmount: <TApi, TRes, TSigner>(options: TCreateTxsOptions<TApi, TRes, TSigner>, builder: GeneralBuilder<TApi, TRes, TSigner, TTransferBaseOptions<TApi, TRes, TSigner>>, amount?: string, relative?: boolean) => Promise<TRes>;
2327
- declare const createTransferOrSwapAll: <TApi, TRes, TSigner>(options: TTransferOptions<TApi, TRes, TSigner>) => Promise<TTransactionContext<TApi, TRes>[]>;
2328
- declare const createTransferOrSwap: <TApi, TRes, TSigner>(options: TTransferOptions<TApi, TRes, TSigner>) => Promise<TRes>;
2329
-
2330
- declare const isConfig: <TApi>(value: any) => value is TBuilderConfig<TApi>;
2353
+ declare const createTransferOrSwapAll: <TApi, TRes, TSigner>(options: TSubstrateTransferOptions<TApi, TRes, TSigner>) => Promise<TTransactionContext<TApi, TRes>[]>;
2354
+ declare const createTransferOrSwap: <TApi, TRes, TSigner>(options: TSubstrateTransferOptions<TApi, TRes, TSigner>) => Promise<TRes>;
2331
2355
 
2332
- declare const getAssetReserveChain: (chain: TSubstrateChain$1, assetLocation: TLocation) => TSubstrateChain$1;
2356
+ declare const getAssetReserveChain: (chain: TSubstrateChain, assetLocation: TLocation) => TSubstrateChain;
2333
2357
 
2334
- declare const getChainVersion: <TApi, TRes, TSigner>(chain: TChain$1) => Version;
2358
+ declare const getChainVersion: <TApi, TRes, TSigner>(chain: TChain) => Version;
2335
2359
 
2336
2360
  /**
2337
2361
  * Gets the relay chain (Polkadot, Kusama, Westend, or Paseo) of a given chain.
@@ -2339,13 +2363,20 @@ declare const getChainVersion: <TApi, TRes, TSigner>(chain: TChain$1) => Version
2339
2363
  * @param chain - The chain to evaluate.
2340
2364
  * @returns The corresponding relay chain.
2341
2365
  */
2342
- declare const getRelayChainOf: (chain: TSubstrateChain$1) => TRelaychain;
2366
+ declare const getRelayChainOf: (chain: TSubstrateChain) => TRelaychain;
2367
+
2368
+ declare const createChainClient: <TApi, TRes, TSigner>(api: PolkadotApi<TApi, TRes, TSigner>, chain: TSubstrateChain) => Promise<TApi>;
2343
2369
 
2344
- declare const createChainClient: <TApi, TRes, TSigner>(api: PolkadotApi<TApi, TRes, TSigner>, chain: TSubstrateChain$1) => Promise<TApi>;
2370
+ declare const resolveModuleError: (chain: TSubstrateChain, error: TModuleError) => TDryRunError;
2345
2371
 
2346
- declare const resolveModuleError: (chain: TSubstrateChain$1, error: TModuleError) => TDryRunError;
2372
+ declare const createEthereumBridgeInstructions: <TApi, TRes, TSigner>({ api, sender, recipient, assetInfo, ahAddress, version }: TCreateEthBridgeInstructionsOptions<TApi, TRes, TSigner>, origin: TSubstrateChain, messageId: string, ethAsset: TAssetInfo) => unknown[];
2373
+ declare const createCustomXcmOnDest: <TApi, TRes, TSigner>(options: TPolkadotXCMTransferOptions<TApi, TRes, TSigner>, origin: TSubstrateChain, messageId: string, ethAsset: TAssetInfo) => {
2374
+ [x: string]: unknown[];
2375
+ };
2376
+
2377
+ declare const generateMessageId: <TApi, TRes, TSigner>(api: PolkadotApi<TApi, TRes, TSigner>, senderAddress: string, sourceParaId: number, tokenAddress: string, recipient: string, amount: TAmount) => Promise<string>;
2347
2378
 
2348
- declare const padFee: (raw: bigint, origin: TSubstrateChain$1, dest: TChain$1, side: "origin" | "destination") => bigint;
2379
+ declare const padFee: (raw: bigint, origin: TSubstrateChain, dest: TChain, side: "origin" | "destination") => bigint;
2349
2380
  declare const padValueBy: (amount: bigint, percent: number) => bigint;
2350
2381
 
2351
2382
  /**
@@ -2358,15 +2389,19 @@ declare const getChain: <TApi, TRes, TSigner, T extends keyof ReturnType<typeof
2358
2389
 
2359
2390
  declare const getEvmPrivateKeyHex: (path: string) => "0x5fb92d6e98884f76de468fa3f6278f8807c48bebc13595d45af5bdc4da702133" | "0x8075991ce870b93a8870eca0c0f91913d12f47948ca0fd25b49c6fa7cdbeee8b" | "0x0b6e18cafb6ed99687ec547bd28139cafdd2bffe70e6b688025de6b445aa5c5b" | "0x39539ab1876910bbf3a223d84a29e28f1cb4e2e456503e7e91ed39b2e7223d68" | "0x7dce9bc8babb68fec1409be38c8e1a52650206a7ed90ff956ae8a6d15eeaaef4" | "0xb9d2ea9a615f3165812e8d44de0d24da9bbd164b65c4f0573e1ce2c8dbd9c8df" | undefined;
2360
2391
 
2392
+ declare const isConfig: <TApi>(value: any) => value is TBuilderConfig<TApi>;
2393
+
2394
+ declare const isViemSigner: (value: unknown) => value is WalletClient;
2395
+
2361
2396
  declare const createBeneficiaryLocXTokens: <TApi, TRes, TSigner>({ api, recipient, origin, destination, version, paraId }: TCreateBeneficiaryXTokensOptions<TApi, TRes, TSigner>) => TLocation;
2362
2397
  declare const createBeneficiaryLocation: <TApi, TRes, TSigner>({ api, address, version }: TCreateBeneficiaryOptions<TApi, TRes, TSigner>) => TLocation;
2363
2398
 
2364
- declare const createDestination: (version: Version, origin: TSubstrateChain$1, destination: TDestination, chainId?: number, junction?: TJunction, parents?: Parents) => TLocation;
2365
- declare const createVersionedDestination: (version: Version, origin: TSubstrateChain$1, destination: TDestination, chainId?: number, junction?: TJunction, parents?: Parents) => TXcmVersioned<TLocation>;
2399
+ declare const createDestination: (version: Version, origin: TSubstrateChain, destination: TDestination, chainId?: number, junction?: TJunction, parents?: Parents) => TLocation;
2400
+ declare const createVersionedDestination: (version: Version, origin: TSubstrateChain, destination: TDestination, chainId?: number, junction?: TJunction, parents?: Parents) => TXcmVersioned<TLocation>;
2366
2401
 
2367
2402
  declare const createX1Payload: (version: Version, junction: TJunction) => TJunctions;
2368
2403
 
2369
- declare const getChainLocation: (chain: TChain$1, destChain: TChain$1) => TLocation;
2404
+ declare const getChainLocation: (chain: TChain, destChain: TChain) => TLocation;
2370
2405
 
2371
2406
  /**
2372
2407
  * This function localizes a location by removing the `Parachain` junction
@@ -2377,49 +2412,23 @@ declare const getChainLocation: (chain: TChain$1, destChain: TChain$1) => TLocat
2377
2412
  * @param location - The location to localize
2378
2413
  * @returns The localized location
2379
2414
  */
2380
- declare const localizeLocation: (chain: TChain$1, location: TLocation, origin?: TChain$1) => TLocation;
2415
+ declare const localizeLocation: (chain: TChain, location: TLocation, origin?: TChain) => TLocation;
2381
2416
 
2382
2417
  declare const reverseTransformLocation: (location: TLocation) => TLocation;
2383
2418
 
2384
2419
  declare const normalizeAmount: (amount: bigint) => bigint;
2385
2420
 
2386
- declare const resolveDestChain: (originChain: TSubstrateChain$1, paraId: number | undefined) => "AssetHubPolkadot" | "Acala" | "Ajuna" | "Astar" | "BifrostPolkadot" | "BridgeHubPolkadot" | "Centrifuge" | "Darwinia" | "EnergyWebX" | "Hydration" | "Interlay" | "Heima" | "Jamton" | "Moonbeam" | "CoretimePolkadot" | "Collectives" | "Crust" | "Manta" | "NeuroWeb" | "Pendulum" | "Mythos" | "Peaq" | "PeoplePolkadot" | "Unique" | "Xode" | "AssetHubKusama" | "BridgeHubKusama" | "Karura" | "Kintsugi" | "Moonriver" | "CoretimeKusama" | "Encointer" | "Basilisk" | "BifrostKusama" | "CrustShadow" | "Crab" | "Laos" | "Quartz" | "RobonomicsPolkadot" | "PeopleKusama" | "Shiden" | "Zeitgeist" | "AssetHubWestend" | "BridgeHubWestend" | "CollectivesWestend" | "CoretimeWestend" | "Penpal" | "PeopleWestend" | "AjunaPaseo" | "AssetHubPaseo" | "BifrostPaseo" | "BridgeHubPaseo" | "CoretimePaseo" | "EnergyWebXPaseo" | "HeimaPaseo" | "HydrationPaseo" | "LaosPaseo" | "NeuroWebPaseo" | "PeoplePaseo" | "ZeitgeistPaseo" | undefined;
2421
+ declare const resolveDestChain: (originChain: TSubstrateChain, paraId: number | undefined) => "AssetHubPolkadot" | "Acala" | "Ajuna" | "Astar" | "BifrostPolkadot" | "BridgeHubPolkadot" | "Centrifuge" | "Darwinia" | "EnergyWebX" | "Hydration" | "Interlay" | "Heima" | "Jamton" | "Moonbeam" | "CoretimePolkadot" | "Collectives" | "Crust" | "Manta" | "NeuroWeb" | "Pendulum" | "Mythos" | "Peaq" | "PeoplePolkadot" | "Unique" | "Xode" | "AssetHubKusama" | "BridgeHubKusama" | "Karura" | "Kintsugi" | "Moonriver" | "CoretimeKusama" | "Encointer" | "Basilisk" | "BifrostKusama" | "CrustShadow" | "Crab" | "Laos" | "Quartz" | "RobonomicsPolkadot" | "PeopleKusama" | "Shiden" | "Zeitgeist" | "AssetHubWestend" | "BridgeHubWestend" | "CollectivesWestend" | "CoretimeWestend" | "Penpal" | "PeopleWestend" | "AjunaPaseo" | "AssetHubPaseo" | "BifrostPaseo" | "BridgeHubPaseo" | "CoretimePaseo" | "EnergyWebXPaseo" | "HeimaPaseo" | "HydrationPaseo" | "LaosPaseo" | "NeuroWebPaseo" | "PeoplePaseo" | "ZeitgeistPaseo" | undefined;
2387
2422
 
2388
2423
  declare const resolveParaId: (paraId: number | undefined, destination: TDestination) => number | undefined;
2389
2424
 
2390
- interface TSwapExtension {
2391
- RouterBuilder: typeof RouterBuilder;
2392
- }
2393
- declare const registerSwapExtension: (extension: TSwapExtension) => void;
2394
- declare const getSwapExtensionOrThrow: () => TSwapExtension;
2395
-
2396
2425
  declare const convertBuilderConfig: <TApi>(config: TBuilderOptions<TApiOrUrl<TApi>> | undefined) => TBuilderConfig<TUrl> | undefined;
2397
- declare const createRouterBuilder: <TApi, TRes, TSigner>(options: TTransferOptionsWithSwap<TApi, TRes, TSigner>) => _paraspell_swap.RouterBuilderCore<unknown, unknown, unknown, object & {
2398
- from: TSubstrateChain | undefined;
2399
- } & {
2400
- exchange: TExchangeInput;
2401
- } & {
2402
- to: TChain | undefined;
2403
- } & {
2404
- currencyFrom: TCurrencyInput;
2405
- } & {
2406
- currencyTo: TCurrencyInput;
2407
- } & {
2408
- amount: TAmount;
2409
- } & {
2410
- sender: string;
2411
- } & {
2412
- evmSenderAddress: string | undefined;
2413
- } & {
2414
- recipient: string | undefined;
2415
- } & {
2416
- slippagePct: string;
2417
- }>;
2418
- declare const executeWithRouter: <TApi, TRes, TSigner, T>(options: TTransferOptionsWithSwap<TApi, TRes, TSigner>, executor: (builder: ReturnType<typeof createRouterBuilder<TApi, TRes, TSigner>>) => Promise<T>) => Promise<T>;
2426
+ declare const createSwapBuilder: <TApi, TRes, TSigner>(options: TTransferOptionsWithSwap<TApi, TRes, TSigner>) => TSwapBuilder<TApi, TRes, TSigner>;
2427
+ declare const executeWithSwap: <TApi, TRes, TSigner, T>(options: TTransferOptionsWithSwap<TApi, TRes, TSigner>, executor: (builder: TSwapBuilder<TApi, TRes, TSigner>) => Promise<T>) => Promise<T>;
2419
2428
  declare const normalizeExchange: (exchange: TExchangeInput) => TExchangeInput;
2420
2429
 
2421
- declare const abstractDecimals: <TApi, TRes, TSigner>(amount: TAmount$1, decimals: number | undefined, api: PolkadotApi<TApi, TRes, TSigner>) => bigint;
2422
- declare const applyDecimalAbstraction: (amount: TAmount$1, decimals: number | undefined, shouldAbstract: boolean) => bigint;
2430
+ declare const abstractDecimals: <TApi, TRes, TSigner>(amount: TAmount, decimals: number | undefined, api: PolkadotApi<TApi, TRes, TSigner>) => bigint;
2431
+ declare const applyDecimalAbstraction: (amount: TAmount, decimals: number | undefined, shouldAbstract: boolean) => bigint;
2423
2432
 
2424
2433
  declare const createAssetsFilter: (asset: TAsset, version: Version) => {
2425
2434
  Wild: {
@@ -2436,9 +2445,9 @@ declare const createBaseExecuteXcm: <TRes>(options: TCreateBaseTransferXcmOption
2436
2445
  suffixXcm?: unknown[];
2437
2446
  }) => unknown[];
2438
2447
 
2439
- declare const createExecuteCall: (chain: TSubstrateChain$1, xcm: TXcmVersioned<any>, maxWeight: TWeight) => TSerializedExtrinsics;
2448
+ declare const createExecuteCall: (chain: TSubstrateChain, xcm: TXcmVersioned<any>, maxWeight: TWeight) => TSerializedExtrinsics;
2440
2449
 
2441
- declare const createExecuteExchangeXcm: <TApi, TRes, TSigner>(input: TPolkadotXCMTransferOptions<TApi, TRes, TSigner>, origin: TSubstrateChain$1, weight: TWeight, originExecutionFee: bigint, destExecutionFee: bigint) => TRes;
2450
+ declare const createExecuteExchangeXcm: <TApi, TRes, TSigner>(input: TPolkadotXCMTransferOptions<TApi, TRes, TSigner>, origin: TSubstrateChain, weight: TWeight, originExecutionFee: bigint, destExecutionFee: bigint) => TRes;
2442
2451
 
2443
2452
  declare const createDirectExecuteXcm: <TApi, TRes, TSigner>(options: TCreateTransferXcmOptions<TApi, TRes, TSigner>) => Promise<OneKey<_paraspell_sdk_common.Version, unknown[]>>;
2444
2453
 
@@ -2450,7 +2459,7 @@ declare const getLocalTransferAmount: <TApi, TRes, TSigner>({ assetInfo, balance
2450
2459
 
2451
2460
  declare const handleToAhTeleport: <TApi, TRes, TSigner>(origin: TParachain, input: TPolkadotXCMTransferOptions<TApi, TRes, TSigner>, defaultTx: TRes) => Promise<TRes>;
2452
2461
 
2453
- declare const throwUnsupportedCurrency: (currency: TCurrencyInput$1, chain: string, { isDestination }?: {
2462
+ declare const throwUnsupportedCurrency: (currency: TCurrencyInput, chain: string, { isDestination }?: {
2454
2463
  isDestination: boolean;
2455
2464
  }) => never;
2456
2465
 
@@ -2459,8 +2468,8 @@ declare const formatUnits: typeof formatUnits$1;
2459
2468
 
2460
2469
  declare const addXcmVersionHeader: <T, V extends Version>(obj: T, version: V) => OneKey<V, T>;
2461
2470
  declare const selectXcmVersion: (forcedVersion: Version | undefined, originVersion: Version, destMaxVersion?: Version) => Version;
2462
- declare const pickCompatibleXcmVersion: (origin: TSubstrateChain$1, destination: TDestination, override?: Version) => Version;
2463
- declare const pickRouterCompatibleXcmVersion: (origin: TSubstrateChain$1 | undefined, exchangeChain: TSubstrateChain$1, destination: TChain$1 | undefined) => Version;
2471
+ declare const pickCompatibleXcmVersion: (origin: TSubstrateChain, destination: TDestination, override?: Version) => Version;
2472
+ declare const pickRouterCompatibleXcmVersion: (origin: TSubstrateChain | undefined, exchangeChain: TSubstrateChain, destination: TChain | undefined) => Version;
2464
2473
 
2465
- export { API_TYPES, AmountTooLowError, ApiNotInitializedError, AssetClaimBuilder, BaseAssetsPallet, BatchMode, BatchValidationError, BridgeHaltedError, Builder, DEFAULT_TTL_MS, DRY_RUN_CLIENT_TIMEOUT_MS, DryRunFailedError, ETH_MAINNET_CHAIN_ID, ETH_TESTNET_CHAIN_ID, EXCHANGE_CHAINS, EXTENSION_MS, ExtensionNotInstalledError, FeatureTemporarilyDisabledError, GeneralBuilder, InvalidAddressError, MAX_CLIENTS, MissingChainApiError, MissingParameterError, NoXCMSupportImplementedError, NumberFormatError, OverrideConflictError, PolkadotApi, PolkadotXcmError, PolkadotXcmExecutionError, ProviderUnavailableError, RELAY_LOCATION, RoutingResolutionError, RuntimeApiError, RuntimeApiUnavailableError, ScenarioNotSupportedError, SubmitTransactionError, TRANSACT_ORIGINS, TX_CLIENT_TIMEOUT_MS, TransferToAhNotSupported, TypeAndThenUnavailableError, UnableToComputeError, UnsupportedOperationError, ValidationError, XTokensError, abstractDecimals, addEthereumBridgeFees, addXcmVersionHeader, applyDecimalAbstraction, assertAddressIsString, assertHasId, assertSender, assertSenderSource, assertSwapSupport, assertToIsString, blake2b256, blake2b512, calcPreviewMintAmount, claimAssets, compareAddresses, computeOverridenAmount, constructTypeAndThenCall, convertBuilderConfig, convertSs58, createAsset, createAssetId, createAssetsFilter, createBaseExecuteXcm, createBeneficiaryLocXTokens, createBeneficiaryLocation, createChainClient, createClientCache, createClientPoolHelpers, createDestination, createDirectExecuteXcm, createExecuteCall, createExecuteExchangeXcm, createRouterBuilder, createTransfer, createTransferOrSwap, createTransferOrSwapAll, createTxOverrideAmount, createTypeAndThenCall, createTypeThenAutoReserve, createVersionedAssets, createVersionedDestination, createX1Payload, deriveAccountId, dryRun, dryRunInternal, dryRunOrigin, encodeSs58, executeWithRouter, formatAssetIdToERC20, formatUnits, getAssetBalanceInternal, getAssetReserveChain, getBalance, getBalanceInternal, getBridgeStatus, getChain, getChainConfig, getChainLocation, getChainProviders, getChainVersion, getEthErc20Balance, getEvmPrivateKeyHex, getFailureInfo, getLocalTransferAmount, getMinTransferableAmount, getMinTransferableAmountInternal, getMoonbeamErc20Balance, getOriginXcmFee, getOriginXcmFeeInternal, getParaEthTransferFees, getParaId, getRelayChainOf, getSwapExtensionOrThrow, getTChain, getTransferInfo, getTransferableAmount, getTransferableAmountInternal, getXcmFee, getXcmFeeInternal, getXcmFeeOnce, handleExecuteTransfer, handleSwapExecuteTransfer, handleToAhTeleport, isConfig, isSenderSigner, keyFromWs, localizeLocation, maybeOverrideAsset, maybeOverrideAssets, normalizeAmount, normalizeExchange, overrideTxAmount, padFee, padValueBy, parseUnits, pickCompatibleXcmVersion, pickRouterCompatibleXcmVersion, registerSwapExtension, resolveAssetCount, resolveChainApi, resolveDestChain, resolveModuleError, resolveParaId, resolveTransferParams, reverseTransformLocation, selectXcmVersion, sortAssets, throwUnsupportedCurrency, transferMoonbeamEvm, transferMoonbeamToEth, traverseXcmHops, validateAddress, validateAssetSpecifiers, validateCurrency, validateDestination, validateDestinationAddress, validateTransact, verifyEdOnDestination, wrapTxBypass };
2466
- export type { BuildHopInfoOptions, ClientCache, HopProcessParams, HopTraversalConfig, HopTraversalResult, IPolkadotXCMTransfer, IXTokensTransfer, OneKey, TAddress, TApiOrUrl, TApiType, TAssetClaimInternalOptions, TAssetClaimOptions, TAssetClaimOptionsBase, TBatchOptions, TBatchedTransferOptions, TBifrostToken, TBridgeStatus, TBuildAllInternalRes, TBuildDestInfoOptions, TBuildInternalRes, TBuildInternalResBase, TBuilderConfig, TBuilderInternalOptions, TBuilderOptions, TBypassOptions, TCacheItem, TChainConfig, TChainConfigMap, TChainEndpoint, TChainWithApi, TClientEntry, TClientKey, TConditionalXcmFeeDetail, TConditionalXcmFeeHopInfo, TCreateBaseSwapXcmOptions, TCreateBaseTransferXcmOptions, TCreateBeneficiaryOptions, TCreateBeneficiaryXTokensOptions, TCreateEthBridgeInstructionsOptions, TCreateSwapXcmInternalOptions, TCreateSwapXcmOptions, TCreateTransferXcmOptions, TCreateTxsOptions, TDestWeight, TDestXcmFeeDetail, TDestination, TDryRunBaseOptions, TDryRunBypassOptions, TDryRunCallBaseOptions, TDryRunCallOptions, TDryRunChainFailure, TDryRunChainResult, TDryRunChainSuccess, TDryRunError, TDryRunOptions, TDryRunPreviewOptions, TDryRunResBase, TDryRunResult, TDryRunXcmBaseOptions, TDryRunXcmOptions, TEvmBuilderOptions, TEvmBuilderOptionsBase, TEvmChainFrom, TExchangeChain, TExchangeInput, TFeeType, TForeignAssetId, TForeignOrNativeAsset, TForeignOrTokenAsset, TGetAssetBalanceOptions, TGetAssetBalanceOptionsBase, TGetBalanceCommonOptions, TGetBalanceOptions, TGetBalanceOptionsBase, TGetFeeForDestChainBaseOptions, TGetFeeForDestChainOptions, TGetMinTransferableAmountOptions, TGetOriginXcmFeeBaseOptions, TGetOriginXcmFeeInternalOptions, TGetOriginXcmFeeOptions, TGetReverseTxFeeOptions, TGetTransferInfoOptions, TGetTransferInfoOptionsBase, TGetTransferableAmountOptions, TGetTransferableAmountOptionsBase, TGetXcmFeeBaseOptions, TGetXcmFeeBuilderOptions, TGetXcmFeeInternalOptions, TGetXcmFeeOptions, TGetXcmFeeResult, THopInfo, THopTransferInfo, TMantaAsset, TModuleError, TNativeTokenAsset, TOriginFeeDetails, TOtherReserveAsset, TPaymentInfo, TPolkadotXCMTransferOptions, TPolkadotXcmMethod, TProviderEntry, TReserveAsset, TResolveHopParams, TScenario, TSelfReserveAsset, TSender, TSerializeEthTransferOptions, TSerializedEthTransfer, TSerializedExtrinsics, TSerializedRuntimeApiQuery, TSerializedStateQuery, TSetBalanceRes, TStatusChangeCallback, TSwapConfig, TSwapEvent, TSwapEventType, TSwapExtension, TSwapFeeEstimates, TSwapOptions, TTransactOptions, TTransactOrigin, TTransactionContext, TTransactionType, TTransferBaseOptions, TTransferBaseOptionsWithSender, TTransferBaseOptionsWithSwap, TTransferFeeEstimates, TTransferInfo, TTransferInternalOptions, TTransferLocalOptions, TTransferOptions, TTransferOptionsWithSwap, TTxFactory, TTypeAndThenCallContext, TTypeAndThenFees, TTypeAndThenOverrides, TUrl, TVerifyEdOnDestinationOptions, TVerifyEdOnDestinationOptionsBase, TWeight, TXTokensCurrencySelection, TXTokensMethod, TXTokensTransferOptions, TXcmAsset, TXcmFeeBase, TXcmFeeDetail, TXcmFeeDetailError, TXcmFeeDetailSuccess, TXcmFeeDetailWithFallback, TXcmFeeHopInfo, TXcmFeeHopResult, TXcmFeeSwapConfig, TXcmForeignAsset, TXcmPalletMethod, TXcmVersioned, TZeitgeistAsset, WithApi, WithRequiredSender, WithRequiredSwapOptions };
2474
+ export { API_TYPES, AmountTooLowError, ApiNotInitializedError, AssetClaimBuilder, BaseAssetsPallet, BatchMode, BatchValidationError, BridgeHaltedError, Builder, DEFAULT_TTL_MS, DRY_RUN_CLIENT_TIMEOUT_MS, DryRunFailedError, ETH_MAINNET_CHAIN_ID, ETH_TESTNET_CHAIN_ID, EXCHANGE_CHAINS, EXTENSION_MS, ExtensionNotInstalledError, FeatureTemporarilyDisabledError, GeneralBuilder, InvalidAddressError, MAX_CLIENTS, MissingChainApiError, MissingParameterError, NoXCMSupportImplementedError, NumberFormatError, OverrideConflictError, PolkadotApi, PolkadotXcmError, PolkadotXcmExecutionError, ProviderUnavailableError, RELAY_LOCATION, RoutingResolutionError, RuntimeApiError, RuntimeApiUnavailableError, ScenarioNotSupportedError, SubmitTransactionError, TRANSACT_ORIGINS, TX_CLIENT_TIMEOUT_MS, TransferToAhNotSupported, TypeAndThenUnavailableError, UnableToComputeError, UnsupportedOperationError, ValidationError, XTokensError, abstractDecimals, addEthereumBridgeFees, addXcmVersionHeader, applyDecimalAbstraction, assertAddressIsString, assertExtensionInstalled, assertHasId, assertNotEvmTransfer, assertSender, assertSenderSource, assertSubstrateOrigin, assertSwapSupport, assertToIsString, blake2b256, blake2b512, calcPreviewMintAmount, claimAssets, compareAddresses, computeOverridenAmount, constructTypeAndThenCall, convertBuilderConfig, convertSs58, createAsset, createAssetId, createAssetsFilter, createBaseExecuteXcm, createBeneficiaryLocXTokens, createBeneficiaryLocation, createChainClient, createClientCache, createClientPoolHelpers, createCustomXcmOnDest, createDestination, createDirectExecuteXcm, createEthereumBridgeInstructions, createExecuteCall, createExecuteExchangeXcm, createSwapBuilder, createTransfer, createTransferOrSwap, createTransferOrSwapAll, createTxOverrideAmount, createTypeAndThenCall, createTypeThenAutoReserve, createVersionedAssets, createVersionedDestination, createX1Payload, deriveAccountId, dryRun, dryRunInternal, dryRunOrigin, encodeSs58, executeWithSwap, formatAssetIdToERC20, formatUnits, generateMessageId, getAssetBalanceInternal, getAssetReserveChain, getBalance, getBalanceInternal, getBridgeStatus, getChain, getChainConfig, getChainLocation, getChainProviders, getChainVersion, getEthErc20Balance, getEvmExtensionOrThrow, getEvmPrivateKeyHex, getEvmSnowbridgeExtensionOrThrow, getFailureInfo, getLocalTransferAmount, getMinTransferableAmount, getMinTransferableAmountInternal, getMoonbeamErc20Balance, getOriginXcmFee, getOriginXcmFeeInternal, getParaEthTransferFees, getParaId, getRelayChainOf, getSwapExtensionOrThrow, getTChain, getTransferInfo, getTransferableAmount, getTransferableAmountInternal, getXcmFee, getXcmFeeInternal, getXcmFeeOnce, handleExecuteTransfer, handleSwapExecuteTransfer, handleToAhTeleport, isConfig, isSenderSigner, isViemSigner, keyFromWs, localizeLocation, maybeOverrideAsset, maybeOverrideAssets, normalizeAmount, normalizeExchange, overrideTxAmount, padFee, padValueBy, parseUnits, pickCompatibleXcmVersion, pickRouterCompatibleXcmVersion, registerEvmExtension, registerEvmSnowbridgeExtension, registerSwapExtension, resolveAssetCount, resolveDestChain, resolveModuleError, resolveParaId, resolveTransferParams, reverseTransformLocation, selectXcmVersion, sortAssets, throwUnsupportedCurrency, transferMoonbeamEvm, transferMoonbeamToEth, traverseXcmHops, validateAddress, validateAssetSpecifiers, validateCurrency, validateDestination, validateDestinationAddress, validateTransact, verifyEdOnDestination, wrapTxBypass };
2475
+ export type { BuildHopInfoOptions, ClientCache, HopProcessParams, HopTraversalConfig, HopTraversalResult, IPolkadotXCMTransfer, IXTokensTransfer, OneKey, TAddress, TApiOrUrl, TApiType, TAssetClaimInternalOptions, TAssetClaimOptions, TAssetClaimOptionsBase, TBatchOptions, TBatchedTransferOptions, TBifrostToken, TBridgeStatus, TBuildAllInternalRes, TBuildDestInfoOptions, TBuildInternalRes, TBuildInternalResBase, TBuilderConfig, TBuilderInternalOptions, TBuilderOptions, TBypassOptions, TCacheItem, TChainConfig, TChainConfigMap, TChainEndpoint, TChainWithApi, TClientEntry, TClientKey, TConditionalXcmFeeDetail, TConditionalXcmFeeHopInfo, TCreateBaseSwapXcmOptions, TCreateBaseTransferXcmOptions, TCreateBeneficiaryOptions, TCreateBeneficiaryXTokensOptions, TCreateEthBridgeInstructionsOptions, TCreateSwapXcmInternalOptions, TCreateSwapXcmOptions, TCreateTransferXcmOptions, TCreateTxsOptions, TDestWeight, TDestXcmFeeDetail, TDestination, TDryRunBaseOptions, TDryRunBypassOptions, TDryRunCallBaseOptions, TDryRunCallOptions, TDryRunChainFailure, TDryRunChainResult, TDryRunChainSuccess, TDryRunError, TDryRunOptions, TDryRunPreviewOptions, TDryRunResBase, TDryRunResult, TDryRunXcmBaseOptions, TDryRunXcmOptions, TEvmExtension, TEvmSnowbridgeExtension, TEvmTransferOptions, TEvmTransferOptionsBase, TExchangeChain, TExchangeInput, TFeeType, TForeignAssetId, TForeignOrNativeAsset, TForeignOrTokenAsset, TGetAssetBalanceOptions, TGetAssetBalanceOptionsBase, TGetBalanceCommonOptions, TGetBalanceOptions, TGetBalanceOptionsBase, TGetFeeForDestChainBaseOptions, TGetFeeForDestChainOptions, TGetMinTransferableAmountOptions, TGetOriginXcmFeeBaseOptions, TGetOriginXcmFeeInternalOptions, TGetOriginXcmFeeOptions, TGetReverseTxFeeOptions, TGetTransferInfoOptions, TGetTransferInfoOptionsBase, TGetTransferableAmountOptions, TGetTransferableAmountOptionsBase, TGetXcmFeeBaseOptions, TGetXcmFeeBuilderOptions, TGetXcmFeeInternalOptions, TGetXcmFeeOptions, TGetXcmFeeResult, THopInfo, THopTransferInfo, TMantaAsset, TModuleError, TNativeTokenAsset, TOriginFeeDetails, TOtherReserveAsset, TPaymentInfo, TPolkadotXCMTransferOptions, TPolkadotXcmMethod, TProviderEntry, TReserveAsset, TResolveHopParams, TScenario, TSelfReserveAsset, TSender, TSerializedExtrinsics, TSerializedRuntimeApiQuery, TSerializedStateQuery, TSetBalanceRes, TStatusChangeCallback, TSubstrateTransferBaseOptions, TSubstrateTransferBaseOptionsWithSender, TSubstrateTransferOptions, TSwapBuilder, TSwapBuilderFactory, TSwapConfig, TSwapEvent, TSwapEventType, TSwapExtension, TSwapFeeEstimates, TSwapOptions, TTransactOptions, TTransactOrigin, TTransactionContext, TTransactionType, TTransferBaseOptions, TTransferBaseOptionsWithSender, TTransferBaseOptionsWithSwap, TTransferFeeEstimates, TTransferInfo, TTransferInternalOptions, TTransferLocalOptions, TTransferOptions, TTransferOptionsWithSwap, TTxFactory, TTypeAndThenCallContext, TTypeAndThenFees, TTypeAndThenOverrides, TUrl, TVerifyEdOnDestinationOptions, TVerifyEdOnDestinationOptionsBase, TWeight, TXTokensCurrencySelection, TXTokensMethod, TXTokensTransferOptions, TXcmAsset, TXcmFeeBase, TXcmFeeDetail, TXcmFeeDetailError, TXcmFeeDetailSuccess, TXcmFeeDetailWithFallback, TXcmFeeHopInfo, TXcmFeeHopResult, TXcmFeeSwapConfig, TXcmForeignAsset, TXcmPalletMethod, TXcmVersioned, TZeitgeistAsset, WithApi, WithRequiredSender, WithRequiredSwapOptions };