|
|
@ -11,6 +11,7 @@ const createTxNotification = require('./lib/tx-notification.js') |
|
|
|
const configManager = require('./lib/config-manager-singleton') |
|
|
|
const configManager = require('./lib/config-manager-singleton') |
|
|
|
const setupMultiplex = require('./lib/stream-utils.js').setupMultiplex |
|
|
|
const setupMultiplex = require('./lib/stream-utils.js').setupMultiplex |
|
|
|
const HostStore = require('./lib/remote-store.js').HostStore |
|
|
|
const HostStore = require('./lib/remote-store.js').HostStore |
|
|
|
|
|
|
|
const Web3 = require('web3') |
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
//
|
|
|
|
// connect to other contexts
|
|
|
|
// connect to other contexts
|
|
|
@ -62,6 +63,7 @@ var providerOpts = { |
|
|
|
signTransaction: idStore.signTransaction.bind(idStore), |
|
|
|
signTransaction: idStore.signTransaction.bind(idStore), |
|
|
|
} |
|
|
|
} |
|
|
|
var provider = MetaMaskProvider(providerOpts) |
|
|
|
var provider = MetaMaskProvider(providerOpts) |
|
|
|
|
|
|
|
var web3 = new Web3(provider) |
|
|
|
|
|
|
|
|
|
|
|
// log new blocks
|
|
|
|
// log new blocks
|
|
|
|
provider.on('block', function(block){ |
|
|
|
provider.on('block', function(block){ |
|
|
@ -205,12 +207,18 @@ function updateBadge(state){ |
|
|
|
//
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
|
|
function addUnconfirmedTx(txParams, cb){ |
|
|
|
function addUnconfirmedTx(txParams, cb){ |
|
|
|
var txId = idStore.addUnconfirmedTransaction(txParams, cb) |
|
|
|
|
|
|
|
createTxNotification({ |
|
|
|
web3.version.getNetwork(function(err, network) { |
|
|
|
title: 'New Unsigned Transaction', |
|
|
|
if (err) return cb(err) |
|
|
|
txParams: txParams, |
|
|
|
|
|
|
|
confirm: idStore.approveTransaction.bind(idStore, txId, noop), |
|
|
|
txParams.metamaskNetworkId = network |
|
|
|
cancel: idStore.cancelTransaction.bind(idStore, txId), |
|
|
|
var txId = idStore.addUnconfirmedTransaction(txParams, cb) |
|
|
|
|
|
|
|
createTxNotification({ |
|
|
|
|
|
|
|
title: 'New Unsigned Transaction', |
|
|
|
|
|
|
|
txParams: txParams, |
|
|
|
|
|
|
|
confirm: idStore.approveTransaction.bind(idStore, txId, noop), |
|
|
|
|
|
|
|
cancel: idStore.cancelTransaction.bind(idStore, txId), |
|
|
|
|
|
|
|
}) |
|
|
|
}) |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|