Kobe Client
A comprehensive, async Rust client library for interacting with Jito Network APIs.
Features
- MEV & Staker Rewards API: Query MEV and priority fee rewards for stakers and validators
- Stake Pool API: Access validator statistics, JitoSOL metrics, and network data
- StakeNet API: On-chain validator history and performance data
- Async/Await: Built on
tokioandreqwestfor high-performance async operations - Type-Safe: Strongly typed request and response structures
- Error Handling: Comprehensive error types with detailed messages
- Retry Logic: Automatic retry with exponential backoff
- Configurable: Flexible configuration options for timeouts, retries, and more
Installation
Add this to your Cargo.toml:
[]
= "0.1"
= { = "1", = ["full"] }
Quick Start
use KobeClient;
async
Usage Examples
MEV & Staker Rewards API
Get Staker Rewards
use JitoClient;
let client = mainnet;
// Get top 5 staker rewards
let rewards = client.get_staker_rewards.await?;
for reward in rewards.rewards
Get Validator Rewards
// Get validator rewards for a specific epoch
let validator_rewards = client.get_validator_rewards.await?;
for validator in validator_rewards.validators
Stake Pool API
Get Validator Information
// Get all validators for the current epoch
let validators = client.get_validators.await?;
// Get validators for a specific epoch
let validators_600 = client.get_validators.await?;
// Filter validators running Jito
let jito_validators: = validators.validators
.into_iter
.filter
.collect;
println!;
Get Validator History
// Get historical data for a specific validator
let vote_account = "GdRKUZKdiXMEATjddQW6q4W8bPgXRBYJKayfeqdQcEPa";
let history = client.get_validator_history.await?;
for entry in history.iter.take
Get MEV Network Statistics
// Get current epoch MEV stats
let mev_stats = client.get_mev_rewards.await?;
println!;
println!;
// Get MEV stats for a specific epoch
let mev_stats_600 = client.get_mev_rewards.await?;
Get JitoSOL Metrics
use ;
// Get JitoSOL to SOL ratio for the last 7 days
let end = now;
let start = end - days;
let ratio = client.get_jitosol_sol_ratio.await?;
for point in ratio.ratios
Get MEV Commission Averages
// Get historical MEV commission averages with APY and TVL data
let commission_data = client.get_mev_commission_average_over_time.await?;
println!;
// Print APY data
for apy_point in commission_data.apy
Convenience Methods
// Get current epoch
let current_epoch = client.get_current_epoch.await?;
println!;
// Get only Jito-running validators
let jito_validators = client.get_jito_validators.await?;
// Get top 10 validators by MEV rewards
let top_validators = client.get_validators_by_mev_rewards.await?;
// Check if a validator is running Jito
let is_jito = client.is_validator_running_jito.await?;
// Get validator MEV commission
let commission = client.get_validator_mev_commission.await?;
// Calculate total MEV rewards across multiple epochs
let total_mev = client.calculate_total_mev_rewards.await?;
println!;
Configuration
Using the Builder Pattern
use JitoClientBuilder;
use Duration;
let client = new
.timeout
.user_agent
.retry
.max_retries
.build;
Using Config
use ;
use Duration;
let config = mainnet
.with_timeout
.with_user_agent
.with_retry
.with_max_retries;
let client = new;
Custom Base URL
let config = custom;
let client = new;
Error Handling
The library provides detailed error types:
use ;
let client = mainnet;
match client.get_staker_rewards.await
Advanced Usage
Query Parameters
use QueryParams;
let params = default
.limit
.offset
.epoch;
let rewards = client.get_staker_rewards_with_params.await?;
Retry Logic
The client automatically retries failed requests with exponential backoff. You can configure this behavior:
let client = new
.retry // Enable retries
.max_retries // Maximum 3 retry attempts
.build;
Retries are attempted for:
- Network timeouts
- Connection errors
- Temporary network issues
Retries are NOT attempted for:
- Invalid parameters (400)
- Not found errors (404)
- Rate limiting (429)
- Server errors (5xx)
API Documentation
For detailed API documentation, visit:
Examples
Check the examples/ directory for complete working examples:
# Run the basic example
# Run the validator analysis example
# Run the MEV tracking example
Testing
# Run all tests
# Run tests with output
# Run specific test
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
This project is licensed under either of:
- Apache License, Version 2.0 (LICENSE or http://www.apache.org/licenses/LICENSE-2.0)
at your option.
Disclaimer
This is an unofficial client library and is not affiliated with or endorsed by Jito Labs or the Jito Foundation.