Skip to main content

derive_ata_with_program

Function derive_ata_with_program 

Source
pub fn derive_ata_with_program(
    wallet: &Address,
    mint: &Address,
    token_program: &Address,
) -> Result<(Address, u8), ProgramError>
Expand description

Derive an ATA address with an explicit token program (SPL Token or Token-2022).

Same as derive_ata but lets you specify which token program the mint belongs to. Use this for Token-2022 mints.

let (ata, bump) = derive_ata_with_program(
    wallet.address(),
    mint.address(),
    &programs::TOKEN_2022,
)?;