Environment Constants
TheEnvironmentConstants object contains all network-specific endpoints:
RPC Endpoints
Configure Solana RPC connections with multiple providers:Mainnet RPCs
Devnet RPCs
RPC Endpoint Interface
API Server URLs
History Server
Historical trading data and analytics:Data Server
Real-time market data and price feeds:DLOB Server
Decentralized Limit Order Book access:Events Server
Real-time event streaming:Swift Server
High-performance transaction execution:SDK Configuration
Initialize the Drift SDK with environment-specific settings:Config Object
The globalConfig object maintains SDK state:
Accessing Market Configs
Environment Selection
Choose the appropriate environment based on your use case:Mainnet (Production)
- Production applications
- Real trading
- Live user data
Devnet (Development)
- Development and testing
- Integration testing
- Feature development
Staging
- Pre-production testing
- Release candidate validation
- Performance testing
Connection Strategies
Single RPC Connection
RPC Failover
Multiple Connections
Best Practices
Environment Variables
Store environment selection in environment variables:Lazy Initialization
Initialize only when needed:Type Safety
Use TypeScript for environment safety:Error Handling
Handle connection failures gracefully:Related Resources
Error Handling
Learn about error handling strategies
Performance Optimization
Optimize your Drift integration