Skip to content

Commit 4b08055

Browse files
authored
fix(governance/xc_admin): fix price store instruction parsing (#2001)
1 parent 4dfb294 commit 4b08055

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

governance/xc_admin/packages/xc_admin_common/src/__tests__/PriceStoreProgramInstruction.test.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@ test("Price store instruction parse: roundtrip", (done) => {
3535
const instruction = createPriceStoreInstruction(data);
3636
const parsed = parsePriceStoreInstruction(instruction);
3737
expect(parsed).toStrictEqual(data);
38+
39+
instruction.programId = new PublicKey(instruction.programId.toBuffer());
40+
const parsed2 = parsePriceStoreInstruction(instruction);
41+
expect(parsed2).toStrictEqual(data);
3842
}
3943
done();
4044
});

governance/xc_admin/packages/xc_admin_common/src/price_store.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ export function createPriceStoreInstruction(
149149
export function parsePriceStoreInstruction(
150150
instruction: TransactionInstruction
151151
): PriceStoreInstruction {
152-
if (instruction.programId != PRICE_STORE_PROGRAM_ID) {
152+
if (!instruction.programId.equals(PRICE_STORE_PROGRAM_ID)) {
153153
throw new Error("program ID mismatch");
154154
}
155155
if (instruction.data.length < 1) {

0 commit comments

Comments
 (0)