import { DEFAULT_NETWORK } from '@config' ; import { Asset , IAccount , NetworkId , StoreAccount , TAddress , WalletId } from '@types' ; import { isSameAddress } from '@utils' ; export const getAccountByAddressAndNetworkName = ( accounts ) => ( address , networkId ) : IAccount | undefined => { return accounts . find ( ( account ) => isSameAddress ( account . address , address as TAddress ) && account . networkId === networkId ) ; } ; export const getIdenticalAccount = ( accounts ) => ( address , networkId , walletId ) : IAccount | undefined => { return accounts . find ( ( account ) => isSameAddress ( account . address , address as TAddress ) && account . networkId === networkId && account . wallet === walletId ) ; } ; export const getAccountsByAsset = ( accounts , { uuid : targetUuid } ) : StoreAccount [ ] => accounts . filter ( ( { assets } ) => assets . find ( ( { uuid } ) => uuid === targetUuid ) ) ; export const getBaseAsset = ( account ) => account . assets . find ( ( a ) => a . type === 'base' ) ; export const isEthereumAccount = ( account ) => account . networkId === DEFAULT_NETWORK ; export const isAccountInNetwork = ( account , networkIdToFilter ) => account . networkId === networkIdToFilter ;