add support for 12 seed phrase
Imdavyking opened this issue · 1 comments
Imdavyking commented
Please can you add support for 12 seed phrase, i have tried it but to no avail, https://github.com/abmera/bip39toalgo
Imdavyking commented
in flutter for 12 seed phrase
import 'dart:typed_data';
import 'package:bip39/bip39.dart' as bip39;
import 'package:bip32/bip32.dart' as bip32;
class SeedPhraseRoot {
Uint8List seed;
bip32.BIP32 root;
SeedPhraseRoot(Uint8List _seed, bip32.BIP32 _root) {
seed = _seed;
root = _root;
}
}
SeedPhraseRoot seedFromMnemonic(seedPhrase) {
Uint8List seed = bip39.mnemonicToSeed(seedPhrase);
bip32.BIP32 root = bip32.BIP32.fromSeed(seed);
return SeedPhraseRoot(seed, root);
}
Future calculateAlgorandKey(Map config) async {
SeedPhraseRoot seedRoot_ = seedFromMnemonic(seedPhrase);
KeyData masterKey =
await ED25519_HD_KEY.derivePath("m/44'/283'/0'/0'/0'", seedRoot_.seed);
final account =
await algorandClient.loadAccountFromPrivateKey(HEX.encode(masterKey.key));
if (config['getAlgorandKeys'] != null && config['getAlgorandKeys'] == true) {
return account;
}
return {
'address': account.publicAddress,
};
}