From 4fd4bb79f149c27a749540e690c728407a81ed2e Mon Sep 17 00:00:00 2001 From: Elena Bardho Date: Mon, 3 Feb 2025 13:31:12 +0000 Subject: [PATCH 1/2] Add ipfs gateway --- src/app/components/transaction.tsx | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/app/components/transaction.tsx b/src/app/components/transaction.tsx index 992ae6e..83349c8 100644 --- a/src/app/components/transaction.tsx +++ b/src/app/components/transaction.tsx @@ -34,6 +34,7 @@ export const TransactionButton = () => { const [isInOutputPlutusData , setIsInOutputPlutusData] = useState(false); const [voteResult, setVoteResult] = useState(); const [voteID, setVoteID] = useState(); + const [voterType, setVoterType] = useState(); const [cardanoscan, setCardanoscan] = useState(); const [metadataAnchorURL, setmetadataAnchorURL] = useState(); const [metadataAnchorHash, setMetadataAnchorHash] = useState(); @@ -49,6 +50,7 @@ export const TransactionButton = () => { setIsInOutputPlutusData(false); setVoteResult(""); setVoteID(""); + setVoterType(""); setMessage("Please connect your wallet first."); return; } @@ -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; } @@ -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); } @@ -306,9 +310,13 @@ export const TransactionButton = () => { Vote Choice {voteResult} + + Voter Type + {voterType} + Metadata Anchor URL - {metadataAnchorURL} + {metadataAnchorURL} Metadata Anchor Hash From 5f87228d82c8cdd793262391bb63ba5477e566c1 Mon Sep 17 00:00:00 2001 From: Elena Bardho Date: Mon, 3 Feb 2025 14:08:54 +0000 Subject: [PATCH 2/2] IPFS gateway --- src/app/components/transaction.tsx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/app/components/transaction.tsx b/src/app/components/transaction.tsx index 83349c8..99f1f13 100644 --- a/src/app/components/transaction.tsx +++ b/src/app/components/transaction.tsx @@ -6,6 +6,11 @@ import { BlockfrostProvider, deserializeAddress } from "@meshsdk/core"; import { Button, TextField, Box, Typography, Container, Table, TableBody, TableCell, TableContainer, TableRow, Paper } from "@mui/material"; import * as CLS from "@emurgo/cardano-serialization-lib-browser"; import ReactJsonPretty from 'react-json-pretty'; +import * as dotenv from 'dotenv'; + +dotenv.config(); + +const NEXT_PUBLIC_REST_IPFS_GATEWAY = process.env.NEXT_PUBLIC_REST_IPFS_GATEWAY; // Function to decode an unasigned transaction const decodeTransaction = (unsignedTransactionHex: string) => { @@ -316,7 +321,7 @@ export const TransactionButton = () => { Metadata Anchor URL - {metadataAnchorURL} + {metadataAnchorURL} Metadata Anchor Hash @@ -391,4 +396,4 @@ export const TransactionButton = () => { ); -}; \ No newline at end of file +};