program-examples icon indicating copy to clipboard operation
program-examples copied to clipboard

tokens/nft-operations: add the native (Solana Native) flavor to complete the anchor/native/pinocchio trio

Open sandeepnayakam opened this issue 1 month ago • 3 comments

Proposal

tokens/nft-operations currently ships two flavors: anchor/ and pinocchio/. The native/ flavor is missing, which breaks the repo's stated pattern of "one per framework flavor" for token examples (cf. tokens/create-token, tokens/transfer-tokens, tokens/pda-mint-authority, tokens/escrow, which all ship the full trio).

This issue proposes adding tokens/nft-operations/native/ — a Solana Native (plain cargo build-sbf) implementation of the same NFT operations the Anchor flavor teaches, so learners can compare the three frameworks on the same example.

Why this example

  • Framework-completion PRs have direct precedent: the Solana Foundation's recent program-examples bounty rounds paid for exactly this kind of flavor coverage (Account Data, PDA-Rent-Payer, Create Token, Transfer Tokens, Token Swap, etc.).
  • native/ is the middle ground learners use to understand what Anchor generates for them — it is the most instructive diff of the trio for Metaplex-heavy examples, since the native flavor hand-builds token-metadata instructions (per AGENTS.md, no mpl crate dependency, mpl_util.rs pattern).

What I will deliver (on approval — happy to be assigned)

  • tokens/nft-operations/native/ following the repo layout: program/ crate (root workspace member), package.json with the mandatory build-and-test script, LiteSVM-based tests via @solana/kit + litesvm 1.x (mocha + tsx, FailedTransactionMetadata assertions, svm.expireBlockhash() on resend).
  • Hand-built Metaplex token-metadata instructions in Rust (no mpl crate), mirroring the pinocchio flavor's approach where applicable.
  • No toolchain bumps, no lockfile hoisting, no shared JS helpers — AGENTS.md and CONTRIBUTING.md followed.
  • A separate branch + PR referencing Fixes #<this issue> once approved.

If the maintainers would rather see a different flavor gap filled first (e.g. tokens/token-swap native), I'm happy to redirect — it's open for me to pick up.

sandeepnayakam avatar Oct 20 '26 16:10 sandeepnayakam

Hi! Are you still planning to build the native/ flavor for nft-operations? I'm interested in contributing to this repo. If you're already on it I'll pick something else, but if you'd like to split the work or hand it off, I can take it.

nisargpatel7042lva avatar Oct 24 '26 11:10 nisargpatel7042lva

Hi maintainers @amilz @dev-jodee,

I have implemented \ okens/nft-operations/native/\ completing the trio alongside \nchor/\ and \pinocchio/\ per this issue proposal:

  • Zero mpl crate dependency: Hand-crafted wire format serialization in \mpl_util.rs\ (\CreateMetadataAccountV3, \CreateMasterEditionV3, and \Verify\ with \VerificationArgs::CollectionV1) adhering strictly to \AGENTS.md.
  • LiteSVM unit tests: Tested with @solana/kit\ and \litesvm 1.x\ (3/3 passing in 21ms), explicitly asserting post-state \collection.verified\ transition from 0 to 1.
  • Code hygiene: Clean \cargo fmt --check\ and \cargo clippy -- -D warnings\ with zero warnings.
  • Security & isolation: Hardened against Greptile audit findings (isolated lockfile dependencies, non-destructive mainnet dump without altering global cluster config).

The implementation is ready in PR #769. Could a maintainer please review and label this issue \ccepted\ so the PR check can clear? Thank you!

sehaha avatar Oct 28 '26 04:10 sehaha

/attempt #754

Hi maintainers (@amilz @dev-jodee),

I would like to claim and implement the Native (Solana Native) flavor for tokens/nft-operations/native/ to complete the architectural trio alongside anchor/ and pinocchio/.

Proposed Implementation & Deliverables

  1. Solana Native Program (tokens/nft-operations/native/program/):

    • Native instruction processor covering:
      • CreateCollection (collection NFT mint with zero decimals & metadata)
      • MintNft (individual 1-of-1 NFT under the collection)
      • VerifyCollection (collection verification transition)
    • Zero MPL Crate Dependencies: Hand-crafted wire serialization in mpl_util.rs (CreateMetadataAccountV3, CreateMasterEditionV3, and Verify via VerificationArgs::CollectionV1), strictly adhering to AGENTS.md.
    • Robust account boundary validation, PDA derivations, and isolated CPI invocation.
  2. LiteSVM Test Suite (tokens/nft-operations/native/):

    • End-to-end tests using @solana/kit + litesvm 1.x (mocha + tsx).
    • Verifies collection creation, NFT minting, and explicit verification state transitions (collection.verified: 0 -> 1).
    • Self-contained dependencies without touching the root workspace lockfile or mutating global cluster configurations.
  3. Quality & Tooling:

    • Fully passes cargo fmt --check and cargo clippy -- -D warnings with zero warnings.
    • Standard root workspace registration and mandatory package.json build-and-test script.

Could you please assign this issue or label it accepted so we can submit the PR and clear the maintainer review gate? Thank you!


Contributor Settlement Details

  • PayPal: [email protected]
  • ETH: 0x12d82214Bb97409e3654E9B7acd658a3f812F272
  • USDC: 0x12d82214Bb97409e3654E9B7acd658a3f812F272
  • BTC: bc1qw2nk7f2d9z6h4pscga9pq52r5v64chsw6c9fku

Rohank143 avatar Oct 28 '26 12:10 Rohank143