import type { CoinbaseWalletProvider } from '@coinbase/wallet-sdk'; import type { TransactionRequest, Web3Provider } from '@ethersproject/providers'; import type { SafeAppProvider } from '@gnosis.pm/safe-apps-provider'; import type { Keplr } from '@keplr-wallet/types'; import type { MetaMaskInpageProvider } from '@metamask/providers'; import type { PhantomWalletAdapter } from '@solana/wallet-adapter-phantom'; import type { Connection, Signer, Transaction } from '@solana/web3.js'; import type WalletConnectProvider from '@walletconnect/web3-provider'; import type { Narrow, TypedData, TypedDataDomain, TypedDataToPrimitiveTypes } from 'abitype'; import type { BigNumber, ethers } from 'ethers'; import type { CosmosTransaction } from 'rango-sdk/lib'; import type { AVAILABLE_WALLETS_GROUPS_CONFIG, BTC_CHAINS, BTC_WALLETS_CONFIG, COSMOS_CHAINS, COSMOS_WALLETS_CONFIG, EVM_WALLETS_CONFIG, KUJIRA_CHAINS, SOL_WALLETS_CONFIG, WALLET_NAMES } from './constants'; import type { TErc20SendTokenOptions } from './context'; import type { XDeFi } from './provider'; import type { BTClikeTransaction } from './provider/xDeFi/types'; declare type TAvailableWalletNames = keyof typeof WALLET_NAMES; declare type TAvailableEvmWalletNames = typeof EVM_WALLETS_CONFIG[number]; declare type TAvailableSolWalletNames = typeof SOL_WALLETS_CONFIG[number]; declare type TAvailableCosmosWalletNames = typeof COSMOS_WALLETS_CONFIG[number]; declare type TAvailableBTCWalletNames = typeof BTC_WALLETS_CONFIG[number]; declare type TWalletsTypeList = TAvailableEvmWalletNames | TAvailableSolWalletNames | TAvailableCosmosWalletNames; declare type TAvailableWalletsGroups = typeof AVAILABLE_WALLETS_GROUPS_CONFIG[number]; declare type TChainsWithWalletsLink = { key: TAvailableWalletsGroups; chains: readonly number[]; wallets: TWalletsTypeList[]; validate: (chainId: number) => boolean; }; declare const WALLET_STATUS: { NOT_INITED: string; CONNECTING: string; LOADING: string; READY: string; }; declare type WalletStatus = typeof WALLET_STATUS; declare type WalletStatusEnum = WalletStatus[keyof WalletStatus]; declare type TConnectedWallet = { chainId: number; blockchain: string; addresses: string[]; }; declare type TWalletAddressesHistory = { [address: string]: number[]; }; declare type TWalletStateDefault = { connectedWallets: TConnectedWallet[]; isConnected: boolean; status: WalletStatusEnum; subName: null | string; walletProvider: WalletConnectProvider | MetaMaskInpageProvider | CoinbaseWalletProvider | SafeAppProvider | null; connection: Connection | null; chainId: null | number; address: string | null; addressShort: string | null; addressDomain: string | null; balance: string | null; }; declare type TEvmWalletStore = { name: TAvailableEvmWalletNames; provider: Web3Provider; } & TWalletStateDefault; declare type TSolWalletStore = { name: TAvailableSolWalletNames; provider: PhantomWalletAdapter; } & TWalletStateDefault; declare type TCosmosWalletStore = { name: TAvailableCosmosWalletNames; provider: Keplr; } & TWalletStateDefault; declare type TWalletBodyDefaultState = { name: null; provider: null; } & TWalletStateDefault; declare type TBTCWalletStore = { name: TAvailableBTCWalletNames; provider: XDeFi; } & TWalletStateDefault; declare type TWalletStore = TEvmWalletStore | TSolWalletStore | TCosmosWalletStore | TBTCWalletStore | TWalletBodyDefaultState; declare type TWalletState = { [walletName in TAvailableWalletNames]: TWalletStore; }; declare type TWalletLocalData = { name: string; subName: string; chainId: number; address: string; }; declare type TWallet = { restore: () => Promise; connect: ({ name, chainId }: { name: any; chainId: any; }) => Promise; changeNetwork: (chainId: number) => Promise; sendTx: (transaction: TransactionRequest | Transaction | CosmosTransaction | BTClikeTransaction, options?: { signers?: Signer[]; fromChainId?: number; }) => Promise; signMessage: (message: string, options?: { fromChainId?: number; }) => Promise; signTypedData: (options: SignTypedDataArgs) => Promise; disconnect: () => void; getNonce: () => Promise; estimateGas: (data: TransactionRequest) => Promise; waitForTransaction: (transactionHash: string, config?: { confirmations?: number; fromChainId?: number; }) => Promise; getTransaction: (transactionHash: string) => Promise; connectedWallets: TConnectedWallet[]; walletAddressesHistory: TWalletAddressesHistory; walletState: TWalletState; erc20SendToken: (options: TErc20SendTokenOptions) => Promise; } & TWalletStore; declare type TWalletValues = typeof WALLET_NAMES[keyof typeof WALLET_NAMES]; declare type TAvailableNetworkNames = 'COSMOS' | 'OSMOSIS' | 'BTC' | 'LTC' | 'BCH' | 'DOGE' | 'THOR' | 'BNB' | 'JUNO' | 'AKASH' | 'KUJIRA' | 'STARGAZE' | 'PERSISTENCE' | 'MARS' | 'STRIDE'; declare type TChainWallet = { name: TAvailableNetworkNames; chainId: typeof COSMOS_CHAINS[number] | typeof BTC_CHAINS[number] | typeof KUJIRA_CHAINS[number]; network: string; }; export declare type SignTypedDataArgs = { /** Domain or domain signature for origin or contract */ domain: TypedDataDomain; /** Named list of all type definitions */ types: Narrow; } & (TTypedData extends TypedData ? TypedDataToPrimitiveTypes extends infer TSchema ? TSchema[keyof TSchema] extends infer TValue ? { [key: string]: any; } extends TValue ? { /** * Data to sign * * Use a [const assertion](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-4.html#const-assertions) on {@link types} for type inference. */ value: { [key: string]: unknown; }; } : { /** Data to sign */ value: TValue; } : never : never : never); export declare type SignTypedDataResult = string; export type { TAvailableWalletNames, TWallet, TWalletStore, TWalletLocalData, TWalletValues, TAvailableEvmWalletNames, TAvailableSolWalletNames, TEvmWalletStore, TSolWalletStore, TCosmosWalletStore, TConnectedWallet, TWalletAddressesHistory, TWalletState, TChainsWithWalletsLink, TWalletsTypeList, TChainWallet, TAvailableWalletsGroups, TBTCWalletStore, WalletStatusEnum, WalletStatus, TypedDataDomain }; export { WALLET_STATUS };