diff --git a/applications/tari_dan_wallet_web_ui/package-lock.json b/applications/tari_dan_wallet_web_ui/package-lock.json index 3cf86380cb..cde0162304 100644 --- a/applications/tari_dan_wallet_web_ui/package-lock.json +++ b/applications/tari_dan_wallet_web_ui/package-lock.json @@ -16,6 +16,7 @@ "@tanstack/react-query": "^4.33.0", "@tanstack/react-query-devtools": "^4.33.0", "async-mutex": "^0.4.0", + "file-saver": "^2.0.5", "react": "^18.2.0", "react-dom": "^18.2.0", "react-icons": "^4.9.0", @@ -1379,6 +1380,11 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/file-saver": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/file-saver/-/file-saver-2.0.5.tgz", + "integrity": "sha512-P9bmyZ3h/PRG+Nzga+rbdI4OEpNDzAVyy74uVO9ATgzLK6VtAsYybF/+TOCvrc0MO793d6+42lLyZTw7/ArVzA==" + }, "node_modules/find-root": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/find-root/-/find-root-1.1.0.tgz", diff --git a/applications/tari_dan_wallet_web_ui/package.json b/applications/tari_dan_wallet_web_ui/package.json index d52f302bdd..09a0fac527 100644 --- a/applications/tari_dan_wallet_web_ui/package.json +++ b/applications/tari_dan_wallet_web_ui/package.json @@ -17,6 +17,7 @@ "@tanstack/react-query": "^4.33.0", "@tanstack/react-query-devtools": "^4.33.0", "async-mutex": "^0.4.0", + "file-saver": "^2.0.5", "react": "^18.2.0", "react-dom": "^18.2.0", "react-icons": "^4.9.0", diff --git a/applications/tari_dan_wallet_web_ui/src/routes/Transactions/Substates.tsx b/applications/tari_dan_wallet_web_ui/src/routes/Transactions/Substates.tsx index 8237c46f66..90e71f045c 100644 --- a/applications/tari_dan_wallet_web_ui/src/routes/Transactions/Substates.tsx +++ b/applications/tari_dan_wallet_web_ui/src/routes/Transactions/Substates.tsx @@ -41,7 +41,6 @@ function RowData({ info, state }: any, index: number) { const theme = useTheme(); const itemKey = Object.keys(info[0])[0]; const itemValue = Object.values(info[0])[0]; - console.log(info); return ( <> diff --git a/applications/tari_dan_wallet_web_ui/src/routes/Transactions/TransactionDetails.tsx b/applications/tari_dan_wallet_web_ui/src/routes/Transactions/TransactionDetails.tsx index 7e63d5da21..4a085b20cf 100644 --- a/applications/tari_dan_wallet_web_ui/src/routes/Transactions/TransactionDetails.tsx +++ b/applications/tari_dan_wallet_web_ui/src/routes/Transactions/TransactionDetails.tsx @@ -26,6 +26,7 @@ import { useTransactionDetails } from "../../api/hooks/useTransactions"; import { Accordion, AccordionDetails, AccordionSummary } from "../../Components/Accordion"; import { Grid, Table, TableContainer, TableBody, TableRow, TableCell, Button, Fade, Alert } from "@mui/material"; import Typography from "@mui/material/Typography"; +import { saveAs } from 'file-saver'; import { DataTableCell, StyledPaper } from "../../Components/StyledComponents"; import PageHeading from "../../Components/PageHeading"; import Events from "./Events"; @@ -66,21 +67,21 @@ export default function TransactionDetails() { if (result) { if (result.result.Accept) { return ( - Accepted); + Accepted); } if (result.result.AcceptFeeRejectRest) { return ( - {result.result.AcceptFeeRejectRest[1].ExecutionFailure} + {result.result.AcceptFeeRejectRest[1].ExecutionFailure} ); } if (result.result.Reject) { return ( - {Object.keys(result.result.Reject)[0]} - {result.result.Reject[Object.keys(result.result.Reject)[0]]} + {Object.keys(result.result.Reject)[0]} - {result.result.Reject[Object.keys(result.result.Reject)[0]]} ) } } else { return ( - In progress + In progress ); } } @@ -107,6 +108,14 @@ export default function TransactionDetails() { ); } + console.log(data); + const handleDownload = () => { + const json = JSON.stringify(data, null, 2); + const blob = new Blob([json], { type: 'application/json' }); + const filename = `tx-${data?.transaction?.id}.json` || 'tx-unknown_id.json'; + saveAs(blob, filename); + } + if (data.status === "Rejected" || data.status === "InvalidTransaction") { return ( @@ -128,6 +137,10 @@ export default function TransactionDetails() { + + JSON + + Reason @@ -172,6 +185,10 @@ export default function TransactionDetails() { Result {renderResult(data?.result)} + + JSON + + {data?.transaction_failure ? ( Reason @@ -190,7 +207,7 @@ export default function TransactionDetails() { alignItems: "center", padding: "2rem 1rem 0.5rem 1rem", }} - // className="flex-container" + // className="flex-container" > More Info