CNFT (cnft v0.1.7)
View SourceCNFT is a module for handling transactions related to creating, minting, and transferring NFTs on the Solana blockchain.
This module uses Rustler to interface with native Rust code for performance-critical operations.
Summary
Functions
Creates a tree transaction.
Returns the information of a compressed/standard asset including metadata and owner.
Returns the merkle tree proof information for a compressed asset.
Mints a new NFT on the Solana blockchain.
Transfers an NFT to a new owner.
Functions
Creates a tree transaction.
Parameters
- rpc_client: The RPC client to interact with the Solana blockchain.
- payer: The account that will pay for the transaction.
Returns
- A transaction data structure.
Returns the information of a compressed/standard asset including metadata and owner.
## Parameters
- rpc_client: The RPC url to interact with the Solana blockchain.
- asset: The NFT asset to retrieve data for.
## Returns
- The api reponse in JSON string.
Returns the merkle tree proof information for a compressed asset.
## Parameters
- rpc_client: The RPC url to interact with the Solana blockchain.
- asset: The NFT asset to retrieve data for.
## Returns
- The api reponse in JSON string.
Mints a new NFT on the Solana blockchain.
Parameters
- rpc_client: The RPC client to interact with the Solana blockchain.
- tree: The public key (as a string) of the tree structure where the NFT will be minted.
- owner: The public key (as a string) of the account that will own the minted NFT.
- payer: The keypair (as a string, e.g., base58 encoded) of the account that will pay for the transaction.
- name: The name of the NFT.
- symbol: The symbol of the NFT.
- uri: The URI pointing to the NFT metadata.
- seller_fee_basis_points: The royalty fee in basis points (e.g., 100 = 1%)
- is_mutable: Boolean indicating if the NFT metadata can be updated.
- nonce: A unique identifier for the minted NFT.
Returns
{:ok, transaction_signature}
: A tuple containing the atom:ok
and the transaction signature as a string.{:error, reason}
: A tuple containing the atom:error
and a reason for failure (if the NIF fails).
Transfers an NFT to a new owner.
Parameters
- rpc_client: The RPC client to interact with the Solana blockchain.
- asset: The NFT asset to be transferred.
- owner: The current owner of the NFT.
- payer: The account that will pay for the transaction.
- receiver: The account that will receive the NFT.
Returns
- A transaction data structure.