MnemonicWallet resolveBech32Address returns incorrect address
Closed this issue · 1 comments
przmyst commented
resolveBech32Address returns valid, but incorrect address.
Returned: terra11ekrj3gn8ae9rcgfg23we3e3j5u6d5eh2hw7tkk
Expected: terra1hc5z28ew02x3m3r5fcq66qgp2w9ydwn8cft9cv
import { MnemonicWallet } from "cosmes/wallet";
import { MsgInstantiateContract } from "cosmes/client";
async function main() {
const wallet = new MnemonicWallet({
mnemonic: "address finger arm glide plastic current garment universe people secret mask snack duck what spend congress curious hip wall ensure feel more traffic size",
bech32Prefix: "terra",
chainId: "columbus-5",
rpc: "https://terra-classic-lcd.publicnode.com",
gasPrice: {
amount: "50",
denom: "uluna",
},
})
const msg = new MsgInstantiateContract(
wallet.address,
wallet.address,
'6036',
{
"name": "Test Token",
"symbol": "TEST",
"decimals": 6,
"initial_balances": [
{
"address": wallet.address,
"amount": "777777777777777"
}
]
},
undefined,
'My Label'
)
const tx = {
msgs: [msg],
memo: 'Instantiate Contract via Cosmes'
}
//TODO wallet.address is incorrect given the mnemonic above
console.log(wallet.address)
const fee = await wallet.estimateFee(tx);
console.log("Tx fee:", fee);
const txHash = await wallet.broadcastTx(tx, fee);
console.log("Tx hash:", txHash);
const { txResponse } = await wallet.pollTx(txHash);
console.log("Tx response:", txResponse);
}
main();
przmyst commented
Resolved by specifying coinType as 330.
const wallet = new MnemonicWallet({
mnemonic: "address finger arm glide plastic current garment universe people secret mask snack duck what spend congress curious hip wall ensure feel more traffic size",
bech32Prefix: "terra",
chainId: "columbus-5",
rpc: "https://terra-classic-lcd.publicnode.com",
gasPrice: {
amount: "50",
denom: "uluna",
},
coinType: 330
})