diff --git a/explorer/src/components/instruction/InstructionCard.tsx b/explorer/src/components/instruction/InstructionCard.tsx index 543837f5bb..6ccdb4ff1c 100644 --- a/explorer/src/components/instruction/InstructionCard.tsx +++ b/explorer/src/components/instruction/InstructionCard.tsx @@ -11,6 +11,7 @@ import { useTransactionDetails, useFetchRawTransaction, } from "providers/transactions/details"; +import { Address } from "components/common/Address"; type InstructionProps = { title: string; @@ -73,11 +74,21 @@ export function InstructionCard({
Program | ++ + | +
Program | -- - | -
diff --git a/explorer/src/components/instruction/RawParsedDetails.tsx b/explorer/src/components/instruction/RawParsedDetails.tsx index 78682386be..76b514b2f2 100644 --- a/explorer/src/components/instruction/RawParsedDetails.tsx +++ b/explorer/src/components/instruction/RawParsedDetails.tsx @@ -1,47 +1,16 @@ import React from "react"; -import { ParsedInstruction, TransactionInstruction } from "@solana/web3.js"; -import { Address } from "components/common/Address"; -import { wrap } from "utils"; +import { ParsedInstruction } from "@solana/web3.js"; -type RawParsedDetailsProps = { +export function RawParsedDetails({ + ix, + children, +}: { ix: ParsedInstruction; - raw?: TransactionInstruction; -}; - -export function RawParsedDetails({ ix, raw }: RawParsedDetailsProps) { - let hex = null; - let b64 = null; - if (raw) { - hex = wrap(raw.data.toString("hex"), 50); - b64 = wrap(raw.data.toString("base64"), 50); - } - + children?: React.ReactNode; +}) { return ( <> - | |
Program | -- - | -
Instruction Data (Hex) | -
- {hex}- |
-
Instruction Data (Base64) | -
- {b64}- |
-
Instruction Data (JSON) | diff --git a/explorer/src/providers/transactions/details.tsx b/explorer/src/providers/transactions/details.tsx index 75dc5ba84b..134b3d35f0 100644 --- a/explorer/src/providers/transactions/details.tsx +++ b/explorer/src/providers/transactions/details.tsx @@ -128,34 +128,25 @@ async function fetchRawTransaction( cluster: Cluster, url: string ) { - dispatch({ - type: ActionType.Update, - status: FetchStatus.Fetching, - key: signature, - url, - }); - let fetchStatus; let transaction; try { transaction = await new Connection(url).getConfirmedTransaction(signature); fetchStatus = FetchStatus.Fetched; + dispatch({ + type: ActionType.Update, + status: fetchStatus, + key: signature, + data: { + raw: transaction, + }, + url, + }); } catch (error) { if (cluster !== Cluster.Custom) { reportError(error, { url }); } - fetchStatus = FetchStatus.FetchFailed; } - - dispatch({ - type: ActionType.Update, - status: fetchStatus, - key: signature, - data: { - raw: transaction, - }, - url, - }); } export function useFetchRawTransaction() {