Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pythnetwork/pyth-solana-receiver",
"version": "0.10.1",
"version": "0.10.2",
"description": "Pyth solana receiver SDK",
"homepage": "https://pyth.network",
"main": "lib/index.js",
Expand Down
62 changes: 33 additions & 29 deletions target_chains/solana/sdk/js/pyth_solana_receiver/src/vaa.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,35 +133,39 @@ async function generateVaaInstructionGroups(

// Second write and verify instructions
const writeSecondPartAndVerifyInstructions: InstructionWithEphemeralSigners[] =
[
{
instruction: await wormhole.methods
.writeEncodedVaa({
index: VAA_SPLIT_INDEX,
data: vaa.subarray(VAA_SPLIT_INDEX),
})
.accounts({
draftVaa: encodedVaaKeypair.publicKey,
})
.instruction(),
signers: [],
computeUnits: WRITE_ENCODED_VAA_COMPUTE_BUDGET,
},
{
instruction: await wormhole.methods
.verifyEncodedVaaV1()
.accounts({
guardianSet: getGuardianSetPda(
getGuardianSetIndex(vaa),
wormhole.programId,
),
draftVaa: encodedVaaKeypair.publicKey,
})
.instruction(),
signers: [],
computeUnits: VERIFY_ENCODED_VAA_COMPUTE_BUDGET,
},
];
[];

// The second write instruction is only needed if there are more bytes past the split index in the VAA
if (vaa.length > VAA_SPLIT_INDEX) {
writeSecondPartAndVerifyInstructions.push({
instruction: await wormhole.methods
.writeEncodedVaa({
index: VAA_SPLIT_INDEX,
data: vaa.subarray(VAA_SPLIT_INDEX),
})
.accounts({
draftVaa: encodedVaaKeypair.publicKey,
})
.instruction(),
signers: [],
computeUnits: WRITE_ENCODED_VAA_COMPUTE_BUDGET,
});
}

writeSecondPartAndVerifyInstructions.push({
instruction: await wormhole.methods
.verifyEncodedVaaV1()
.accounts({
guardianSet: getGuardianSetPda(
getGuardianSetIndex(vaa),
wormhole.programId,
),
draftVaa: encodedVaaKeypair.publicKey,
})
.instruction(),
signers: [],
computeUnits: VERIFY_ENCODED_VAA_COMPUTE_BUDGET,
});

// Close instructions
const closeInstructions: InstructionWithEphemeralSigners[] = [
Expand Down
Loading