From 2c728bb172a87e2c778c39459f369b2db68b0662 Mon Sep 17 00:00:00 2001 From: nvsriram <50625504+nvsriram@users.noreply.github.com> Date: Wed, 18 Jan 2023 19:27:30 -0500 Subject: [PATCH] Explorer: Add toggle for raw tx logs (#29765) Add toggle for raw tx logs --- .../transaction/ProgramLogSection.tsx | 39 ++++++++++++++++--- 1 file changed, 33 insertions(+), 6 deletions(-) diff --git a/explorer/src/components/transaction/ProgramLogSection.tsx b/explorer/src/components/transaction/ProgramLogSection.tsx index 8142ea279d..72101543df 100644 --- a/explorer/src/components/transaction/ProgramLogSection.tsx +++ b/explorer/src/components/transaction/ProgramLogSection.tsx @@ -4,8 +4,10 @@ import { useTransactionDetails } from "providers/transactions"; import { ProgramLogsCardBody } from "components/ProgramLogsCardBody"; import { parseProgramLogs } from "utils/program-logs"; import { useCluster } from "providers/cluster"; +import { TableCardBody } from "components/common/TableCardBody"; export function ProgramLogSection({ signature }: SignatureProps) { + const [showRaw, setShowRaw] = React.useState(false); const { cluster, url } = useCluster(); const details = useTransactionDetails(signature); @@ -26,14 +28,27 @@ export function ProgramLogSection({ signature }: SignatureProps) {

Program Instruction Logs

+
{prettyLogs !== null ? ( - + showRaw ? ( + + ) : ( + + ) ) : (
Logs not supported for this transaction @@ -43,3 +58,15 @@ export function ProgramLogSection({ signature }: SignatureProps) { ); } + +const RawProgramLogs = ({ raw }: { raw: string[] }) => { + return ( + + + +
{JSON.stringify(raw, null, 2)}
+ + +
+ ); +};