Skip to content

Commit

Permalink
Update explorer to new CardanoTransaction signed entity beacon
Browse files Browse the repository at this point in the history
Co-authored-by: Sébastien Fauvel <[email protected]>
Co-authored-by: Damien Lachaume <[email protected]>
  • Loading branch information
3 people committed Jun 4, 2024
1 parent a5b5e4c commit fc41440
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -110,12 +110,9 @@ export default function CardanoTransactionsSnapshotsList(props) {
<Card.Body>
<Card.Title>{cardanoTransactionsSnapshot.hash}</Card.Title>
<ListGroup variant="flush" className="data-list-group">
<ListGroup.Item>Epoch: {cardanoTransactionsSnapshot.epoch}</ListGroup.Item>
<ListGroup.Item>
Epoch: {cardanoTransactionsSnapshot.beacon.epoch}
</ListGroup.Item>
<ListGroup.Item>
Immutable file number:{" "}
{cardanoTransactionsSnapshot.beacon.immutable_file_number}
Block Number: {cardanoTransactionsSnapshot.block_number}
</ListGroup.Item>
<ListGroup.Item>
Merkle Root: {cardanoTransactionsSnapshot.merkle_root}
Expand Down
24 changes: 2 additions & 22 deletions mithril-explorer/src/components/CertificateModal/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { selectedAggregator } from "@/store/settingsSlice";
import RawJsonButton from "#/RawJsonButton";
import Stake from "#/Stake";
import ProtocolParameters from "#/ProtocolParameters";
import SignedEntityType from "#/SignedEntityType";
import SignerTable from "#/SignerTable";
import VerifyCertificateModal from "#/VerifyCertificate/VerifyCertificateModal";

Expand Down Expand Up @@ -72,28 +73,7 @@ export default function CertificateModal({
<Row md={1} xl="auto">
<Col xl={4} className="mb-3">
<h4>Beacon</h4>
<Table className="mb-3">
<tbody>
<tr>
<td>
<em>Network:</em>
</td>
<td>{certificate.beacon.network}</td>
</tr>
<tr>
<td>
<em>Epoch:</em>
</td>
<td>{certificate.beacon.epoch}</td>
</tr>
<tr>
<td>
<em>Immutable File Number:</em>
</td>
<td>{certificate.beacon.immutable_file_number}</td>
</tr>
</tbody>
</Table>
<SignedEntityType signedEntityType={certificate.signed_entity_type} table />
<h4>Protocol Parameters</h4>
<ProtocolParameters
className="mb-3"
Expand Down
29 changes: 26 additions & 3 deletions mithril-explorer/src/components/SignedEntityType.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { useEffect, useState } from "react";
import { ListGroup } from "react-bootstrap";
import { ListGroup, Table } from "react-bootstrap";

export default function SignedEntityType({ signedEntityType }) {
export default function SignedEntityType({ signedEntityType, table = false }) {
const [entityName, setEntityName] = useState("");
const [beacon, setBeacon] = useState({});

Expand All @@ -13,12 +13,35 @@ export default function SignedEntityType({ signedEntityType }) {
setBeacon({
epoch: signedEntityType[type_name],
});
} else if (type_name === "CardanoTransactions") {
setBeacon({
epoch: signedEntityType[type_name][0],
block_number: signedEntityType[type_name][1],
});
} else {
setBeacon(signedEntityType[type_name] ?? {});
}
}, [signedEntityType]);

return (
return table ? (
<Table className="mb-3">
<tbody>
<tr>
<td colSpan={2}>
<h6>{entityName}</h6>
</td>
</tr>
{Object.entries(beacon).map(([key, value]) => (
<tr key={key}>
<td>
<em>{key}:</em>
</td>
<td>{value}</td>
</tr>
))}
</tbody>
</Table>
) : (
<ListGroup>
<ListGroup.Item>
<h6>{entityName}</h6>
Expand Down

0 comments on commit fc41440

Please sign in to comment.