import { useEffect , useState } from 'react' ; import Account from '@tasit/account' ; export function useAccount ( options ) { const [ address , setAddress ] = useState ( '' ) ; const { asyncStorage = true , randomBytes , randomBytesGenerated } = options ; useEffect ( ( ) => { function makeAccount ( ) { const account = Account . createUsingRandomness ( randomBytes ) ; const { address : accountAddress , } = account ; setAddress ( accountAddress ) ; if ( asyncStorage ) { } } if ( randomBytesGenerated ) { makeAccount ( ) ; } } , [ asyncStorage , randomBytes , randomBytesGenerated ] ) ; return address ; } export interface AccountOptions { /** If it should use Async Storage for the public key, defaults to `true` */ asyncStorage ? : boolean ; randomBytes : Uint8Array ; randomBytesGenerated : boolean ; }