For the complete documentation index, see llms.txt. This page is also available as Markdown.

Build an nft pc

Description

Create post-conditions for NFT transfers to ensure specific tokens are or aren't transferred

Use Cases

  • Protecting valuable NFTs from accidental transfers

  • Ensuring specific NFTs are transferred in marketplace transactions

  • Safeguarding NFT collections during contract interactions

Key Concepts

  • Asset identifier - Contract address + asset name with :: separator

  • Token ID - The specific NFT ID as a Clarity value (using Cl.uint())

  • NFT post-conditions use the .nft() method

  • .willMaybeSendAsset() - The NFT may or may not be sent, and the condition always passes. It still counts as covering that NFT instance under Deny or Originator mode, so an optional transfer can be authorised without falling back to Allow. Added by SIP-040, available in @stacks/transactions 7.4.0 and later.

Last updated

Was this helpful?