Please help i'm trying to create an Associated token account for a PDA onchain using
let create_accounts = Create {
payer: ctx.accounts.signer.to_account_info().clone(),
associated_token: ctx.accounts.token_escrow.to_account_info().clone(),
authority: ctx.accounts.another_pda.to_account_info().clone(),
mint: ctx.accounts.token_mint.to_account_info().clone(),
system_program: ctx.accounts.system_program.to_account_info().clone(),
token_program: ctx.accounts.token_program.to_account_info().clone(),
rent: ctx.accounts.rent.to_account_info().clone(),
};
let cpi_ctx = CpiContext::new(
self.associated_token_program.to_account_info().clone(),
create_accounts,
);
anchor_spl::associated_token::create(cpi_ctx)?;
But I'm getting this error
Error: failed to send transaction: Transaction simulation failed: Error processing Instruction 0: An account required by the instruction is missing