How to use the qtumjs-wallet.networks.testnet 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
import { networks, generateMnemonic } from 'qtumjs-wallet'


const network = process.env.MAINNET ? networks.mainnet : networks.testnet
let wallet


const _getData = () => {
  const publicAddress = wallet.address
  const privateKey    = wallet.toWIF()

  return {
    privateKey,
    address: publicAddress,
  }
}

const createWallet = () => {
  const mnemonic  = generateMnemonic()
  const password  = 'superstrong'
github swaponline / swap.core / src / swap.swaps / QtumSwap.js View on Github external
this.methods = this.abi.reduce((acc, params) => {
      const { name, type } = params

      if (type === 'function') {
        return {
          ...acc,
          [name]: params,
        }
      }

      return acc
    })

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

    const privateKey = this.app.env.storage.storage.getItem(`${this.app.network}:qtum:privateKey`)

    this.wallet = network.fromWIF(privateKey)
  }

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