Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(xc-admin): add price store instructions and executor support #1900

Merged
merged 2 commits into from
Sep 16, 2024

Conversation

Riateche
Copy link
Contributor

No description provided.

Copy link

vercel bot commented Sep 12, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
api-reference ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 16, 2024 10:24am
pyth-staking-v2-mainnet ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 16, 2024 10:24am
staking-v2 ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 16, 2024 10:24am
xc-admin-frontend ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 16, 2024 10:24am

export function createPriceStoreInstruction(
data: PriceStoreInstruction
): TransactionInstruction {
if (data.type == "Initialize") {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i recommend using switch here, but if not triple equals (===)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Refactored to use switch.

throw new Error("instruction data is too short");
}
const publisherKey = new PublicKey(instruction.data.subarray(3, 35));
if (instruction.keys.length != 5) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

de we need to check remaining accounts to be valid?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've added a check that accounts and instruction data match the expected values.

Copy link
Collaborator

@ali-bahjati ali-bahjati left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

@Riateche Riateche merged commit 5527782 into main Sep 16, 2024
8 checks passed
@Riateche Riateche deleted the xc-admin-price-store-instructions branch September 16, 2024 11:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants