i'm trying to make a wallet in react native using ethers.js, but when i'm trying to call the function createRandom, to generate a secure random seed the application gets crashed.
this is the code, i'm using this in a react Context but also when i just the function Wallet.createRandom(), it also gets stoped.
const initWallet = async () => {
console.log( wallet.currAccount )
if ( !wallet.currAccount ) {
try {
const account = ethers.Wallet.createRandom()
const encryptAccount = await account.encrypt( password )
const assets: Assets = {
1: [TokenItems[0]]
}
dispatch({
type: 'create_account',
payload: { name: 'Account 1', wallet: encryptAccount, assets }
})
console.log( wallet.currAccount )
} catch (error) {
console.log( error )
}
}
Does anyone know why this happen?