I try to create a program with Anchor/Rust to mint a cNFT as a part of a collection, I have this following error on the anchor build
and don't understand why he can't access the collection_mint
inside the struct.
#[derive(Accounts)]
pub struct InitNFT<'info> {
#[account(mut, signer)]
pub signer: Signer<'info>,
#[account(
init_if_needed,
seeds = [SEED.as_bytes()],
bump,
payer = signer,
mint::decimals = 0,
mint::authority = signer,
mint::freeze_authority = signer
)]
pub collection_mint: Account<'info, Mint>,
/// CHECK: address
#[account(
mut,
address=MetadataMPL::find_pda(&collection_mint.key()).0
)]
pub metadata_account: AccountInfo<'info>,
/// CHECK: address
#[account(
mut,
// address=MasterEdition::find_pda(&collection_mint.key()).0
)]
pub master_edition_account: AccountInfo<'info>,
/// CHECK:
#[account(
mut,
seeds = [merkle_tree.key().as_ref()],
bump,
seeds::program = bubblegum_program.key()
)]
pub tree_authority: UncheckedAccount<'info>,
/// CHECK:
#[account(mut)]
pub merkle_tree: UncheckedAccount<'info>,
.......
}
The errors:
error[E0425]: cannot find value `collection_mint` in this scope
--> programs/solana-c-nft/src/lib.rs:214:40
|
214 | address=MetadataMPL::find_pda(&collection_mint.key()).0
| ^^^^^^^^^^^^^^^ not found in this scope
error[E0425]: cannot find value `collection_mint` in this scope
--> programs/solana-c-nft/src/lib.rs:221:42
|
221 | address=MasterEdition::find_pda(&collection_mint.key()).0
| ^^^^^^^^^^^^^^^ not found in this scope
And the Cargo.toml
[workspace]
members = [
"programs/solana-c-nft",
"libs/account-compression",
"libs/bubblegum"
]
resolver = "2"
[profile.release]
overflow-checks = true
lto = "fat"
codegen-units = 1
[profile.release.build-override]
opt-level = 3
incremental = false
codegen-units = 1
[workspace.dependencies]
anchor-gen = { git = "https://github.com/ChewingGlass/anchor-gen.git" }
anchor-lang = "0.30.0"
solana-program = "1.18.11"
Thanks for your time :)