Docs

useRoleMembers

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

Available to use on contracts that implement the Permissions interface.

Example

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,
);
}

Parameters

Returns

The hook's data property, once loaded, is an array of wallet addresses that have the specified role