open-index/open-npm huggingface dataset:
npm package: @phonktown/contract-indexer
Description: TypeScript contract library with auto-generated ABIs and typed contract instances
Author: Phonktown
Latest version: 1.0.1

# Contract Indexer

A TypeScript library that automatically fetches ABIs from Etherscan and generates fully typed contract instances for viem.

## Installation

```bash
npm install @phonktown/contract-indexer
# or
yarn add @phonktown/contract-indexer
```

## Usage

### Basic Usage

```typescript
import { contracts, createContracts } from '@your-org/contract-indexer';
import { createPublicClient, http } from 'viem';

// Define your chain configuration
const hoodiChain = {
  id: 17000,
  name: 'Hoodi',
  network: 'hoodi',
  nativeCurrency: { decimals: 18, name: 'Ether', symbol: 'ETH' },
  rpcUrls: {
    default: { http: ['https://rpc.hoodi.network'] },
    public: { http: ['https://rpc.hoodi.network'] },
  },
} as const;

// Create a viem client
const client = createPublicClient({
  chain: hoodiChain,
  transport: http()
});

// Get typed contract instances
const { 
  dualgovernanceContract, 
  emergencyprotectedtimelockContract,
  dualgovernanceconfigproviderContract 
} = createContracts.hoodi(client);

// Now you have fully typed contract instances!
const result = await dualgovernanceContract.read.someFunction();
```

### Available Networks

```typescript
// Access contract configurations without a client
console.log('Available networks:', Object.keys(contracts));
// -> ['mainnet', 'hoodi']

console.log('Hoodi contracts:', Object.keys(contracts.hoodi));
// -> ['dualgovernanceContract', 'emergencyprotectedtimelockContract', ...]

// Get contract address and ABI
const { address, abi } = contracts.hoodi.dualgovernanceContract;
```

### Multi-Network Support

```typescript
import { mainnet } from 'viem/chains';

// Create clients for different networks
const mainnetClient = createPublicClient({ chain: mainnet, transport: http() });
const hoodiClient = createPublicClient({ chain: hoodiChain, transport: http() });

// Get contracts for each network
const mainnetContracts = createContracts.mainnet(mainnetClient);
const hoodiContracts = createContracts.hoodi(hoodiClient);
```

## Features

- ✅ **Fully Typed**: Complete TypeScript support with auto-generated types
- ✅ **Multi-Network**: Support for mainnet, hoodi, and more
- ✅ **Auto-Generated ABIs**: Fetched from Etherscan and cached
- ✅ **viem Integration**: Ready-to-use with viem contract instances
- ✅ **Tree Shakeable**: Import only what you need

## Contract Addresses

### Hoodi Network
- **DualGovernance**: `0x9CAaCCc62c66d817CC59c44780D1b722359795bF`
- **EmergencyProtectedTimelock**: `0x69E8e916c4A19F42C13C802abDF2767E1fB4F059`
- **DualGovernanceConfigProvider**: `0x2b685e6fB288bBb7A82533BAfb679FfDF6E5bb33`

## Development

This package automatically fetches ABIs from Etherscan and generates typed contract instances. The build process ensures all contracts are up-to-date and fully typed.

## License

MIT