Fix instruction validation for parsed memo instructions (#16591)
This commit is contained in:
parent
59268b8629
commit
013875e787
|
@ -185,11 +185,15 @@ function isRelevantInstruction(
|
|||
account.equals(pubkey) ||
|
||||
mintMap.get(account.toBase58())?.mint === address
|
||||
);
|
||||
} else {
|
||||
} else if (
|
||||
typeof instruction.parsed === "object" &&
|
||||
"info" in instruction.parsed
|
||||
) {
|
||||
return Object.entries(instruction.parsed.info).some(
|
||||
([key, value]) =>
|
||||
value === address ||
|
||||
(typeof value === "string" && mintMap.get(value)?.mint === address)
|
||||
);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -47,7 +47,11 @@ export class InstructionContainer {
|
|||
this.instructions = parsedTransaction.transaction.message.instructions.map(
|
||||
(instruction) => {
|
||||
if ("parsed" in instruction) {
|
||||
if (typeof instruction.parsed === "object") {
|
||||
instruction.parsed = create(instruction.parsed, ParsedInfo);
|
||||
} else if (typeof instruction.parsed !== "string") {
|
||||
throw new Error("Unexpected parsed response");
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
|
|
Loading…
Reference in New Issue