useSetAllRoleMembers

Overwrite the list of members for specific roles

Example

const Component = () => {
const { contract } = useContract("{{contract_address}}");
const {
mutate: overwriteRoles,
isLoading,
error,
} = useSetAllRoleMembers(contract);
if (error) {
console.error("failed to overwrite roles", error);
}
return (
<button
disabled={isLoading}
onClick={() =>
overwriteRoles({
rolesWithAddresses: { minter: ["{{wallet_address}"] },
})
}
>
Overwrite Roles
</button>
);
};
function useSetAllRoleMembers(
contract: RequiredParam<TContract>,
): UseMutationResult<
void,
unknown,
{ [role in any]: Array<string> },
unknown
>;

Parameters

Instance of a SmartContract

Type

let contract: RequiredParam<TContract>;

Returns

let returnType: UseMutationResult<
void,
unknown,
{ [role in any]: Array<string> },
unknown
>;

A mutation object to overwrite all roles on the contract