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