Allowed net_version to be called synchronously

feature/default_network_editable
Kevin Serrano 8 years ago
parent ce57957aa0
commit 4033b620bd
No known key found for this signature in database
GPG Key ID: 7CC862A58D2889B4
  1. 2
      CHANGELOG.md
  2. 5
      app/scripts/lib/inpage-provider.js
  3. 3
      app/scripts/metamask-controller.js

@ -2,6 +2,8 @@
## Current Master
- net_version has been made synchronous.
## 3.2.0 2017-1-24
- Add ability to import accounts in JSON file format (used by Mist, Geth, MyEtherWallet, and more!)

@ -84,6 +84,11 @@ MetamaskInpageProvider.prototype.send = function (payload) {
result = true
break
case 'net_version':
let networkVersion = self.publicConfigStore.getState().networkVersion
result = networkVersion
break
// throw not-supported Error
default:
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
pipe(
this.store,
storeTransform(selectPublicState),
storeTransform(selectPublicState.bind(this)),
publicConfigStore
)
@ -186,6 +186,7 @@ module.exports = class MetamaskController extends EventEmitter {
const result = { selectedAddress: undefined }
try {
result.selectedAddress = state.PreferencesController.selectedAddress
result.networkVersion = this.getNetworkState()
} catch (_) {}
return result
}

Loading…
Cancel
Save