ContractRoles class
Handle contract permissions
Example
const contract = await sdk.getContract("{{contract_address}}");
const rolesAndMembers = await contract.roles.getAll();
await contract.roles.grantRole("admin", "0x...");
Constructors
Constructor | Modifiers | Description |
---|---|---|
(constructor)(contractWrapper, roles) | Constructs a new instance of the ContractRoles class |
Properties
Property | Modifiers | Type | Description |
---|---|---|---|
featureName | "Permissions" |
Methods
Method | Modifiers | Description |
---|---|---|
get(role) | Call this to get a list of addresses that are members of a specific role. | |
getAll() | Call this to get get a list of addresses for all supported roles on the contract. | |
grant(role, address) | Call this to grant a role to a specific address. | |
revoke(role, address) | Call this to revoke a role from a specific address. | |
setAll(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 ContractRoles.grant() and ContractRoles.revoke() respectively instead. |
Signature:
export declare class ContractRoles<TContract extends IPermissions, TRole extends Role> implements DetectableFeature
Implements: DetectableFeature
Remarks
Configure roles and permissions for a contract, to restrict certain actions.