> For the complete documentation index, see [llms.txt](https://docs.haven1.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.haven1.org/build/developer-tools/haven1-sdk/use-cases-and-examples/check-proof-of-identity-poi-status.md).

# Check Proof of Identity (POI) Status

This guide provides an example of how to check if a user is POI active by verifying that the user's ProofOfIdentity balance is more than 0 and that the user is not suspended.

## Example Code

```typescript
import { ProofOfIdentityContract as ProofOfIdentityContractSDK } from '@haven1/blockchain-sdk/contract';
import { useReadContracts } from 'wagmi';
import { Address } from 'viem';

type CheckPOIStatusParameters = {
  address: Address;
  contractAddress: Address;
  chainId: number;
};

export const checkPOIStatus = async ({
  address,
  contractAddress,
  chainId,
}: CheckPOIStatusParameters) => {
  const { data: poiResult, isLoading, isError } = useReadContracts({
    contracts: [
      {
        address: contractAddress,
        chainId,
        abi: ProofOfIdentityContractSDK.abi,
        functionName: 'balanceOf',
        args: [address],
      },
      {
        address: contractAddress,
        chainId,
        abi: ProofOfIdentityContractSDK.abi,
        functionName: 'isSuspended',
        args: [address],
      },
    ],
  });

  if (isLoading) {
    console.log('Loading POI status...');
    return;
  }

  if (isError) {
    console.error('Error fetching POI status');
    return;
  }

  const balance = poiResult?.[0]?.result;
  const isSuspended = poiResult?.[1]?.result;

  if (balance > 0 && !isSuspended) {
    console.log('User is POI active');
  } else {
    console.log('User is not POI active');
  }
};
```

## Usage

```typescript
const params = {
  address: '0xUserAddress',
  contractAddress: '0xContractAddress',
  chainId: Haven1Testnet,
};

checkPOIStatus(params);
```

This example demonstrates how to use the `checkPOIStatus` function to verify if a user is POI active by checking their balance and suspension status.

## Example Code using ProofOfIdentity wagmi wrap Contract hook

```typescript
import { ProofOfIdentity } from '@haven1/wagmi-sdk/contract';
import { useEffect } from 'react';

const CheckPOIStatusWithHook = ({ address, contractAddress, chainId }) => {
  const { data, isLoading, isError } = ProofOfIdentity({
    address,
    contractAddress,
    chainId,
  });

  useEffect(() => {
    if (isLoading) {
      console.log('Loading POI status...');
      return;
    }

    if (isError) {
      console.error('Error fetching POI status');
      return;
    }

    const { balance, isSuspended } = data;

    if (balance > 0 && !isSuspended) {
      console.log('User is POI active');
    } else {
      console.log('User is not POI active');
    }
  }, [data, isLoading, isError]);

  return null;
};
```

## Usage

```typescript
const params = {
  address: '0xUserAddress',
  contractAddress: '0xContractAddress',
  chainId: Haven1Testnet,
};

<CheckPOIStatusWithHook {...params} />;
```

This example demonstrates how to use the `useProofOfIdentity` hook to verify if a user is POI active by checking their balance and suspension status.

### Contract Addresses

Here are the contract addresses for different environments:

#### **Proof** of **identity** V1

* devnet: `0xd635521BA9c5694a2237EA94f2455aBfdDF41ef9`
* testnet: `0xDb5ecc06e7C82d3ed4dBA699b8E8D0433A3ED729`

#### Proof of identity V2&#x20;

* devnet: `0x89B63B0698b03B01F7b75f0e1973DE6270D89dA5`
* testnet: `N/A`


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.haven1.org/build/developer-tools/haven1-sdk/use-cases-and-examples/check-proof-of-identity-poi-status.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
