I'm trying to write a program that mint token to an address being passed as an argument, my code looks like this
pub fn mint_tok(ctx:Context<Donate>,amount_token:u64,address:pubkey) -> Result<()> {
let cpi_ctx = CpiContext::new(
self.token_program.to_account_info(),
MintTo {
mint:ctx.accounts.chrt_mint.to_account_info(),
to:address.to_account_info,
authority: self.chrt_mint_authority.to_account_info(),
}
);
}
but I got an error that says I can't use pubkey with the to_account_info() method, Any help about how I can pass the token account address as an argument will be appreciated