Skip to content

Added example to mint compressed NFTs #9

New issue

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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

akshatcoder-hash
Copy link

made changes on the previous Pull Request and added README and example to mint compressed NFTs.

Copy link

@buffalojoec buffalojoec left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good, but this needs a bit of cleaning up and comment resolution before I can merge it


1. The Bubblegum program, developed by Metaplex, plays a role in verifying the metadata (information) linked to an NFT (non-fungible token).

2. When Bubblegum is activated, it uses a process called "account-compression" to add a new data point (called a "leaf") to the Merkle tree structure.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: "invoked" instead of "activated"

payer: Keypair
) => {
const cmintKey = loadWalletKey("COLL.json"); //load your collection account keypair
// const collectionMint = cmintKey.publicKey;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we remove this comment?

{commitment: "finalized"},
TOKEN_PROGRAM_ID
);
console.log("1")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are these logs really necessary?

connection: Connection,
payer: Keypair
) => {
const cmintKey = loadWalletKey("COLL.json"); //load your collection account keypair

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔑 - I would rather see you generate keypairs using JavaScript code, than loading ones from local disk.

Users that are checking out these scripts should be able to clone, install dependencies (yarn | npm ) and then run the script and get their cNFT

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if we want users to directly clone and mint the cNFTs, should I add the keypair json to it?
I am generating keypairs using solana-cli tho

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why can't you do it with JavaScript code instead?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah! That would be better. Let me check if I can generate using the keypairs with fixed starting letters like we do using grind in solana-cli


async function main(){

const keypair = loadWalletKey("CNFT.json");

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, see 🔑


async function createTree() {
// Load the wallet key for the user who will create the merkle tree
const keypair = loadWalletKey("CNFT.json");

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, see 🔑


async function mintOneCNFT() {
// Load the wallet key for the user who will mint the CNFT
const keypair = loadWalletKey("CNFT.json");

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, see 🔑

Pretty much anywhere you're loading local JSON keys

import { loadWalletKey, sendVersionedTx } from "./utils";
import { Connection, Keypair, PublicKey, SystemProgram, Transaction, VersionedMessage } from "@solana/web3.js";
import { SPL_ACCOUNT_COMPRESSION_PROGRAM_ID, SPL_NOOP_PROGRAM_ID, ValidDepthSizePair, getConcurrentMerkleTreeAccountSize } from "@solana/spl-account-compression";
import { SYSTEM_PROGRAM_ID } from "@raydium-io/raydium-sdk";

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can just use SystemProgram.programId from @solana/web3.js for this

{
"dependencies": {
"@metaplex-foundation/mpl-bubblegum": "^0.6.2",
"@raydium-io/raydium-sdk": "^1.3.0-beta.17",

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't need this dependency

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants