-
Notifications
You must be signed in to change notification settings - Fork 39
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this 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. |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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") |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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"); |
There was a problem hiding this comment.
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"); |
There was a problem hiding this comment.
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"); |
There was a problem hiding this comment.
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"; |
There was a problem hiding this comment.
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", |
There was a problem hiding this comment.
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
made changes on the previous Pull Request and added README and example to mint compressed NFTs.