Reputation: 21
I am trying to CPI the Token Program to send spl-tokens to a wallet. For this the derive accounts in the context struct has three accounts without any attribute over them:
But I get four Trait not implemented errors. They are:
AccountSerialize
is not implemented for anchor_spl::token::Mint
at line --- mint_token_outanchor_lang::AccountDeserialize
is not implemented for TokenAccount
at line --- token_out: Account<'info, TokenAccount>anchor_lang::Owner
is not implemented for TokenAccount
at line --- token_out: Account<'info, TokenAccount>anchor_lang::Owner
is not implemented for anchor_spl::token::Mint
at line --- mint_token_out: Account<'info, Mint>Is there something wrong I'm doing?
I have tried adding the constraint #[account(mut, has_one = wallet, owner = wallet)] as the account attribute for mint_token_out. But I still get the error..
Upvotes: 2
Views: 2529
Reputation: 49661
That error indicates that you did not use #[derive(Accounts)]
for the related struct that you created for the method.
#[derive(Accounts)]
pub struct YourTructForContext<'info>{}
#[derive(Accounts)]
Implements an Accounts deserializer on the given struct. Meaning it allows this struct to process user addresses and accounts.
Upvotes: 1