2

i'm trying to change the authority of token mint to a pda so only the program can mint

 pub fn into_set_authority_context(&self) -> CpiContext<'_, '_, '_, 'info, SetAuthority<'info>> {
        let cpi_accounts = SetAuthority {
            account_or_mint: self.token_mint.to_account_info().clone(),
            current_authority: self.current_owner.to_account_info().clone(),
        };
        CpiContext::new(self.token_program.to_account_info().clone(), cpi_accounts)
    }

anchor_spl::token::set_authority(
        ctx.accounts.into_set_authority_context(),
        AuthorityType::AccountOwner,
        Some(authority),
    ).expect("set_authority failed");

But I get an error:

     Error: failed to send transaction: Transaction simulation failed: Error processing Instruction 0: custom program error: 0xf

1 Answer 1

2

Convert 0xF to decimal (15), then visiting https://github.com/solana-labs/solana-program-library/blob/master/token/program/src/error.rs

You'll find at the #15th position the error is: #[error("Account does not support specified authority type")]

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.