diff --git a/explorer/src/components/AccountsCard.tsx b/explorer/src/components/AccountsCard.tsx
index 6d669994fb..7bdb67a6a1 100644
--- a/explorer/src/components/AccountsCard.tsx
+++ b/explorer/src/components/AccountsCard.tsx
@@ -7,7 +7,8 @@ import {
Account,
Status
} from "../providers/accounts";
-import { assertUnreachable, displayAddress } from "../utils";
+import { assertUnreachable } from "../utils";
+import { displayAddress } from "../utils/tx";
import { useCluster } from "../providers/cluster";
import { PublicKey, LAMPORTS_PER_SOL } from "@solana/web3.js";
diff --git a/explorer/src/components/TransactionModal.tsx b/explorer/src/components/TransactionModal.tsx
index 45fcfa7756..b870006e23 100644
--- a/explorer/src/components/TransactionModal.tsx
+++ b/explorer/src/components/TransactionModal.tsx
@@ -5,12 +5,13 @@ import {
ActionType,
Selected
} from "../providers/transactions";
-import { displayAddress } from "../utils";
+import { displayAddress, decodeCreate, decodeTransfer } from "../utils/tx";
import { useBlocks } from "../providers/blocks";
import {
LAMPORTS_PER_SOL,
TransferParams,
- CreateAccountParams
+ CreateAccountParams,
+ TransactionInstruction
} from "@solana/web3.js";
function TransactionModal() {
@@ -70,31 +71,27 @@ function TransactionDetails({ selected }: { selected: Selected }) {
);
}
- const details = block.transactions[selected.signature];
- if (!details) return renderError("Transaction not found");
+ const transaction = block.transactions[selected.signature];
+ if (!transaction) return renderError("Transaction not found");
- const { transfers, creates } = details;
- if (transfers.length === 0 && creates.length === 0)
- return renderError(
- "Details for this transaction's instructions are not yet supported"
- );
+ if (transaction.instructions.length === 0)
+ return renderError("No instructions found");
+
+ const instructionDetails = transaction.instructions.map((ix, index) => {
+ const transfer = decodeTransfer(ix);
+ if (transfer) return
{transfer.fromPubkey.toBase58()}
@@ -120,9 +124,17 @@ function TransferDetails({ transfer }: { transfer: TransferParams }) {
);
}
-function CreateDetails({ create }: { create: CreateAccountParams }) {
+function CreateDetails({
+ create,
+ index
+}: {
+ create: CreateAccountParams;
+ index: number;
+}) {
return (
{create.fromPubkey.toBase58()}
@@ -142,6 +154,31 @@ function CreateDetails({ create }: { create: CreateAccountParams }) {
);
}
+function InstructionDetails({
+ ix,
+ index
+}: {
+ ix: TransactionInstruction;
+ index: number;
+}) {
+ return (
+ {pubkey.toBase58()}
+ {displayAddress(ix.programId)}
+