-
Notifications
You must be signed in to change notification settings - Fork 213
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(xc-admin): add price store instructions and executor support (#1900
) * feat(xc-admin): add price store instructions and executor support * refactor(governance/xc_admin): use switch, verify data and accounts
- Loading branch information
Showing
4 changed files
with
364 additions
and
2 deletions.
There are no files selected for viewing
40 changes: 40 additions & 0 deletions
40
...ance/xc_admin/packages/xc_admin_common/src/__tests__/PriceStoreProgramInstruction.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import { PublicKey } from "@solana/web3.js"; | ||
import { | ||
createPriceStoreInstruction, | ||
parsePriceStoreInstruction, | ||
PriceStoreInstruction, | ||
} from "../price_store"; | ||
|
||
test("Price store instruction parse: roundtrip", (done) => { | ||
const items: PriceStoreInstruction[] = [ | ||
{ | ||
type: "Initialize", | ||
data: { | ||
payerKey: new PublicKey("Fe9vtgwRhbMSUsAjwUzupzRoJKofyyk1Rz8ZUrPmGHMr"), | ||
authorityKey: new PublicKey( | ||
"D9rnZSLjdYboFGDGHk5Qre2yBS8HYbc6374Zm6AeC1PB" | ||
), | ||
}, | ||
}, | ||
{ | ||
type: "InitializePublisher", | ||
data: { | ||
authorityKey: new PublicKey( | ||
"D9rnZSLjdYboFGDGHk5Qre2yBS8HYbc6374Zm6AeC1PB" | ||
), | ||
publisherKey: new PublicKey( | ||
"EXAyN9UVu1x163PQkVzyNm4YunNkMGu5Ry7ntoyyQGTe" | ||
), | ||
bufferKey: new PublicKey( | ||
"7q6SS575jGDjE8bWsx4PiLVqS7cHJhjJBhysvRoP53WJ" | ||
), | ||
}, | ||
}, | ||
]; | ||
for (const data of items) { | ||
const instruction = createPriceStoreInstruction(data); | ||
const parsed = parsePriceStoreInstruction(instruction); | ||
expect(parsed).toStrictEqual(data); | ||
} | ||
done(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.