@buildeross/constants
v0.2.2
Published
Shared constants and configuration for BuilderOSS apps
Readme
@buildeross/constants
Shared constants and configuration values for BuilderOSS applications, including contract addresses, chain configurations, cache settings, and API endpoints.
Installation
pnpm install @buildeross/constantsFeatures
- Multi-Chain Support: Contract addresses for Ethereum, Base, Optimism, and Zora
- Environment-Aware: Testnet and mainnet configurations
- Cache Configuration: Optimized cache timing for different data types
- Type-Safe: Full TypeScript support with typed addresses and chain IDs
- Comprehensive Coverage: All Builder protocol contracts and external services
Usage
Contract Addresses
import {
PUBLIC_MANAGER_ADDRESS,
PUBLIC_BUILDER_ADDRESS,
PUBLIC_ZORA_NFT_CREATOR,
} from '@buildeross/constants'
// Get manager address for specific chain
const managerAddress = PUBLIC_MANAGER_ADDRESS[CHAIN_ID.ETHEREUM]
// Get builder treasury address
const builderAddress = PUBLIC_BUILDER_ADDRESS[CHAIN_ID.ETHEREUM]Chain Configuration
import {
PUBLIC_DEFAULT_CHAINS,
PUBLIC_ALL_CHAINS,
L1_CHAINS,
L2_CHAINS,
} from '@buildeross/constants'
// Use default chains based on environment
const chains = PUBLIC_DEFAULT_CHAINS
// Get L2 chains only
const l2Chains = L2_CHAINSCache Settings
import { CACHE_TIMES } from '@buildeross/constants'
// Use optimized cache times for different data types
const daoInfoCache = CACHE_TIMES.DAO_INFO
const proposalCache = CACHE_TIMES.DAO_PROPOSALAPI Configuration
import {
PUBLIC_SUBGRAPH_URL,
PUBLIC_ALCHEMY_API_URL,
PUBLIC_ETHERSCAN_API_URL,
} from '@buildeross/constants'
// Access configured API endpoints
const subgraphUrl = PUBLIC_SUBGRAPH_URL[chainId]Development
Prerequisites
- Node.js 18+
- pnpm 8+
Setup
# Install dependencies
pnpm install
# Build the package
pnpm build
# Development build with watch
pnpm dev
# Run type checking
pnpm type-check
# Run linting
pnpm lintScripts
pnpm build- Build the package for productionpnpm dev- Build in watch mode for developmentpnpm type-check- Run TypeScript type checkingpnpm lint- Run ESLint with auto-fixpnpm clean- Remove build artifacts
Dependencies
Dependencies
@buildeross/types: Shared TypeScript types
Peer Dependencies
wagmi: ^2.15.4 (for chain configurations)
Exported Constants
Contract Addresses
PUBLIC_MANAGER_ADDRESS- DAO manager contract addressesPUBLIC_L1_BRIDGE_ADDRESS- Layer 1 bridge contract addressesPUBLIC_BUILDER_ADDRESS- Builder treasury addressesPUBLIC_NOUNS_ADDRESS- Nouns treasury addressesPUBLIC_ZORA_NFT_CREATOR- Zora NFT creator contract addressesMERKLE_RESERVE_MINTER- Merkle reserve minter addressesL2_MIGRATION_DEPLOYER- L2 migration deployer addressesMERKLE_METADATA_RENDERER- Merkle metadata renderer addressesL1_CROSS_DOMAIN_MESSENGER- Cross-domain messenger addressesNULL_ADDRESS- Zero address constantALLOWED_MIGRATION_DAOS- Whitelisted DAO addresses for migration
Chain Configuration
PUBLIC_DEFAULT_CHAINS- Default chains based on environmentPUBLIC_ALL_CHAINS- All supported chains (mainnet + testnet)PUBLIC_IS_TESTNET- Environment flag for testnet modeL1_CHAINS- Layer 1 chain IDsL2_CHAINS- Layer 2 chain IDs
Cache Settings
CACHE_TIMES- Optimized cache durations for different data typesDAO_INFO- DAO metadata cachingDAO_PROPOSAL- Proposal data cachingTOKEN_INFO- Token metadata cachingEXPLORE- Explore page data cachingIN_PROGRESS_PROPOSAL- Active proposal cachingSETTLED_PROPOSAL- Historical proposal cachingDECODE- Transaction decode cachingDAO_FEED- Activity feed cachingPROFILE- User profile cachingRENDERER- Metadata renderer caching
API & Service Configuration
PUBLIC_SUBGRAPH_URL- GraphQL subgraph endpointsPUBLIC_ALCHEMY_API_KEY- Alchemy API configurationPUBLIC_ETHERSCAN_API_KEY- Etherscan API configurationPUBLIC_TENDERLY_*- Tenderly simulation configurationPUBLIC_INFURA_*- Infura RPC configurationPUBLIC_WALLETCONNECT_*- WalletConnect configurationFARCASTER_ENABLED- Farcaster integration flagSWR_KEYS- Standardized SWR cache keysLAYERS- Z-index layer constants for UIMESSAGES- Standard error and info messages
Type Safety
All addresses are typed using AddressType from @buildeross/types, ensuring type safety across the application. Chain IDs use the CHAIN_ID enum for consistent chain identification.
Environment Support
The package automatically detects the environment using NEXT_PUBLIC_NETWORK_TYPE and provides appropriate configurations for both testnet and mainnet deployments.
License
MIT License - see LICENSE file for details.
