Open Source tool for minting compressed NFTs on Solana.
- Images, Videos, audios and 3D files supported
- Configuration panel for managing RPCs
- One single transaction to create the cNFT and upload the assets to Arweave
- Clone the repository
git clone https://github.com/3-land/minting-tool.git
- Navigate to the repository
cd cloned-repo
- Install dependencies
npm install
- Run the project
npm run dev
- Mint cNFT
- Merkle Tree Creation
Description This asynchronous function creates a new merkle tree on the blockchain.
Parameters
payer
: A string or PublicKey representing the payer's public key.public_tree
: A boolean indicating whether the tree is public. Defaults totrue
.options
: An object containing the following properties:rpc
: A string representing the RPC endpoint of the blockchain.
Returns
An object containing the transaction (tx
) that creates the tree.
Details The function performs the following steps:
- Converts the
payer
to a PublicKey. - Creates a connection to the blockchain using the provided RPC endpoint.
- Generates a new keypair for the Merkle tree.
- Prepares the parameters for creating the tree, including the maximum depth and buffer size.
- Creates an instruction (
allocTreeIx
) to allocate space for the tree on the blockchain. - Finds the program address for the tree authority.
- Prepares the accounts and arguments for the
createTreeIx
instruction. - Creates the
createTreeIx
instruction. - Adds the instructions to a new transaction.
- Signs the transaction with the signers.
- Returns the transaction.
Example
const payer = "B3tZ7ZiMoVJGVTsW6zWjKW6EvGjqJMgDZLzQZjNZED8e";
const public_tree = true;
const options = { rpc: "https://api.mainnet-beta.solana.com" };
const result = await createTree({ payer, public_tree, options });
console.log(result.tx);
Description This asynchronous function compresses an NFT by creating a transaction that includes the NFT's metadata and other related information.
Parameters
payer
: A string or PublicKey representing the payer's public key.tree
: A string or PublicKey representing the tree's public key.treeDelegate
: A string or PublicKey representing the tree delegate's public key. If not provided, it defaults to the payer's public key.metadata
: An object containing the metadata of the NFT.creatorWallets
: An array of objects, each representing a creator's wallet.options
: An object containing the following properties:rpc
: A string representing the RPC endpoint of the blockchain.
Returns
An object containing the transaction (tx
) that compresses the NFT and an upload
function that uploads the files associated with the NFT.
Details The function performs the following steps:
- Converts the
payer
,tree
, andtreeDelegate
to PublicKey. - Creates a connection to the blockchain using the provided RPC endpoint.
- Prepares the creators, traits, and files for the NFT.
- Bundles the metadata file and any main or cover files.
- Gets the funding instructions and registers the files with Irys.
- Prepares the on-chain metadata and mint accounts.
- Creates the mint instruction and adds it to a new transaction.
- Signs the transaction with the signers.
- Returns the transaction and the upload function.
Example
const payer = "B3tZ7ZiMoVJGVTsW6zWjKW6EvGjqJMgDZLzQZjNZED8e";
const tree = "B3tZ7ZiMoVJGVTsW6zWjKW6EvGjqJMgDZLzQZjNZED8e";
const treeDelegate = "B3tZ7ZiMoVJGVTsW6zWjKW6EvGjqJMgDZLzQZjNZED8e";
const metadata = { ... };
const creatorWallets = [ ... ];
const options = { rpc: "https://api.mainnet-beta.solana.com" };
const result = await compressNFT({ payer, tree, treeDelegate, metadata, creatorWallets, options });
console.log(result.tx);
Description This asynchronous function retrieves the IDs of assets associated with a given transaction signature.
Parameters
signature
: A string representing the transaction signature.connection
: An object representing the connection to the blockchain.
Returns An array of asset IDs associated with the given transaction signature.
Details The function performs the following steps:
- Retrieves the transaction information associated with the given signature.
- Retrieves all change log events from the transaction.
- For each change log event, it retrieves the index and tree ID.
- It then retrieves the asset associated with the index and tree ID and adds it to the
ids
array. - Finally, it returns the
ids
array.
Example
const signature = "5JPy8Zg7z4P7UjZj9Dq6xkTy3VRmogqAqDjJjwBzCqTk";
const connection = new Connection("https://api.mainnet-beta.solana.com");
const ids = await getCNFtId(signature, connection);
console.log(ids);
First off, thank you for considering contributing to this project! It's people like you that make the open source community such a fantastic place to learn, inspire, and create. Every contribution helps and is greatly appreciated.
-
Fork the project repository: Click on the 'Fork' button at the top right of this page. This will create a copy of the repository in your GitHub account.
-
Clone the forked repository to your local machine
-
Create a new branch -
git checkout -b [branch-name]
-
Make changes in the source code
-
Commit the changes -
git commit -m "[commit message]"
-
Push the changes -
git push origin [branch-name]"
-
Submit a pull request - Go to the GitHub page of your forked repository and click on ‘Pull request’. Click the ‘New pull request’ button and select the branch that contains your changes. Click ‘Create pull request’ to submit the pull request.
This project is licensed under the MIT License. See the LICENSE file for details.