fromMnemonic static method
Creates and initializes the account
th SolanaWallet and the
change
th account for the given bip39 mnemonic
string of
12 words.
Omitting account
or change
means they will be null
with the following rules of the meaning of null
in this context.
If either account
or change
is null
, and the other
is not, then it will be taken to be zero.
If account
and change
are both null
, then we derive
the address that would be returned by using
solana-keygen pubkey prompt://
and passing the mnemonic
seed phrase
Implementation
static Future<Ed25519HDKeyPair> fromMnemonic(
String mnemonic, {
int? account,
int? change,
}) {
final List<int> seed = bip39.mnemonicToSeed(mnemonic);
return Ed25519HDKeyPair.fromSeedWithHdPath(
seed: seed,
hdPath: getHDPath(account, change),
);
}