|
|
@ -1,4 +1,4 @@ |
|
|
|
const pipe = require('pump') |
|
|
|
const pump = require('pump') |
|
|
|
const RpcEngine = require('json-rpc-engine') |
|
|
|
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') |
|
|
@ -12,7 +12,7 @@ function MetamaskInpageProvider (connectionStream) { |
|
|
|
|
|
|
|
|
|
|
|
// setup connectionStream multiplexing
|
|
|
|
// setup connectionStream multiplexing
|
|
|
|
var multiStream = self.multiStream = ObjectMultiplex() |
|
|
|
var multiStream = self.multiStream = ObjectMultiplex() |
|
|
|
pipe( |
|
|
|
pump( |
|
|
|
connectionStream, |
|
|
|
connectionStream, |
|
|
|
multiStream, |
|
|
|
multiStream, |
|
|
|
connectionStream, |
|
|
|
connectionStream, |
|
|
@ -21,7 +21,7 @@ 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' }) |
|
|
|
pipe( |
|
|
|
pump( |
|
|
|
multiStream.createStream('publicConfig'), |
|
|
|
multiStream.createStream('publicConfig'), |
|
|
|
self.publicConfigStore, |
|
|
|
self.publicConfigStore, |
|
|
|
(err) => logStreamDisconnectWarning('MetaMask PublicConfigStore', err) |
|
|
|
(err) => logStreamDisconnectWarning('MetaMask PublicConfigStore', err) |
|
|
@ -32,7 +32,7 @@ function MetamaskInpageProvider (connectionStream) { |
|
|
|
|
|
|
|
|
|
|
|
// connect to async provider
|
|
|
|
// connect to async provider
|
|
|
|
const streamMiddleware = createStreamMiddleware() |
|
|
|
const streamMiddleware = createStreamMiddleware() |
|
|
|
pipe( |
|
|
|
pump( |
|
|
|
streamMiddleware.stream, |
|
|
|
streamMiddleware.stream, |
|
|
|
multiStream.createStream('provider'), |
|
|
|
multiStream.createStream('provider'), |
|
|
|
streamMiddleware.stream, |
|
|
|
streamMiddleware.stream, |
|
|
|