Skip to content
This repository was archived by the owner on Mar 11, 2025. It is now read-only.

Commit 5cd5479

Browse files
authored
Adding Curve Option When Creating ATA (#7143)
1 parent 209362f commit 5cd5479

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

token/js/src/actions/createAssociatedTokenAccount.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import { getAssociatedTokenAddressSync } from '../state/mint.js';
1414
* @param confirmOptions Options for confirming the transaction
1515
* @param programId SPL Token program account
1616
* @param associatedTokenProgramId SPL Associated Token program account
17+
* @param allowOwnerOffCurve Allow the owner account to be a PDA (Program Derived Address)
1718
*
1819
* @return Address of the new associated token account
1920
*/
@@ -25,8 +26,15 @@ export async function createAssociatedTokenAccount(
2526
confirmOptions?: ConfirmOptions,
2627
programId = TOKEN_PROGRAM_ID,
2728
associatedTokenProgramId = ASSOCIATED_TOKEN_PROGRAM_ID,
29+
allowOwnerOffCurve = false,
2830
): Promise<PublicKey> {
29-
const associatedToken = getAssociatedTokenAddressSync(mint, owner, false, programId, associatedTokenProgramId);
31+
const associatedToken = getAssociatedTokenAddressSync(
32+
mint,
33+
owner,
34+
allowOwnerOffCurve,
35+
programId,
36+
associatedTokenProgramId,
37+
);
3038

3139
const transaction = new Transaction().add(
3240
createAssociatedTokenAccountInstruction(

0 commit comments

Comments
 (0)