From c2eb3f6524ec783fd842142d3de57e115a184ead Mon Sep 17 00:00:00 2001 From: kumavis Date: Sat, 30 Jan 2016 23:15:38 -0800 Subject: [PATCH] add basic sync support --- app/scripts/inpage.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/app/scripts/inpage.js b/app/scripts/inpage.js index d45dde593..2d872e08e 100644 --- a/app/scripts/inpage.js +++ b/app/scripts/inpage.js @@ -11,8 +11,14 @@ var pluginStream = new LocalMessageDuplexStream({ var remoteProvider = new StreamProvider() remoteProvider.pipe(pluginStream).pipe(remoteProvider) +// handle synchronous methods remotely +var syncProvider = new Web3.providers.HttpProvider('https://rawtestrpc.metamask.io/') +remoteProvider.send = syncProvider.send.bind(syncProvider) + // create web3 var web3 = new Web3(remoteProvider) window.web3 = web3 -web3.setProvider = function(){} -console.log('Metamask injected web3') \ No newline at end of file +web3.setProvider = function(){ + console.log('MetaMask Extension - overrode web3.setProvider') +} +console.log('MetaMask Extension - injected web3') \ No newline at end of file