aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkumavis <kumavis@users.noreply.github.com>2017-11-30 04:31:52 +0800
committerGitHub <noreply@github.com>2017-11-30 04:31:52 +0800
commit23a5ea9321e4046338323e9df9e64d230d057df1 (patch)
treed39040d64de7b02e57096a2aa32e3d9b619c09af
parent4d6bae774a22487f9861225e6fc00a73829a51ee (diff)
parent327651e7fbed9fab2e243412bbf5437c97e1caa4 (diff)
downloadtangerine-wallet-browser-23a5ea9321e4046338323e9df9e64d230d057df1.tar
tangerine-wallet-browser-23a5ea9321e4046338323e9df9e64d230d057df1.tar.gz
tangerine-wallet-browser-23a5ea9321e4046338323e9df9e64d230d057df1.tar.bz2
tangerine-wallet-browser-23a5ea9321e4046338323e9df9e64d230d057df1.tar.lz
tangerine-wallet-browser-23a5ea9321e4046338323e9df9e64d230d057df1.tar.xz
tangerine-wallet-browser-23a5ea9321e4046338323e9df9e64d230d057df1.tar.zst
tangerine-wallet-browser-23a5ea9321e4046338323e9df9e64d230d057df1.zip
Merge pull request #2627 from MetaMask/reload-fix
Fix dapp reload via obs-store@3
-rw-r--r--app/scripts/background.js9
-rw-r--r--app/scripts/lib/inpage-provider.js4
-rw-r--r--app/scripts/metamask-controller.js3
-rw-r--r--package.json2
4 files changed, 11 insertions, 7 deletions
diff --git a/app/scripts/background.js b/app/scripts/background.js
index 3e560d302..da022c490 100644
--- a/app/scripts/background.js
+++ b/app/scripts/background.js
@@ -1,10 +1,11 @@
const urlUtil = require('url')
const endOfStream = require('end-of-stream')
-const pipe = require('pump')
+const pump = require('pump')
const log = require('loglevel')
const extension = require('extensionizer')
const LocalStorageStore = require('obs-store/lib/localStorage')
const storeTransform = require('obs-store/lib/transform')
+const asStream = require('obs-store/lib/asStream')
const ExtensionPlatform = require('./platforms/extension')
const Migrator = require('./lib/migrator/')
const migrations = require('./migrations/')
@@ -72,10 +73,10 @@ function setupController (initState) {
global.metamaskController = controller
// setup state persistence
- pipe(
- controller.store,
+ pump(
+ asStream(controller.store),
storeTransform(versionifyData),
- diskStore
+ asStream(diskStore)
)
function versionifyData (state) {
diff --git a/app/scripts/lib/inpage-provider.js b/app/scripts/lib/inpage-provider.js
index da75c4be2..99cc5d2cf 100644
--- a/app/scripts/lib/inpage-provider.js
+++ b/app/scripts/lib/inpage-provider.js
@@ -3,6 +3,7 @@ const RpcEngine = require('json-rpc-engine')
const createIdRemapMiddleware = require('json-rpc-engine/src/idRemapMiddleware')
const createStreamMiddleware = require('json-rpc-middleware-stream')
const LocalStorageStore = require('obs-store')
+const asStream = require('obs-store/lib/asStream')
const ObjectMultiplex = require('obj-multiplex')
module.exports = MetamaskInpageProvider
@@ -21,9 +22,10 @@ function MetamaskInpageProvider (connectionStream) {
// subscribe to metamask public config (one-way)
self.publicConfigStore = new LocalStorageStore({ storageKey: 'MetaMask-Config' })
+
pump(
mux.createStream('publicConfig'),
- self.publicConfigStore,
+ asStream(self.publicConfigStore),
(err) => logStreamDisconnectWarning('MetaMask PublicConfigStore', err)
)
diff --git a/app/scripts/metamask-controller.js b/app/scripts/metamask-controller.js
index a4c77e468..f9b7b4182 100644
--- a/app/scripts/metamask-controller.js
+++ b/app/scripts/metamask-controller.js
@@ -3,6 +3,7 @@ const extend = require('xtend')
const pump = require('pump')
const Dnode = require('dnode')
const ObservableStore = require('obs-store')
+const asStream = require('obs-store/lib/asStream')
const AccountTracker = require('./lib/account-tracker')
const EthQuery = require('eth-query')
const RpcEngine = require('json-rpc-engine')
@@ -456,7 +457,7 @@ module.exports = class MetamaskController extends EventEmitter {
setupPublicConfig (outStream) {
pump(
- this.publicConfigStore,
+ asStream(this.publicConfigStore),
outStream,
(err) => {
if (err) log.error(err)
diff --git a/package.json b/package.json
index 941707de1..02476f01e 100644
--- a/package.json
+++ b/package.json
@@ -115,7 +115,7 @@
"multiplex": "^6.7.0",
"number-to-bn": "^1.7.0",
"obj-multiplex": "^1.0.0",
- "obs-store": "^2.3.1",
+ "obs-store": "^3.0.0",
"once": "^1.3.3",
"ping-pong-stream": "^1.0.0",
"pojo-migrator": "^2.1.0",