This function is used extract the details of account using a secret phrase.
import { ethers } from "ethers";
const standardPath = "m/44'/60'/0'/0";
const activeIndex = 1;
const path = `${standardPath}/${activeIndex}`;
const hdNode = ethers.HDNodeWallet.fromPhrase("YOUR_PHRASE");
const wallet = ethers.HDNodeWallet.fromMnemonic(hdNode.mnemonic, path)
The phrase needs to be passed in order to get the details.
A promise that resolves when trying to extract the data from mnemonic.
{
provider: null,
address: 'YOUR_ADDRESS',
publicKey: 'YOUR_PUBLIC_KEY',
fingerprint: '0xe7b9604b',
parentFingerprint: '0xed91e544',
mnemonic: Mnemonic {
phrase: 'YOUR_MNEMONIC',
password: '',
wordlist: LangEn { locale: 'en' },
entropy: '0x7c61f4b9031c6586b8cc74745487166b'
},
chainCode: '0x61a139b8bb1158f6d480178f227951377f389f',
path: "m/44'/60'/0'/0/1",
index: 1,
depth: 5
}