mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-22 01:47:00 +01:00
add basic sync support
This commit is contained in:
parent
2aa38ac4b4
commit
c2eb3f6524
@ -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')
|
||||
web3.setProvider = function(){
|
||||
console.log('MetaMask Extension - overrode web3.setProvider')
|
||||
}
|
||||
console.log('MetaMask Extension - injected web3')
|
Loading…
Reference in New Issue
Block a user