From 4b08055b7e889223c9ab4aaa5052d8ca20b103c9 Mon Sep 17 00:00:00 2001 From: Pavel Strakhov Date: Mon, 7 Oct 2024 15:38:57 +0100 Subject: [PATCH] fix(governance/xc_admin): fix price store instruction parsing (#2001) --- .../src/__tests__/PriceStoreProgramInstruction.test.ts | 4 ++++ .../xc_admin/packages/xc_admin_common/src/price_store.ts | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/governance/xc_admin/packages/xc_admin_common/src/__tests__/PriceStoreProgramInstruction.test.ts b/governance/xc_admin/packages/xc_admin_common/src/__tests__/PriceStoreProgramInstruction.test.ts index 7336ba44d..5a836414e 100644 --- a/governance/xc_admin/packages/xc_admin_common/src/__tests__/PriceStoreProgramInstruction.test.ts +++ b/governance/xc_admin/packages/xc_admin_common/src/__tests__/PriceStoreProgramInstruction.test.ts @@ -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(); }); diff --git a/governance/xc_admin/packages/xc_admin_common/src/price_store.ts b/governance/xc_admin/packages/xc_admin_common/src/price_store.ts index 7fa53e0ad..47aba211b 100644 --- a/governance/xc_admin/packages/xc_admin_common/src/price_store.ts +++ b/governance/xc_admin/packages/xc_admin_common/src/price_store.ts @@ -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) {