isValidMnemonic static method

bool isValidMnemonic(
  1. Mnemonic mnemonic, [
  2. ElectrumV2MnemonicTypes? mnemonicType
])

Checks if a mnemonic is a valid Electrum V2 mnemonic of the specified type.

mnemonic The mnemonic to check. mnemonicType (Optional) The Electrum V2 mnemonic type to check against. If not provided, any type of Electrum V2 mnemonic will be accepted.

Returns true if the mnemonic is valid for the specified type (or any type), otherwise returns false.

Implementation

static bool isValidMnemonic(Mnemonic mnemonic,
    [ElectrumV2MnemonicTypes? mnemonicType]) {
  if (_isBip39OrV1Mnemonic(mnemonic)) {
    return false;
  }
  return (mnemonicType != null
      ? _isType(mnemonic, mnemonicType)
      : _isAnyType(mnemonic));
}