mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 01:39:44 +01:00
web3-provider - add nonce tracker
This commit is contained in:
parent
bdf262fb18
commit
4b8be94f51
@ -4,7 +4,6 @@ const extend = require('xtend')
|
||||
const EthStore = require('eth-store')
|
||||
const PortStream = require('./lib/port-stream.js')
|
||||
const MetaMaskProvider = require('./lib/metamask-provider')
|
||||
// const IdentityManager = require('./lib/idmgmt')
|
||||
const IdentityStore = require('./lib/idStore')
|
||||
|
||||
console.log('ready to roll')
|
||||
@ -41,7 +40,8 @@ var zeroClient = MetaMaskProvider({
|
||||
var result = selectedAddress ? [selectedAddress] : []
|
||||
cb(null, result)
|
||||
},
|
||||
signTransaction: idStore.addUnconfirmedTransaction.bind(idStore),
|
||||
approveTx: idStore.addUnconfirmedTransaction.bind(idStore),
|
||||
signTransaction: idStore.signTransaction.bind(idStore),
|
||||
})
|
||||
var ethStore = new EthStore(zeroClient)
|
||||
idStore.setStore(ethStore)
|
||||
|
@ -1,4 +1,5 @@
|
||||
const ProviderEngine = require('web3-provider-engine')
|
||||
const NonceTrackerSubprovider = require('web3-provider-engine/subproviders/nonce-tracker.js')
|
||||
const CacheSubprovider = require('web3-provider-engine/subproviders/cache.js')
|
||||
const FixtureSubprovider = require('web3-provider-engine/subproviders/fixture.js')
|
||||
const FilterSubprovider = require('web3-provider-engine/subproviders/filters.js')
|
||||
@ -12,6 +13,9 @@ function metamaskProvider(opts){
|
||||
|
||||
var engine = new ProviderEngine()
|
||||
|
||||
// nonce tracker
|
||||
engine.addProvider(new NonceTrackerSubprovider())
|
||||
|
||||
// cache layer
|
||||
engine.addProvider(new CacheSubprovider())
|
||||
|
||||
@ -33,6 +37,7 @@ function metamaskProvider(opts){
|
||||
// id mgmt
|
||||
engine.addProvider(new HookedWalletSubprovider({
|
||||
getAccounts: opts.getAccounts,
|
||||
approveTx: opts.approveTx,
|
||||
signTransaction: opts.signTransaction,
|
||||
}))
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user