Permissions
There are four different permissions types supported by the five contracts:
TokenHolder
ParentTokenHolder
UpdateAuthority
Anybody
TokenHolder
In order to do the action, the item class NFT must be held in the case of item creation or item class updates. The item NFT must be held in the case of item activation.
ParentTokenHolder
In order to do the action, the parent class of this class NFT must be held. In the case of item activation, it is the class of the item being activated.
UpdateAuthority
In order to do the action, the signer must be the update authority on the metadata of the item class or item.
Anybody
Anybody can do this action. There are no requirements to be met.
These permissions types are used to do certain things. In the item contract, for instance, you can set who is allowed to build an instance of an ItemClass, who can update it, who can stake against it, etc.
Here is an example of an ItemClassSettings
struct that has several fields/properties that use these permissions:
When performing an action against a raindrops contract, you must specify what type of permissiveness you want to use to do that action and that permissiveness will be checked against the existing array of permissions for the object being manipulated with that contract's endpoint.
The CLI will also use the permissiveness chosen to determine what additional accounts that might be needed to send in the instruction call to prove validity.
Here’s an example configuration file for opening an item escrow, which is the first action one does to create an item from an item class using the Item contract:
Notice that buildPermissivenessToUse
is set to tokenHolder. This means that the ItemClass
allows anybody holding the ItemClass
NFT to use the ItemClass
recipe to turn a non-raindrops NFT into an Item
instance of this ItemClass
. For instance, if you have an NFT that looks like a potion that you just made on a minting site, that does not mean it is an actual Potion that is used during play by Game X. If you hold the NFT representing the ItemClass
for Potion, then you have the right to go through the creation process to turn this freshly minted NFT potion look-alike into an actual Potion that your game client can process during gameplay. At the end of this creation cycle you’ll have an Item PDA seeded to your potion NFT that allows it to be used within the game.
Last updated