Skip to content

Commit

Permalink
Merge pull request #296 from metaDAOproject/staging
Browse files Browse the repository at this point in the history
feat: merge fix for coder error
  • Loading branch information
R-K-H authored Oct 12, 2024
2 parents 3bf7054 + 10660c2 commit 32c4140
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion packages/indexer/src/transaction/serializer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -378,8 +378,24 @@ function getIxWithDisplay(
if (!idl) {
return null;
}
const coder = new BorshInstructionCoder(idl);
let coder: BorshInstructionCoder | null = null;
let decodedIx: AnchorInstruction | null = null;

// Added because of this error:
// User defined types not provided
// TypeError: field.type is not an Object. (evaluating '"vec" in field.type')
try {
coder = new BorshInstructionCoder(idl);
} catch (e) {
logger.error("error with initializing coder", e);
return null;
}

if (!coder) {
logger.error("no coder can't continue");
return null;
}

try {
decodedIx = coder.decode(Buffer.from(instruction.data));
} catch (e) {
Expand Down

0 comments on commit 32c4140

Please sign in to comment.