I have the following code that works fine with PDAs.
const escrow_pda = PublicKey.findProgramAddressSync([Buffer.from("escrow"), fundraiser.publicKey.toBytes()], program.programId)[0];const esc = await program.account.campaignEscrow.fetch(escrow_pda);
However, when I use the same fetch method on the following ATA, it returns Error: Invalid account discriminator
const vault_ata = (await getOrCreateAssociatedTokenAccount(provider.connection, fundraiser, mint_token, escrow_pda, true)).address const esc = await program.account.campaignEscrow.fetch(vault_ata);
What methods do you use to fetch data from the associated token account in typescript ?
EDIT:
How can I also get the token balance in Rust ?
//TokenAccountpub donor_ata: Account<'info, TokenAccount>,