I want to transfer custom spl-token by '@solana/web3.js'.
I call a function getOrCreateAssociatedTokenAccount. It returns TokenAccountNotFoundError
const connection = new Connection('https://api.devnet.solana.com', 'confirmed');
const adminPubKey = new PublicKey(my wallet publicKey);
const mintAccount = await getMintAccount(tokenId);
const { signTransaction } = useWallet();
const adminTokenAccount = await findATA(
connection,
adminPubKey,
new PublicKey(mintAccount.toString()),
adminPubKey,
signTransaction, //
);
const findATA = async (connection, payer, tokenMintAddress, walletAddress, signTransaction) => {
return await getOrCreateAssociatedTokenAccount(
connection,
payer,
tokenMintAddress,
walletAddress,
signTransaction,
);
};
it always returns null.
return await
since the function that callsfindATA()
is already awaiting the result.