Permissions
Functionality available for contracts that inherit the Permissions extension.
Allows you to manage the roles and permissions of the smart contract.
Roles include
admin, transfer, minter, pauser, lister, asset, unwrap, factory,
or any other custom roles you have created.
get
Get a list of wallet addresses that are members of a given role.
from thirdweb.constants.role import Role
# Select any role to filter by
role = Role.ADMIN
role_members = contract.roles.get(role)
print(role_members)
Configuration
get_all
Retrieve all of the roles and associated wallets.
all_role_members = contract.roles.get_all()
print(all_role_members)
Configuration
Return Value
A dictionary containing role names as keys and an array of wallet addresses as the value.
Dict[Role, List[str]]
grant
Make a wallet a member of a given role.
from thirdweb.constants.role import Role
address = "0x7fDae677aA6f94Edff9872C4b91D26407709c790" # Address to grant a role
role = Role.ADMIN # Select a role to grant
receipt = contract.roles.grant(role, address)
Configuration
revoke
Revoke a given role from a wallet.
from thirdweb.constants.role import Role
address = "0x7fDae677aA6f94Edff9872C4b91D26407709c790" # Address to revoke role
role = Role.ADMIN # Select a role to revoke
receipt = contract.roles.revoke(
role,
"{{wallet_address}}",
)