mirror of https://github.com/GOSTSec/gostexplr
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
49 lines
960 B
49 lines
960 B
7 years ago
|
var models = require('../models');
|
||
|
var express = require('express');
|
||
|
var router = express.Router();
|
||
|
|
||
|
/* GET home page. */
|
||
|
router.get('/:txid', function(req, res, next) {
|
||
|
const txid = encodeURI(req.params.txid);
|
||
|
|
||
|
models.Transaction.findOne({
|
||
|
where: {
|
||
|
txid,
|
||
|
},
|
||
|
include: [{
|
||
|
attributes: ['hash'],
|
||
|
model: models.Block,
|
||
|
},{
|
||
|
model: models.Vout,
|
||
|
include: {
|
||
|
model: models.Address,
|
||
|
}
|
||
|
}, {
|
||
|
model: models.Transaction,
|
||
|
as: 'txtx',
|
||
|
}],
|
||
|
})
|
||
|
.then((transaction) => {
|
||
|
if (transaction === null) {
|
||
|
res.status(404).render('404');
|
||
|
return;
|
||
|
}
|
||
|
const vouts = [];
|
||
|
transaction.Vouts.forEach((vout) => {
|
||
|
vout.Addresses.forEach((address) => {
|
||
|
vouts.push({
|
||
|
address: address.address,
|
||
|
value: vout.value,
|
||
|
});
|
||
|
});
|
||
|
});
|
||
|
res.render('transaction', {
|
||
|
transaction,
|
||
|
vouts,
|
||
|
});
|
||
|
});
|
||
|
|
||
|
});
|
||
|
|
||
|
module.exports = router;
|