Skip to content

Commit

Permalink
Check delegated position before tracking
Browse files Browse the repository at this point in the history
  • Loading branch information
ChewingGlass committed Mar 6, 2025
1 parent 379c735 commit 8c237dd
Showing 1 changed file with 22 additions and 16 deletions.
38 changes: 22 additions & 16 deletions packages/helium-vote-service/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -559,22 +559,28 @@ server.post<{
.instruction();
instructions.push(countIx);
if (vote.delegatedPosition) {
const delegatedCountIx = await heliumSubDaosProgram.methods
.trackVoteV0()
.accounts({
payer: pdaWallet,
delegatedPosition: new PublicKey(vote.delegatedPosition),
registrar: HNT_REGISTRAR,
position: positionKey(new PublicKey(vote.asset))[0],
proposal,
mint: new PublicKey(vote.asset),
marker: voteMarkerKey(
new PublicKey(vote.asset),
proposal
)[0],
})
.instruction();
instructions.push(delegatedCountIx);
const delegatedPosition =
await provider.connection.getAccountInfo(
new PublicKey(vote.delegatedPosition)
);
if (delegatedPosition) {
const delegatedCountIx = await heliumSubDaosProgram.methods
.trackVoteV0()
.accounts({
payer: pdaWallet,
delegatedPosition: new PublicKey(vote.delegatedPosition),
registrar: HNT_REGISTRAR,
position: positionKey(new PublicKey(vote.asset))[0],
proposal,
mint: new PublicKey(vote.asset),
marker: voteMarkerKey(
new PublicKey(vote.asset),
proposal
)[0],
})
.instruction();
instructions.push(delegatedCountIx);
}
}
return instructions;
})
Expand Down

0 comments on commit 8c237dd

Please sign in to comment.