Skip to content

Commit

Permalink
Add voter type Constitutional Committee
Browse files Browse the repository at this point in the history
  • Loading branch information
elenabardho committed Feb 3, 2025
1 parent be1a04f commit 4ab6d1d
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/app/components/transaction.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export const TransactionButton = () => {
const [isInOutputPlutusData , setIsInOutputPlutusData] = useState(false);
const [voteResult, setVoteResult] = useState<string>();
const [voteID, setVoteID] = useState<string>();
const [voterType, setVoterType] = useState<string>();
const [cardanoscan, setCardanoscan] = useState<string>();
const [metadataAnchorURL, setmetadataAnchorURL] = useState<string>();
const [metadataAnchorHash, setMetadataAnchorHash] = useState<string>();
Expand All @@ -49,6 +50,7 @@ export const TransactionButton = () => {
setIsInOutputPlutusData(false);
setVoteResult("");
setVoteID("");
setVoterType("");
setMessage("Please connect your wallet first.");
return;
}
Expand Down Expand Up @@ -125,6 +127,7 @@ export const TransactionButton = () => {
console.log("voterJSON:", voterJSON);
let script;
// Function to check if the voterJSON has ConstitutionalCommitteeHotCred to avoid type error
// Check voter type
function isConstitutionalCommitteeHotCred(voter: CLS.VoterJSON): voter is { ConstitutionalCommitteeHotCred: { Script: string } } {
return (voter as { ConstitutionalCommitteeHotCred: any }).ConstitutionalCommitteeHotCred !== undefined;
}
Expand All @@ -133,6 +136,7 @@ export const TransactionButton = () => {
// If it has ConstitutionalCommitteeHotCred, extract the Script hex
const credType = voterJSON.ConstitutionalCommitteeHotCred;
script = credType.Script;
setVoterType("Constitutional Committee");
console.log("ConstitutionalCommitteeHotCred Script:", script);

}
Expand Down Expand Up @@ -306,6 +310,10 @@ export const TransactionButton = () => {
<TableCell sx={{ fontWeight: "bold" }}>Vote Choice </TableCell>
<TableCell>{voteResult}</TableCell>
</TableRow>
<TableRow>
<TableCell sx={{ fontWeight: "bold" }}>Voter Type </TableCell>
<TableCell>{voterType}</TableCell>
</TableRow>
<TableRow>
<TableCell sx={{ fontWeight: "bold" }}>Metadata Anchor URL</TableCell>
<TableCell><a href={metadataAnchorURL} target="_blank">{metadataAnchorURL}</a></TableCell>
Expand Down

0 comments on commit 4ab6d1d

Please sign in to comment.