@kondor-ai/address-book
v0.0.5
Published
A package that provides chain configurations, contract addresses, and RPC URLs for various blockchain networks.
Readme
@kondor-ai/address-book
A package that provides chain configurations, contract addresses, and RPC URLs for various blockchain networks.
Overview
This package extends the chain configurations from viem with additional contract addresses and RPC URLs. It supports the following networks:
- Arbitrum
- Avalanche
- Base
- Ethereum
- Optimism
- Polygon
Each chain configuration includes:
- Standard chain properties from viem
- Custom RPC URLs including DRPC endpoints
- Contract addresses for common protocols like Aave V3 Pool, USDC, and USDT
Installation
npm install @kondor-ai/address-book
# or
yarn add @kondor-ai/address-book
# or
pnpm add @kondor-ai/address-bookUsage
import { arbitrum, ethereum, getPublicRpcUrl, getAuthenticatedRpcUrl } from '@kondor-ai/address-book';
// Access chain configurations
console.log(arbitrum.id); // 42161
console.log(ethereum.contracts.usdc.address); // 0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48
// Get RPC URLs
const publicRpcUrl = getPublicRpcUrl(arbitrum);
const authenticatedRpcUrl = getAuthenticatedRpcUrl(arbitrum);Environment Variables
This package requires the following environment variables to be set:
# For Block Explorers Authenticated API
ARBISCAN_API_KEY: ${ARBISCAN_API_KEY}
BASESCAN_API_KEY: ${BASESCAN_API_KEY}
ETHERSCAN_API_KEY: ${ETHERSCAN_API_KEY}
OPTIMISM_EXPLORER_API_KEY: ${OPTIMISM_EXPLORER_API_KEY}
POLYGONSCAN_API_KEY: ${POLYGONSCAN_API_KEY}
SNOWTRACE_API_KEY: ${SNOWTRACE_API_KEY}
# For Authenticated RPC URL
DRPC_API_KEY={DRPC_API_KEY}API
Chain Configurations
Each chain configuration extends the viem Chain type with additional properties:
rpcUrls: Includes both default and DRPC endpointscontracts: Contains addresses for various contracts on the chain
Utility Functions
getPublicRpcUrl(chain): Returns the default public RPC URL for a chaingetAuthenticatedRpcUrl(chain): Returns the authenticated DRPC URL for a chain
License
MIT
