import EventEmitter from 'events'; import { ChainAgnosticProvider } from '@avalabs/vm-module-types'; import { PublicKey, SendOptions } from '@solana/web3.js'; import { SolanaCaip2ChainId } from '@avalabs/core-chains-sdk'; import { WalletIcon } from '@wallet-standard/base'; interface ConnectionEvent { connect(...args: unknown[]): unknown; disconnect(...args: unknown[]): unknown; accountChanged(...args: unknown[]): unknown; } interface ConnectionEventEmitter { on(event: E, listener: ConnectionEvent[E], context?: any): void; off(event: E, listener: ConnectionEvent[E], context?: any): void; } interface Connection extends ConnectionEventEmitter { publicKey: PublicKey | null; info: { icon: WalletIcon; version: string; name: string; }; connect(options?: { onlyIfTrusted?: boolean; }): Promise<{ publicKey: PublicKey; }>; disconnect(): Promise; signAndSendTransaction(account: string, caipId: SolanaCaip2ChainId, serializedTx: string, options?: SendOptions): Promise; signTransaction(account: string, caip2Id: SolanaCaip2ChainId, base64EncodedTx: string): Promise; signAllTransactions(account: string, caip2Id: SolanaCaip2ChainId, base64EncodedTxs: string[]): Promise; signMessage(account: string, base64EncodedMsg: string): Promise; } /** * Represents a Solana Wallet Provider that interacts with a chain-agnostic provider * to manage wallet connections, transactions, and events. * * @extends EventEmitter * @implements Connection */ declare class SolanaWalletProvider extends EventEmitter implements Connection { #private; publicKey: PublicKey | null; /** * Creates an instance of SolanaWalletProvider. * * @param chainAgnosticProvider - The chain-agnostic provider used for communication. * @param options - Wallet information including icon, version, and name. */ constructor(chainAgnosticProvider: ChainAgnosticProvider, { icon, version, name }: { icon: WalletIcon; version: string; name: string; }); /** * Retrieves wallet metadata such as icon, version, and name. */ get info(): { icon: WalletIcon; version: string; name: string; }; /** * Connects to the wallet. If already connected, returns the public key. * * @param options - Connection options. * @param options.onlyIfTrusted - If true, connects without approval if previously approved. * @returns An object containing the public key. */ connect({ onlyIfTrusted }?: { onlyIfTrusted?: boolean; }): Promise<{ publicKey: PublicKey; }>; disconnect(): Promise; /** * Signs and sends a transaction. * * @param account - The account to use for signing. * @param caipId - The Solana CAIP-2 chain ID. * @param serializedTx - The serialized transaction to sign and send. * @param sendOptions - Options for sending the transaction. See the docs here: https://solana.com/pl/docs/rpc/http/sendtransaction. * @returns The transaction signature. */ signAndSendTransaction(account: string, caipId: SolanaCaip2ChainId, serializedTx: string, sendOptions: SendOptions): Promise; /** * Signs a transaction without sending it. * * @param account - The account to use for signing. * @param caipId - The Solana CAIP-2 chain ID. * @param serializedTx - The serialized transaction to sign. * @returns The signed transaction. */ signTransaction(account: string, caipId: SolanaCaip2ChainId, serializedTx: string): Promise; /** * Signs multiple transactions without sending them. * * @param address - The address to use for signing. * @param caipId - The Solana CAIP-2 chain ID. * @param serializedTxs - An array of serialized transactions to sign. * @returns An array of signed transactions. */ signAllTransactions(address: string, caipId: SolanaCaip2ChainId, serializedTxs: string[]): Promise; signMessage(account: string, serializedMessage: string): Promise; signIn(): void; } declare function initialize(connection: Connection): void; export { SolanaWalletProvider, initialize };