Skip to main content

ContractRoles.setAll() method

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.

Example

Say you want to overwrite the list of addresses that are members of the minter role.

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 []

Signature:

setAll(rolesWithAddresses: {
[key in TRole]?: string[];
}): Promise<TransactionResult>;

Parameters

ParameterTypeDescription
rolesWithAddresses{ [key in TRole]?: string[]; }A record of Roles to lists of addresses that should be members of the given role.

Returns:

Promise<TransactionResult>

Exceptions

If you are requestiong a role that does not exist on the contract this will throw an error.