From e7caec852dc988b77c2e60f2f31f58fe0334cd17 Mon Sep 17 00:00:00 2001 From: CCristi Date: Tue, 25 Jun 2024 14:30:39 +0200 Subject: [PATCH] chore: Skip decoding instructions with broken instruction parser --- .../src/components/decoders/instructions.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/packages/explorerkit-server/src/components/decoders/instructions.ts b/packages/explorerkit-server/src/components/decoders/instructions.ts index 768102c..f33cbdd 100644 --- a/packages/explorerkit-server/src/components/decoders/instructions.ts +++ b/packages/explorerkit-server/src/components/decoders/instructions.ts @@ -15,10 +15,16 @@ export function decodeInstruction(idls: IdlsMap, instruction: Instruction): Inst }; let parser = idls.get(programId); - if (parser == null) { + if (!parser) { return parsedInstruction; // Short-circuit without decodedData since IDL is missing } - let instructionParser = parser.createParser(ParserType.INSTRUCTION); + + let instructionParser; + try { + instructionParser = parser.createParser(ParserType.INSTRUCTION); + } catch { + return parsedInstruction; // Short-circuit without instructionParser we can't decode the instruction + } if (!instructionParser || !checkIfInstructionParser(instructionParser)) { return parsedInstruction; // Short-circuit without decodedData parser can't be created