Skip to content

Conversation

@Riateche
Copy link
Contributor

No description provided.

@vercel
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-behjati ali-behjati 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