5

    #[account(init,
      payer = funder,
      token::mint = token_mint_a,
      token::authority = authority)]
    pub token_vault_a: Box<Account<'info, TokenAccount>>,


    #[account(init,
        payer = admin,
        associated_token::mint = token_a_mint,
        associated_token::authority = swap_account,
    )]
    pub token_a_account: Box<Account<'info, TokenAccount>>,

1 Answer 1

7

The associated_token accounts are deterministic and only 1 exist per pair (derived from the wallet PublicKey and token mint PublicKey). You can't use Aux accounts in this context.

With the token::mint and token::authority context you can use any TokenAccount matching that mint and authority. This way you can also read and create Auxilarily or non-associated token accounts.

2
  • By using above steps it's giving an error ( rent value not found ) Commented Aug 3, 2022 at 9:29
  • Which steps? There are no steps described above.
    – Omega
    Commented Aug 3, 2022 at 13:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.