fix linting issues; missing requires and params

pull/5370/head
Iuri Matias 5 years ago
parent d7ac146fa4
commit 0062810cb9
  1. 4
      src/blockchain/blockchain.js
  2. 3
      src/blockchain/providers/injected.js
  3. 5
      src/blockchain/providers/node.js
  4. 7
      src/blockchain/providers/vm.js

@ -11,8 +11,6 @@ const Personal = require('web3-eth-personal')
const Web3 = require('web3')
const async = require('async')
const { BN, privateToAddress, isValidPrivate, stripHexPrefix } = require('ethereumjs-util')
const crypto = require('crypto')
const { EventEmitter } = require('events')
const { resultToRemixTx } = require('./txResultHelper')
@ -375,7 +373,7 @@ class Blockchain {
* Create a VM Account
* @param {{privateKey: string, balance: string}} newAccount The new account to create
*/
createVMAccount(newAccount) {
createVMAccount (newAccount) {
if (this.executionContext.getProvider() !== 'vm') {
throw new Error('plugin API does not allow creating a new account through web3 connection. Only vm mode is allowed')
}

@ -1,4 +1,5 @@
const Web3 = require('web3')
const { stripHexPrefix } = require('ethereumjs-util')
class InjectedProvider {
@ -10,7 +11,7 @@ class InjectedProvider {
return this.executionContext.web3().eth.getAccounts(cb)
}
newAccount(passwordPromptCb, cb) {
newAccount (passwordPromptCb, cb) {
passwordPromptCb((passphrase) => {
this.executionContext.web3().personal.newAccount(passphrase, cb)
})

@ -1,4 +1,5 @@
const Web3 = require('web3')
const { stripHexPrefix } = require('ethereumjs-util')
class NodeProvider {
@ -14,7 +15,7 @@ class NodeProvider {
return this.executionContext.web3().eth.getAccounts(cb)
}
newAccount(passwordPromptCb, cb) {
newAccount (passwordPromptCb, cb) {
if (!this.config.get('settings/personal-mode')) {
return cb('Not running in personal mode')
}
@ -26,7 +27,7 @@ class NodeProvider {
resetEnvironment () {
}
getBalanceInEther(address, cb) {
getBalanceInEther (address, cb) {
address = stripHexPrefix(address)
this.executionContext.web3().eth.getBalance(address, (err, res) => {
if (err) {

@ -1,5 +1,6 @@
const Web3 = require('web3')
const { privateToAddress, toChecksumAddress } = require('ethereumjs-util')
const { BN, privateToAddress, toChecksumAddress, isValidPrivate, stripHexPrefix } = require('ethereumjs-util')
const crypto = require('crypto')
class VMProvider {
@ -43,14 +44,14 @@ class VMProvider {
this.accounts[toChecksumAddress('0x' + address.toString('hex'))] = { privateKey, nonce: 0 }
}
createVMAccount (passwordPromptCb, cb) {
createVMAccount (newAccount) {
const { privateKey, balance } = newAccount
this._addAccount(privateKey, balance)
const privKey = Buffer.from(privateKey, 'hex')
return '0x' + privateToAddress(privKey).toString('hex')
}
newAccount(_passwordPromptCb, cb) {
newAccount (_passwordPromptCb, cb) {
let privateKey
do {
privateKey = crypto.randomBytes(32)

Loading…
Cancel
Save