typescript-sdk

Home > @3rdweb/sdk > ModuleWithRoles

ModuleWithRoles class

Extends the Module class to add Role functionality.

Signature:

export declare class ModuleWithRoles<TContract extends AccessControlEnumerable = AccessControlEnumerable> extends Module<TContract> 

Extends: Module<TContract>

Remarks

The constructor for this class is marked as internal. Third-party code should not call the constructor directly or create subclasses that extend the ModuleWithRoles class.

Methods

Method Modifiers Description
getAllRoleMembers()   Call this to get get a list of addresses for all supported roles on the module.
getRoleMembers(role)   Call this to get a list of addresses that are members of a specific role.
grantRole(role, address)   Call this to grant a role to a specific address.
onlyRoles(roles, address)   Throws an error if an address is missing the roles specified.
prepareBatchMetadata(metadata)   Prepares a list of metadata for uploading.
prepareMetadata(metadata)   Prepares any set of metadata for uploading by recursively converting all Buffer|Blob|File objects into a hash of the object after its been uploaded to distributed storage (e.g. IPFS). After uploading any File|Buffer|Blob, the metadata is serialized to a string.
revokeAllRolesFromAddress(address)   Call this to revoke all roles given to a specific address.
revokeRole(role, address)   Call this to revoke a role from a specific address.
setAllRoleMembers(rolesWithAddresses)   Call this to OVERWRITE the list of addresses that are members of specific roles.Every role in the list will be overwritten with the new list of addresses provided with them. If you want to add or remove addresses for a single address use grantRole and revokeRole respectively instead.