SuiAccount.fromMnemonics constructor

SuiAccount.fromMnemonics(
  1. String mnemonics,
  2. SignatureScheme scheme, {
  3. int accountIndex = 0,
  4. int addressIndex = 0,
  5. int changeIndex = 0,
})

Implementation

factory SuiAccount.fromMnemonics(String mnemonics, SignatureScheme scheme,
    {int accountIndex = 0, int addressIndex = 0, int changeIndex = 0}) {
  SuiAccount account;
  switch (scheme) {
    case SignatureScheme.Secp256k1:
      account = SuiAccount(Secp256k1Keypair.fromMnemonics(
        mnemonics,
        accountIndex: accountIndex,
        addressIndex: addressIndex,
        changeIndex: changeIndex,
      ));
      break;
    case SignatureScheme.Secp256r1:
      account = SuiAccount(Secp256r1Keypair.fromMnemonics(
        mnemonics,
        accountIndex: accountIndex,
        addressIndex: addressIndex,
        changeIndex: changeIndex,
      ));
      break;
    case SignatureScheme.Ed25519:
      account = SuiAccount(Ed25519Keypair.fromMnemonics(
        mnemonics,
        accountIndex: accountIndex,
        addressIndex: addressIndex,
        changeIndex: changeIndex,
      ));
      break;
    default:
      throw ArgumentError('Undefined SignatureScheme $scheme');
  }
  return account;
}