/// import type { Config, WalletEntryOption } from '@particle-network/auth'; import type { Chain, ChainInfo } from '@particle-network/chains'; import type { Connector, ParticleConnector } from '../providers/connectors/base'; export interface Account { id: string; publicAddress: string; name?: string; icon?: string; } export interface WalletInfo { publicAddress: string; privateKey: string; mnemonic?: string; } export declare enum WalletReadyState { /** * User-installable wallets can typically be detected by scanning for an API * that they've injected into the global context. If such an API is present, * we consider the wallet to have been installed. */ Installed = "Installed", NotDetected = "NotDetected", /** * Loadable wallets are always available to you. Since you can load them at * any time, it's meaningless to say that they have been detected. */ Loadable = "Loadable", /** * If a wallet is not supported on a given platform (eg. server-rendering, or * mobile) then it will stay in the `Unsupported` state. */ Unsupported = "Unsupported" } export interface ConnectConfig extends Omit { chains: Chain[] | ChainInfo[]; particleWalletEntry?: WalletEntryOption; wallets?: Wallet[]; } export interface JsonRpcRequest { id: number | string; jsonrpc: string; method: string; params?: unknown; } export interface EVMProvider { on(event: string, listener: any): void; once(event: string, listener: any): void; off(event: string, listener: any): void; removeListener(event: string, listener: any): void; request(request: Partial): Promise; disconnect?(): Promise; enable?(): Promise; } export interface PublicKey { toBase58(): string; toJSON(): string; /** * Return the byte array representation of the public key */ toBytes(): Uint8Array; /** * Return the Buffer representation of the public key */ toBuffer(): Buffer; /** * Return the base-58 representation of the public key */ toString(): string; } export type Commitment = 'processed' | 'confirmed' | 'finalized' | 'recent' | 'single' | 'singleGossip' | 'root' | 'max'; export type SendOptions = { /** disable transaction verification step */ skipPreflight?: boolean; /** preflight commitment level */ preflightCommitment?: Commitment; /** Maximum number of times for the RPC node to retry sending the transaction to the leader. */ maxRetries?: number; /** The minimum slot that the request can be evaluated at */ minContextSlot?: number; }; export interface SolanaProvider { publicKey: PublicKey | null; on(event: string, listener: any): void; once(event: string, listener: any): void; off(event: string, listener: any): void; removeListener(event: string, listener: any): void; connect(): Promise; disconnect(): Promise; signAndSendTransaction(transaction: unknown, options?: SendOptions): Promise; signTransaction(transaction: unknown): Promise; signAllTransactions(transaction: unknown[]): Promise; signMessage(message: Uint8Array): Promise; } export type Provider = EVMProvider | SolanaProvider; export interface ConnectorMap { [id: string]: Connector; } export interface ParticleConnectorMap { [id: string]: ParticleConnector; } export interface IConnectDisplay { name: string; icon: string; url: string; } export interface IProviderInfo { id: string; name: string; logo: string; type: string; check: string; } export interface IInjectedProvidersMap { injectedAvailable: boolean; [isProviderName: string]: boolean; } export interface DownloadUrls { browserExtension?: string; qrCode?: string; } export type Wallet = { id: string; name: string; iconUrl: string; downloadUrls?: DownloadUrls; createConnector: (chains?: Chain[]) => C; }; export type WalletMeta = Omit; export type WalletList = { groupName: string; wallets: Wallet[]; }[];