Docs

useIsAddressRole

Hook to check if an address is a member of a role on a smart contract.

Available to use on contracts that implement Permissions interface

Provide the following arguments to the hook:

  • contract - The contract instance to check the role on.

  • roleName - The name of the role to check.

  • address - The wallet address to see if it is a member of the role.

Example

import { useIsAddressRole, useContract } from "@thirdweb-dev/react";
function App() {
const { contract } = useContract(contractAddress);
const isMember = useIsAddressRole(
contract,
roleName,
walletAddress,
);
}

Parameters

Returns

true if the address is a member of the role, or false if not