Closed puneet2019 closed 3 years ago
Are you using this passphrase? It is not supported here because I never saw it being used in the wild. It would be quite some pain to design an API for that because the method already has two optional arguments.
yes, I was using cosmosjs of cosmostaion, they give this option and I am thinking of migrating to cosmjs because I am already using stargate for offline signer. Will reduce an extra dependency.
Alright, let's see how this can be done.
In the meantime what you can do is using thr non-HD wallet DirectSecp256k1Wallet
async function myHelper(/* ... , */password: string): Promise<DirectSecp256k1Wallet> {
const mnemonicChecked = new EnglishMnemonic(mnemonic);
const seed = await Bip39.mnemonicToSeed(mnemonicChecked, password);
const { privkey } = Slip10.derivePath(Slip10Curve.Secp256k1, seed, hdPath);
return DirectSecp256k1Wallet.fromKey(privkey, prefix);
}
Yes, this works, Thank you.
@willclarktech What do you think about changing DirectSecp256k1HdWallet.fromMnemonic
to only take the mnemonic as a positional argument and the test goes into and optional options
object (path, prefix, password)? I would like to avoid an growing list of positional optional arguments.
@webmaster128 I like that. Actually there are probably a few other places which could benefit from this kind of shuffle.
DirectSecp256k1HdWallet.fromMnemonic should take a passphrase parameter as well, it is used in creating bip39.mnemonicToSeed.