cosmjs icon indicating copy to clipboard operation
cosmjs copied to clipboard

How to get the osmos address given mnemonic?

Open btfdip opened this issue 3 years ago • 1 comments

btfdip avatar Jan 20 '22 16:01 btfdip

Something like

import { Secp256k1HdWallet } from '@cosmjs/amino';

const offlineSigner = await Secp256k1HdWallet.fromMnemonic(
  'element fiber pioneer artefact harbor wear lawsuit trouble damage dance live fetch',
  { prefix: 'osmo' }
);
const address = (await offlineSigner.getAccounts())[0].address;
console.log('New account generated:', offlineSigner.mnemonic);
console.log('Address:', address);

webmaster128 avatar Jan 20 '22 21:01 webmaster128