restoreByMnemonic method
Implementation
@override
Future<bool> restoreByMnemonic(String mnemonic) async {
final coin = TWCoinType.TWCoinTypeSmartChain;
StoredKey storedKey = StoredKey();
final directory = await getApplicationDocumentsDirectory();
HDWallet wallet = HDWallet.createWithMnemonic(mnemonic);
StoredKey.importHDWallet(
wallet.mnemonic(), "BL_WALLET", walletPassword, coin);
storedKey.store("${directory.path}/wallet");
// final address = wallet.getAddressForCoin(coin);
// final derivationPath = "m/44'/60'/0'/0/0";
// final pubKey = wallet.getExtendedPublicKey(
// TWPurpose.TWPurposeBIP44, coin, TWHDVersion.TWHDVersionXPUB);
//
// storedKey.addAccount(address, coin, derivationPath, pubKey);
myWallet = wallet;
return true;
}