Skip to content
This repository has been archived by the owner on Feb 9, 2025. It is now read-only.

Commit

Permalink
Possibly init wallet base ata for the user on dual exercise (#1963)
Browse files Browse the repository at this point in the history
  • Loading branch information
brittcyr authored Dec 1, 2023
1 parent 64251a3 commit 3b08984
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions utils/instructions/Dual/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -479,6 +479,17 @@ export async function getExerciseInstruction({
additionalSerializedInstructions.push(serializeInstructionToBase64(ataIx))
}

// Possibly init the base token account that is receiving tokens from exercise.
const walletBaseAta = await findAssociatedTokenAddress(wallet.publicKey, baseMint);
if ((await connection.current.getAccountInfo(walletBaseAta)) === null) {
const [ataIx] = await createAssociatedTokenAccount(
wallet.publicKey,
wallet.publicKey,
baseMint
)
additionalSerializedInstructions.push(serializeInstructionToBase64(ataIx))
}

const prerequisiteInstructions: TransactionInstruction[] = []
const space = 165
const rent = await connection.current.getMinimumBalanceForRentExemption(
Expand Down

1 comment on commit 3b08984

@vercel
Copy link

@vercel vercel bot commented on 3b08984 Dec 1, 2023

Choose a reason for hiding this comment

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

Successfully deployed to the following URLs:

governance-ui – ./

governance-ui-solana-labs.vercel.app
governance-ui-git-main-solana-labs.vercel.app
app.realms.today

Please sign in to comment.