mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-26 12:29:06 +01:00
inpage - add idRemapMiddleware
This commit is contained in:
parent
cc56d0d2f6
commit
440a42bbc3
@ -1,5 +1,6 @@
|
|||||||
const pipe = require('pump')
|
const pipe = require('pump')
|
||||||
const RpcEngine = require('json-rpc-engine')
|
const RpcEngine = require('json-rpc-engine')
|
||||||
|
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 ObjectMultiplex = require('./obj-multiplex')
|
const ObjectMultiplex = require('./obj-multiplex')
|
||||||
@ -27,7 +28,7 @@ function MetamaskInpageProvider (connectionStream) {
|
|||||||
)
|
)
|
||||||
|
|
||||||
// ignore phishing warning message (handled elsewhere)
|
// ignore phishing warning message (handled elsewhere)
|
||||||
multiStream.ignoreStream('phishing')
|
multiStream.ignoreStream('phishing')
|
||||||
|
|
||||||
// connect to async provider
|
// connect to async provider
|
||||||
const streamMiddleware = createStreamMiddleware()
|
const streamMiddleware = createStreamMiddleware()
|
||||||
@ -41,6 +42,7 @@ function MetamaskInpageProvider (connectionStream) {
|
|||||||
|
|
||||||
// handle sendAsync requests via dapp-side rpc engine
|
// handle sendAsync requests via dapp-side rpc engine
|
||||||
const engine = new RpcEngine()
|
const engine = new RpcEngine()
|
||||||
|
engine.push(createIdRemapMiddleware())
|
||||||
engine.push(streamMiddleware)
|
engine.push(streamMiddleware)
|
||||||
|
|
||||||
self.sendAsync = engine.handle.bind(engine)
|
self.sendAsync = engine.handle.bind(engine)
|
||||||
|
@ -93,6 +93,7 @@
|
|||||||
"iframe-stream": "^3.0.0",
|
"iframe-stream": "^3.0.0",
|
||||||
"inject-css": "^0.1.1",
|
"inject-css": "^0.1.1",
|
||||||
"jazzicon": "^1.2.0",
|
"jazzicon": "^1.2.0",
|
||||||
|
"json-rpc-engine": "^3.1.0",
|
||||||
"json-rpc-middleware-stream": "^1.0.0",
|
"json-rpc-middleware-stream": "^1.0.0",
|
||||||
"loglevel": "^1.4.1",
|
"loglevel": "^1.4.1",
|
||||||
"metamask-logo": "^2.1.2",
|
"metamask-logo": "^2.1.2",
|
||||||
|
Loading…
Reference in New Issue
Block a user