blob: d45dde593f3e937d7ae4a9fa6f2ec37bfbf7eb79 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
const Web3 = require('web3')
const StreamProvider = require('./lib/stream-provider.js')
const LocalMessageDuplexStream = require('./lib/local-message-stream.js')
// setup plugin communication
var pluginStream = new LocalMessageDuplexStream({
name: 'inpage',
target: 'contentscript',
})
var remoteProvider = new StreamProvider()
remoteProvider.pipe(pluginStream).pipe(remoteProvider)
// create web3
var web3 = new Web3(remoteProvider)
window.web3 = web3
web3.setProvider = function(){}
console.log('Metamask injected web3')
|