mirror of
https://github.com/GOSTSec/gostexplr
synced 2025-02-05 19:34:26 +00:00
Address page
This commit is contained in:
parent
bdf288c91f
commit
2ba2704881
@ -91,7 +91,7 @@ async function saveTransaction(txid, blockHeight) {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
if (vout) {
|
if (vout) {
|
||||||
await transaction.addVouts(vout, { through: { direction: 0, }, });
|
await transaction.addVouts(vout[0], { through: { direction: 0, }, });
|
||||||
} else {
|
} else {
|
||||||
throw('Couldnt find vout for VIN');
|
throw('Couldnt find vout for VIN');
|
||||||
}
|
}
|
||||||
|
@ -15,9 +15,7 @@ router.get('/:address/:offset*?', async function(req, res, next) {
|
|||||||
model: models.Vout,
|
model: models.Vout,
|
||||||
include: {
|
include: {
|
||||||
model: models.Transaction,
|
model: models.Transaction,
|
||||||
include: {
|
|
||||||
model: models.Vout,
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
@ -26,7 +24,7 @@ router.get('/:address/:offset*?', async function(req, res, next) {
|
|||||||
res.status(404).render('404');
|
res.status(404).render('404');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const limit = 30;
|
const limit = 30;
|
||||||
const paramPage = parseInt(req.params.offset);
|
const paramPage = parseInt(req.params.offset);
|
||||||
const page = isNaN(paramPage) || paramPage < 1 ? 1 : paramPage;
|
const page = isNaN(paramPage) || paramPage < 1 ? 1 : paramPage;
|
||||||
|
@ -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', {
|
||||||
|
@ -7,12 +7,18 @@ block content
|
|||||||
tr
|
tr
|
||||||
td Hash
|
td Hash
|
||||||
td #{transaction.txid}
|
td #{transaction.txid}
|
||||||
|
|
||||||
|
h3 Block
|
||||||
|
table
|
||||||
tr
|
tr
|
||||||
td Block
|
td Block height
|
||||||
td
|
td
|
||||||
a(href=`/block/${transaction.Block.hash}/`) #{transaction.Block.hash}
|
a(href=`/block/${transaction.Block.hash}/`) #{transaction.Block.height}
|
||||||
tr
|
tr
|
||||||
td Block time
|
td Block hash
|
||||||
|
td #{transaction.Block.hash}
|
||||||
|
tr
|
||||||
|
td Time
|
||||||
td #{transaction.blockTime}
|
td #{transaction.blockTime}
|
||||||
tr
|
tr
|
||||||
td Confirmations
|
td Confirmations
|
||||||
@ -47,8 +53,6 @@ block content
|
|||||||
td
|
td
|
||||||
a(href=`/address/${address.address}/`) #{address.address}
|
a(href=`/address/${address.address}/`) #{address.address}
|
||||||
td #{vout.value}
|
td #{vout.value}
|
||||||
td
|
td
|
||||||
if vout.Transactions[0].TransactionVouts.direction == 0
|
each transaction in vout.Transactions
|
||||||
a(href=`/transaction/${vout.Transactions[0].txid}/`) #{vout.Transactions[0].txid}
|
a(href=`/transaction/${transaction.txid}/`) #{transaction.txid}
|
||||||
else
|
|
||||||
span No yet
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user