AleoAccount.fromMnemonic constructor

AleoAccount.fromMnemonic(
  1. String mnemonic, {
  2. int accountIndex = 0,
})

AleoAccount from mnemonic accountIndex 0 for default account, next account index will be will 1

Implementation

AleoAccount.fromMnemonic(
  String mnemonic, {
  int accountIndex = 0,
}) {
  final m = Mnemonic.fromSentence(mnemonic, Language.english);
  final seedHex = hex.encode(m.seed);
  extendedPrivateKey = seedHex;
  String path = "m/44'/0'/$accountIndex'/0'";
  final keys = deriveAleoPath(path, seedHex);
  privateKey = privateKeyFromSeed(seed: keys.key!);
  viewKey = privateKeyToViewKey(privateKey: privateKey);
  address = privateKeyToAddress(privateKey: privateKey);
  derivePath = path;
}