Correct `findAssociatedTokenAddress` JS sample

Fixes #869
This commit is contained in:
Michael Vines 2020-11-18 10:13:16 -08:00 committed by GitHub
parent 222ec663df
commit eff3677b46
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -53,14 +53,14 @@ async function findAssociatedTokenAddress(
walletAddress: Pubkey, walletAddress: Pubkey,
tokenMintAddress: Pubkey tokenMintAddress: Pubkey
): Promise<PublicKey> { ): Promise<PublicKey> {
return PublicKey.findProgramAddress( return (await PublicKey.findProgramAddress(
[ [
walletAddress.toBuffer(), walletAddress.toBuffer(),
SPL_TOKEN_PROGRAM_ID.toBuffer(), SPL_TOKEN_PROGRAM_ID.toBuffer(),
tokenMintAddress.toBuffer(), tokenMintAddress.toBuffer(),
], ],
SPL_ASSOCIATED_TOKEN_ACCOUNT_PROGRAM_ID SPL_ASSOCIATED_TOKEN_ACCOUNT_PROGRAM_ID
)[0]; ))[0];
} }
``` ```