useAllRoleMembers

Hook for getting all wallet addresses that have a role in a smart contract.

Available to use on contracts that implement Permissions .

Example

import { useAllRoleMembers, useContract } from "@thirdweb-dev/react";
function App() {
const { contract } = useContract(contractAddress);
const { data, isLoading, error } = useAllRoleMembers(contract);
}

Parameters

Returns

The hook's data property, once loaded, is an object, where the keys are the role names and the values are arrays of wallet addresses that have that role.

For example, if the contract has two roles, admin and transfer , and the admin role has two members, the data property will look like this:

{
admin: ["0x1234", "0x5678"],
transfer: [],
}

Type

Record<
| "admin"
| "transfer"
| "minter"
| "pauser"
| "lister"
| "asset"
| "unwrap"
| "factory"
| (string & {}),
string[]
> | undefined;