We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
run "anchor build" report error:
... Compiling anchor-spl v0.30.1 Compiling mytest v0.1.0 (/home/anchorData/mytest/programs/mytest) Error: Function _ZN99_$LT$mytest..CreateMetadata$u20$as$u20$anchor_lang..Accounts$LT$mytest..CreateMetadataBumps$GT$$GT$12try_accounts17h5cad088e3a27668cE Stack offset of 4752 exceeded max offset of 4096 by 656 bytes, please minimize large stack variables Finished release [optimized] target(s) in 4m 13s Compiling proc-macro2 v1.0.86 ...
test program code:
use anchor_lang::prelude::*; //use anchor_spl::token::{self, Token, TokenAccount, Mint, MintTo}; use anchor_spl::token::{Token, TokenAccount, Mint}; use mpl_token_metadata::{ID as METAPLEX_METADATA_PROGRAM_ID}; use mpl_token_metadata::types::DataV2; declare_id!("4c1XfqAAvfBGTBCYoSz9ZTWvT8Hof7LM3N73JJrHs2Ts"); #[program] pub mod mytest { pub const TOKEN_TOTAL_SUPPLY: u64 = 1500000000; use super::*; use mpl_token_metadata::instructions::CreateMetadataAccountV3CpiBuilder; use mpl_token_metadata::types::DataV2; pub fn create_normal_spl_token(ctx: Context<CreateMetadata>, name:String, symbol: String, uri:String) -> Result<()> { let data = DataV2 { name, symbol, uri, seller_fee_basis_points:0, creators:None, collection:None, uses:None, }; let mint_authority_bump = ctx.bumps.pda_mint_authority; let mint_authority_seeds: &[&[u8]] = &[ b"mint_authority".as_ref(), &[mint_authority_bump], ]; let seeds = &[mint_authority_seeds]; let cpi_create_v3 = CreateMetadataAccountV3CpiBuilder::new(&ctx.accounts.mpl_program) .metadata(&ctx.accounts.metadata) .data(data) .mint(&ctx.accounts.mint.to_account_info()) .mint_authority(&ctx.accounts.pda_mint_authority) .payer(&ctx.accounts.payer) .update_authority(&ctx.accounts.update_authority, true) .system_program(&ctx.accounts.system_program) .is_mutable(false).invoke_signed(seeds); cpi_create_v3?; Ok(()) } } #[derive(Accounts)] pub struct CreateMetadata<'info> { /// CHECK: metaplex account #[account(address = METAPLEX_METADATA_PROGRAM_ID)] pub mpl_program: AccountInfo<'info>, /// CHECK: metadata account #[account( init, payer = payer, space = 8 + 32 + std::mem::size_of::<AccountInfo>() + 8, seeds = [mint.key().as_ref(), "metadata".as_bytes()], bump, )] pub metadata: AccountInfo<'info>, /// CHECK: mint account #[account( init, payer = payer, mint::decimals = 9, mint::authority = pda_mint_authority, mint::freeze_authority = pda_mint_authority, )] pub mint: Account<'info, Mint>, /// CHECK: token PDA account #[account( init, payer = payer, token::mint = mint, token::authority = pda_mint_authority, )] pub pda_token_account: Account<'info, TokenAccount>, /// CHECK: mint_authority PDA account #[account( init, payer = payer, seeds = [b"mint_authority".as_ref()], space = 8 + 32 + std::mem::size_of::<AccountInfo>() + 8, bump)] pub pda_mint_authority: AccountInfo<'info>, #[account(mut)] pub payer: Signer<'info>, pub update_authority: Signer<'info>, pub system_program: Program<'info, System>, pub token_program:Program<'info, Token>, pub rent: Sysvar<'info, Rent>, }
The text was updated successfully, but these errors were encountered:
I believe this to be a known issue so closing as duplicate: #1186
Sorry, something went wrong.
No branches or pull requests
run "anchor build" report error:
test program code:
The text was updated successfully, but these errors were encountered: