Merge pull request #1101 from MetaMask/i1085-synchronousnet

Allowed net_version to be called synchronously
feature/default_network_editable
Kevin Serrano 8 years ago committed by GitHub
commit 01e43c789c
  1. 1
      CHANGELOG.md
  2. 5
      app/scripts/lib/inpage-provider.js
  3. 3
      app/scripts/metamask-controller.js

@ -1,6 +1,7 @@
# Changelog # Changelog
## Current Master ## Current Master
- net_version has been made synchronous.
## 3.2.1 2017-2-8 ## 3.2.1 2017-2-8

@ -84,6 +84,11 @@ MetamaskInpageProvider.prototype.send = function (payload) {
result = true result = true
break break
case 'net_version':
let networkVersion = self.publicConfigStore.getState().networkVersion
result = networkVersion
break
// throw not-supported Error // throw not-supported Error
default: default:
var link = 'https://github.com/MetaMask/faq/blob/master/DEVELOPERS.md#dizzy-all-async---think-of-metamask-as-a-light-client' var link = 'https://github.com/MetaMask/faq/blob/master/DEVELOPERS.md#dizzy-all-async---think-of-metamask-as-a-light-client'

@ -178,7 +178,7 @@ module.exports = class MetamaskController extends EventEmitter {
// sync publicConfigStore with transform // sync publicConfigStore with transform
pipe( pipe(
this.store, this.store,
storeTransform(selectPublicState), storeTransform(selectPublicState.bind(this)),
publicConfigStore publicConfigStore
) )
@ -186,6 +186,7 @@ module.exports = class MetamaskController extends EventEmitter {
const result = { selectedAddress: undefined } const result = { selectedAddress: undefined }
try { try {
result.selectedAddress = state.PreferencesController.selectedAddress result.selectedAddress = state.PreferencesController.selectedAddress
result.networkVersion = this.getNetworkState()
} catch (_) {} } catch (_) {}
return result return result
} }

Loading…
Cancel
Save