import { HD_WALLETS } from '@config' ; import { getAssetByUUID } from '@services/Store/Asset' ; import { Asset , DPathFormat , Network , NetworkId , WalletId } from '@types' ; const isHDWallet = ( w ) : w is DPathFormat => { return Object . keys ( HD_WALLETS ) . includes ( w ) ; } ; export const getNetworkByChainId = ( chainId , networks = [ ] ) : Network | undefined => { return networks . find ( ( network ) => network . chainId === chainId ) ; } ; export const getNetworkById = ( id , networks = [ ] ) : Network => { return networks . find ( ( network ) => network . id === id ) as Network ; } ; export const isWalletSupported = ( walletId , network ) : boolean => { if ( isHDWallet ( walletId ) ) { return ! ! ( network . dPaths && network . dPaths [ walletId ] ) ; } return true ; } ; export const getBaseAssetByNetwork = ( { network , assets } ) : Asset | undefined => { return getAssetByUUID ( assets ) ( network . baseAsset ) ; } ;