Skip to content

Latest commit

 

History

History
 
 

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

README.md

cNFT Utils

Example code for working with Metaplex compressed NFTs (cNFTs) inside Solana Anchor programs.

This program shows how to add custom logic around the Bubblegum mint via CPI. Two handlers:

  1. mint — mints a cNFT to your collection by CPI'ing Bubblegum. You can also initialize your own program-specific PDA in this handler.
  2. verify — verifies that the owner of a given cNFT actually invoked the instruction. Useful as a building block for permissioned cNFT-gated logic.

Use this as a reference for working with cNFTs in your own programs.

Components

  • programs/cutils/ — the Anchor program. The setup uses a validate/actuate pattern via Anchor's access_control macro; this pairs well with the cNFT verification logic.

There is no tests/ directory in this example today. The program is intended to be deployed and exercised against a real cluster.

Deployment

The program ID declared in programs/cutils/src/lib.rs is BuFyrgRYzg2nPhqYrxZ7d9uYUs4VXtxH71U8EcoAfTQZ. Whether this address is currently deployed on any cluster is not tracked in this repo — verify with solana program show <id> against the cluster you care about.

To deploy your own copy, change the program ID in lib.rs and Anchor.toml, then run anchor build && anchor deploy.

Limitations

Reference implementation only.

Acknowledgements

  • @nickfrosty for the sample code and live demo.
  • @HeyAndyS for the groundwork in cnft-vault.
  • Switchboard VRF-flip (since archived) for inspiring the validate/actuate setup.