diff options
integrate metamask-ui with id mgmt
Diffstat (limited to 'app/scripts/lib')
-rw-r--r-- | app/scripts/lib/metamask-provider.js | 23 |
1 files changed, 12 insertions, 11 deletions
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() |