import { CommonWalletAdapter } from '@core/services/blockchain/wallets/wallets-adapters/common-wallet-adapter' ; import { SolanaWallet } from '@core/services/blockchain/wallets/wallets-adapters/solana/models/types' ; import { Connection } from '@solana/web3.js' ; import { BehaviorSubject } from 'rxjs' ; import { ErrorsService } from '@core/errors/errors.service' ; import { BlockchainData } from '@shared/models/blockchain/blockchain-data' ; import { BlockchainsInfo } from '@core/services/blockchain/blockchain-info' ; import { BLOCKCHAIN_NAME } from '@shared/models/blockchain/blockchain-name' ; import { BlockchainType } from '@shared/models/blockchain/blockchain-type' ; export abstract class CommonSolanaWalletAdapter < T extends SolanaWallet > extends CommonWalletAdapter < T | null > { public get isMultiChainWallet ( ) : boolean { return false ; } get walletType ( ) : BlockchainType { return 'solana' ; } protected constructor ( errorsService , onAddressChanges$ , onNetworkChanges$ , public readonly connection ) { super ( errorsService , onAddressChanges$ , onNetworkChanges$ ) ; } public async signPersonal ( message ) { const encoder = new TextEncoder ( ) ; const encodedMessage = encoder . encode ( message ) ; const { signature } = await this . wallet . signMessage ( encodedMessage , 'utf-8' ) ; return Buffer . from ( signature ) . toString ( 'base64' ) ; } public deActivate ( ) { this . onAddressChanges$ . next ( null ) ; this . onNetworkChanges$ . next ( null ) ; this . isEnabled = false ; } protected getNetwork ( ) { if ( this . isEnabled && this . selectedChain ) { return BlockchainsInfo . getBlockchainByName ( BLOCKCHAIN_NAME . SOLANA ) ; } return null ; } public addToken ( ) { return null ; } public async switchChain ( ) { return null ; } public async addChain ( ) { return null ; } }