Open snailAlice opened 7 months ago
Just a guess, but you might need a different path than the Cosmos Hub derivation path. In the second argument, fromMnemonic
has an hdPath
option
{
prefix: "mx",
hdPath: stringToPath("m/1/1/1"), // what does your chain typically use here?
}
The account restored through the mnemonic phrase is inconsistent with the wallet generated by importing it into the keprl wallet. The crossfi chain is used and the address produced by cosmos is consistent. What do I need to do to get the correct address?
import { DirectSecp256k1HdWallet } from "@cosmjs/proto-signing"
const generateKey = async (): Promise => {
console.log(await (await DirectSecp256k1HdWallet.fromMnemonic("material have exile coconut family trick load door soldier feel busy depth glad seed turtle",{prefix: "mx",})).getAccounts())
console.error("Mnemonic with 1st account:", accounts[0].address)
}
generateKey()
run result: mx1ts9mz7p5p8yqwx84t2sucv3h6et2f8gj3s20hu import keprl wallet: mx18hxcz64d0v5msqwqcm9dtfwgzqhwmnzuslc0sr
What do I need to do to get the correct address?