@@ -11,7 +11,7 @@ import type {
1111} from '../types' ;
1212import { toInstructionPlan } from '../instructions/_plan' ;
1313import { createLoadInstructions as createLoadInstructionsDefault } from '../instructions/load' ;
14- import { getAtaAddress } from '../read' ;
14+ import { getAssociatedTokenAddress } from '../read' ;
1515import { toBigIntAmount , getMintDecimals } from '../helpers' ;
1616import { createTransferCheckedInstruction } from '../instructions/transfer' ;
1717import { getSplInterfaces } from '../spl-interface' ;
@@ -76,15 +76,13 @@ export async function createTransferInstructions(
7676 splInterfaces : transferSplInterfaces ,
7777 } ) ;
7878
79- const recipientAta = getAtaAddress ( {
80- owner : recipient ,
79+ const recipientAta = getAssociatedTokenAddress (
8180 mint ,
82- programId : recipientTokenProgramId ,
83- } ) ;
84- const senderAta = getAtaAddress ( {
85- owner : sourceOwner ,
86- mint,
87- } ) ;
81+ recipient ,
82+ true ,
83+ recipientTokenProgramId ,
84+ ) ;
85+ const senderAta = getAssociatedTokenAddress ( mint , sourceOwner , true ) ;
8886
8987 let transferInstruction : TransactionInstruction ;
9088 if ( recipientTokenProgramId . equals ( LIGHT_TOKEN_PROGRAM_ID ) ) {
@@ -132,7 +130,7 @@ export async function createApproveInstructions(
132130 input : CreateApproveInstructionsInput ,
133131) : Promise < TransactionInstruction [ ] > {
134132 const { rpc, payer, owner, mint, delegate, amount } = input ;
135- const tokenAccount = getAtaAddress ( { owner, mint } ) ;
133+ const tokenAccount = getAssociatedTokenAddress ( mint , owner , true ) ;
136134
137135 return [
138136 ...( await createLoadInstructionsDefault ( {
@@ -156,7 +154,7 @@ export async function createRevokeInstructions(
156154 input : CreateRevokeInstructionsInput ,
157155) : Promise < TransactionInstruction [ ] > {
158156 const { rpc, payer, owner, mint } = input ;
159- const tokenAccount = getAtaAddress ( { owner, mint } ) ;
157+ const tokenAccount = getAssociatedTokenAddress ( mint , owner , true ) ;
160158
161159 return [
162160 ...( await createLoadInstructionsDefault ( {
@@ -178,7 +176,7 @@ export async function createBurnInstructions(
178176 input : CreateBurnInstructionsInput ,
179177) : Promise < TransactionInstruction [ ] > {
180178 const { rpc, payer, owner, mint, authority, amount, decimals } = input ;
181- const tokenAccount = getAtaAddress ( { owner, mint } ) ;
179+ const tokenAccount = getAssociatedTokenAddress ( mint , owner , true ) ;
182180
183181 const amountBn = toBigIntAmount ( amount ) ;
184182 const burnIx =
@@ -216,7 +214,7 @@ export async function createFreezeInstructions(
216214 input : CreateFreezeInstructionsInput ,
217215) : Promise < TransactionInstruction [ ] > {
218216 const { rpc, payer, owner, mint, freezeAuthority } = input ;
219- const tokenAccount = getAtaAddress ( { owner, mint } ) ;
217+ const tokenAccount = getAssociatedTokenAddress ( mint , owner , true ) ;
220218
221219 return [
222220 ...( await createLoadInstructionsDefault ( {
@@ -238,7 +236,7 @@ export async function createThawInstructions(
238236 input : CreateThawInstructionsInput ,
239237) : Promise < TransactionInstruction [ ] > {
240238 const { rpc, payer, owner, mint, freezeAuthority } = input ;
241- const tokenAccount = getAtaAddress ( { owner, mint } ) ;
239+ const tokenAccount = getAssociatedTokenAddress ( mint , owner , true ) ;
242240
243241 return [
244242 ...( await createLoadInstructionsDefault ( {
0 commit comments