@@ -11,7 +11,7 @@ import {
11
11
createAssociatedTokenAccountInstruction ,
12
12
createTransferInstruction ,
13
13
getAccount ,
14
- getAssociatedTokenAddress ,
14
+ getAssociatedTokenAddressSync ,
15
15
getMint ,
16
16
type Mint ,
17
17
} from "@solana/spl-token" ;
@@ -210,9 +210,10 @@ export class PythStakingClient {
210
210
const globalConfig = await this . getGlobalConfig ( ) ;
211
211
return getAccount (
212
212
this . connection ,
213
- await getAssociatedTokenAddress (
213
+ getAssociatedTokenAddressSync (
214
214
globalConfig . pythTokenMint ,
215
215
this . wallet . publicKey ,
216
+ true ,
216
217
) ,
217
218
) ;
218
219
}
@@ -446,9 +447,10 @@ export class PythStakingClient {
446
447
public async createStakeAccountAndDeposit ( amount : bigint ) {
447
448
const globalConfig = await this . getGlobalConfig ( ) ;
448
449
449
- const senderTokenAccount = await getAssociatedTokenAddress (
450
+ const senderTokenAccount = getAssociatedTokenAddressSync (
450
451
globalConfig . pythTokenMint ,
451
452
this . wallet . publicKey ,
453
+ true ,
452
454
) ;
453
455
454
456
const nonce = crypto . randomBytes ( 16 ) . toString ( "hex" ) ;
@@ -528,9 +530,10 @@ export class PythStakingClient {
528
530
const globalConfig = await this . getGlobalConfig ( ) ;
529
531
const mint = globalConfig . pythTokenMint ;
530
532
531
- const senderTokenAccount = await getAssociatedTokenAddress (
533
+ const senderTokenAccount = getAssociatedTokenAddressSync (
532
534
mint ,
533
535
this . wallet . publicKey ,
536
+ true ,
534
537
) ;
535
538
536
539
const instruction = createTransferInstruction (
@@ -551,9 +554,10 @@ export class PythStakingClient {
551
554
const mint = globalConfig . pythTokenMint ;
552
555
const instructions = [ ] ;
553
556
554
- const receiverTokenAccount = await getAssociatedTokenAddress (
557
+ const receiverTokenAccount = getAssociatedTokenAddressSync (
555
558
mint ,
556
559
this . wallet . publicKey ,
560
+ true ,
557
561
) ;
558
562
559
563
// Edge case: if the user doesn't have an ATA, create one
0 commit comments