import type { ChainData, Token } from "@0xsquid/squid-types"; import { ChainType } from "@0xsquid/squid-types"; import { Connector } from "@wagmi/core"; import { IBitcoinContextData } from "../../core/providers/BitcoinProvider"; import { ICantonContextData } from "../../core/providers/CantonProvider"; import { ICosmosContextData } from "../../core/providers/CosmosProvider"; import { IEvmContextData } from "../../core/providers/EvmProvider"; import { ISolanaContextData } from "../../core/providers/SolanaProvider"; import { IStellarContextData } from "../../core/providers/StellarProvider"; import { ISuiContextData } from "../../core/providers/SuiProvider"; import { IXrplContextData } from "../../core/providers/XrplProvider"; import { TokenWithBalance } from "../../core/types/tokens"; import type { ChainTypeToWalletState, ConnectWalletResult, EnsSearchResult, Wallet } from "../../core/types/wallet"; type FormatHashParams = { hash?: string; chainType?: ChainType; }; export declare const formatHash: ({ chainType, hash }: FormatHashParams) => string; export declare const isWalletAddressValid: (chainData?: ChainData, address?: string) => boolean; export declare const redirectToExtensionsStore: (wallet: Wallet) => void; export declare const definedInWindow: (path: string | undefined, clientWindow: Window | undefined) => boolean; export declare const populateWallets: (window: Window | undefined, wallets: T[]) => T[]; export declare const buildFallbackWallets: (discovered: Wallet[]) => Wallet[]; /** * Get the base chain to connect to * If only one chain type is selected, use that chain type * Otherwise, use the wallet's type * This is mainly used for Cosmos wallets, they need a reference chain to connect to (because addresses are different on each chain) * @param wallet * @param chain * @param selectedChainTypes * @param findChain * @returns */ export declare const getDefaultChain: (wallet: Wallet, chain: ChainData | undefined, selectedChainTypes: ChainType[] | undefined, findChain: (chainId: string) => ChainData | undefined) => ChainData | undefined; /** * Sort order: * 1. Connected wallets * 2. Installed wallets * 3. Priority wallets * 4. The rest * * On mobile, Injected and WalletConnect are always on top, * after installed wallets. * * @returns The sorted wallets */ export declare function sortWallets(a: Pick, b: Pick, { isMobile, connectedWallets, priorityList, }: { isMobile: boolean; connectedWallets?: Pick[]; priorityList?: Wallet["connectorId"][]; }): number; export declare function areSameAddress(address1?: string, address2?: string): boolean; export declare function sortAddressBook(a: EnsSearchResult, b: EnsSearchResult, selectedAddress?: string): 1 | 0 | -1; export declare const calculateTotalUsdBalanceUSD: (tokens: Pick[]) => string; export declare function addTokenToWallet({ token: { address, decimals, symbol, logoURI }, provider, }: { token: Pick; provider: any; }): any; export declare function isEvmChainNotSupportedError(error: any): boolean; export declare const getWalletSupportedChainTypes: (wallet: Wallet) => ChainType[]; export declare const getConnectorForChainType: (wallet: Wallet, chainType: T) => ChainTypeToWalletState[T]["wallet"]["connector"] | undefined; export declare function walletSupportsChainType(wallet: Wallet, chainType: ChainType): boolean; interface ConnectWalletMutations { connectEvm: IEvmContextData["connectEvm"]; connectCosmos: ICosmosContextData["connectCosmos"]; cosmosConnectedWallet: ICosmosContextData["cosmosConnectedWallet"]; connectSolana: ISolanaContextData["connectSolana"]; connectBitcoin: IBitcoinContextData["connectBitcoin"]; connectSui: ISuiContextData["connectSui"]; connectXrpl: IXrplContextData["connectXrpl"]; connectStellar: IStellarContextData["connectStellar"]; connectCanton: ICantonContextData["connectCanton"]; } type ConnectWalletParams = { wallet: Wallet; selectedChain?: ChainData; selectedChainTypes?: ChainType[]; findChain: (chainId: string) => ChainData | undefined; } & ConnectWalletMutations; interface WalletConnectionResult { wallet: Wallet; addresses: Array<{ chainType: ChainType; data: ConnectWalletResult; }>; } export declare const connectWallet: (params: ConnectWalletParams) => Promise; /** * Wallets may have a cancelConnect method * This is used to cancel a pending connection and clean up resources * (e.g. network requests, event listeners, etc.) */ export declare const cancelConnectWallet: (wallet: Wallet) => void; export declare const isProblematicConnector: (connector: Connector | undefined) => boolean; interface MergeWalletsParams { singleChainWallets: Wallet[]; multiChainWallets: Wallet[]; } export declare function mergeWallets({ multiChainWallets, singleChainWallets, }: MergeWalletsParams): Wallet[]; export {};