[sui.move]
transfer_policy, which is the real star of this section.
The transfer_policy module defines how assets can be transferred and enforces rules on those transfers.
Here’s a table of the transfer policy features:
Now that you understand the transfer policy. Let’s define the NFT struct and specify transfer policies on the NFT.
[sui.move]
[sui.move]
Rule, and an empty Config. We’ll plug this into the policy later.
Here’s a basic function to mint a new Art NFT:
[sui.move]
[sui.move]
transfer_policy::newcreates the policy and its capability (cap)- The policy is made shared so everyone can access it
- The cap is transferred to the caller so only they can manage the policy
[sui.move]
Rule) and its config. This function can only be called by whoever holds the TransferPolicyCap.
Here’s the critical part: enforcing a 1 SUI transfer fee:
[sui.move]
- It checks the coin’s value is exactly 1 SUI (in Mist)
- Adds that payment to the policy’s internal balance
- Marks the
TransferRequestas passed for this rule
[sui.move]
confirm_request(), the item is stuck in limbo. That’s why TradePort asks recipients to claim from Kiosks.