How to use the qtumjs-wallet.generateMnemonic function in qtumjs-wallet

To help you get started, we’ve selected a few qtumjs-wallet 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 swaponline / swap.core / src / swap.auth / qtum.js View on Github external
const login = (_privateKey, app) => {
  SwapApp.required(app)

  const storageKey = `${app.network}:qtum:privateKey`
  const privateKey = _privateKey || app.env.storage.getItem(storageKey)
  let account

  const network = app.isMainNet()
    ? networks.mainnet
    : networks.testnet

  // TODO check format private key
  if (privateKey) {
    account = network.fromWIF(privateKey)
  } else {
    const mnemonic  = generateMnemonic()
    account = network.fromMnemonic(mnemonic)
    app.env.storage.setItem(storageKey, account.toWIF())
    console.log('account', account.address)
  }

  return account
}
github swaponline / swap.react / shared / helpers / qtum.js View on Github external
const createWallet = () => {
  const mnemonic  = generateMnemonic()
  const password  = 'superstrong'

  wallet = network.fromMnemonic(mnemonic, password)

  return _getData()
}

qtumjs-wallet

A toolkit for building qtum light wallets

ISC
Latest version published 3 years ago

Package Health Score

40 / 100
Full package analysis

Similar packages