Skip to main content

useSetAllRoleMembers() function

This feature is currently in beta and may change based on feedback that we receive.

Use this to OVERWRITE the list of addresses that are members of specific roles

Example

const Component = () => {
const {
mutate: overwriteRoles,
isLoading,
error,
} = useSetAllRoleMembers(SmartContract);

if (error) {
console.error("failed to overwrite roles", error);
}

return (
<button
disabled={isLoading}
onClick={() => overwriteRoles({ rolesWithAddresses: { minter: [] } })}
>
Overwrite Roles
</button>
);
};

Signature:

export declare function useSetAllRoleMembers<
TContract extends ContractWithRoles,
>(
contract: RequiredParam<TContract>,
): import("@tanstack/react-query").UseMutationResult<
void,
unknown,
{ [role in RolesForContract<TContract>]: string[] },
unknown
>;

Parameters

ParameterTypeDescription
contractRequiredParam<TContract>an instance of a

Returns:

import("@tanstack/react-query").UseMutationResult<void, unknown, { [role in RolesForContract<TContract>]: string[]; }, unknown>

a mutation object that can be used to overwrite all roles on the contract