import { DeterministicWallet , GridPlusWallet } from '@mycrypto/wallets' ; import { NetworkId , StoreAccount , TAddress , WalletId } from '@types' ; import { isSameAddress } from '@utils' ; export const getAccountsByNetwork = ( accounts , networkId = true ) => { if ( networkId === true ) return accounts ; return accounts . filter ( ( acc ) => acc . networkId === networkId ) ; } ; export const getAccountsByViewOnly = ( accounts , includeViewOnly ? ) => { if ( includeViewOnly ) return accounts ; return accounts . filter ( ( acc ) => ! isViewOnlyWallet ( acc . wallet ) ) ; } ; export const isViewOnlyWallet = ( walletId ) : boolean => walletId === WalletId . VIEW_ONLY ; export const isHardwareWallet = ( walletId ) : boolean => walletId === WalletId . LEDGER_NANO_S || walletId === WalletId . LEDGER_NANO_S_NEW || walletId === WalletId . TREZOR || walletId === WalletId . TREZOR_NEW ; export const isSenderAccountPresent = ( accounts , addressToCheck ) : boolean => accounts . some ( ( { address , wallet } ) => isSameAddress ( address , addressToCheck ) && ! isViewOnlyWallet ( wallet ) ) ; export const isGridPlusWallet = ( wallet ) : wallet is GridPlusWallet => 'getCredentials' in wallet ;