import type { SvelteComponent } from 'svelte'; import type { AppMetadata, Device, WalletInit, EIP1193Provider, WalletModule, Chain, TokenSymbol } from '@web3-onboard/common'; import type setChain from './chain'; import type connect from './connect'; import type disconnect from './disconnect'; import type { state } from './store'; import type en from './i18n/en.json'; export interface InitOptions { wallets: WalletInit[]; chains: Chain[]; appMetadata?: AppMetadata; i18n?: i18nOptions; } export interface OnboardAPI { connectWallet: typeof connect; disconnectWallet: typeof disconnect; setChain: typeof setChain; state: typeof state; } export interface ConnectOptions { autoSelect?: { label: string; disableModals: boolean; }; } export interface ConnectOptionsString { autoSelect?: string; } export interface DisconnectOptions { label: string; } export interface WalletWithLoadedIcon extends Omit { icon: string; } export interface WalletWithLoadingIcon extends Omit { icon: Promise; } export declare type ConnectedChain = { id: Chain['id']; namespace: Chain['namespace']; }; export interface WalletState { label: string; icon: string; provider: EIP1193Provider; accounts: Account[]; chains: ConnectedChain[]; instance?: unknown; } export declare type Account = { address: Address; ens: Ens | null; balance: Balances | null; }; export declare type Balances = Record | null; export interface Ens { name: string; avatar: Avatar | null; contentHash: string | null; getText: (key: string) => Promise; } export declare type Avatar = { url: string; linkage: Array<{ type: string; content: string; }>; }; export declare type Address = string; export interface AppState { chains: Chain[]; wallets: WalletState[]; } export declare type InternalState = { svelteInstance: SvelteComponent | null; walletModules: WalletModule[]; appMetadata: AppMetadata | null; device: Device | null; }; export declare type Locale = string; export declare type i18nOptions = Record; export declare type i18n = typeof en; export declare type Action = AddChainsAction | AddWalletAction | UpdateWalletAction | RemoveWalletAction | ResetStoreAction | UpdateAccountAction; export declare type AddChainsAction = { type: 'add_chains'; payload: Chain[]; }; export declare type AddWalletAction = { type: 'add_wallet'; payload: WalletState; }; export declare type UpdateWalletAction = { type: 'update_wallet'; payload: { id: string; } & Partial; }; export declare type RemoveWalletAction = { type: 'remove_wallet'; payload: { id: string; }; }; export declare type ResetStoreAction = { type: 'reset_store'; payload: unknown; }; export declare type UpdateAccountAction = { type: 'update_account'; payload: { id: string; address: string; } & Partial; };