Skip to content
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: 6 additions & 4 deletions modules/sdk-coin-sol/src/lib/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -544,12 +544,14 @@ export async function getAssociatedTokenAccountAddress(
}

const coin = getSolTokenFromAddressOnly(tokenMintAddress);
if (!coin || !(coin instanceof SolCoin)) {
throw new UtilsError(`Token not found or not a Solana token: ${tokenMintAddress}`);
let ataAddress: PublicKey;
let programId: string;
if (coin && coin instanceof SolCoin && (coin as any).programId) {
programId = (coin as any).programId.toString();
} else {
programId = TOKEN_PROGRAM_ID.toString();
}

let ataAddress: PublicKey;
const programId = coin.programId;
if (programId === TOKEN_2022_PROGRAM_ID.toString()) {
ataAddress = await getAssociatedTokenAddress(mintPublicKey, ownerPublicKey, false, TOKEN_2022_PROGRAM_ID);
} else {
Expand Down