Permission Controls
Read All Members of All Roles
Get all roles and all the members of each role.
- React
- Javascript
- Python
- Go
React SDK support for getAll is coming soon.
Want this feature sooner? Let us know in Discord!
const rolesAndMembers = await contract.roles.getAll();
Python SDK support for getAll is coming soon.
Want this feature sooner? Let us know in Discord!
Go SDK support for getAll is coming soon.
Want this feature sooner? Let us know in Discord!
Read Members of a Role
Get the wallet addresses of a specific role.
- React
- Javascript
- Python
- Go
React SDK support for get is coming soon.
Want this feature sooner? Let us know in Discord!
const minterAddresses = await contract.roles.get("minter");
Python SDK support for get is coming soon.
Want this feature sooner? Let us know in Discord!
Go SDK support for get is coming soon.
Want this feature sooner? Let us know in Discord!
Grant Role
- React
- Javascript
- Python
- Go
React SDK support for grant is coming soon.
Want this feature sooner? Let us know in Discord!
await contract.roles.grant("minter", "0x1234567890123456789012345678901234567890");
Python SDK support for grant is coming soon.
Want this feature sooner? Let us know in Discord!
Go SDK support for grant is coming soon.
Want this feature sooner? Let us know in Discord!
Revoke Role
- React
- Javascript
- Python
- Go
React SDK support for revoke is coming soon.
Want this feature sooner? Let us know in Discord!
await contract.roles.revoke("minter", "0x1234567890123456789012345678901234567890");
Python SDK support for revoke is coming soon.
Want this feature sooner? Let us know in Discord!
Go SDK support for revoke is coming soon.
Want this feature sooner? Let us know in Discord!
Set All Roles (Overwrite)
This will overwrite all existing permissions on this contract.
THIS INCLUDES YOUR OWN WALLET ADDRESS.
If you revoke your admin permissions, you will not be able to get them back.
Only proceed if you know what you are doing.
- React
- Javascript
- Python
- Go
React SDK support for setAll is coming soon.
Want this feature sooner? Let us know in Discord!
const minterAddresses = await contract.roles.get("minter");
await contract.roles.setAll({
minter: []
});
console.log(await contract.roles.get("minter")); // No matter what members had the role before, the new list will be set to []
Python SDK support for setAll is coming soon.
Want this feature sooner? Let us know in Discord!
Go SDK support for setAll is coming soon.
Want this feature sooner? Let us know in Discord!
Update Roles
- Read the current roles from the
get
function. - Modify the array for the role you want to update.
- Call the
setAll
function with the modified array.
const rolesAndMembers = await contract.roles.getAll();
const updatedRoles = {
...rolesAndMembers,
admin: [...rolesAndMembers.admin, "0x-new-address-here"],
};
await contract.roles.setAll(updatedRoles);