import "ethers/dist/shims.js" ; import { ethers } from "ethers" ; const create = ( ) => { try { const wallet = ethers . Wallet . createRandom ( ) ; return wallet ; } catch ( error ) { throw new Error ( `Error creating account: ${ error . message }` ) ; } } ; const createUsingRandomness = ( randomBytes ) => { try { const mnemonic = ethers . utils . HDNode . entropyToMnemonic ( randomBytes ) ; const wallet = ethers . Wallet . fromMnemonic ( mnemonic ) ; return wallet ; } catch ( error ) { throw new Error ( `Error creating account with randomness: ${ error . message }` ) ; } } ; export const Account = { create , createUsingRandomness } ; export default Account ;