Skip to content

feat(rust): add NFT mint-and-transfer recipe - #250

Open
BrianSeong99 wants to merge 3 commits into
chore/migrate-v0.16from
brian/nft-mint-transfer-recipe
Open

feat(rust): add NFT mint-and-transfer recipe#250
BrianSeong99 wants to merge 3 commits into
chore/migrate-v0.16from
brian/nft-mint-transfer-recipe

Conversation

@BrianSeong99

@BrianSeong99 BrianSeong99 commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

Summary

Add a runnable Rust recipe that mints one NFT with the standard non-fungible faucet, consumes it into Alice's wallet, transfers it to Bob, and verifies ownership after each step. The recipe funds all three accounts with native testnet assets and waits for every transaction to commit.

Depends on #249. This PR targets its chore/migrate-v0.16 branch so the diff contains only the NFT recipe. Retarget this PR to main before deleting the migration branch.

Changes

  • Compose the standard authenticated NFT faucet with BasicWallet for native fee funding and CodeInspection for the production MINT note.
  • Publish and consume a real MINT request, then consume and transfer the resulting P2ID NFT notes. Verify the complete asset in wallet vaults and confirm both NFT-bearing notes are consumed.
  • Document the metadata/salt commitment as an off-chain convention; the faucet does not validate its preimage.
  • Follow the Rust tutorials' structure: overview, learning objectives, prerequisites, numbered steps with excerpts, complete example, expected output, and further reading. Place the page between the fungible-transfer and counter tutorials.
  • Register nft_mint_transfer with the tutorial runner and Rust doctests. Add a consistency test that keeps the published code identical to the executable.

Verification

  • Targeted Rust tests: 6 passed (3 shared-library, 2 MASM compilation, 1 recipe consistency); the NFT binary compiled successfully.
  • Rust documentation tests: 18 passed, 26 partial snippets ignored (16 existing plus 10 NFT walkthrough excerpts). All 10 new excerpts were checked against the unchanged executable; the full NFT example remains compiled and covered by the consistency test.
  • Docusaurus npm run build:dev: passed with no broken-link warnings.
  • Rustfmt, Prettier, shell syntax, and tutorial runner discovery checks passed.
  • Two independent direct testnet runs with fresh accounts and stores completed successfully. Each committed all 3 fee-funding consumes and 5 NFT-flow transactions, including the final ownership assertions.
  • Run 2 balance verification: 119 native base units deducted per transaction, totaling 952 across those 8 transactions (Alice 476, Bob 238, NFT faucet 238). These figures exclude the funding service's own note-creation transactions.

Testnet execution used the locked dependencies and TUTORIAL_NETWORK=testnet cargo run --locked --manifest-path ../../Cargo.toml --bin nft_mint_transfer from a fresh directory under rust-client/.tutorial-runs/. The canonical Yarn wrapper's discovery and syntax were checked; its full clean-and-run path was not executed.

Follow-up and limits

  • Add the recipe to the Docs repository's explicit Rust Recipes sidebar when this source is ingested; maintain the content here.
  • The devnet attempt rejected SDK 0.16.0 during version negotiation before account creation. Testnet is the verified network.
  • Insufficient-balance and network-failure scenarios are not covered. Burning, marketplaces, and metadata hosting are outside this recipe.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant