git add A robust TypeScript-based SEDA Oracle Push Solver for enterprise-grade Oracle integrations. This system posts DataRequests to the SEDA oracle network, orchestrates EVM integrations across multiple chains, and provides comprehensive batch processing with advanced reliability features.
- π Multi-Chain Oracle Integration - Seamlessly integrate SEDA oracle data with multiple EVM chains
- ποΈ Enterprise Architecture - Service-oriented design with dependency injection and clean separation of concerns
- π Robust Batch Processing - Advanced batch handling with signature validation and merkle proof generation
- β‘ Type-Safe Operations - Full TypeScript support with comprehensive type definitions
- π‘οΈ Production-Ready Reliability - Comprehensive error handling, retry logic, and graceful degradation
- π Advanced Scheduling - Cosmos sequence coordination, task management, and intelligent retry mechanisms
- π Multi-Network Support - Testnet, mainnet, and local development environments
- π§ Consolidated Configuration - Centralized, environment-based configuration management
- π Structured Logging - Comprehensive execution tracking with configurable log levels
- π§ͺ Comprehensive Testing - Full test coverage with mock services and integration tests
# Install dependencies
npm install
# Set up environment (copy and edit)
cp env.example .env
# Run the push solver
npm start
# Or run in development mode
npm run dev
seda-push-solver/
βββ src/
β βββ index.ts # Main exports
β βββ runner.ts # Application runner
β βββ scheduler.ts # Main scheduler entry point
β β
β βββ config/ # π§ Consolidated Configuration
β β βββ index.ts # Configuration exports
β β βββ seda.ts # SEDA network configurations
β β βββ evm.ts # EVM network configurations
β β βββ environment.ts # Environment utilities
β β βββ validators.ts # Configuration validation
β β
β βββ types/ # π Type Definitions
β β βββ index.ts # Type exports
β β βββ core.ts # Core system types
β β βββ seda.ts # SEDA-specific types
β β βββ evm.ts # EVM-specific types
β β βββ batch-types.ts # Batch processing types
β β
β βββ core/ # ποΈ Core Business Logic
β β βββ data-request/ # DataRequest operations
β β β βββ data-request-builder.ts # DataRequest construction
β β β βββ executor.ts # DataRequest execution
β β β βββ input-builder.ts # Input parameter building
β β β βββ signer.ts # SEDA signer management
β β β βββ config-loader.ts # Configuration loading
β β β βββ index.ts # Module exports
β β β
β β βββ scheduler/ # Advanced scheduling system
β β β βββ scheduler-core.ts # Core scheduling logic
β β β βββ task-manager.ts # Task lifecycle management
β β β βββ task-executor.ts # Task execution engine
β β β βββ cosmos-sequence-coordinator.ts # Cosmos sequence handling
β β β βββ retry-handler.ts # Intelligent retry logic
β β β βββ statistics.ts # Performance metrics
β β β βββ types.ts # Scheduler types
β β β
β β βββ network/ # Network abstractions (legacy compatibility)
β β βββ index.ts # Re-exports from config module
β β
β βββ evm/ # π EVM Integration
β β βββ orchestrator.ts # Multi-chain orchestration
β β βββ batch-poster.ts # Batch posting to EVM chains
β β βββ result-poster.ts # Result posting logic
β β βββ prover-discovery.ts # Prover contract discovery
β β βββ abi/ # Contract ABIs
β β
β βββ crypto/ # π Cryptographic Operations
β β βββ signature-processor.ts # Signature validation and processing
β β βββ merkle-proof-generator.ts # Merkle proof generation
β β βββ constants.ts # Crypto constants
β β
β βββ seda/ # π SEDA Network Integration
β β βββ batch-client.ts # Batch data client
β β βββ batch-service.ts # Batch processing service
β β βββ data-request-client.ts # DataRequest client
β β
β βββ services/ # π― Service Layer
β β βββ service-container.ts # Dependency injection container
β β βββ seda-service.ts # SEDA operations service
β β βββ config-service.ts # Configuration management service
β β βββ logging-service.ts # Structured logging service
β β βββ index.ts # Service exports
β β
β βββ infrastructure/ # ποΈ Infrastructure Services
β β βββ infrastructure-container.ts # Infrastructure DI container
β β βββ timer-service.ts # Timer abstractions
β β βββ process-service.ts # Process lifecycle management
β β βββ health-service.ts # Health monitoring
β β βββ index.ts # Infrastructure exports
β β
β βββ helpers/ # π§ Utility Functions
β β βββ error-utils.ts # Error handling utilities
β β βββ timeout-utils.ts # Timeout management
β β βββ index.ts # Helper exports
β β
β βββ utils/ # π οΈ General Utilities
β βββ hex.ts # Hex conversion utilities
β
βββ tests/ # π§ͺ Test Suite
β βββ unit/ # Unit tests
β β βββ types.test.ts # Type definition tests
β β βββ config.test.ts # Configuration tests
β β βββ services.test.ts # Service layer tests
β β βββ infrastructure.test.ts # Infrastructure tests
β β βββ index-exports.test.ts # Export validation tests
β β
β βββ mocks/ # Mock implementations
β β βββ config-service.mock.ts # Mock configuration service
β β βββ seda-service.mock.ts # Mock SEDA service
β β βββ logging-service.mock.ts # Mock logging service
β β βββ infrastructure.mock.ts # Mock infrastructure services
β β
β βββ integration/ # Integration tests
β
βββ config.ts # Global configuration
βββ package.json # Dependencies and scripts
βββ tsconfig.json # TypeScript configuration
βββ .env # Environment variables (create from template)
Create a .env
file with your configuration:
# SEDA Network Configuration
SEDA_NETWORK=testnet # testnet, mainnet, or local
SEDA_MNEMONIC="your 24-word mnemonic" # Your SEDA wallet mnemonic
SEDA_RPC_ENDPOINT= # Optional: custom RPC endpoint
SEDA_ORACLE_PROGRAM_IDS="program1,program2" # Your Oracle Program IDs (comma-separated for multiple programs)
# DataRequest Configuration
SEDA_REPLICATION_FACTOR=1 # Number of oracle replications
SEDA_DR_TIMEOUT_SECONDS=120 # DataRequest timeout
SEDA_DR_POLLING_INTERVAL_SECONDS=5 # Polling interval
SEDA_DR_MEMO="Custom DataRequest" # Custom memo text
# Scheduler Configuration
SCHEDULER_INTERVAL_MS=60000 # Interval between operations (ms)
SCHEDULER_CONTINUOUS=true # Run continuously
SCHEDULER_MAX_RETRIES=3 # Maximum retry attempts
SCHEDULER_MEMO="Scheduled Operation" # Scheduler memo
# EVM Configuration (if using EVM integration)
EVM_PRIVATE_KEY="your-private-key" # EVM private key
EVM_NETWORKS=sepolia,polygon # Enabled EVM networks
# Advanced Configuration
COSMOS_POSTING_TIMEOUT_MS=20000 # Cosmos posting timeout
COSMOS_MAX_QUEUE_SIZE=100 # Maximum queue size
LOG_LEVEL=info # Logging level (debug, info, warn, error)
The project now uses consolidated configuration in src/config/seda.ts
:
// Network configurations are now centralized and type-safe
export const SEDA_NETWORKS = {
testnet: {
name: 'testnet',
rpcEndpoint: 'https://rpc.testnet.seda.xyz',
explorerEndpoint: 'https://testnet.explorer.seda.xyz',
dataRequest: {
oracleProgramId: getRequiredOracleProgramId(),
replicationFactor: 1,
execGasLimit: BigInt(150_000_000_000_000),
gasPrice: BigInt(10_000),
consensusOptions: { method: 'none' as const },
timeoutSeconds: 120,
pollingIntervalSeconds: 1,
memo: 'DX Feed Oracle DataRequest'
}
}
// ... other networks
};
npm start
- Start the push solver in production modenpm run dev
- Start in development mode with hot reloadnpm run build
- Build and type-check the projectnpm test
- Run the test suitenpm run lint
- Lint the codebasenpm run clean
- Clean build artifacts
import {
SEDADataRequestBuilder,
loadSEDAConfig,
ServiceContainer
} from './src';
// Initialize services
const services = ServiceContainer.createProduction();
const config = services.configService.loadSEDAConfig();
// Create and initialize builder
const builder = new SEDADataRequestBuilder(config);
await builder.initialize();
// Post a DataRequest
const result = await builder.postDataRequest({
memo: 'My custom DataRequest'
});
console.log('DataRequest ID:', result.drId);
console.log('Exit Code:', result.exitCode);
import { ServiceContainer, getServices } from './src/services';
// Use production services
const services = ServiceContainer.createProduction();
// Access individual services
const sedaService = services.sedaService;
const logger = services.loggingService;
const config = services.configService;
// Or use global services
const globalServices = getServices();
import { SEDADataRequestScheduler } from './src';
// Create scheduler with custom configuration
const scheduler = new SEDADataRequestScheduler({
intervalMs: 30000, // 30 seconds
continuous: true,
maxRetries: 3,
memo: 'Scheduled DataRequest'
});
// Start the scheduler
await scheduler.initialize();
await scheduler.start();
- Centralized: All configuration now lives in
src/config/
- Type-Safe: Full TypeScript support with proper interfaces
- Environment-Driven: Easy deployment configuration
- Backward Compatible: Legacy imports still work
- Dependency Injection: Clean service container pattern
- Interface-Based: Easy testing and mocking
- Separation of Concerns: Clear boundaries between layers
- Production-Ready: Full error handling and logging
- Eliminated
any
Types: Replaced with proper TypeScript interfaces - Comprehensive Type Definitions: Full coverage of all operations
- Runtime Safety: Type validation and error handling
- Developer Experience: Better IDE support and autocomplete
- Signature Validation: Cryptographic signature verification
- Merkle Proof Generation: Efficient proof generation for validators
- Multi-Chain Support: Simultaneous EVM chain integration
- Error Recovery: Robust error handling and retry logic
The project includes comprehensive testing:
# Run all tests
npm test
# Run specific test suites
npm run test:unit
npm run test:integration
npm run test:types
# Run with coverage
npm run test:coverage
- Unit Tests: Individual component testing
- Integration Tests: End-to-end workflow testing
- Type Tests: TypeScript compilation and type safety
- Mock Services: Isolated testing with mock implementations
- Node.js v18 or higher
- TypeScript v4.5 or higher
- SEDA Account with testnet/mainnet tokens
- Oracle Program deployed to SEDA network
- EVM Private Key (for EVM integration features)
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
The solver now supports executing multiple oracle programs in parallel within each scheduled interval. This allows you to:
- Post DataRequests for multiple programs simultaneously: All configured programs execute in parallel rather than sequentially
- Track multiple DataRequests concurrently: Each program's DataRequest is tracked independently
- Post results to EVM chains in parallel: Results from all programs are processed and posted to EVM networks simultaneously
Configure multiple oracle programs using the SEDA_ORACLE_PROGRAM_IDS
environment variable:
# Single program (legacy support)
SEDA_ORACLE_PROGRAM_IDS="your-single-program-id"
# Multiple programs (new parallel execution)
SEDA_ORACLE_PROGRAM_IDS="program-id-1,program-id-2,program-id-3"
- Parallel Posting: When the scheduler triggers, it posts DataRequests for all configured programs simultaneously
- Independent Tracking: Each program's DataRequest is tracked independently with its own lifecycle
- Parallel Result Processing: Once oracle execution completes, results from all programs are processed and posted to EVM networks in parallel
- Comprehensive Logging: The system provides detailed logs for each program's execution status
- Improved Efficiency: Multiple programs execute concurrently instead of waiting for each other
- Better Resource Utilization: Takes full advantage of parallel processing capabilities
- Reduced Latency: Overall execution time is determined by the slowest program rather than the sum of all programs
- Maintained Reliability: Each program operates independently, so failures in one don't affect others