Fix bad system instruction type handling

This commit is contained in:
Justin Starry 2020-05-07 09:22:04 +08:00 committed by Michael Vines
parent 6c8a5747f7
commit e31b30c595
1 changed files with 2 additions and 2 deletions

View File

@ -58,9 +58,9 @@ export function decodeTransfer(
ix: TransactionInstruction
): TransferParams | null {
if (!ix.programId.equals(SystemProgram.programId)) return null;
if (SystemInstruction.decodeInstructionType(ix) !== "Transfer") return null;
try {
if (SystemInstruction.decodeInstructionType(ix) !== "Transfer") return null;
return SystemInstruction.decodeTransfer(ix);
} catch (err) {
console.error(ix, err);
@ -72,9 +72,9 @@ export function decodeCreate(
ix: TransactionInstruction
): CreateAccountParams | null {
if (!ix.programId.equals(SystemProgram.programId)) return null;
if (SystemInstruction.decodeInstructionType(ix) !== "Create") return null;
try {
if (SystemInstruction.decodeInstructionType(ix) !== "Create") return null;
return SystemInstruction.decodeCreateAccount(ix);
} catch (err) {
console.error(ix, err);