Skip to content

Commit fc41440

Browse files
Alenarsfauveldlachaume
committed
Update explorer to new CardanoTransaction signed entity beacon
Co-authored-by: Sébastien Fauvel <[email protected]> Co-authored-by: Damien Lachaume <[email protected]>
1 parent a5b5e4c commit fc41440

File tree

3 files changed

+30
-30
lines changed

3 files changed

+30
-30
lines changed

mithril-explorer/src/components/Artifacts/CardanoTransactionsSnapshotsList/index.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -110,12 +110,9 @@ export default function CardanoTransactionsSnapshotsList(props) {
110110
<Card.Body>
111111
<Card.Title>{cardanoTransactionsSnapshot.hash}</Card.Title>
112112
<ListGroup variant="flush" className="data-list-group">
113+
<ListGroup.Item>Epoch: {cardanoTransactionsSnapshot.epoch}</ListGroup.Item>
113114
<ListGroup.Item>
114-
Epoch: {cardanoTransactionsSnapshot.beacon.epoch}
115-
</ListGroup.Item>
116-
<ListGroup.Item>
117-
Immutable file number:{" "}
118-
{cardanoTransactionsSnapshot.beacon.immutable_file_number}
115+
Block Number: {cardanoTransactionsSnapshot.block_number}
119116
</ListGroup.Item>
120117
<ListGroup.Item>
121118
Merkle Root: {cardanoTransactionsSnapshot.merkle_root}

mithril-explorer/src/components/CertificateModal/index.js

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { selectedAggregator } from "@/store/settingsSlice";
77
import RawJsonButton from "#/RawJsonButton";
88
import Stake from "#/Stake";
99
import ProtocolParameters from "#/ProtocolParameters";
10+
import SignedEntityType from "#/SignedEntityType";
1011
import SignerTable from "#/SignerTable";
1112
import VerifyCertificateModal from "#/VerifyCertificate/VerifyCertificateModal";
1213

@@ -72,28 +73,7 @@ export default function CertificateModal({
7273
<Row md={1} xl="auto">
7374
<Col xl={4} className="mb-3">
7475
<h4>Beacon</h4>
75-
<Table className="mb-3">
76-
<tbody>
77-
<tr>
78-
<td>
79-
<em>Network:</em>
80-
</td>
81-
<td>{certificate.beacon.network}</td>
82-
</tr>
83-
<tr>
84-
<td>
85-
<em>Epoch:</em>
86-
</td>
87-
<td>{certificate.beacon.epoch}</td>
88-
</tr>
89-
<tr>
90-
<td>
91-
<em>Immutable File Number:</em>
92-
</td>
93-
<td>{certificate.beacon.immutable_file_number}</td>
94-
</tr>
95-
</tbody>
96-
</Table>
76+
<SignedEntityType signedEntityType={certificate.signed_entity_type} table />
9777
<h4>Protocol Parameters</h4>
9878
<ProtocolParameters
9979
className="mb-3"

mithril-explorer/src/components/SignedEntityType.js

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React, { useEffect, useState } from "react";
2-
import { ListGroup } from "react-bootstrap";
2+
import { ListGroup, Table } from "react-bootstrap";
33

4-
export default function SignedEntityType({ signedEntityType }) {
4+
export default function SignedEntityType({ signedEntityType, table = false }) {
55
const [entityName, setEntityName] = useState("");
66
const [beacon, setBeacon] = useState({});
77

@@ -13,12 +13,35 @@ export default function SignedEntityType({ signedEntityType }) {
1313
setBeacon({
1414
epoch: signedEntityType[type_name],
1515
});
16+
} else if (type_name === "CardanoTransactions") {
17+
setBeacon({
18+
epoch: signedEntityType[type_name][0],
19+
block_number: signedEntityType[type_name][1],
20+
});
1621
} else {
1722
setBeacon(signedEntityType[type_name] ?? {});
1823
}
1924
}, [signedEntityType]);
2025

21-
return (
26+
return table ? (
27+
<Table className="mb-3">
28+
<tbody>
29+
<tr>
30+
<td colSpan={2}>
31+
<h6>{entityName}</h6>
32+
</td>
33+
</tr>
34+
{Object.entries(beacon).map(([key, value]) => (
35+
<tr key={key}>
36+
<td>
37+
<em>{key}:</em>
38+
</td>
39+
<td>{value}</td>
40+
</tr>
41+
))}
42+
</tbody>
43+
</Table>
44+
) : (
2245
<ListGroup>
2346
<ListGroup.Item>
2447
<h6>{entityName}</h6>

0 commit comments

Comments
 (0)