diff --git a/explorer/src/components/account/TokenHistoryCard.tsx b/explorer/src/components/account/TokenHistoryCard.tsx index 2fe9ba140e..484b14b726 100644 --- a/explorer/src/components/account/TokenHistoryCard.tsx +++ b/explorer/src/components/account/TokenHistoryCard.tsx @@ -25,6 +25,7 @@ import { TokenInstructionType, IX_TITLES, } from "components/instruction/token/types"; +import { reportError } from "utils/sentry"; export function TokenHistoryCard({ pubkey }: { pubkey: PublicKey }) { const address = pubkey.toBase58(); @@ -194,6 +195,21 @@ function TokenHistoryTable({ tokens }: { tokens: TokenInfoWithPubkey[] }) { ); } +function instructionTypeName( + ix: ParsedInstruction, + tx: ConfirmedSignatureInfo +): string { + try { + const parsed = coerce(ix.parsed, ParsedInfo); + const { type: rawType } = parsed; + const type = coerce(rawType, TokenInstructionType); + return IX_TITLES[type]; + } catch (err) { + reportError(err, { signature: tx.signature }); + return "Unknown"; + } +} + function TokenTransactionRow({ mint, tx, @@ -219,10 +235,7 @@ function TokenTransactionRow({ return ( <> {tokenInstructions.map((ix, index) => { - const parsed = coerce(ix.parsed, ParsedInfo); - const { type: rawType } = parsed; - const type = coerce(rawType, TokenInstructionType); - const typeName = IX_TITLES[type]; + const typeName = instructionTypeName(ix, tx); let statusText; let statusClass;