Skip to content
This repository was archived by the owner on Mar 11, 2025. It is now read-only.
Merged
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
10 changes: 9 additions & 1 deletion token/js/src/actions/createAssociatedTokenAccountIdempotent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { getAssociatedTokenAddressSync } from '../state/mint.js';
* @param confirmOptions Options for confirming the transaction
* @param programId SPL Token program account
* @param associatedTokenProgramId SPL Associated Token program account
* @param allowOwnerOffCurve Allow the owner account to be a PDA (Program Derived Address)
*
* @return Address of the new or existing associated token account
*/
Expand All @@ -26,8 +27,15 @@ export async function createAssociatedTokenAccountIdempotent(
confirmOptions?: ConfirmOptions,
programId = TOKEN_PROGRAM_ID,
associatedTokenProgramId = ASSOCIATED_TOKEN_PROGRAM_ID,
allowOwnerOffCurve = false,
): Promise<PublicKey> {
const associatedToken = getAssociatedTokenAddressSync(mint, owner, false, programId, associatedTokenProgramId);
const associatedToken = getAssociatedTokenAddressSync(
mint,
owner,
allowOwnerOffCurve,
programId,
associatedTokenProgramId,
);

const transaction = new Transaction().add(
createAssociatedTokenAccountIdempotentInstruction(
Expand Down
Loading