Add global var for background.

feature/default_network_editable
Kevin Serrano 8 years ago
parent 1e54a1b5e8
commit b1f68ec9cd
  1. 1
      app/scripts/background.js
  2. 2
      app/scripts/config.js
  3. 9
      app/scripts/lib/idStore.js
  4. 8
      app/scripts/metamask-controller.js

@ -13,6 +13,7 @@ const extension = require('./lib/extension')
const STORAGE_KEY = 'metamask-config'
const controller = new MetamaskController({
// User confirmation callbacks:
showUnconfirmedMessage,

@ -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,

@ -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
}

@ -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()
}

Loading…
Cancel
Save