import { EventEmitter } from '@angular/core' ; import { Connection , Transaction , TransactionSignature } from '@solana/web3.js' ; interface SolanaWalletEvents { connect ( ... args ) : unknown ; disconnect ( ... args ) : unknown ; } export interface SolanaWallet extends EventEmitter < SolanaWalletEvents > { publicKey ? : { toBytes ( ) : Uint8Array ; } ; isConnected : boolean ; signTransaction ( transaction ) : Promise < Transaction > ; signAllTransactions ( transactions ) : Promise < Transaction [ ] > ; signMessage ( message , encoding ) : Promise < { signature : Uint8Array ; } > ; sendTransaction ( transaction , connection , options ) : Promise < TransactionSignature > ; connect ( ) : Promise < boolean > ; disconnect ( ) : Promise < boolean > ; on : ( event : string , callback : ( ) => void ) => unknown ; off : ( event : string , callback : ( ) => void ) => unknown ; } export interface PhantomWallet extends SolanaWallet { isPhantom ? : boolean ; _handleDisconnect ( ... args ) : unknown ; } export interface SolflareWallet extends SolanaWallet { isSolflare ? : boolean ; } declare global { interface Window { solana ? : PhantomWallet ; solflare ? : SolflareWallet ; } }