typescript-sdk

Home > @3rdweb/sdk > ModuleWithRoles > setAllRoleMembers

ModuleWithRoles.setAllRoleMembers() 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 grantRole and revokeRole respectively instead.

Signature:

setAllRoleMembers(rolesWithAddresses: SetAllRoles): Promise<any>;

Parameters

Parameter Type Description
rolesWithAddresses SetAllRoles A record of Roles to lists of addresses that should be members of the given role.

Returns:

Promise<any>

Exceptions

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

Example

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

const minterAddresses: string[] = await module.getRoleMemberList("minter");
await module.setAllRoleMembers({
 minter: []
});
console.log(await module.getRoleMemberList("minter")); // No matter what members had the role before, the new list will be set to []