import { toChecksumAddress } from 'ethereumjs-util' ; import getUuid from 'uuid-by-string' ; import v4 from 'uuid/v4' ; import { NetworkId , TUuid } from '@types' ; export const generateUUID = ( ) : TUuid => { return v4 ( ) as TUuid ; } ; const generateUUIDByIdAndAddress = ( id , address ? ) => address ? ( getUuid ( `${ id }-${ toChecksumAddress ( address ) }` ) as TUuid ) : ( getUuid ( `${ id }` ) as TUuid ) ; export const generateAssetUUID = ( chainId , address ? ) : TUuid => generateUUIDByIdAndAddress ( chainId . toString ( ) , address ) ; export const generateDeterministicAddressUUID = ( id , address ) => generateUUIDByIdAndAddress ( id , address ) ; export const getUUID = ( val ) : TUuid => getUuid ( val ) as TUuid ;