aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkumavis <kumavis@users.noreply.github.com>2016-08-12 11:53:15 +0800
committerGitHub <noreply@github.com>2016-08-12 11:53:15 +0800
commit8943e86470f3a5cada9208615c1ea70cae2a0b85 (patch)
tree0a8511d74baa587af81eec3d3bb6c4f6b1e971f9
parenta5cfa937ef216ae3e0ec687e39bffb1c2bfaed82 (diff)
parent878a01a294c8dbc915ceb7a5f52f0006247fb4b4 (diff)
downloadtangerine-wallet-browser-8943e86470f3a5cada9208615c1ea70cae2a0b85.tar
tangerine-wallet-browser-8943e86470f3a5cada9208615c1ea70cae2a0b85.tar.gz
tangerine-wallet-browser-8943e86470f3a5cada9208615c1ea70cae2a0b85.tar.bz2
tangerine-wallet-browser-8943e86470f3a5cada9208615c1ea70cae2a0b85.tar.lz
tangerine-wallet-browser-8943e86470f3a5cada9208615c1ea70cae2a0b85.tar.xz
tangerine-wallet-browser-8943e86470f3a5cada9208615c1ea70cae2a0b85.tar.zst
tangerine-wallet-browser-8943e86470f3a5cada9208615c1ea70cae2a0b85.zip
Merge branch 'master' into CustomRpcLoadingBug
-rw-r--r--app/scripts/background.js1
-rw-r--r--app/scripts/config.js3
-rw-r--r--app/scripts/lib/idStore.js9
-rw-r--r--app/scripts/metamask-controller.js8
-rw-r--r--ui/app/store.js15
5 files changed, 24 insertions, 12 deletions
diff --git a/app/scripts/background.js b/app/scripts/background.js
index 34c994ab7..e04309e74 100644
--- a/app/scripts/background.js
+++ b/app/scripts/background.js
@@ -13,6 +13,7 @@ const extension = require('./lib/extension')
const STORAGE_KEY = 'metamask-config'
+
const controller = new MetamaskController({
// User confirmation callbacks:
showUnconfirmedMessage,
diff --git a/app/scripts/config.js b/app/scripts/config.js
index 5f6ffd936..7a1d54a3b 100644
--- a/app/scripts/config.js
+++ b/app/scripts/config.js
@@ -3,6 +3,8 @@ const TESTNET_RPC_URL = 'https://morden.infura.io/'
const DEFAULT_RPC_URL = TESTNET_RPC_URL
const CLASSIC_RPC_URL = 'https://mainnet-nf.infura.io/'
+global.METAMASK_DEBUG = false
+
module.exports = {
network: {
default: DEFAULT_RPC_URL,
@@ -11,4 +13,3 @@ module.exports = {
classic: CLASSIC_RPC_URL,
},
}
-
diff --git a/app/scripts/lib/idStore.js b/app/scripts/lib/idStore.js
index c6ac55a03..f63e03ec6 100644
--- a/app/scripts/lib/idStore.js
+++ b/app/scripts/lib/idStore.js
@@ -153,8 +153,9 @@ IdentityStore.prototype.getNetwork = function (err) {
this._currentState.network = 'loading'
return this._didUpdate()
}
-
- console.log('web3.getNetwork returned ' + network)
+ if (global.METAMASK_DEBUG) {
+ console.log('web3.getNetwork returned ' + network)
+ }
this._currentState.network = network
this._didUpdate()
})
@@ -475,7 +476,9 @@ IdentityStore.prototype._restoreFromSeed = function (password, seed, derivedKey)
keyStore.generateNewAddress(derivedKey, 3)
configManager.setWallet(keyStore.serialize())
- console.log('restored from seed. saved to keystore')
+ if (global.METAMASK_DEBUG) {
+ console.log('restored from seed. saved to keystore')
+ }
return keyStore
}
diff --git a/app/scripts/metamask-controller.js b/app/scripts/metamask-controller.js
index e7e96a472..2c141a402 100644
--- a/app/scripts/metamask-controller.js
+++ b/app/scripts/metamask-controller.js
@@ -94,7 +94,9 @@ module.exports = class MetamaskController {
function logger (err, request, response) {
if (err) return console.error(err)
if (!request.isMetamaskInternal) {
- console.log(`RPC (${originDomain}):`, request, '->', response)
+ if (global.METAMASK_DEBUG) {
+ console.log(`RPC (${originDomain}):`, request, '->', response)
+ }
if (response.error) {
console.error('Error in RPC response:\n', response.error)
}
@@ -218,7 +220,9 @@ module.exports = class MetamaskController {
// Log blocks
processBlock (block) {
- console.log(`BLOCK CHANGED: #${block.number.toString('hex')} 0x${block.hash.toString('hex')}`)
+ if (global.METAMASK_DEBUG) {
+ console.log(`BLOCK CHANGED: #${block.number.toString('hex')} 0x${block.hash.toString('hex')}`)
+ }
this.verifyNetwork()
}
diff --git a/ui/app/store.js b/ui/app/store.js
index ab6422e73..8d891bdc9 100644
--- a/ui/app/store.js
+++ b/ui/app/store.js
@@ -1,17 +1,20 @@
const createStore = require('redux').createStore
const applyMiddleware = require('redux').applyMiddleware
const thunkMiddleware = require('redux-thunk')
-const createLogger = require('redux-logger')
const rootReducer = require('./reducers')
+const createLogger = require('redux-logger')
+
+global.METAMASK_DEBUG = false
module.exports = configureStore
-const loggerMiddleware = createLogger()
+const loggerMiddleware = createLogger({
+ predicate: () => global.METAMASK_DEBUG,
+})
+
+const middlewares = [thunkMiddleware, loggerMiddleware]
-const createStoreWithMiddleware = applyMiddleware(
- thunkMiddleware,
- loggerMiddleware
-)(createStore)
+const createStoreWithMiddleware = applyMiddleware(...middlewares)(createStore)
function configureStore (initialState) {
return createStoreWithMiddleware(rootReducer, initialState)