aboutsummaryrefslogtreecommitdiffstats
path: root/app/scripts/metamask-controller.js
diff options
context:
space:
mode:
authorkumavis <aaron@kumavis.me>2017-01-25 11:47:00 +0800
committerkumavis <aaron@kumavis.me>2017-01-25 11:47:00 +0800
commit76ce348a04b83693eda0e8a40f9888c1f5fe7ef5 (patch)
treed31aeddd6752f03ca1c65569e4fadf203ca8692f /app/scripts/metamask-controller.js
parenta06ee454045b9087160d3af1c081556662bbd3cb (diff)
downloadtangerine-wallet-browser-76ce348a04b83693eda0e8a40f9888c1f5fe7ef5.tar
tangerine-wallet-browser-76ce348a04b83693eda0e8a40f9888c1f5fe7ef5.tar.gz
tangerine-wallet-browser-76ce348a04b83693eda0e8a40f9888c1f5fe7ef5.tar.bz2
tangerine-wallet-browser-76ce348a04b83693eda0e8a40f9888c1f5fe7ef5.tar.lz
tangerine-wallet-browser-76ce348a04b83693eda0e8a40f9888c1f5fe7ef5.tar.xz
tangerine-wallet-browser-76ce348a04b83693eda0e8a40f9888c1f5fe7ef5.tar.zst
tangerine-wallet-browser-76ce348a04b83693eda0e8a40f9888c1f5fe7ef5.zip
obs-store - use published module
Diffstat (limited to 'app/scripts/metamask-controller.js')
-rw-r--r--app/scripts/metamask-controller.js29
1 files changed, 17 insertions, 12 deletions
diff --git a/app/scripts/metamask-controller.js b/app/scripts/metamask-controller.js
index d3077817d..8f157a45e 100644
--- a/app/scripts/metamask-controller.js
+++ b/app/scripts/metamask-controller.js
@@ -1,6 +1,9 @@
const EventEmitter = require('events')
const extend = require('xtend')
const promiseToCallback = require('promise-to-callback')
+const pipe = require('pump')
+const ObservableStore = require('obs-store')
+const storeTransform = require('obs-store/lib/transform')
const EthStore = require('./lib/eth-store')
const MetaMaskProvider = require('web3-provider-engine/zero.js')
const KeyringController = require('./keyring-controller')
@@ -13,9 +16,6 @@ const extension = require('./lib/extension')
const autoFaucet = require('./lib/auto-faucet')
const nodeify = require('./lib/nodeify')
const IdStoreMigrator = require('./lib/idStore-migrator')
-const ObservableStore = require('./lib/observable/')
-const HostStore = require('./lib/observable/host')
-const synchronizeStore = require('./lib/observable/util/sync')
const accountImporter = require('./account-import-strategies')
const version = require('../manifest.json').version
@@ -258,18 +258,21 @@ module.exports = class MetamaskController extends EventEmitter {
initPublicConfigStore () {
// get init state
- var initPublicState = this.store.get()
- var publicConfigStore = new HostStore(initPublicState, { readOnly: true })
+ const publicConfigStore = new ObservableStore()
// sync publicConfigStore with transform
- synchronizeStore(this.store, publicConfigStore, selectPublicState)
+ pipe(
+ this.store,
+ storeTransform(selectPublicState),
+ publicConfigStore
+ )
function selectPublicState(state) {
- let result = { selectedAccount: undefined }
+ const result = { selectedAccount: undefined }
try {
result.selectedAccount = state.config.selectedAccount
- } catch (err) {
- console.warn('Error in "selectPublicState": ' + err.message)
+ } catch (_) {
+ // thats fine, im sure it will be there next time...
}
return result
}
@@ -314,9 +317,11 @@ module.exports = class MetamaskController extends EventEmitter {
this.opts.showUnconfirmedMessage(msgParams, msgId)
}
- setupPublicConfig (stream) {
- var storeStream = this.publicConfigStore.createStream()
- stream.pipe(storeStream).pipe(stream)
+ setupPublicConfig (outStream) {
+ pipe(
+ this.publicConfigStore,
+ outStream
+ )
}
// Log blocks