import type { CosmWasmClient, Contract as CosmWasmContract, ExecuteInstruction } from '@cosmjs/cosmwasm-stargate'; import type { EncodeObject as CmTransaction } from '@cosmjs/proto-signing'; import type { DeliverTxResponse, StargateClient } from '@cosmjs/stargate'; import type { Connection, Keypair, Transaction as SolTransaction, VersionedTransactionResponse as SolTransactionReceipt } from '@solana/web3.js'; import type { Contract as EV5Contract, providers as EV5Providers, PopulatedTransaction as EV5Transaction } from 'ethers'; import type { Contract as StarknetContract, Invocation as StarknetInvocation, Provider as StarknetProvider, GetTransactionReceiptResponse as StarknetTxReceipt } from 'starknet'; import type { GetContractReturnType, PublicClient, Transaction as VTransaction, TransactionReceipt as VTransactionReceipt } from 'viem'; import type { Contract as ZKSyncBaseContract, Provider as ZKSyncBaseProvider, types as zkSyncTypes } from 'zksync-ethers'; import type { AleoProvider as AleoSDKProvider, AleoReceipt as AleoSDKReceipt, AleoTransaction as AleoSDKTransaction } from '@hyperlane-xyz/aleo-sdk/runtime'; import type { CosmosNativeProvider } from '@hyperlane-xyz/cosmos-sdk/runtime'; import type { RadixProvider as RadixSDKProvider, RadixSDKReceipt, RadixSDKTransaction } from '@hyperlane-xyz/radix-sdk/runtime'; import type { Annotated, KnownProtocolType } from '@hyperlane-xyz/utils'; import { ProtocolType } from '@hyperlane-xyz/utils'; export declare enum ProviderType { EthersV5 = "ethers-v5", Viem = "viem", SolanaWeb3 = "solana-web3", CosmJs = "cosmjs", CosmJsNative = "cosmjs-native", CosmJsWasm = "cosmjs-wasm", GnosisTxBuilder = "gnosis-txBuilder", Starknet = "starknet", ZkSync = "zksync", Radix = "radix", Aleo = "aleo", Tron = "tron" } export type { KnownProtocolType }; export declare const PROTOCOL_TO_DEFAULT_PROVIDER_TYPE: Record; export type ProviderMap = Partial>; type ProtocolTypesMapping = { [ProtocolType.Ethereum]: { transaction: EthersV5Transaction; provider: EthersV5Provider; contract: EthersV5Contract; receipt: EthersV5TransactionReceipt; }; [ProtocolType.Sealevel]: { transaction: SolanaWeb3Transaction; provider: SolanaWeb3Provider; contract: SolanaWeb3Contract; receipt: SolanaWeb3TransactionReceipt; }; [ProtocolType.Cosmos]: { transaction: CosmJsWasmTransaction; provider: CosmJsWasmProvider; contract: CosmJsWasmContract; receipt: CosmJsWasmTransactionReceipt; }; [ProtocolType.CosmosNative]: { transaction: CosmJsNativeTransaction; provider: CosmJsNativeProvider; contract: null; receipt: CosmJsNativeTransactionReceipt; }; [ProtocolType.Starknet]: { transaction: StarknetJsTransaction; provider: StarknetJsProvider; contract: StarknetJsContract; receipt: StarknetJsTransactionReceipt; }; [ProtocolType.Radix]: { transaction: RadixTransaction; provider: RadixProvider; contract: null; receipt: RadixTransactionReceipt; }; [ProtocolType.Aleo]: { transaction: AleoTransaction; provider: AleoProvider; contract: null; receipt: AleoTransactionReceipt; }; [ProtocolType.Tron]: { transaction: EthersV5Transaction; provider: TronProvider; contract: null; receipt: EthersV5TransactionReceipt; }; [ProtocolType.Unknown]: { transaction: never; provider: never; contract: never; receipt: never; }; }; type ProtocolTyped = ProtocolTypesMapping[T][K]; export type ProtocolTypedTransaction = ProtocolTyped; export type ProtocolTypedProvider = ProtocolTyped; export type ProtocolTypedContract = ProtocolTyped; export type ProtocolTypedReceipt = ProtocolTyped; export type AnyProtocolTransaction = ProtocolTransaction; export type ProtocolTransaction = ProtocolTypedTransaction['transaction']; export type AnyProtocolReceipt = ProtocolReceipt; export type ProtocolReceipt = ProtocolTypedReceipt['receipt']; export type AnnotatedTypedTransaction = Annotated>; /** * Providers with discriminated union of type */ interface TypedProviderBase { type: ProviderType; provider: T; } export interface EthersV5Provider extends TypedProviderBase { type: ProviderType.EthersV5; provider: EV5Providers.Provider; } export interface ViemProvider extends TypedProviderBase { type: ProviderType.Viem; provider: PublicClient; } export interface SolanaWeb3Provider extends TypedProviderBase { type: ProviderType.SolanaWeb3; provider: Connection; } export interface CosmJsProvider extends TypedProviderBase> { type: ProviderType.CosmJs; provider: Promise; } export interface CosmJsWasmProvider extends TypedProviderBase> { type: ProviderType.CosmJsWasm; provider: Promise; } export interface CosmJsNativeProvider extends TypedProviderBase> { type: ProviderType.CosmJsNative; provider: Promise; } export interface StarknetJsProvider extends TypedProviderBase { type: ProviderType.Starknet; provider: StarknetProvider; } export interface RadixProvider extends TypedProviderBase { type: ProviderType.Radix; provider: RadixSDKProvider; } export interface AleoProvider extends TypedProviderBase { type: ProviderType.Aleo; provider: AleoSDKProvider; } export interface TronProvider extends TypedProviderBase { type: ProviderType.Tron; provider: EV5Providers.Provider; } export interface ZKSyncProvider extends TypedProviderBase { type: ProviderType.ZkSync; provider: ZKSyncBaseProvider; } export interface GnosisTxBuilderProvider extends TypedProviderBase { type: ProviderType.GnosisTxBuilder; provider: EV5Providers.Provider; } export type TypedProvider = EthersV5Provider | ViemProvider | SolanaWeb3Provider | CosmJsProvider | CosmJsWasmProvider | CosmJsNativeProvider | StarknetJsProvider | ZKSyncProvider | GnosisTxBuilderProvider | RadixProvider | AleoProvider | TronProvider; /** * Contracts with discriminated union of provider type */ interface TypedContractBase { type: ProviderType; contract: T; } export interface EthersV5Contract extends TypedContractBase { type: ProviderType.EthersV5; contract: EV5Contract; } export interface ViemContract extends TypedContractBase { type: ProviderType.Viem; contract: GetContractReturnType; } export interface SolanaWeb3Contract extends TypedContractBase { type: ProviderType.SolanaWeb3; contract: never; } export interface CosmJsContract extends TypedContractBase { type: ProviderType.CosmJs; contract: never; } export interface CosmJsWasmContract extends TypedContractBase { type: ProviderType.CosmJsWasm; contract: CosmWasmContract; } export interface StarknetJsContract extends TypedContractBase { type: ProviderType.Starknet; contract: StarknetContract; } export interface ZKSyncContract extends TypedContractBase { type: ProviderType.ZkSync; contract: ZKSyncBaseContract; } export type TypedContract = EthersV5Contract | ViemContract | SolanaWeb3Contract | CosmJsContract | CosmJsWasmContract | StarknetJsContract | ZKSyncBaseContract; /** * Transactions with discriminated union of provider type */ interface TypedTransactionBase { type: ProviderType; transaction: T; } export interface EthersV5Transaction extends TypedTransactionBase { type: ProviderType.EthersV5; transaction: EV5Transaction; } export interface ViemTransaction extends TypedTransactionBase { type: ProviderType.Viem; transaction: VTransaction; } export interface SolanaWeb3Transaction extends TypedTransactionBase { type: ProviderType.SolanaWeb3; transaction: SolTransaction; extraSigners?: Keypair[]; } export interface CosmJsTransaction extends TypedTransactionBase { type: ProviderType.CosmJs; transaction: CmTransaction; } export interface CosmJsWasmTransaction extends TypedTransactionBase { type: ProviderType.CosmJsWasm; transaction: ExecuteInstruction; } export interface CosmJsNativeTransaction extends TypedTransactionBase { type: ProviderType.CosmJsNative; transaction: CmTransaction; } export interface StarknetJsTransaction extends TypedTransactionBase { type: ProviderType.Starknet; transaction: StarknetInvocation; } export interface RadixTransaction extends TypedTransactionBase { type: ProviderType.Radix; transaction: RadixSDKTransaction; } export interface AleoTransaction extends TypedTransactionBase { type: ProviderType.Aleo; transaction: AleoSDKTransaction; } export interface ZKSyncTransaction extends TypedTransactionBase { type: ProviderType.ZkSync; transaction: zkSyncTypes.TransactionRequest; } export interface TronTransaction extends TypedTransactionBase { type: ProviderType.Tron; transaction: EV5Transaction; } export type TypedTransaction = EthersV5Transaction | ViemTransaction | SolanaWeb3Transaction | CosmJsTransaction | CosmJsWasmTransaction | CosmJsNativeTransaction | StarknetJsTransaction | ZKSyncTransaction | RadixTransaction | AleoTransaction | TronTransaction; export type AnnotatedEV5Transaction = Annotated; export type AnnotatedViemTransaction = Annotated; export type AnnotatedSolanaWeb3Transaction = Annotated; export type AnnotatedCosmJsTransaction = Annotated; export type AnnotatedCosmJsWasmTransaction = Annotated; export type AnnotatedCosmJsNativeTransaction = Annotated; export type AnnotatedStarknetJsTransaction = Annotated; export type AnnotatedZKSyncTransaction = Annotated; export type AnnotatedRadixTransaction = Annotated; export type AnnotatedTronTransaction = Annotated; export type TypedAnnotatedTransaction = AnnotatedEV5Transaction | AnnotatedViemTransaction | AnnotatedSolanaWeb3Transaction | AnnotatedCosmJsTransaction | AnnotatedCosmJsWasmTransaction | AnnotatedCosmJsNativeTransaction | AnnotatedStarknetJsTransaction | AnnotatedZKSyncTransaction | AnnotatedRadixTransaction | AnnotatedTronTransaction; /** * Transaction receipt/response with discriminated union of provider type */ interface TypedTransactionReceiptBase { type: ProviderType; receipt: T; } export interface EthersV5TransactionReceipt extends TypedTransactionReceiptBase { type: ProviderType.EthersV5; receipt: EV5Providers.TransactionReceipt; } export interface ViemTransactionReceipt extends TypedTransactionReceiptBase { type: ProviderType.Viem; receipt: VTransactionReceipt; } export interface SolanaWeb3TransactionReceipt extends TypedTransactionReceiptBase { type: ProviderType.SolanaWeb3; receipt: SolTransactionReceipt; } export interface CosmJsTransactionReceipt extends TypedTransactionReceiptBase { type: ProviderType.CosmJs; receipt: DeliverTxResponse; } export interface CosmJsWasmTransactionReceipt extends TypedTransactionReceiptBase { type: ProviderType.CosmJsWasm; receipt: DeliverTxResponse; } export interface CosmJsNativeTransactionReceipt extends TypedTransactionReceiptBase { type: ProviderType.CosmJsNative; receipt: DeliverTxResponse; } export interface StarknetJsTransactionReceipt extends TypedTransactionReceiptBase { type: ProviderType.Starknet; receipt: StarknetTxReceipt; } export interface ZKSyncTransactionReceipt extends TypedTransactionReceiptBase { type: ProviderType.ZkSync; receipt: zkSyncTypes.TransactionReceipt; } export interface RadixTransactionReceipt extends TypedTransactionReceiptBase { type: ProviderType.Radix; receipt: RadixSDKReceipt; } export interface AleoTransactionReceipt extends TypedTransactionReceiptBase { type: ProviderType.Aleo; receipt: AleoSDKReceipt; } export interface TronTransactionReceipt extends TypedTransactionReceiptBase { type: ProviderType.Tron; receipt: EV5Providers.TransactionReceipt; } export type TypedTransactionReceipt = EthersV5TransactionReceipt | ViemTransactionReceipt | SolanaWeb3TransactionReceipt | CosmJsTransactionReceipt | CosmJsWasmTransactionReceipt | CosmJsNativeTransactionReceipt | StarknetJsTransactionReceipt | ZKSyncTransactionReceipt | RadixTransactionReceipt | AleoTransactionReceipt | TronTransactionReceipt; //# sourceMappingURL=ProviderType.d.ts.map