Introducing a new way to review your PRs.

Read the announcement

solana-foundation / explorer

Explorer for Solana clusters

View on GitHub

23 documents · Updated Nov 23, 2026

docs / instruction-card-rendering

Instruction card rendering model

Instruction cards give transaction and message inspection one shared way to explain a program call. They turn an instruction node into a card with decoded fields, account roles, arguments, events, raw data, and nested calls. The transaction page and the inspector use the same card model with different viewing context.

Instruction card entity

The instruction-card entity separates instruction meaning from page context. Program-specific cards describe the useful content, while the shared frame supplies position, result state, raw access, collapse behavior, and nested-card layout.

Instruction node model

An instruction node is the unit that a card renders. It carries the instruction position, the parsed or wire instruction, its program identity, and optional child nodes for inner instructions. A child position is shown as a path such as 3.2, so readers can relate a nested call to its parent.

The node keeps the instruction itself separate from the card's decoded data. This lets a card change its field presentation without changing the source instruction. A raw instruction is also retained when the card needs exact account keys and instruction bytes.

References: app/…/node.ts• L3-47 app/…/instruction-nodes.ts• L11-35

Instruction surface model

An instruction surface is the context in which cards run. It supplies the card component, transaction result, optional signature, sibling instruction data, raw-instruction access, collapse policy, and raw-view program checks.

The transaction surface connects cards to a confirmed signature and can fetch raw instructions on demand. The inspector surface has no execution result or signature, starts cards collapsed, and checks that a program exists and is executable because the message has not run. This context keeps those differences out of every program card.

References: app/…/surface.tsx• L9-43 app/…/TxInstructionSurface.tsx• L18-50 app/…/inspector-surface.tsx• L3-18

Card declarations

app/…/define-instruction-card.tsx defines the reusable card declaration model. A declaration gives a title and a function that maps decoded information to field descriptors. The shared view then adds the program row and common card behavior.

This model covers the common label-and-value shape. A card that needs asynchronous data or event data can use the same view directly and build its rows around that data. In both cases, program-specific meaning remains separate from the shared frame.

References: app/…/define-instruction-card.tsx• L8-61 app/…/InstructionCardView.tsx• L11-43

Instruction content renderers

The content model turns decoded instruction information into a small set of renderable rows and blocks. Each renderer preserves the meaning of the value while the shared table controls its layout.

Field renderer

Field descriptors represent ordinary instruction details. They can show addresses, SOL, bytes, epochs, slots, strings, text, timestamps, JSON, or preformatted values. A heading names a group, and a note explains a state that has no value to show.

The value renderer maps each field kind to a user-facing form. Addresses keep their link or token label behavior. Lists keep repeated addresses as separate values. SOL, epochs, slots, and timestamps use their domain displays. Strings can be copied, while preformatted values preserve line breaks and JSON remains readable as structured data. These rules keep cards consistent even when different programs supply different fields.

The field renderer also supports wide content blocks. Raw bytes can show hex and base64 views with copy and download actions. Document text stays intact for reading and copying. A payload puts raw bytes beside decoded content and opens on the raw view.

References: app/…/fields.ts• L6-71 app/…/fields.ts• L73-189 app/…/InstructionFields.tsx• L20-96 app/…/ValueCell.tsx• L16-74 app/…/FieldBlock.tsx• L12-71

Token instruction renderer

The token instruction renderer adapts parsed token data to the shared card model. It adds token context when account data is available, formats amounts with mint decimals and symbols, and keeps a raw amount view when that context is missing. This lets the same card explain both parsed RPC instructions and byte-form instructions without changing the common card frame.

For byte-form instructions, the renderer separates account rows from argument rows by matching decoded addresses to the wire account list. It preserves the account roles and leaves values that cannot be safely interpreted in a clear raw form.

References: app/…/TokenDetailsCard.tsx• L35-115 app/…/TokenDetailsCard.tsx• L139-221 app/…/TokenDetailsCard.spec.tsx• L74-141 app/…/TokenDetailsCard.spec.tsx• L395-465

Account renderer

Account rows explain which instruction accounts a program call uses. Each row shows a human-readable name, address, signer role, and writable role. IDL account groups add nesting so a reader can expand only the account group of interest.

When names do not cover all accounts, the renderer labels the remaining positions instead of hiding them. This keeps the decoded view aligned with the wire instruction even when an interface definition is incomplete.

References: app/…/accounts.ts• L5-76 app/…/DecodedInstructionCard.tsx• L49-115 app/…/AccountNameCell.tsx• L1-80

Argument renderer

Arguments are shown as a tree of names, types, and values. Scalars appear as value rows. Objects, arrays, maps, and enum-like values form expandable groups. Empty groups remain visible so an absent value is not mistaken for an omitted field.

Codama data is converted into this common argument model before rendering. Discriminator and option markers guide decoding but do not become user-facing argument rows.

References: app/…/args.ts• L5-94 app/…/ArgRows.tsx• L11-57

Event renderer

Events are program messages recovered from transaction logs. A decoded event shows its name and argument tree. An unknown event keeps its bytes and shows them as raw data.

Events belong to a transaction surface rather than to the instruction node. This allows cards that read logs to add event rows while inspector cards, which have no transaction logs, omit them.

References: app/…/events.ts• L1-6 app/…/EventRows.tsx• L14-56 app/…/InstructionCardView.tsx• L21-28

Raw-data renderer

Every card can expose a Raw view beside its decoded view. The Raw view shows the program, account keys, and instruction bytes for a wire instruction. For a parsed instruction it also shows the provider's parsed JSON. If the exact wire form is not available, the card states that limitation instead of presenting incomplete data as exact.

The transaction page can fetch missing top-level raw instructions when the reader opens Raw. Inner instructions do not have separate wire rows, so their raw source remains unavailable unless the node already carries one. The inspector uses the message it has and validates the target program in Raw mode.

References: app/…/raw-source.ts• L5-26 app/…/BaseInstructionCard.tsx• L30-102 app/…/BaseRawDetails.tsx• L10-55 app/…/BaseRawParsedDetails.tsx• L6-28

Instruction card composition

The shared frame composes the renderers into one readable unit. It marks the instruction position and result state, offers decoded and Raw views, and places nested calls and events after the main content.

Transaction screen composition

The transaction screen creates top-level nodes in message order and attaches trusted inner instructions to their parent. It gives the shared node list to InstructionNodeCards, which asks the surface's card component to render each node.

The card router chooses a program-specific explanation when a decoder recognizes the instruction. It can use parsed data, raw data, or an IDL-based explanation. If no explanation is available, the instruction remains visible through a generic card. A card error also falls back to that generic view so one bad instruction does not remove the rest of the transaction.

This relationship is part of the broader transaction inspection flow. The instruction decoding and simulation page explains how the router obtains decoded instruction information.

References: app/…/InstructionsSection.tsx• L15-53 app/…/InstructionNodeCard.tsx• L57-112 app/…/InstructionNodeCard.tsx• L124-201 app/…/InstructionNodeCards.tsx• L9-43

Inspector screen composition

The inspector decompiles a message after its address lookup tables resolve. It builds the same node shape and places those nodes inside an inspector surface. The result is the same card language without a confirmed execution result, signature, or transaction-log events.

The inspector can also attach compiled inner instructions when they are supplied. Each parent card then renders its child cards under an Inner Instructions group. A missing node still gets an Unknown Instruction frame with its position, so gaps remain visible in the message order.

The transaction detail route describes how users reach transaction views. The transaction sharing page describes how inspection links and public transaction views are shared.

References: app/…/InstructionsSection.tsx• L25-95 app/…/InstructionNodeCards.tsx• L19-43 app/…/BaseInstructionCard.tsx• L87-101

Nested instruction composition

Nested cards preserve the parent-child relationship instead of flattening all calls into one list. The parent frame places its children below the main rows, and each child gets its own position, raw toggle, decoded content, and possible events.

The shared surface supplies the same card component to both levels. This keeps a child call subject to the same program routing and fallback rules as a top-level call while its position still identifies the parent instruction.

References: app/…/BaseInstructionCard.tsx• L87-101 app/…/InstructionNodeCards.tsx• L9-31 app/…/node.ts• L14-23

Change checklist

When these files or sections are changed, remember to consider these:

  • Changes to InstructionNode must keep top-level and child positions aligned with raw lookup and log event labels.
  • Changes to InstructionSurface must preserve the different contracts for confirmed transactions and unexecuted messages.
  • Changes to field or argument value kinds must update both the descriptor model and its renderer so decoded cards do not silently lose values.
  • Changes to raw instruction access must preserve the distinction between fetched top-level bytes, unavailable version data, and inner instructions without wire data.
  • Changes to account names must keep nested groups, account positions, and remaining accounts aligned with the instruction's account list.
  • Changes to child-node composition must keep generic fallback cards visible for missing or failing top-level and inner instructions.
  • Changes to event data must keep transaction-log events out of inspector surfaces while preserving raw bytes for unknown events.
  • Changes to token amount context must preserve the distinction between UI amounts with mint metadata and raw amounts without known decimals.
  • Changes to token account matching must keep wire account order aligned with decoded address rows, including repeated addresses and unnamed accounts.
  • Changes to FieldValue kinds must keep value display behavior aligned with copy actions, links, line breaks, and structured JSON presentation.

Important failure modes

TriggerConsequenceGuard
A node position or child index changesRaw lookup, event labels, and scroll anchors can point to the wrong instructionBuild positions from the message index and preserve the parent index for children
A transaction card has no signature in its surfaceLog-derived events and transaction raw data cannot be associated with the cardPass the confirmed signature through TxInstructionSurface
A raw instruction cannot be reconstructed for a supported message versionThe Raw view could show false account or byte dataShow the unavailable state and keep the parsed view usable
An IDL has fewer account names than the instruction has accountsValid accounts can disappear from the decoded viewRender remaining accounts with position-based labels
A program-specific card throwsOne instruction could break the whole instruction sectionKeep the per-card error boundary and generic fallback
A decoded event cannot be identifiedEvent details would be misleading or silently lostKeep the event bytes and render an unknown event
Inner instructions are flattened into the top-level listReaders lose which parent call produced a nested callAttach children to the parent node and render them inside its card
Token mint metadata is unavailableThe card may show a raw amount instead of a user amount or symbolKeep the raw amount visible and use mint or token-account data only when known
A token byte instruction has repeated decoded addressesAccount rows can be matched to the wrong fieldFall back to the common field view instead of assigning ambiguous account names
A new field kind has no value rendererThe row can render without a useful value or fail at runtimeAdd the kind to Value and preserve its display semantics

Key files

FileWhy to read it
app/…/node.tsDefines the shared instruction node and position model.
app/…/surface.tsxDefines the context shared by transaction and inspector cards.
app/…/define-instruction-card.tsxShows the short declaration model for common decoded cards.
app/…/fields.tsDefines field values and wide content blocks used by cards.
app/…/accounts.tsDefines account names, groups, roles, and visibility.
app/…/args.tsDefines the nested argument model used by decoded instructions and events.
app/…/ValueCell.tsxShows how shared field values become links, balances, copied text, structured JSON, and other displays.
app/…/FieldBlock.tsxShows how raw and decoded wide content stays together in a field block.
app/…/BaseInstructionCard.tsxComposes decoded content, Raw content, child cards, and events.
app/…/DecodedInstructionCard.tsxShows how program, account, argument, and extra field rows form a decoded card.
app/…/InstructionNodeCards.tsxRenders lists of top-level or nested nodes and missing-node fallbacks.
app/…/TxInstructionSurface.tsxConnects cards to confirmed transaction data and lazy raw loading.
app/…/inspector-surface.tsxDefines the unexecuted-message card context.
app/…/InstructionsSection.tsxShows how the transaction page assembles and mounts instruction cards.
app/…/InstructionsSection.tsxShows how the inspector assembles the same card model from a message.
app/…/InstructionNodeCard.tsxShows program routing, IDL fallback, and per-card failure handling.
app/…/TokenDetailsCard.tsxShows how token instructions add token-aware fields and account rows to the shared card model.