Skip to content

Commit

Permalink
fix: changes after merge
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexStefan committed Feb 11, 2024
1 parent 3ac3543 commit b2ed80e
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/marinade-directed-stake.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,11 @@ export function getDirectedStakeSdk(
* If the vote address is left undefined the standard delegation strategy is used.
*
* @param {DirectedStakeSdk} directedStakeSdk - The DirectedStakeSdk instance
* @param {PublicKey} validatorVoteAddress - The vote address to identify the validator
* @param {PublicKey} target - The vote address to identify the validator
*/
export async function createDirectedStakeVoteIx(
directedStakeSdk: DirectedStakeSdk,
validatorVoteAddress?: PublicKey
target?: PublicKey
): Promise<TransactionInstruction | undefined> {
const owner = assertNotUndefinedAndReturn(
directedStakeSdk.program.provider.publicKey,
Expand All @@ -60,22 +60,22 @@ export async function createDirectedStakeVoteIx(
const { voteRecord } = await getUserVoteRecord(directedStakeSdk, owner)

if (!voteRecord) {
if (validatorVoteAddress) {
if (target) {
return (
await withCreateVote({
sdk: directedStakeSdk,
validatorVote: validatorVoteAddress,
target,
})
).instruction
}
return
}

if (validatorVoteAddress) {
if (target) {
return (
await withUpdateVote({
sdk: directedStakeSdk,
validatorVote: validatorVoteAddress,
target,
voteRecord: voteRecord.publicKey,
})
).instruction
Expand Down

0 comments on commit b2ed80e

Please sign in to comment.