1

I am trying to call this instruction to lock an NFT.


        LockCpiBuilder::new(&ctx.accounts.metadata_program)
            .authority(&ctx.accounts.admin.to_account_info()) //authority
            .token_owner(Some(&ctx.accounts.admin.to_account_info()))
            .token(&ctx.accounts.token_account.to_account_info())
            .mint(&ctx.accounts.mint.to_account_info())
            .metadata(&ctx.accounts.metadata_account.to_account_info())
            .edition(Some(&ctx.accounts.master_edition.to_account_info()))
            .token_record(Some(&ctx.accounts.token_record.to_account_info()))
            .payer(&ctx.accounts.admin.to_account_info())
            .system_program(&ctx.accounts.system_program)
            .sysvar_instructions(&ctx.accounts.sysvar_program)
            .spl_token_program(Some(&ctx.accounts.token_program.to_account_info()))
            .authorization_rules_program(Some(&ctx.accounts.auth_rules_program))
            .authorization_rules(Some(&ctx.accounts.auth_rules.to_account_info()))
            .lock_args(LockArgs::V1 {
                authorization_data: None,
            })
            .invoke()?;

The call is failing and these are the program logs

#1
Unknown Program (MZp46X3Fdg3B9Neb1oFXmeuLaeZhf52McEjxL6hAJBb) Instruction

> Program logged: "Instruction: Initialize"
> Program logged: "freeze authority Some(9gafE5oBZnyTRXZD2WbcwJW5pfZ5WQXWJDLtCcTXMsBr)"
> Program invoked: Token Metadata Program
  > Program logged: "IX: Lock"
  > Program logged: "Invalid authority type"
  > Program consumed: 17579 of 162916 compute units
  > Program returned error: "custom program error: 0x9e"
> Program consumed: 54663 of 200000 compute units
> Program returned error: "custom program error: 0x9e"
> 
2
  • 1
    have you set admin as delegate authority before locking the nft?
    – denimcodes
    Jan 19 at 7:42
  • Turns out that was the issue. I had to delegate first.
    – Jimii
    Jan 19 at 10:57

1 Answer 1

0

The error that you're seeing 0x9e, decimal 158, is InvalidAuthorityType: https://github.com/metaplex-foundation/mpl-token-metadata/blob/64ba3cb8937dff668a5e1926d3beaf694ea6f3dc/programs/token-metadata/program/src/error.rs#L625

So maybe the admin account you're providing isn't the correct authority on the NFT

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.