Skip to content

Commit

Permalink
fix(governance/xc_admin): fix price store instruction parsing (#2001)
Browse files Browse the repository at this point in the history
  • Loading branch information
Riateche authored Oct 7, 2024
1 parent 4dfb294 commit 4b08055
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ test("Price store instruction parse: roundtrip", (done) => {
const instruction = createPriceStoreInstruction(data);
const parsed = parsePriceStoreInstruction(instruction);
expect(parsed).toStrictEqual(data);

instruction.programId = new PublicKey(instruction.programId.toBuffer());
const parsed2 = parsePriceStoreInstruction(instruction);
expect(parsed2).toStrictEqual(data);
}
done();
});
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ export function createPriceStoreInstruction(
export function parsePriceStoreInstruction(
instruction: TransactionInstruction
): PriceStoreInstruction {
if (instruction.programId != PRICE_STORE_PROGRAM_ID) {
if (!instruction.programId.equals(PRICE_STORE_PROGRAM_ID)) {
throw new Error("program ID mismatch");
}
if (instruction.data.length < 1) {
Expand Down

0 comments on commit 4b08055

Please sign in to comment.