Simplify code
This commit is contained in:
parent
1dfafb2966
commit
2358f346dc
|
@ -46,11 +46,10 @@ const BlockTransactions: React.FC = () => {
|
||||||
provider.getBlockWithTransactions(blockNumber.toNumber()),
|
provider.getBlockWithTransactions(blockNumber.toNumber()),
|
||||||
provider.send("eth_getBlockReceipts", [blockNumber.toNumber()]),
|
provider.send("eth_getBlockReceipts", [blockNumber.toNumber()]),
|
||||||
]);
|
]);
|
||||||
document.title = `Block #${_block.number} Transactions | Otterscan`;
|
|
||||||
|
|
||||||
const responses = _block.transactions
|
const responses = _block.transactions
|
||||||
.map((t, i): ProcessedTransaction => {
|
.map(
|
||||||
return {
|
(t, i): ProcessedTransaction => ({
|
||||||
blockNumber: blockNumber.toNumber(),
|
blockNumber: blockNumber.toNumber(),
|
||||||
timestamp: _block.timestamp,
|
timestamp: _block.timestamp,
|
||||||
miner: _block.miner,
|
miner: _block.miner,
|
||||||
|
@ -74,8 +73,8 @@ const BlockTransactions: React.FC = () => {
|
||||||
: t.maxPriorityFeePerGas!.add(_block.baseFeePerGas!),
|
: t.maxPriorityFeePerGas!.add(_block.baseFeePerGas!),
|
||||||
data: t.data,
|
data: t.data,
|
||||||
status: provider.formatter.number(_receipts[i].status),
|
status: provider.formatter.number(_receipts[i].status),
|
||||||
};
|
|
||||||
})
|
})
|
||||||
|
)
|
||||||
.reverse();
|
.reverse();
|
||||||
setTxs(responses);
|
setTxs(responses);
|
||||||
|
|
||||||
|
@ -92,9 +91,12 @@ const BlockTransactions: React.FC = () => {
|
||||||
);
|
);
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
const processedResponses = responses.map((r, i): ProcessedTransaction => {
|
const processedResponses = responses.map(
|
||||||
return { ...r, internalMinerInteraction: checkTouchMinerAddr[i] };
|
(r, i): ProcessedTransaction => ({
|
||||||
});
|
...r,
|
||||||
|
internalMinerInteraction: checkTouchMinerAddr[i],
|
||||||
|
})
|
||||||
|
);
|
||||||
setTxs(processedResponses);
|
setTxs(processedResponses);
|
||||||
};
|
};
|
||||||
readBlock();
|
readBlock();
|
||||||
|
|
Loading…
Reference in New Issue