1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-25 20:02:58 +01:00
metamask-extension/app/scripts/inpage.js
2015-12-18 22:05:16 -08:00

18 lines
529 B
JavaScript

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')