How to use the bip39.wordlists.EN function in bip39

To help you get started, we’ve selected a few bip39 examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Emurgo / yoroi-mobile / src / utils / validators.js View on Github external
if (!value) {
    return {amountIsRequired: true}
  }

  try {
    parseAdaDecimal(value)
    return {}
  } catch (e) {
    if (e instanceof InvalidAdaAmount) {
      return {invalidAmount: e.errorCode}
    }
    throw e
  }
}

wordlists.EN.forEach((word) => {
  assert.assert(
    word === word.toLowerCase(),
    'we expect wordlist to contain only lowercase words',
  )
})

const MNEMONIC_LENGTH = 15

export const cleanMnemonic = (mnemonic: string) => {
  // get rid of common punctuation
  mnemonic = mnemonic.replace(/[.,?]/g, ' ')
  // normalize whitespace
  mnemonic = mnemonic.replace(/\s+/g, ' ')
  // dictionary does not contain uppercase characters
  mnemonic = mnemonic.toLowerCase()
  // remove leading/trailing whitespace
github jolocom / smartwallet-app / src / ui / recovery / container / inputSeedPhrase.tsx View on Github external
private handleInputChange = (text: string): void => {
    let matches = [] as string[]
    if (text.length >= 2) {
      matches = wordlists.EN.filter((word: string): boolean =>
        word.startsWith(text.trim()),
      )
    }

    this.setState({
      inputValue: text,
      suggestions: matches.slice(0, 10),
    })
  }
github Emurgo / yoroi-mobile / src / utils / validators.js View on Github external
  const isUnknown = (word) => !wordlists.EN.includes(word)