feat: instruction name in transaction#945
feat: instruction name in transaction#945C0mberry wants to merge 8 commits intosolana-foundation:masterfrom
Conversation
|
@C0mberry is attempting to deploy a commit to the Solana Foundation Team on Vercel. A member of the Team first needs to authorize it. |
Greptile SummaryThis PR adds instruction-name badges to the Transaction History table by lazily fetching Confidence Score: 4/5Safe to merge after fixing the fallback label string in getTransactionInstructionNames. One P1 display bug: the fallback at line 144 appends " Program" to names that already contain it, producing visibly incorrect badge text for Compute Budget (and potentially other known programs) when their instruction fails to decode. Everything else — lazy fetching, state merging, badge overflow — is correct. app/utils/instruction.ts — specifically the fallback return at line 144. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[instruction from ParsedTransactionWithMeta] --> B{has 'parsed' field?}
B -->|Yes| C{ix.parsed is object with 'type'?}
C -->|Yes| D["return programName + ': ' + camelToTitleCase(type)"]
C -->|No - string| E["return programName + ': Memo' ⚠️ e.g. 'Memo Program: Memo'"]
B -->|No - PartiallyDecoded| F{programId == ComputeBudget?}
F -->|Yes| G[intoTransactionInstruction]
G --> H{txInstruction defined?}
H -->|Yes| I[identifyComputeBudgetInstruction]
I -->|success| J["return programName + ': ' + camelToTitleCase(name)"]
I -->|throws| K
H -->|No / throws| K["return programName + ' Program: Unknown' 🐛 e.g. 'Compute Budget Program Program: Unknown'"]
F -->|No| K
Reviews (1): Last reviewed commit: "lint fix" | Re-trigger Greptile |
| // fall through | ||
| } | ||
| } | ||
| return `${programName} Program: Unknown Instruction`; |
There was a problem hiding this comment.
Double "Program" in fallback label
getProgramName already returns strings that include "Program" (e.g., "Compute Budget Program", "System Program", "Token Program"), so appending " Program" here produces labels like "Compute Budget Program Program: Unknown Instruction". This will surface visibly in the UI for any Compute Budget instruction that can't be decoded (e.g., new instruction type not yet in @solana-program/compute-budget), and for any other known program that reaches this fallback. The correct fallback is simply ${programName}: Unknown Instruction.
| return `${programName} Program: Unknown Instruction`; | |
| return `${programName}: Unknown Instruction`; |
There was a problem hiding this comment.
i want to get "Unknown Program: Unknown Instruction" such naming
There was a problem hiding this comment.
Got it. Now I have the full picture. The new getProgramName in programs.ts (added in this PR) returns "Unknown" for unrecognized programs. So the fallback line needs to handle both cases:
- Known program →
"Compute Budget Program: Unknown Instruction"(no double "Program") - Unknown program →
"Unknown Program: Unknown Instruction"
Here's the fix:
| return `${programName} Program: Unknown Instruction`; | |
| return programName === 'Unknown' ? 'Unknown Program: Unknown Instruction' : `${programName}: Unknown Instruction`; |
This gives you exactly "Unknown Program: Unknown Instruction" for unrecognized programs, while keeping "System Program: Unknown Instruction" etc. for known ones.
Tip: You can customize Greptile's behavior for this repo with .greptile/rules and .greptile/config.
6fd4645 to
e283806
Compare
| @@ -17,21 +18,39 @@ import { toBase64 } from '@/app/shared/lib/bytes'; | |||
|
|
|||
| import { Copyable } from '../../common/Copyable'; | |||
| import { getTransactionRows, HistoryCardFooter, HistoryCardHeader } from '../HistoryCardComponents'; | |||
| import { InstructionBadges } from './InstructionBadges'; | |||
|
|
|||
| export function TransactionHistoryCard({ address }: { address: string }) { | |||
There was a problem hiding this comment.
I think, as we are reworking the TransactionHistoryCard component, we have to move it into a separate feature with tests, stories and all the goodness
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Description
Type of change
Screenshots
Testing
Related Issues
HOO-368
Checklist
build:infoscript to update build information