Skip to main content

useIsAddressRole() function

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

Use this to check if a WalletAddress is a member of a role on a

Example

const {
data: isMember,
isLoading,
error,
} = useIsAddressRole(SmartContract, "admin", "0x123");

Signature:

export declare function useIsAddressRole<TContract extends ContractWithRoles>(
contract: RequiredParam<TContract>,
role: RolesForContract<TContract>,
walletAddress: RequiredParam<WalletAddress>,
): boolean;

Parameters

ParameterTypeDescription
contractRequiredParam<TContract>an instance of a
roleRolesForContract<TContract>the role to check the member against, see
walletAddressRequiredParam<WalletAddress>the address to check

Returns:

boolean

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