# Contracts

This module exports several contract factories and types that are autogenerated from ABI files. Below is a summary of each export:

* **FeeContract**: This is a type representing the FeeContract, which is used for handling fee-related operations within the blockchain.
* **ProofOfIdentity**: This type represents the ProofOfIdentity contract, which is used for getting and verifying the identity of users on the blockchain.
* **ProofOfIdentityV2**: This is an updated version of the ProofOfIdentity contract, providing enhanced features for identity verification.

## Typechain Generated ABI with Ethers.js

The autogenerated ABI files are ready to be used with Ethers.js, providing a seamless integration for interacting with Ethereum smart contracts. The Typechain-generated types ensure type safety and autocompletion in your IDE, making it easier to work with contract methods and events.

### Using the Factories

Each contract has a corresponding factory class that can be used to create instances of the contract. These factories are designed to work with Ethers.js, allowing you to connect to contracts using a signer or provider.

Example usage:

```typescript
import { ethers } from 'ethers';

import { ProofOfIdentity__factory } from '@haven1/blockchain-sdk/contract';

const provider = new ethers.providers.JsonRpcProvider('YOUR_RPC_URL');
const contractAddress = 'YOUR_CONTRACT_ADDRESS';
const proofOfIdentity = ProofOfIdentity__factory.connect(
  contractAddress,
  provider,
);

// Now you can call contract methods
const balance = await proofOfIdentity.balanceOf('0xYourAddress');
console.log(balance.toString());
```

This setup allows you to interact with the blockchain efficiently, leveraging the power of TypeScript for better code quality and maintainability.


---

# Agent Instructions: 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:

```
GET https://docs.haven1.org/build/developer-tools/haven1-sdk/haven1-blockchain-sdk/contracts.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
