Ayush a3b87a4948 update: tokens native, formatter, trigger action on project changes (#81) il y a 1 an
..
programs 39a2518210 revert cnft example cargo.toml il y a 1 an
tests a3b87a4948 update: tokens native, formatter, trigger action on project changes (#81) il y a 1 an
.gitignore feaf2a1eb7 move folder il y a 2 ans
Anchor.toml feaf2a1eb7 move folder il y a 2 ans
Cargo.toml 56dafe4b4a add resolver = "2" to fix compile warning il y a 1 an
README.md feaf2a1eb7 move folder il y a 2 ans
package.json f116e3891a update to @coral-xyz/spl-token 0.30.0 il y a 1 an
pnpm-lock.yaml a3b87a4948 update: tokens native, formatter, trigger action on project changes (#81) il y a 1 an
tsconfig.json a3b87a4948 update: tokens native, formatter, trigger action on project changes (#81) il y a 1 an

README.md

Solana Program cNFT Transfer example

This repo contains example code of how you can work with Metaplex compressed NFTs inside of Solana Anchor programs.

The basic idea is to allow for transfering cNFTs that are owned by a PDA account. So our program will have a vault (this PDA) that you can send cNFTs to manually and then withdraw them using the program instructions.

There are two instructions: one simple transfer that can withdraw one cNFT, and one instructions that can withdraw two cNFTs at the same time.

This program can be used as an inspiration on how to work with cNFTs in Solana programs.

Components

The Anchor program can be found in the programs folder and tests some clientside tests. There are also some typescript node scripts in tests/scripts to run them individually (plus there is one called withdrawWithLookup.ts which demonstrates the use of the program with account lookup tables).

Deployment

The program is deployed on devnet at CNftyK7T8udPwYRzZUMWzbh79rKrz9a5GwV2wv7iEHpk. You can deploy it yourself by changing the respective values in lib.rs and Anchor.toml.

Limitations

This is just an example implementation. It is missing all logic wheter a transfer should be performed or not (everyone can withdraw any cNFT in the vault). Furthermore it is not optimized for using lowest possible compute. It is intended as a proof of concept and reference implemention only.

Further resources

A video about the creation of this code which also contains further explanations has been publised on Solandy's YouTube channel: https://youtu.be/qzr-q_E7H0M