├── README.md ├── programs └── solana-nft │ ├── Xargo.toml │ ├── Cargo.toml │ └── src │ └── lib.rs ├── .gitignore ├── .prettierignore ├── target └── deploy │ └── solana_nft-keypair.json ├── Cargo.toml ├── Anchor.toml └── LICENSE /README.md: -------------------------------------------------------------------------------- 1 | # Solana-NFT-minting-program-using-Anchor -------------------------------------------------------------------------------- /programs/solana-nft/Xargo.toml: -------------------------------------------------------------------------------- 1 | [target.bpfel-unknown-unknown.dependencies.std] 2 | features = [] 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .anchor 2 | .DS_Store 3 | target 4 | **/*.rs.bk 5 | node_modules 6 | test-ledger 7 | .yarn 8 | -------------------------------------------------------------------------------- /.prettierignore: -------------------------------------------------------------------------------- 1 | .anchor 2 | .DS_Store 3 | target 4 | node_modules 5 | dist 6 | build 7 | test-ledger 8 | -------------------------------------------------------------------------------- /target/deploy/solana_nft-keypair.json: -------------------------------------------------------------------------------- 1 | [121,9,47,129,253,26,218,101,86,235,204,6,31,188,246,22,97,202,114,211,160,241,208,252,111,136,75,146,160,115,70,39,229,227,162,245,122,206,213,152,72,11,90,124,11,123,238,115,87,222,235,218,152,192,155,227,203,66,204,223,16,19,148,43] -------------------------------------------------------------------------------- /Cargo.toml: -------------------------------------------------------------------------------- 1 | [workspace] 2 | members = [ 3 | "programs/*" 4 | ] 5 | resolver = "2" 6 | 7 | [profile.release] 8 | overflow-checks = true 9 | lto = "fat" 10 | codegen-units = 1 11 | [profile.release.build-override] 12 | opt-level = 3 13 | incremental = false 14 | codegen-units = 1 15 | -------------------------------------------------------------------------------- /Anchor.toml: -------------------------------------------------------------------------------- 1 | [toolchain] 2 | 3 | [features] 4 | resolution = true 5 | skip-lint = false 6 | 7 | [programs.localnet] 8 | solana_nft = "GUPgmjutVzrin2XorvkteHZK1SRhohpTLkAabkh3r7bQ" 9 | 10 | [registry] 11 | url = "https://api.apr.dev" 12 | 13 | [provider] 14 | cluster = "Localnet" 15 | wallet = "~/.config/solana/id.json" 16 | 17 | [scripts] 18 | test = "yarn run ts-mocha -p ./tsconfig.json -t 1000000 tests/**/*.ts" 19 | -------------------------------------------------------------------------------- /programs/solana-nft/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "solana-nft" 3 | version = "0.1.0" 4 | description = "Created with Anchor" 5 | edition = "2021" 6 | 7 | [lib] 8 | crate-type = ["cdylib", "lib"] 9 | name = "solana_nft" 10 | 11 | [features] 12 | default = [] 13 | cpi = ["no-entrypoint"] 14 | no-entrypoint = [] 15 | no-idl = [] 16 | no-log-ix-name = [] 17 | idl-build = ["anchor-lang/idl-build"] 18 | 19 | [dependencies] 20 | anchor-lang = "0.30.1" 21 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2025 MARK 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /programs/solana-nft/src/lib.rs: -------------------------------------------------------------------------------- 1 | use anchor_lang::prelude::*; 2 | use anchor_spl::associated_token::AssociatedToken; 3 | use anchor_spl::metadata::{ 4 | create_master_edition_v3, create_metadata_accounts_v3, CreateMasterEditionV3, CreateMedatadataAccountsV3 ,Metadata 5 | }; 6 | use anchor_spl::token::{mint_to, Mint, MintTo, Token, TokenAccount}; 7 | use mpl_token_metadata::state::{Collection, Creator, DataV2}; 8 | 9 | declare_id!("GUPgmjutVzrin2XorvkteHZK1SRhohpTLkAabkh3r7bQ"); 10 | 11 | #[program] 12 | pub mod solana_nft { 13 | use super::*; 14 | 15 | 16 | } 17 | 18 | #[derive(Accounts)] 19 | pub struct CreateNFT<'info> { 20 | #[account(mut)] 21 | pub authority: Signer<'info>, 22 | #[account(mut)] 23 | pub payer: Signer<'info>, 24 | #[acocunt(init, payer=payer, mint::decimals=0, mint::authority=authority, mint::freeze_authority=authority, seeds = ["mint".as_bytes(), id.to_le_bytes().as_ref()], bump)] 25 | pub mint: Account<'info, Mint>, 26 | #[account(init_if_needed, payer=payer, associated_token::mint=mint, associated_token::authority=authority)] 27 | pub token_account: Account<'info, TokenAccount>, 28 | pub associated_token_program: Program<'info, AssociatedToken>, 29 | pub rent: Sysvar<'info, Rent>, 30 | pub system_program: Program<'info, System>, 31 | pub token_program: Program<'info, Token>, 32 | pub metadata_program: Program<'info, Metadata>, 33 | #[account(mut, seeds=[b"metadata".as_ref(), metadata_program.key().as_ref(), mint.key().as_ref(), b"edition".as_ref()], bump, seeds::program=metadata_program.key())] 34 | pub master_edition_account:UncheckedAccount<'info>, 35 | #[acocunt(mut, seeds=[b"metadata".as_ref(), metadata_program.key().as_ref(), mint.key().as_ref()], bump, seeds::program=metadata_program.key())] 36 | pub nft_metadata:UncheckedAccount<'info>, 37 | } --------------------------------------------------------------------------------