diff --git a/src/app/components/downloadFiles.tsx b/src/app/components/downloadFiles.tsx
new file mode 100644
index 0000000..c7fcae5
--- /dev/null
+++ b/src/app/components/downloadFiles.tsx
@@ -0,0 +1,42 @@
+import { Button } from '@mui/material';
+import React from 'react';
+
+const downloadFile = (data : any, filename : string , fileExtension = "json") => {
+ const jsonString = JSON.stringify(data, null, 2);
+ const blob = new Blob([jsonString], { type: 'application/json' });
+ const href = URL.createObjectURL(blob);
+ const link = document.createElement('a');
+ link.href = href;
+ link.download = `${filename}.${fileExtension}`;
+ document.body.appendChild(link);
+ link.click();
+
+ // Cleanup
+ document.body.removeChild(link);
+ URL.revokeObjectURL(data);
+};
+
+const downloadSignature = (govActionID : string, voterKeyHash : string , signature : string) => {
+ const data = {
+ type: "Unwitnessed Tx ConwayEra",
+ description: "Ledger Cddl Format",
+ govActionID,
+ voterKeyHash,
+ cborHex: signature
+ };
+ downloadFile(data, "vote", "signature");
+}
+
+interface DownloadButtonProps {
+ govActionID: string;
+ voterKeyHash: string;
+ signature: string;
+ }
+
+export default function DownloadButton({ govActionID, voterKeyHash, signature }: DownloadButtonProps) {
+ return ;
+ }
+
\ No newline at end of file
diff --git a/src/app/components/transaction.tsx b/src/app/components/transaction.tsx
index 0cc3cda..c2d0551 100644
--- a/src/app/components/transaction.tsx
+++ b/src/app/components/transaction.tsx
@@ -5,11 +5,12 @@ import { useWallet } from "@meshsdk/react";
import { deserializeAddress } from "@meshsdk/core";
import { Button, TextField, Box, Typography, Container } from "@mui/material";
import * as CSL from "@emurgo/cardano-serialization-lib-browser";
-import ReactJsonPretty from 'react-json-pretty';
+import ReactJsonPretty from "react-json-pretty";
import * as txValidationUtils from "../utils/txValidationUtils";
import { TransactionChecks } from "./validationChecks";
-import { decodeHextoTx,convertGAToBech, getCardanoScanURL } from "../utils/txUtils";
+import {decodeHextoTx,convertGAToBech,getCardanoScanURL} from "../utils/txUtils";
import { VotingDetails } from "./votingDetails";
+import DownloadButton from "./downloadFiles";
export const TransactionButton = () => {
const [message, setMessage] = useState("");
@@ -22,6 +23,7 @@ export const TransactionButton = () => {
const [cardanoscan, setCardanoscan] = useState("");
const [metadataAnchorURL, setMetadataAnchorURL] = useState("");
const [metadataAnchorHash, setMetadataAnchorHash] = useState("");
+ const [stakeCredentialHash, setStakeCredentialHash] = useState("");
const [validationState, setValidationState] = useState({
isPartOfSigners: false,
isOneVote: false,
@@ -80,6 +82,7 @@ export const TransactionButton = () => {
const changeAddress = await wallet.getChangeAddress();
const stakeCred = deserializeAddress(changeAddress).stakeCredentialHash;
+ setStakeCredentialHash(stakeCred);
console.log("Connected wallet network ID:", network);
console.log("unsignedTransaction:", unsignedTransaction);
@@ -109,7 +112,7 @@ export const TransactionButton = () => {
isMetadataAnchorValid: await txValidationUtils.checkMetadataAnchor(voteMetadataURL,voteMetadataHash),
isUnsignedTransaction: txValidationUtils.isUnsignedTransaction(unsignedTransaction),
});
-
+
//********************************************Voting Details *********************************************************************/
const transactionNetworkID = transactionBody.outputs().get(0).address().to_bech32().startsWith("addr_test1") ? 0 : 1;
if (votes && hasOneVote) {
@@ -298,6 +301,9 @@ export const TransactionButton = () => {
>
{signature}
+
+
+
)}