aboutsummaryrefslogtreecommitdiffstats
path: root/app/scripts
diff options
context:
space:
mode:
authorkumavis <aaron@kumavis.me>2017-09-12 05:21:09 +0800
committerkumavis <aaron@kumavis.me>2017-09-12 05:21:09 +0800
commit41164f61dbba700fbbe1eead4f1b436dabcfc331 (patch)
tree01d543d32ff5b0c3d814adece2cc7dbe489b4837 /app/scripts
parentef3bf810bf14da6651ef849e481eb0253be3c8d1 (diff)
parent96107556dcc57f04aeebfc7d775d5a60a88cb450 (diff)
downloadtangerine-wallet-browser-41164f61dbba700fbbe1eead4f1b436dabcfc331.tar
tangerine-wallet-browser-41164f61dbba700fbbe1eead4f1b436dabcfc331.tar.gz
tangerine-wallet-browser-41164f61dbba700fbbe1eead4f1b436dabcfc331.tar.bz2
tangerine-wallet-browser-41164f61dbba700fbbe1eead4f1b436dabcfc331.tar.lz
tangerine-wallet-browser-41164f61dbba700fbbe1eead4f1b436dabcfc331.tar.xz
tangerine-wallet-browser-41164f61dbba700fbbe1eead4f1b436dabcfc331.tar.zst
tangerine-wallet-browser-41164f61dbba700fbbe1eead4f1b436dabcfc331.zip
Merge branch 'master' of github.com:MetaMask/metamask-extension into filter-leak-fix
Diffstat (limited to 'app/scripts')
-rw-r--r--app/scripts/lib/inpage-provider.js20
1 files changed, 12 insertions, 8 deletions
diff --git a/app/scripts/lib/inpage-provider.js b/app/scripts/lib/inpage-provider.js
index b2515bfb8..da75c4be2 100644
--- a/app/scripts/lib/inpage-provider.js
+++ b/app/scripts/lib/inpage-provider.js
@@ -38,14 +38,22 @@ function MetamaskInpageProvider (connectionStream) {
streamMiddleware.stream,
(err) => logStreamDisconnectWarning('MetaMask RpcProvider', err)
)
+
// handle sendAsync requests via dapp-side rpc engine
- const engine = new RpcEngine()
- engine.push(createIdRemapMiddleware())
- engine.push(streamMiddleware)
+ const rpcEngine = new RpcEngine()
+ rpcEngine.push(createIdRemapMiddleware())
+ rpcEngine.push(streamMiddleware)
+ self.rpcEngine = rpcEngine
+}
- self.sendAsync = engine.handle.bind(engine)
+// handle sendAsync requests via asyncProvider
+// also remap ids inbound and outbound
+MetamaskInpageProvider.prototype.sendAsync = function (payload, cb) {
+ const self = this
+ self.rpcEngine.handle(payload, cb)
}
+
MetamaskInpageProvider.prototype.send = function (payload) {
const self = this
@@ -91,10 +99,6 @@ MetamaskInpageProvider.prototype.send = function (payload) {
}
}
-MetamaskInpageProvider.prototype.sendAsync = function () {
- throw new Error('MetamaskInpageProvider - sendAsync not overwritten')
-}
-
MetamaskInpageProvider.prototype.isConnected = function () {
return true
}