useRoleMembers
Hook for getting all wallet addresses that have a specific role in a smart contract.
Available to use on contracts that implement the PermissionsEnumerable interface.
import { useRoleMembers } from "@thirdweb-dev/react";
const { data, isLoading, error } = useRoleMembers(contract, "{{role_name}}");
Usage
Provide your contract instance from the useContract
and role name as the arguments.
import { useContract, useRoleMembers } from "@thirdweb-dev/react";
// Your smart contract address (must implement permission controls)
const contractAddress = "{{contract_address}}";
const roleName = "admin";
function App() {
const { contract } = useContract(contractAddress);
const { data, isLoading, error } = useRoleMembers(contract, roleName);
}