import { WalletSigner, WalletMeta, LoginResponse, BalanceResponse, SubmitTransferResponse, IStorage } from '@dimcool/sdk'; import { Transaction, Keypair } from '@solana/web3.js'; /** Tokens `DimWallet.send` can send (other SPL tokens need a mint: use the SDK). */ type WalletSendToken = 'USDC' | 'SOL'; type EnabledNetwork = 'solana' | 'evm'; interface WalletRpcUrls { solana?: string; evm?: string; } interface WalletSdkConfig { appId?: string; baseUrl?: string; storage?: IStorage; } type WalletPrivateKeyInput = string | { solana?: string; evm?: string; }; interface WalletOptions { enabledNetworks: EnabledNetwork[]; fromMnemonic?: string; fromPrivateKey?: WalletPrivateKeyInput; solanaDerivationPath?: string; solanaAccountIndex?: number; rpcUrls?: WalletRpcUrls; sdk?: WalletSdkConfig; } interface WalletAddresses { solana?: string; evm?: string; } interface WalletLoginOptions { /** Which key signs in: the Solana one (default) or the EVM one. Same account either way. */ chain?: 'solana' | 'evm'; referralCode?: string; username?: string; walletMeta?: WalletMeta; } interface WalletInfo { addresses: WalletAddresses; isAuthenticated: boolean; userId?: string; username?: string | null; } interface WalletSendOptions { recipient: string; amount: number; /** What to send; defaults to USDC. */ token?: WalletSendToken; } interface WalletSendResult { signature: string; status: SubmitTransferResponse['status']; recipientAddress: string; amountMinor: number; token: WalletSendToken; feeMinor: number; } interface WalletSwapOptions { from: string; to: string; amount: string | number; } interface WalletSolanaApi { signMessage(message: string): Promise; signAndSendTransaction(transaction: Transaction): Promise; } interface WalletEvmApi { /** EIP-191 `personal_sign`, as the API's EVM sign-in and wallet linking check it (0x hex). */ signMessage(message: string): Promise; /** EIP-712 typed data (Hyperliquid's approvals and withdrawals), 0x hex. */ signTypedData(domain: Record, types: Record>, value: Record): Promise; } interface WalletApi { readonly solana?: WalletSolanaApi; readonly ethereum?: WalletEvmApi; getAddresses(): WalletAddresses; getSigner(chain?: 'solana' | 'evm'): WalletSigner; login(options?: WalletLoginOptions): Promise; setUsername(username: string): Promise; getInfo(): Promise; getBalances(): Promise; send(options: WalletSendOptions): Promise; swap(options: WalletSwapOptions): Promise; } declare class Wallet implements WalletApi { private readonly enabledNetworks; private readonly rpcUrls; private readonly solanaDerivationPath; private readonly sdkConfig; private sdk; private solanaKeypair; private evmWallet; private currentUser; readonly solana?: WalletSolanaApi; readonly ethereum?: WalletEvmApi; constructor(options: WalletOptions); private getSdk; private requireEvmWallet; private requireSolanaKeypair; private initializeFromMnemonic; private initializeFromPrivateKey; setKeypair(privateKey: string | Uint8Array): void; setEvmPrivateKey(privateKey: string): void; generateSolanaKeypair(): { publicKey: string; secretKey: Uint8Array; }; loadFromStorage(): Promise; clear(): void; hasKeypair(): boolean; getPublicKey(): string | null; getSolanaKeypair(): Keypair; getSolanaPrivateKeyBase58(): string; getAddresses(): WalletAddresses; /** The signer the SDK signs in with: the Solana key (default) or the EVM key. */ getSigner(chain?: 'solana' | 'evm'): WalletSigner; login(options?: WalletLoginOptions): Promise; setUsername(username: string): Promise; getInfo(): Promise; getBalances(): Promise; send(options: WalletSendOptions): Promise; swap(_options: WalletSwapOptions): Promise; } declare function createWallet(options: WalletOptions): Wallet; declare function getWallet(options?: WalletOptions): Wallet; export { type EnabledNetwork, Wallet, type WalletAddresses, type WalletApi, type WalletEvmApi, type WalletInfo, type WalletLoginOptions, type WalletOptions, type WalletPrivateKeyInput, type WalletRpcUrls, type WalletSdkConfig, type WalletSendOptions, type WalletSendResult, type WalletSendToken, type WalletSolanaApi, type WalletSwapOptions, createWallet, getWallet };