0

Currently running some tests in a program that uses the token-22 program and my instruction has this constraint

    #[account(
        mint::decimals = 9,
        mint::authority = user,
        mint::freeze_authority = user,
        extensions::metadata_pointer::metadata_address = mint.key(),
    )]
    pub mint: InterfaceAccount<'info, Mint>,

which then outputs the errror

 'Program log: AnchorError occurred. Error Code: ConstraintMintMetadataPointerExtension. Error Number: 2030. Error Message: A metadata pointer extension constraint was violated.',
    'Program 5zjbNpnsSkCNG6zHzK183ujm6dn6fWeHWeUnk1Rzrs1Y consumed 8812 of 200000 compute units',
    'Program 5zjbNpnsSkCNG6zHzK183ujm6dn6fWeHWeUnk1Rzrs1Y failed: custom program error: 0x7ee'

My mint is derived by using the createMint function on the client side passing the TOKEN_22_PROGRAM_ID as the expected program. What could i be doing wrong?

1 Answer 1

1

I believe you have to initialize the mint in the instruction for the macro to work.

try adding an init and payer to this.

#[account(
        init,
        signer,
        payer = user,
        mint::decimals = 9,
        mint::authority = user,
        mint::freeze_authority = user,
        mint::token_program = token_program,
        extensions::metadata_pointer::authority = asset_controller.key(),
        extensions::metadata_pointer::metadata_address = asset_mint.key(),
    )]

This assumes you make the mint a Keypair rather than deriving it in the program which would be recommended so you don't get the address DOS'd

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.