2016-05-26 02:27:49 +02:00
|
|
|
const urlUtil = require('url')
|
2016-01-15 11:03:42 +01:00
|
|
|
const Dnode = require('dnode')
|
2016-02-11 02:44:46 +01:00
|
|
|
const eos = require('end-of-stream')
|
|
|
|
const extend = require('xtend')
|
|
|
|
const EthStore = require('eth-store')
|
2016-04-26 20:36:05 +02:00
|
|
|
const MetaMaskProvider = require('web3-provider-engine/zero.js')
|
2016-05-23 03:02:27 +02:00
|
|
|
const PortStream = require('./lib/port-stream.js')
|
2016-02-11 02:44:46 +01:00
|
|
|
const IdentityStore = require('./lib/idStore')
|
2016-05-24 23:59:33 +02:00
|
|
|
const createUnlockRequestNotification = require('./lib/notifications.js').createUnlockRequestNotification
|
2016-04-28 23:16:24 +02:00
|
|
|
const createTxNotification = require('./lib/notifications.js').createTxNotification
|
|
|
|
const createMsgNotification = require('./lib/notifications.js').createMsgNotification
|
Made configuration migrateable
Abstract all configuration data into a singleton called `configManager`, who is responsible for reading and writing to the persisted storage (localStorage, in our case).
Uses my new module [pojo-migrator](https://www.npmjs.com/package/pojo-migrator), and wraps it with the `ConfigManager` class, which we can hang any state setting or getting methods we need.
By keeping all the persisted state in one place, we can stabilize its outward-facing API, making the interactions increasingly atomic, which will allow us to add features that require restructuring the persisted data in the long term without having to rewrite UI or even `background.js` code.
All the restructuring and data-type management is kept in one neat little place.
This should make it very easy to add new configuration options like user-configured providers, per-domain vaults, and more!
I know this doesn't seem like a big user-facing feature, but we have a big laundry list of features that I think this will really help streamline.
2016-03-31 04:15:49 +02:00
|
|
|
const configManager = require('./lib/config-manager-singleton')
|
2016-05-03 23:32:22 +02:00
|
|
|
const messageManager = require('./lib/message-manager')
|
2016-04-15 21:12:04 +02:00
|
|
|
const setupMultiplex = require('./lib/stream-utils.js').setupMultiplex
|
|
|
|
const HostStore = require('./lib/remote-store.js').HostStore
|
2016-04-28 00:29:10 +02:00
|
|
|
const Web3 = require('web3')
|
2015-12-19 07:05:16 +01:00
|
|
|
|
2016-02-11 02:44:46 +01:00
|
|
|
//
|
|
|
|
// connect to other contexts
|
|
|
|
//
|
2016-01-17 01:22:54 +01:00
|
|
|
|
2015-08-02 08:36:03 +02:00
|
|
|
chrome.runtime.onConnect.addListener(connectRemote)
|
2016-06-21 22:18:32 +02:00
|
|
|
function connectRemote (remotePort) {
|
2016-01-15 11:03:42 +01:00
|
|
|
var isMetaMaskInternalProcess = (remotePort.name === 'popup')
|
2016-03-10 03:33:30 +01:00
|
|
|
var portStream = new PortStream(remotePort)
|
2016-01-15 11:03:42 +01:00
|
|
|
if (isMetaMaskInternalProcess) {
|
|
|
|
// communication with popup
|
2016-05-26 02:27:49 +02:00
|
|
|
setupTrustedCommunication(portStream, 'MetaMask')
|
2016-01-15 11:03:42 +01:00
|
|
|
} else {
|
|
|
|
// communication with page
|
2016-05-26 02:27:49 +02:00
|
|
|
var originDomain = urlUtil.parse(remotePort.sender.url).hostname
|
|
|
|
setupUntrustedCommunication(portStream, originDomain)
|
2016-01-15 11:03:42 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-06-21 22:18:32 +02:00
|
|
|
function setupUntrustedCommunication (connectionStream, originDomain) {
|
2016-04-15 21:12:04 +02:00
|
|
|
// setup multiplexing
|
|
|
|
var mx = setupMultiplex(connectionStream)
|
|
|
|
// connect features
|
2016-05-26 02:27:49 +02:00
|
|
|
setupProviderConnection(mx.createStream('provider'), originDomain)
|
2016-04-15 21:12:04 +02:00
|
|
|
setupPublicConfig(mx.createStream('publicConfig'))
|
|
|
|
}
|
|
|
|
|
2016-06-21 22:18:32 +02:00
|
|
|
function setupTrustedCommunication (connectionStream, originDomain) {
|
2016-04-15 21:12:04 +02:00
|
|
|
// setup multiplexing
|
|
|
|
var mx = setupMultiplex(connectionStream)
|
|
|
|
// connect features
|
|
|
|
setupControllerConnection(mx.createStream('controller'))
|
2016-05-26 02:27:49 +02:00
|
|
|
setupProviderConnection(mx.createStream('provider'), originDomain)
|
2016-02-11 02:44:46 +01:00
|
|
|
}
|
2016-01-17 10:27:25 +01:00
|
|
|
|
2016-02-11 02:44:46 +01:00
|
|
|
//
|
|
|
|
// state and network
|
|
|
|
//
|
2016-01-17 10:27:25 +01:00
|
|
|
|
2016-02-11 02:44:46 +01:00
|
|
|
var idStore = new IdentityStore()
|
2016-04-28 03:04:33 +02:00
|
|
|
|
2016-04-01 01:32:35 +02:00
|
|
|
var providerOpts = {
|
Made configuration migrateable
Abstract all configuration data into a singleton called `configManager`, who is responsible for reading and writing to the persisted storage (localStorage, in our case).
Uses my new module [pojo-migrator](https://www.npmjs.com/package/pojo-migrator), and wraps it with the `ConfigManager` class, which we can hang any state setting or getting methods we need.
By keeping all the persisted state in one place, we can stabilize its outward-facing API, making the interactions increasingly atomic, which will allow us to add features that require restructuring the persisted data in the long term without having to rewrite UI or even `background.js` code.
All the restructuring and data-type management is kept in one neat little place.
This should make it very easy to add new configuration options like user-configured providers, per-domain vaults, and more!
I know this doesn't seem like a big user-facing feature, but we have a big laundry list of features that I think this will really help streamline.
2016-03-31 04:15:49 +02:00
|
|
|
rpcUrl: configManager.getCurrentRpcAddress(),
|
2016-04-28 23:16:24 +02:00
|
|
|
// account mgmt
|
2016-06-21 22:18:32 +02:00
|
|
|
getAccounts: function (cb) {
|
2016-02-11 02:44:46 +01:00
|
|
|
var selectedAddress = idStore.getSelectedAddress()
|
|
|
|
var result = selectedAddress ? [selectedAddress] : []
|
|
|
|
cb(null, result)
|
|
|
|
},
|
2016-04-28 23:16:24 +02:00
|
|
|
// tx signing
|
2016-05-26 02:27:49 +02:00
|
|
|
approveTransaction: newUnsignedTransaction,
|
2016-02-20 21:13:18 +01:00
|
|
|
signTransaction: idStore.signTransaction.bind(idStore),
|
2016-04-28 23:16:24 +02:00
|
|
|
// msg signing
|
2016-05-26 02:27:49 +02:00
|
|
|
approveMessage: newUnsignedMessage,
|
2016-04-28 23:16:24 +02:00
|
|
|
signMessage: idStore.signMessage.bind(idStore),
|
2016-04-01 01:32:35 +02:00
|
|
|
}
|
|
|
|
var provider = MetaMaskProvider(providerOpts)
|
2016-04-28 00:29:10 +02:00
|
|
|
var web3 = new Web3(provider)
|
2016-04-28 03:04:33 +02:00
|
|
|
idStore.web3 = web3
|
2016-06-04 00:18:20 +02:00
|
|
|
idStore.getNetwork()
|
2016-03-03 01:58:47 +01:00
|
|
|
|
|
|
|
// log new blocks
|
2016-06-21 22:18:32 +02:00
|
|
|
provider.on('block', function (block) {
|
|
|
|
console.log('BLOCK CHANGED:', '#' + block.number.toString('hex'), '0x' + block.hash.toString('hex'))
|
2016-06-04 00:18:20 +02:00
|
|
|
|
|
|
|
// Check network when restoring connectivity:
|
|
|
|
if (idStore._currentState.network === 'loading') {
|
|
|
|
idStore.getNetwork()
|
|
|
|
}
|
2016-03-03 01:58:47 +01:00
|
|
|
})
|
|
|
|
|
2016-06-04 00:18:20 +02:00
|
|
|
provider.on('error', idStore.getNetwork.bind(idStore))
|
|
|
|
|
2016-04-01 01:32:35 +02:00
|
|
|
var ethStore = new EthStore(provider)
|
2016-02-11 02:44:46 +01:00
|
|
|
idStore.setStore(ethStore)
|
2016-01-15 11:03:42 +01:00
|
|
|
|
2016-06-21 22:18:32 +02:00
|
|
|
function getState () {
|
2016-03-08 23:33:01 +01:00
|
|
|
var state = extend(
|
|
|
|
ethStore.getState(),
|
|
|
|
idStore.getState(),
|
Made configuration migrateable
Abstract all configuration data into a singleton called `configManager`, who is responsible for reading and writing to the persisted storage (localStorage, in our case).
Uses my new module [pojo-migrator](https://www.npmjs.com/package/pojo-migrator), and wraps it with the `ConfigManager` class, which we can hang any state setting or getting methods we need.
By keeping all the persisted state in one place, we can stabilize its outward-facing API, making the interactions increasingly atomic, which will allow us to add features that require restructuring the persisted data in the long term without having to rewrite UI or even `background.js` code.
All the restructuring and data-type management is kept in one neat little place.
This should make it very easy to add new configuration options like user-configured providers, per-domain vaults, and more!
I know this doesn't seem like a big user-facing feature, but we have a big laundry list of features that I think this will really help streamline.
2016-03-31 04:15:49 +02:00
|
|
|
configManager.getConfig()
|
2016-03-08 23:33:01 +01:00
|
|
|
)
|
2016-02-11 02:44:46 +01:00
|
|
|
return state
|
2015-08-02 08:36:03 +02:00
|
|
|
}
|
|
|
|
|
2016-04-15 22:04:17 +02:00
|
|
|
//
|
|
|
|
// public store
|
|
|
|
//
|
|
|
|
|
|
|
|
// get init state
|
|
|
|
var initPublicState = extend(
|
|
|
|
idStoreToPublic(idStore.getState()),
|
|
|
|
configToPublic(configManager.getConfig())
|
|
|
|
)
|
|
|
|
|
|
|
|
var publicConfigStore = new HostStore(initPublicState)
|
|
|
|
|
|
|
|
// subscribe to changes
|
2016-06-21 22:18:32 +02:00
|
|
|
configManager.subscribe(function (state) {
|
2016-04-15 22:04:17 +02:00
|
|
|
storeSetFromObj(publicConfigStore, configToPublic(state))
|
|
|
|
})
|
2016-06-21 22:18:32 +02:00
|
|
|
idStore.on('update', function (state) {
|
2016-04-15 22:04:17 +02:00
|
|
|
storeSetFromObj(publicConfigStore, idStoreToPublic(state))
|
|
|
|
})
|
|
|
|
|
|
|
|
// idStore substate
|
2016-06-21 22:18:32 +02:00
|
|
|
function idStoreToPublic (state) {
|
2016-04-15 22:04:17 +02:00
|
|
|
return {
|
|
|
|
selectedAddress: state.selectedAddress,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// config substate
|
2016-06-21 22:18:32 +02:00
|
|
|
function configToPublic (state) {
|
2016-04-15 22:04:17 +02:00
|
|
|
return {
|
|
|
|
provider: state.provider,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// dump obj into store
|
2016-06-21 22:18:32 +02:00
|
|
|
function storeSetFromObj (store, obj) {
|
|
|
|
Object.keys(obj).forEach(function (key) {
|
2016-04-15 22:04:17 +02:00
|
|
|
store.set(key, obj[key])
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2016-02-11 02:44:46 +01:00
|
|
|
//
|
2016-04-15 21:12:04 +02:00
|
|
|
// remote features
|
2016-02-11 02:44:46 +01:00
|
|
|
//
|
|
|
|
|
2016-06-21 22:18:32 +02:00
|
|
|
function setupPublicConfig (stream) {
|
2016-04-15 21:12:04 +02:00
|
|
|
var storeStream = publicConfigStore.createStream()
|
|
|
|
stream.pipe(storeStream).pipe(stream)
|
|
|
|
}
|
|
|
|
|
2016-06-21 22:18:32 +02:00
|
|
|
function setupProviderConnection (stream, originDomain) {
|
2016-06-21 22:14:21 +02:00
|
|
|
// decorate all payloads with origin domain
|
2016-06-21 23:12:48 +02:00
|
|
|
stream.on('data', function onRpcRequest (request) {
|
2016-06-21 22:14:21 +02:00
|
|
|
var payloads = Array.isArray(request) ? request : [request]
|
2016-06-21 23:12:48 +02:00
|
|
|
payloads.forEach(function (payload) {
|
2016-06-21 22:14:21 +02:00
|
|
|
// Append origin to rpc payload
|
|
|
|
payload.origin = originDomain
|
|
|
|
// Append origin to signature request
|
|
|
|
if (payload.method === 'eth_sendTransaction') {
|
|
|
|
payload.params[0].origin = originDomain
|
|
|
|
} else if (payload.method === 'eth_sign') {
|
|
|
|
payload.params.push({ origin: originDomain })
|
|
|
|
}
|
|
|
|
})
|
2016-05-26 02:27:49 +02:00
|
|
|
// handle rpc request
|
2016-06-21 23:12:48 +02:00
|
|
|
provider.sendAsync(request, function onPayloadHandled (err, response) {
|
2016-06-21 22:18:32 +02:00
|
|
|
if (err) {
|
|
|
|
return logger(err)
|
|
|
|
}
|
2016-06-21 22:14:21 +02:00
|
|
|
logger(null, request, response)
|
2016-05-26 02:27:49 +02:00
|
|
|
try {
|
|
|
|
stream.write(response)
|
|
|
|
} catch (err) {
|
|
|
|
logger(err)
|
|
|
|
}
|
|
|
|
})
|
|
|
|
})
|
2016-05-23 03:02:27 +02:00
|
|
|
|
2016-06-21 22:18:32 +02:00
|
|
|
function logger (err, request, response) {
|
2016-05-23 03:02:27 +02:00
|
|
|
if (err) return console.error(err.stack)
|
|
|
|
if (!request.isMetamaskInternal) {
|
2016-05-26 02:27:49 +02:00
|
|
|
console.log(`RPC (${originDomain}):`, request, '->', response)
|
2016-06-21 22:18:32 +02:00
|
|
|
if (response.error) console.error('Error in RPC response:\n' + response.error.message)
|
2016-05-23 03:02:27 +02:00
|
|
|
}
|
|
|
|
}
|
2016-03-10 03:33:30 +01:00
|
|
|
}
|
|
|
|
|
2016-06-21 22:18:32 +02:00
|
|
|
function setupControllerConnection (stream) {
|
2016-04-15 21:12:04 +02:00
|
|
|
var dnode = Dnode({
|
2016-06-21 22:18:32 +02:00
|
|
|
getState: function (cb) { cb(null, getState()) },
|
|
|
|
setRpcTarget: setRpcTarget,
|
|
|
|
setProviderType: setProviderType,
|
2016-04-01 01:32:35 +02:00
|
|
|
useEtherscanProvider: useEtherscanProvider,
|
2016-06-21 22:18:32 +02:00
|
|
|
agreeToDisclaimer: agreeToDisclaimer,
|
2016-02-11 02:44:46 +01:00
|
|
|
// forward directly to idStore
|
2016-06-21 22:18:32 +02:00
|
|
|
createNewVault: idStore.createNewVault.bind(idStore),
|
|
|
|
recoverFromSeed: idStore.recoverFromSeed.bind(idStore),
|
|
|
|
submitPassword: idStore.submitPassword.bind(idStore),
|
2016-02-11 02:44:46 +01:00
|
|
|
setSelectedAddress: idStore.setSelectedAddress.bind(idStore),
|
2016-03-03 07:58:23 +01:00
|
|
|
approveTransaction: idStore.approveTransaction.bind(idStore),
|
2016-06-21 22:18:32 +02:00
|
|
|
cancelTransaction: idStore.cancelTransaction.bind(idStore),
|
|
|
|
signMessage: idStore.signMessage.bind(idStore),
|
|
|
|
cancelMessage: idStore.cancelMessage.bind(idStore),
|
|
|
|
setLocked: idStore.setLocked.bind(idStore),
|
2016-03-24 18:32:50 +01:00
|
|
|
clearSeedWordCache: idStore.clearSeedWordCache.bind(idStore),
|
2016-06-21 22:18:32 +02:00
|
|
|
exportAccount: idStore.exportAccount.bind(idStore),
|
|
|
|
revealAccount: idStore.revealAccount.bind(idStore),
|
|
|
|
saveAccountLabel: idStore.saveAccountLabel.bind(idStore),
|
|
|
|
tryPassword: idStore.tryPassword.bind(idStore),
|
|
|
|
recoverSeed: idStore.recoverSeed.bind(idStore),
|
2016-02-11 02:44:46 +01:00
|
|
|
})
|
2016-04-15 21:12:04 +02:00
|
|
|
stream.pipe(dnode).pipe(stream)
|
2016-06-21 22:18:32 +02:00
|
|
|
dnode.on('remote', function (remote) {
|
2016-02-11 02:44:46 +01:00
|
|
|
// push updates to popup
|
|
|
|
ethStore.on('update', sendUpdate)
|
|
|
|
idStore.on('update', sendUpdate)
|
|
|
|
// teardown on disconnect
|
2016-06-21 22:18:32 +02:00
|
|
|
eos(stream, function unsubscribe () {
|
2016-02-11 02:44:46 +01:00
|
|
|
ethStore.removeListener('update', sendUpdate)
|
|
|
|
})
|
2016-06-21 22:18:32 +02:00
|
|
|
function sendUpdate () {
|
2016-02-11 02:44:46 +01:00
|
|
|
var state = getState()
|
|
|
|
remote.sendUpdate(state)
|
|
|
|
}
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
//
|
|
|
|
// plugin badge text
|
|
|
|
//
|
|
|
|
|
|
|
|
idStore.on('update', updateBadge)
|
2015-12-19 07:05:16 +01:00
|
|
|
|
2016-06-21 22:18:32 +02:00
|
|
|
function updateBadge (state) {
|
2016-01-19 02:05:46 +01:00
|
|
|
var label = ''
|
2016-04-19 01:39:35 +02:00
|
|
|
var unconfTxs = configManager.unconfirmedTxs()
|
2016-05-03 23:32:22 +02:00
|
|
|
var unconfTxLen = Object.keys(unconfTxs).length
|
|
|
|
var unconfMsgs = messageManager.unconfirmedMsgs()
|
|
|
|
var unconfMsgLen = Object.keys(unconfMsgs).length
|
|
|
|
var count = unconfTxLen + unconfMsgLen
|
2016-01-19 02:05:46 +01:00
|
|
|
if (count) {
|
|
|
|
label = String(count)
|
|
|
|
}
|
2016-03-08 23:33:01 +01:00
|
|
|
chrome.browserAction.setBadgeText({ text: label })
|
|
|
|
chrome.browserAction.setBadgeBackgroundColor({ color: '#506F8B' })
|
2016-01-19 02:05:46 +01:00
|
|
|
}
|
2015-12-19 07:05:16 +01:00
|
|
|
|
2016-03-11 00:39:31 +01:00
|
|
|
//
|
2016-04-28 23:16:24 +02:00
|
|
|
// Add unconfirmed Tx + Msg
|
2016-03-11 00:39:31 +01:00
|
|
|
//
|
|
|
|
|
2016-06-21 22:18:32 +02:00
|
|
|
function newUnsignedTransaction (txParams, onTxDoneCb) {
|
2016-05-24 23:59:33 +02:00
|
|
|
var state = idStore.getState()
|
|
|
|
if (!state.isUnlocked) {
|
|
|
|
createUnlockRequestNotification({
|
|
|
|
title: 'Account Unlock Request',
|
|
|
|
})
|
2016-06-17 04:51:34 +02:00
|
|
|
idStore.addUnconfirmedTransaction(txParams, onTxDoneCb, noop)
|
2016-05-24 23:59:33 +02:00
|
|
|
} else {
|
2016-06-17 04:51:34 +02:00
|
|
|
addUnconfirmedTx(txParams, onTxDoneCb)
|
2016-05-24 23:59:33 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-06-21 22:18:32 +02:00
|
|
|
function newUnsignedMessage (msgParams, cb) {
|
2016-05-24 23:59:33 +02:00
|
|
|
var state = idStore.getState()
|
|
|
|
if (!state.isUnlocked) {
|
|
|
|
createUnlockRequestNotification({
|
|
|
|
title: 'Account Unlock Request',
|
|
|
|
})
|
|
|
|
} else {
|
2016-06-04 00:18:20 +02:00
|
|
|
addUnconfirmedMsg(msgParams, cb)
|
2016-05-24 23:59:33 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-06-23 04:28:11 +02:00
|
|
|
createTxNotification({
|
|
|
|
title: 'New Unsigned Transaction',
|
|
|
|
txParams: {to: '0xabc', from: '0xdef'},
|
|
|
|
// confirm: idStore.approveTransaction.bind(idStore, txData.id, noop),
|
|
|
|
// cancel: idStore.cancelTransaction.bind(idStore, txData.id),
|
|
|
|
})
|
|
|
|
|
2016-06-21 22:18:32 +02:00
|
|
|
function addUnconfirmedTx (txParams, onTxDoneCb) {
|
|
|
|
idStore.addUnconfirmedTransaction(txParams, onTxDoneCb, function (err, txData) {
|
2016-06-17 04:51:34 +02:00
|
|
|
if (err) return onTxDoneCb(err)
|
|
|
|
createTxNotification({
|
|
|
|
title: 'New Unsigned Transaction',
|
|
|
|
txParams: txParams,
|
|
|
|
confirm: idStore.approveTransaction.bind(idStore, txData.id, noop),
|
|
|
|
cancel: idStore.cancelTransaction.bind(idStore, txData.id),
|
|
|
|
})
|
2016-03-11 00:39:31 +01:00
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2016-06-21 22:18:32 +02:00
|
|
|
function addUnconfirmedMsg (msgParams, cb) {
|
2016-04-28 23:16:24 +02:00
|
|
|
var msgId = idStore.addUnconfirmedMessage(msgParams, cb)
|
|
|
|
createMsgNotification({
|
|
|
|
title: 'New Unsigned Message',
|
|
|
|
msgParams: msgParams,
|
|
|
|
confirm: idStore.approveMessage.bind(idStore, msgId, noop),
|
|
|
|
cancel: idStore.cancelMessage.bind(idStore, msgId),
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2016-03-08 23:33:01 +01:00
|
|
|
//
|
|
|
|
// config
|
|
|
|
//
|
|
|
|
|
2016-06-21 22:18:32 +02:00
|
|
|
function agreeToDisclaimer (cb) {
|
2016-06-17 00:58:11 +02:00
|
|
|
try {
|
|
|
|
configManager.setConfirmed(true)
|
|
|
|
cb()
|
|
|
|
} catch (e) {
|
|
|
|
cb(e)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-03-08 23:33:01 +01:00
|
|
|
// called from popup
|
2016-06-21 22:18:32 +02:00
|
|
|
function setRpcTarget (rpcTarget) {
|
Made configuration migrateable
Abstract all configuration data into a singleton called `configManager`, who is responsible for reading and writing to the persisted storage (localStorage, in our case).
Uses my new module [pojo-migrator](https://www.npmjs.com/package/pojo-migrator), and wraps it with the `ConfigManager` class, which we can hang any state setting or getting methods we need.
By keeping all the persisted state in one place, we can stabilize its outward-facing API, making the interactions increasingly atomic, which will allow us to add features that require restructuring the persisted data in the long term without having to rewrite UI or even `background.js` code.
All the restructuring and data-type management is kept in one neat little place.
This should make it very easy to add new configuration options like user-configured providers, per-domain vaults, and more!
I know this doesn't seem like a big user-facing feature, but we have a big laundry list of features that I think this will really help streamline.
2016-03-31 04:15:49 +02:00
|
|
|
configManager.setRpcTarget(rpcTarget)
|
2016-03-08 23:33:01 +01:00
|
|
|
chrome.runtime.reload()
|
2016-06-04 00:18:20 +02:00
|
|
|
idStore.getNetwork()
|
2016-03-08 23:33:01 +01:00
|
|
|
}
|
|
|
|
|
2016-06-21 22:18:32 +02:00
|
|
|
function setProviderType (type) {
|
2016-05-11 00:37:13 +02:00
|
|
|
configManager.setProviderType(type)
|
|
|
|
chrome.runtime.reload()
|
2016-06-04 00:18:20 +02:00
|
|
|
idStore.getNetwork()
|
2016-05-11 00:37:13 +02:00
|
|
|
}
|
|
|
|
|
2016-06-21 22:18:32 +02:00
|
|
|
function useEtherscanProvider () {
|
2016-04-01 01:32:35 +02:00
|
|
|
configManager.useEtherscanProvider()
|
|
|
|
chrome.runtime.reload()
|
|
|
|
}
|
|
|
|
|
2016-03-10 03:33:30 +01:00
|
|
|
// util
|
|
|
|
|
2016-06-21 22:18:32 +02:00
|
|
|
function noop () {}
|