mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-22 09:57:02 +01:00
deps - obs-store@3 + migrate stream plumbing
This commit is contained in:
parent
e71115735c
commit
f64bc3c01a
@ -1,10 +1,11 @@
|
|||||||
const urlUtil = require('url')
|
const urlUtil = require('url')
|
||||||
const endOfStream = require('end-of-stream')
|
const endOfStream = require('end-of-stream')
|
||||||
const pipe = require('pump')
|
const pump = require('pump')
|
||||||
const log = require('loglevel')
|
const log = require('loglevel')
|
||||||
const extension = require('extensionizer')
|
const extension = require('extensionizer')
|
||||||
const LocalStorageStore = require('obs-store/lib/localStorage')
|
const LocalStorageStore = require('obs-store/lib/localStorage')
|
||||||
const storeTransform = require('obs-store/lib/transform')
|
const storeTransform = require('obs-store/lib/transform')
|
||||||
|
const asStream = require('obs-store/lib/asStream')
|
||||||
const ExtensionPlatform = require('./platforms/extension')
|
const ExtensionPlatform = require('./platforms/extension')
|
||||||
const Migrator = require('./lib/migrator/')
|
const Migrator = require('./lib/migrator/')
|
||||||
const migrations = require('./migrations/')
|
const migrations = require('./migrations/')
|
||||||
@ -72,10 +73,10 @@ function setupController (initState) {
|
|||||||
global.metamaskController = controller
|
global.metamaskController = controller
|
||||||
|
|
||||||
// setup state persistence
|
// setup state persistence
|
||||||
pipe(
|
pump(
|
||||||
controller.store,
|
asStream(controller.store),
|
||||||
storeTransform(versionifyData),
|
storeTransform(versionifyData),
|
||||||
diskStore
|
asStream(diskStore)
|
||||||
)
|
)
|
||||||
|
|
||||||
function versionifyData (state) {
|
function versionifyData (state) {
|
||||||
|
@ -3,6 +3,7 @@ const RpcEngine = require('json-rpc-engine')
|
|||||||
const createIdRemapMiddleware = require('json-rpc-engine/src/idRemapMiddleware')
|
const createIdRemapMiddleware = require('json-rpc-engine/src/idRemapMiddleware')
|
||||||
const createStreamMiddleware = require('json-rpc-middleware-stream')
|
const createStreamMiddleware = require('json-rpc-middleware-stream')
|
||||||
const LocalStorageStore = require('obs-store')
|
const LocalStorageStore = require('obs-store')
|
||||||
|
const asStream = require('obs-store/lib/asStream')
|
||||||
const ObjectMultiplex = require('obj-multiplex')
|
const ObjectMultiplex = require('obj-multiplex')
|
||||||
|
|
||||||
module.exports = MetamaskInpageProvider
|
module.exports = MetamaskInpageProvider
|
||||||
@ -21,9 +22,10 @@ function MetamaskInpageProvider (connectionStream) {
|
|||||||
|
|
||||||
// subscribe to metamask public config (one-way)
|
// subscribe to metamask public config (one-way)
|
||||||
self.publicConfigStore = new LocalStorageStore({ storageKey: 'MetaMask-Config' })
|
self.publicConfigStore = new LocalStorageStore({ storageKey: 'MetaMask-Config' })
|
||||||
|
|
||||||
pump(
|
pump(
|
||||||
mux.createStream('publicConfig'),
|
mux.createStream('publicConfig'),
|
||||||
self.publicConfigStore,
|
asStream(self.publicConfigStore),
|
||||||
(err) => logStreamDisconnectWarning('MetaMask PublicConfigStore', err)
|
(err) => logStreamDisconnectWarning('MetaMask PublicConfigStore', err)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -3,6 +3,7 @@ const extend = require('xtend')
|
|||||||
const pump = require('pump')
|
const pump = require('pump')
|
||||||
const Dnode = require('dnode')
|
const Dnode = require('dnode')
|
||||||
const ObservableStore = require('obs-store')
|
const ObservableStore = require('obs-store')
|
||||||
|
const asStream = require('obs-store/lib/asStream')
|
||||||
const AccountTracker = require('./lib/account-tracker')
|
const AccountTracker = require('./lib/account-tracker')
|
||||||
const EthQuery = require('eth-query')
|
const EthQuery = require('eth-query')
|
||||||
const RpcEngine = require('json-rpc-engine')
|
const RpcEngine = require('json-rpc-engine')
|
||||||
@ -456,7 +457,7 @@ module.exports = class MetamaskController extends EventEmitter {
|
|||||||
|
|
||||||
setupPublicConfig (outStream) {
|
setupPublicConfig (outStream) {
|
||||||
pump(
|
pump(
|
||||||
this.publicConfigStore,
|
asStream(this.publicConfigStore),
|
||||||
outStream,
|
outStream,
|
||||||
(err) => {
|
(err) => {
|
||||||
if (err) log.error(err)
|
if (err) log.error(err)
|
||||||
|
@ -115,7 +115,7 @@
|
|||||||
"multiplex": "^6.7.0",
|
"multiplex": "^6.7.0",
|
||||||
"number-to-bn": "^1.7.0",
|
"number-to-bn": "^1.7.0",
|
||||||
"obj-multiplex": "^1.0.0",
|
"obj-multiplex": "^1.0.0",
|
||||||
"obs-store": "^2.3.1",
|
"obs-store": "^3.0.0",
|
||||||
"once": "^1.3.3",
|
"once": "^1.3.3",
|
||||||
"ping-pong-stream": "^1.0.0",
|
"ping-pong-stream": "^1.0.0",
|
||||||
"pojo-migrator": "^2.1.0",
|
"pojo-migrator": "^2.1.0",
|
||||||
|
Loading…
Reference in New Issue
Block a user