aboutsummaryrefslogtreecommitdiffstats
path: root/app/scripts
diff options
context:
space:
mode:
authorKevin Serrano <kevgagser@gmail.com>2016-11-12 07:41:04 +0800
committerKevin Serrano <kevgagser@gmail.com>2016-11-12 07:41:04 +0800
commit20cea5b2f5429cc2574f755fcba0ce5bb12f1a13 (patch)
tree27d182105680d44d6bdc37ce21ece8db35372e12 /app/scripts
parentbfeaae69f2a0c845d8ebfa907a90049f53ba3aea (diff)
downloadtangerine-wallet-browser-20cea5b2f5429cc2574f755fcba0ce5bb12f1a13.tar
tangerine-wallet-browser-20cea5b2f5429cc2574f755fcba0ce5bb12f1a13.tar.gz
tangerine-wallet-browser-20cea5b2f5429cc2574f755fcba0ce5bb12f1a13.tar.bz2
tangerine-wallet-browser-20cea5b2f5429cc2574f755fcba0ce5bb12f1a13.tar.lz
tangerine-wallet-browser-20cea5b2f5429cc2574f755fcba0ce5bb12f1a13.tar.xz
tangerine-wallet-browser-20cea5b2f5429cc2574f755fcba0ce5bb12f1a13.tar.zst
tangerine-wallet-browser-20cea5b2f5429cc2574f755fcba0ce5bb12f1a13.zip
Various keyring changes
- Rearrange the require statements. - Remove unused web3. - Simplify some callbacks and promises. - Clarify certain parameters.
Diffstat (limited to 'app/scripts')
-rw-r--r--app/scripts/keyring-controller.js28
1 files changed, 10 insertions, 18 deletions
diff --git a/app/scripts/keyring-controller.js b/app/scripts/keyring-controller.js
index b74d6cbfc..bb1727d7a 100644
--- a/app/scripts/keyring-controller.js
+++ b/app/scripts/keyring-controller.js
@@ -1,18 +1,18 @@
const async = require('async')
-const EventEmitter = require('events').EventEmitter
-const encryptor = require('./lib/encryptor')
-const messageManager = require('./lib/message-manager')
const ethUtil = require('ethereumjs-util')
const ethBinToOps = require('eth-bin-to-ops')
const EthQuery = require('eth-query')
-const BN = ethUtil.BN
+const bip39 = require('bip39')
const Transaction = require('ethereumjs-tx')
+const EventEmitter = require('events').EventEmitter
+
const createId = require('web3-provider-engine/util/random-id')
+const normalize = require('./lib/sig-util').normalize
+const encryptor = require('./lib/encryptor')
+const messageManager = require('./lib/message-manager')
const autoFaucet = require('./lib/auto-faucet')
-const bip39 = require('bip39')
-
-// TEMPORARY UNTIL FULL DEPRECATION:
const IdStoreMigrator = require('./lib/idStore-migrator')
+const BN = ethUtil.BN
// Keyrings:
const SimpleKeyring = require('./keyrings/simple')
@@ -26,7 +26,6 @@ module.exports = class KeyringController extends EventEmitter {
constructor (opts) {
super()
- this.web3 = opts.web3
this.configManager = opts.configManager
this.ethStore = opts.ethStore
this.encryptor = encryptor
@@ -98,7 +97,7 @@ module.exports = class KeyringController extends EventEmitter {
if (err) return cb(err)
this.addNewKeyring('HD Key Tree', {
mnemonic: seed,
- n: 1,
+ numberOfAccounts: 1,
}, (err) => {
if (err) return cb(err)
const firstKeyring = this.keyrings[0]
@@ -143,9 +142,7 @@ module.exports = class KeyringController extends EventEmitter {
.then(() => {
return this.persistAllKeyrings()
})
- .then(() => {
- cb(null)
- })
+ .then(cb)
.catch((err) => {
cb(err)
})
@@ -153,7 +150,7 @@ module.exports = class KeyringController extends EventEmitter {
createFirstKeyTree (password, cb) {
this.clearKeyrings()
- this.addNewKeyring('HD Key Tree', {n: 1}, (err) => {
+ this.addNewKeyring('HD Key Tree', {numberOfAccounts: 1}, (err) => {
const firstKeyring = this.keyrings[0]
const accounts = firstKeyring.getAccounts()
const firstAccount = accounts[0]
@@ -564,9 +561,4 @@ module.exports = class KeyringController extends EventEmitter {
}
-function normalize (address) {
- if (!address) return
- return ethUtil.addHexPrefix(address.toLowerCase())
-}
-
function noop () {}