2016-04-20 00:07:15 +02:00
|
|
|
const h = require('react-hyperscript')
|
2016-04-20 02:31:34 +02:00
|
|
|
const formatBalance = require('../util').formatBalance
|
2016-04-20 03:21:28 +02:00
|
|
|
const addressSummary = require('../util').addressSummary
|
|
|
|
const explorerLink = require('../../lib/explorer-link')
|
2016-05-06 23:42:08 +02:00
|
|
|
const Panel = require('./panel')
|
2016-04-20 00:07:15 +02:00
|
|
|
|
2016-04-20 03:21:28 +02:00
|
|
|
module.exports = function(transactions, network) {
|
2016-05-06 23:42:08 +02:00
|
|
|
return h('section', [
|
|
|
|
|
|
|
|
h('.current-domain-panel.flex-center.font-small', [
|
|
|
|
h('span', 'Transactions'),
|
|
|
|
]),
|
|
|
|
|
|
|
|
h('.tx-list', {
|
|
|
|
style: {
|
|
|
|
overflowY: 'auto',
|
|
|
|
height: '180px',
|
|
|
|
textAlign: 'center',
|
|
|
|
},
|
2016-05-05 22:27:00 +02:00
|
|
|
},
|
2016-05-06 23:42:08 +02:00
|
|
|
|
|
|
|
[
|
|
|
|
|
|
|
|
transactions.map((transaction) => {
|
|
|
|
console.dir(transaction)
|
|
|
|
|
|
|
|
var panelOpts = {
|
|
|
|
key: `tx-${transaction.hash}`,
|
|
|
|
identiconKey: transaction.txParams.to,
|
|
|
|
style: {
|
|
|
|
cursor: 'pointer',
|
|
|
|
},
|
|
|
|
onClick: (event) => {
|
|
|
|
var url = explorerLink(transaction.hash, parseInt(network))
|
|
|
|
chrome.tabs.create({ url });
|
|
|
|
},
|
|
|
|
attributes: [
|
|
|
|
{
|
|
|
|
key: 'TO',
|
|
|
|
value: addressSummary(transaction.txParams.to),
|
|
|
|
},
|
|
|
|
{
|
|
|
|
key: 'VALUE',
|
|
|
|
value: formatBalance(transaction.txParams.value),
|
|
|
|
},
|
|
|
|
]
|
|
|
|
}
|
|
|
|
|
|
|
|
return h(Panel, panelOpts)
|
|
|
|
})
|
|
|
|
]
|
|
|
|
)
|
|
|
|
|
|
|
|
])
|
|
|
|
}
|