|
|
|
@ -20,9 +20,6 @@ router.get('/:txid', async function(req, res, next) {
@@ -20,9 +20,6 @@ router.get('/:txid', async function(req, res, next) {
|
|
|
|
|
model: models.Address, |
|
|
|
|
}, { |
|
|
|
|
model: models.Transaction, |
|
|
|
|
include: { |
|
|
|
|
model: models.Vout, |
|
|
|
|
}, |
|
|
|
|
} |
|
|
|
|
], |
|
|
|
|
},], |
|
|
|
@ -33,16 +30,6 @@ router.get('/:txid', async function(req, res, next) {
@@ -33,16 +30,6 @@ router.get('/:txid', async function(req, res, next) {
|
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// const vouts = [];
|
|
|
|
|
// transaction.Vouts.forEach((vout) => {
|
|
|
|
|
// vout.Addresses.forEach((address) => {
|
|
|
|
|
// vouts.push({
|
|
|
|
|
// address: address.address,
|
|
|
|
|
// value: vout.value,
|
|
|
|
|
// });
|
|
|
|
|
// });
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
|
|
const lastBlock = await models.Block.findOne({ |
|
|
|
|
attributes: [ |
|
|
|
|
[models.sequelize.fn('MAX', models.sequelize.col('height')), 'maxheight'] |
|
|
|
@ -52,13 +39,13 @@ router.get('/:txid', async function(req, res, next) {
@@ -52,13 +39,13 @@ router.get('/:txid', async function(req, res, next) {
|
|
|
|
|
const confirmations = lastBlock.maxheight - transaction.Block.height + 1; |
|
|
|
|
|
|
|
|
|
const txJson = transaction.toJSON(); |
|
|
|
|
// txJson.vins = txJson.Vouts.filter({TransactionVouts: {direction: 0}});
|
|
|
|
|
// txJson.vouts txJson.Vouts.filter({TransactionVouts: {direction: 1}});
|
|
|
|
|
const txTemplate = Object.assign(txJson, { |
|
|
|
|
vins: txJson.Vouts.filter((vout) => vout.TransactionVouts.direction === 0), |
|
|
|
|
vouts: txJson.Vouts.filter((vout) => vout.TransactionVouts.direction === 1), |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
console.log(transaction.Vouts.length); |
|
|
|
|
|
|
|
|
|
txTemplate.blockTime = transaction.Block.time.toUTCString(); |
|
|
|
|
|
|
|
|
|
res.render('transaction', { |
|
|
|
|