From 7347a66eb0f4d5ab7f7d95e3657179408f4319f9 Mon Sep 17 00:00:00 2001 From: kumavis Date: Fri, 15 Jan 2016 02:03:42 -0800 Subject: integrate metamask-ui with id mgmt --- app/scripts/lib/metamask-provider.js | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) (limited to 'app/scripts/lib') diff --git a/app/scripts/lib/metamask-provider.js b/app/scripts/lib/metamask-provider.js index fea6d1f9f..d7d06d3f1 100644 --- a/app/scripts/lib/metamask-provider.js +++ b/app/scripts/lib/metamask-provider.js @@ -3,7 +3,7 @@ const CacheSubprovider = require('web3-provider-engine/subproviders/cache.js') const StaticSubprovider = require('web3-provider-engine/subproviders/static.js') const FilterSubprovider = require('web3-provider-engine/subproviders/filters.js') const VmSubprovider = require('web3-provider-engine/subproviders/vm.js') -const LightWalletSubprovider = require('web3-provider-engine/subproviders/lightwallet.js') +const HookedWalletSubprovider = require('web3-provider-engine/subproviders/hooked-wallet.js') const RpcSubprovider = require('web3-provider-engine/subproviders/rpc.js') module.exports = metamaskProvider @@ -22,7 +22,7 @@ function metamaskProvider(opts){ eth_hashrate: '0x0', eth_mining: false, eth_syncing: true, - }) + })) // filters engine.addProvider(new FilterSubprovider()) @@ -31,21 +31,22 @@ function metamaskProvider(opts){ engine.addProvider(new VmSubprovider()) // id mgmt - engine.addProvider(new LightWalletSubprovider()) + engine.addProvider(new HookedWalletSubprovider({ + getAccounts: opts.getAccounts, + sendTransaction: opts.sendTransaction, + })) // data source engine.addProvider(new RpcSubprovider({ - rpcUrl: 'https://testrpc.metamask.io/', + rpcUrl: opts.rpcUrl, })) // log new blocks - engine.on('block', function(block){ - // lazy hack - move caching and current block to engine - engine.currentBlock = block - console.log('================================') - console.log('BLOCK CHANGED:', '#'+block.number.toString('hex'), '0x'+block.hash.toString('hex')) - console.log('================================') - }) + // engine.on('block', function(block){ + // console.log('================================') + // console.log('BLOCK CHANGED:', '#'+block.number.toString('hex'), '0x'+block.hash.toString('hex')) + // console.log('================================') + // }) // start polling for blocks engine.start() -- cgit v1.2.3