KobeClient

Struct KobeClient 

Source
pub struct KobeClient { /* private fields */ }
Expand description

Main client for interacting with Jito APIs

Implementations§

Source§

impl KobeClient

Source

pub fn new(config: Config) -> Self

Create a new Jito API client with the given configuration

Source

pub fn mainnet() -> Self

Create a client with mainnet defaults

Examples found in repository?
examples/basic.rs (line 6)
4async fn main() {
5    // Create a client with mainnet defaults
6    let client = KobeClient::mainnet();
7
8    println!("=== Jito API Client - Basic Example ===\n");
9
10    // 1. Get current epoch
11    println!("1. Getting current epoch...");
12    let current_epoch = client.get_current_epoch().await.unwrap();
13    println!("   Current epoch: {}\n", current_epoch);
14
15    // 2. Get staker rewards
16    println!("2. Getting staker rewards (limit 5)...");
17    let rewards = client.get_staker_rewards(Some(5)).await.unwrap();
18    println!("   Found {} staker rewards:", rewards.rewards.len());
19    for (i, reward) in rewards.rewards.iter().enumerate() {
20        println!(
21            "   {}. Stake Account: {}",
22            i + 1,
23            &reward.stake_account[..8]
24        );
25        println!("      MEV Rewards: {} lamports", reward.mev_rewards);
26        println!("      Epoch: {}", reward.epoch);
27        println!("      Claimed: {}", reward.mev_claimed);
28    }
29    println!();
30
31    // 3. Get validator information
32    println!("3. Getting validators running Jito...");
33    let jito_validators = client.get_jito_validators().await.unwrap();
34    println!("   Found {} validators running Jito", jito_validators.len());
35
36    // Show top 5 by stake
37    let top_5_by_stake = jito_validators.iter().take(5);
38    for (i, validator) in top_5_by_stake.enumerate() {
39        println!(
40            "   {}. Vote Account: {}",
41            i + 1,
42            &validator.vote_account[..8]
43        );
44        println!("      Active Stake: {} lamports", validator.active_stake);
45        println!("      MEV Commission: {} bps", validator.mev_commission_bps);
46    }
47    println!();
48
49    // 4. Get network MEV statistics
50    println!("4. Getting MEV network statistics...");
51    let mev_stats = client.get_mev_rewards(None).await.unwrap();
52    println!("   Epoch: {}", mev_stats.epoch);
53    println!(
54        "   Total Network MEV: {} lamports",
55        mev_stats.total_network_mev_lamports
56    );
57    println!(
58        "   Jito Stake Weight: {} lamports",
59        mev_stats.jito_stake_weight_lamports
60    );
61    println!(
62        "   MEV per lamport: {:.10}",
63        mev_stats.mev_reward_per_lamport
64    );
65    println!();
66
67    // 5. Get validator rewards
68    println!("5. Getting validator rewards...");
69    let validator_rewards = client.get_validator_rewards(None, Some(3)).await.unwrap();
70    println!("   Top 3 validators by rewards:");
71    for (i, validator) in validator_rewards.validators.iter().enumerate() {
72        println!(
73            "   {}. Vote Account: {}",
74            i + 1,
75            &validator.vote_account[..8]
76        );
77        println!("      MEV Rewards: {} lamports", validator.mev_rewards);
78        if let Some(pf_rewards) = validator.priority_fee_rewards {
79            println!("      Priority Fee Rewards: {} lamports", pf_rewards);
80        }
81    }
82    println!();
83
84    // 6. Get historical validator data
85    println!("6. Getting historical data for a validator...");
86    if let Some(first_validator) = jito_validators.first() {
87        let history = client
88            .get_validator_history(&first_validator.vote_account)
89            .await
90            .unwrap();
91        println!("   Validator: {}", &first_validator.vote_account[..8]);
92        println!("   Historical data (last 3 epochs):");
93        for (i, entry) in history.iter().take(3).enumerate() {
94            println!(
95                "   {}. Epoch {}: {} lamports",
96                i + 1,
97                entry.epoch,
98                entry.mev_rewards
99            );
100        }
101    }
102    println!();
103
104    // 7. Get MEV commission averages
105    println!("7. Getting MEV commission averages...");
106    let commission_avg = client.get_mev_commission_average_over_time().await.unwrap();
107    println!(
108        "   Aggregated MEV Rewards: {} lamports",
109        commission_avg.aggregated_mev_rewards
110    );
111    if let Some(latest_apy) = commission_avg.apy.first() {
112        println!("   Latest APY: {:.2}%", latest_apy.data * 100.0);
113    }
114    if let Some(latest_tvl) = commission_avg.tvl.first() {
115        println!("   Latest TVL: {} lamports", latest_tvl.data);
116    }
117    println!();
118
119    // 8. Check specific validator
120    println!("8. Checking specific validator status...");
121    let test_vote_account = "GdRKUZKdiXMEATjddQW6q4W8bPgXRBYJKayfeqdQcEPa";
122    let is_running_jito = client
123        .is_validator_running_jito(test_vote_account)
124        .await
125        .unwrap();
126    println!("   Vote Account: {}", &test_vote_account[..8]);
127    println!("   Running Jito: {}", is_running_jito);
128
129    if let Some(commission) = client
130        .get_validator_mev_commission(test_vote_account)
131        .await
132        .unwrap()
133    {
134        println!("   MEV Commission: {} bps", commission);
135    }
136    println!();
137
138    // 9. Calculate total MEV for epoch range
139    println!("9. Calculating total MEV rewards...");
140    let start_epoch = current_epoch.saturating_sub(5);
141    let end_epoch = current_epoch.saturating_sub(1);
142    let total_mev = client
143        .calculate_total_mev_rewards(start_epoch, end_epoch)
144        .await
145        .unwrap();
146    println!(
147        "   Total MEV from epoch {} to {}: {} lamports",
148        start_epoch, end_epoch, total_mev
149    );
150    println!();
151
152    println!("=== Example completed successfully! ===");
153}
Source

pub fn base_url(&self) -> &str

Get the base URL

Source

pub async fn get_staker_rewards( &self, limit: Option<u32>, ) -> Result<StakerRewardsResponse, KobeApiError>

Get staker rewards

Retrieves individual claimable MEV and priority fee rewards from the tip distribution merkle trees.

§Arguments
  • limit - Optional limit on the number of results (default: API default)
§Example
let client = KobeClient::mainnet();
let rewards = client.get_staker_rewards(Some(10)).await?;
Examples found in repository?
examples/basic.rs (line 17)
4async fn main() {
5    // Create a client with mainnet defaults
6    let client = KobeClient::mainnet();
7
8    println!("=== Jito API Client - Basic Example ===\n");
9
10    // 1. Get current epoch
11    println!("1. Getting current epoch...");
12    let current_epoch = client.get_current_epoch().await.unwrap();
13    println!("   Current epoch: {}\n", current_epoch);
14
15    // 2. Get staker rewards
16    println!("2. Getting staker rewards (limit 5)...");
17    let rewards = client.get_staker_rewards(Some(5)).await.unwrap();
18    println!("   Found {} staker rewards:", rewards.rewards.len());
19    for (i, reward) in rewards.rewards.iter().enumerate() {
20        println!(
21            "   {}. Stake Account: {}",
22            i + 1,
23            &reward.stake_account[..8]
24        );
25        println!("      MEV Rewards: {} lamports", reward.mev_rewards);
26        println!("      Epoch: {}", reward.epoch);
27        println!("      Claimed: {}", reward.mev_claimed);
28    }
29    println!();
30
31    // 3. Get validator information
32    println!("3. Getting validators running Jito...");
33    let jito_validators = client.get_jito_validators().await.unwrap();
34    println!("   Found {} validators running Jito", jito_validators.len());
35
36    // Show top 5 by stake
37    let top_5_by_stake = jito_validators.iter().take(5);
38    for (i, validator) in top_5_by_stake.enumerate() {
39        println!(
40            "   {}. Vote Account: {}",
41            i + 1,
42            &validator.vote_account[..8]
43        );
44        println!("      Active Stake: {} lamports", validator.active_stake);
45        println!("      MEV Commission: {} bps", validator.mev_commission_bps);
46    }
47    println!();
48
49    // 4. Get network MEV statistics
50    println!("4. Getting MEV network statistics...");
51    let mev_stats = client.get_mev_rewards(None).await.unwrap();
52    println!("   Epoch: {}", mev_stats.epoch);
53    println!(
54        "   Total Network MEV: {} lamports",
55        mev_stats.total_network_mev_lamports
56    );
57    println!(
58        "   Jito Stake Weight: {} lamports",
59        mev_stats.jito_stake_weight_lamports
60    );
61    println!(
62        "   MEV per lamport: {:.10}",
63        mev_stats.mev_reward_per_lamport
64    );
65    println!();
66
67    // 5. Get validator rewards
68    println!("5. Getting validator rewards...");
69    let validator_rewards = client.get_validator_rewards(None, Some(3)).await.unwrap();
70    println!("   Top 3 validators by rewards:");
71    for (i, validator) in validator_rewards.validators.iter().enumerate() {
72        println!(
73            "   {}. Vote Account: {}",
74            i + 1,
75            &validator.vote_account[..8]
76        );
77        println!("      MEV Rewards: {} lamports", validator.mev_rewards);
78        if let Some(pf_rewards) = validator.priority_fee_rewards {
79            println!("      Priority Fee Rewards: {} lamports", pf_rewards);
80        }
81    }
82    println!();
83
84    // 6. Get historical validator data
85    println!("6. Getting historical data for a validator...");
86    if let Some(first_validator) = jito_validators.first() {
87        let history = client
88            .get_validator_history(&first_validator.vote_account)
89            .await
90            .unwrap();
91        println!("   Validator: {}", &first_validator.vote_account[..8]);
92        println!("   Historical data (last 3 epochs):");
93        for (i, entry) in history.iter().take(3).enumerate() {
94            println!(
95                "   {}. Epoch {}: {} lamports",
96                i + 1,
97                entry.epoch,
98                entry.mev_rewards
99            );
100        }
101    }
102    println!();
103
104    // 7. Get MEV commission averages
105    println!("7. Getting MEV commission averages...");
106    let commission_avg = client.get_mev_commission_average_over_time().await.unwrap();
107    println!(
108        "   Aggregated MEV Rewards: {} lamports",
109        commission_avg.aggregated_mev_rewards
110    );
111    if let Some(latest_apy) = commission_avg.apy.first() {
112        println!("   Latest APY: {:.2}%", latest_apy.data * 100.0);
113    }
114    if let Some(latest_tvl) = commission_avg.tvl.first() {
115        println!("   Latest TVL: {} lamports", latest_tvl.data);
116    }
117    println!();
118
119    // 8. Check specific validator
120    println!("8. Checking specific validator status...");
121    let test_vote_account = "GdRKUZKdiXMEATjddQW6q4W8bPgXRBYJKayfeqdQcEPa";
122    let is_running_jito = client
123        .is_validator_running_jito(test_vote_account)
124        .await
125        .unwrap();
126    println!("   Vote Account: {}", &test_vote_account[..8]);
127    println!("   Running Jito: {}", is_running_jito);
128
129    if let Some(commission) = client
130        .get_validator_mev_commission(test_vote_account)
131        .await
132        .unwrap()
133    {
134        println!("   MEV Commission: {} bps", commission);
135    }
136    println!();
137
138    // 9. Calculate total MEV for epoch range
139    println!("9. Calculating total MEV rewards...");
140    let start_epoch = current_epoch.saturating_sub(5);
141    let end_epoch = current_epoch.saturating_sub(1);
142    let total_mev = client
143        .calculate_total_mev_rewards(start_epoch, end_epoch)
144        .await
145        .unwrap();
146    println!(
147        "   Total MEV from epoch {} to {}: {} lamports",
148        start_epoch, end_epoch, total_mev
149    );
150    println!();
151
152    println!("=== Example completed successfully! ===");
153}
Source

pub async fn get_staker_rewards_with_params( &self, params: &QueryParams, ) -> Result<StakerRewardsResponse, KobeApiError>

Get staker rewards with full query parameters

Source

pub async fn get_validator_rewards( &self, epoch: Option<u64>, limit: Option<u32>, ) -> Result<ValidatorRewardsResponse, KobeApiError>

Get validator rewards for a specific epoch

Retrieves aggregated MEV and priority fee rewards data per validator.

§Arguments
  • epoch - Epoch number (optional, defaults to latest)
  • limit - Optional limit on the number of results
Examples found in repository?
examples/basic.rs (line 69)
4async fn main() {
5    // Create a client with mainnet defaults
6    let client = KobeClient::mainnet();
7
8    println!("=== Jito API Client - Basic Example ===\n");
9
10    // 1. Get current epoch
11    println!("1. Getting current epoch...");
12    let current_epoch = client.get_current_epoch().await.unwrap();
13    println!("   Current epoch: {}\n", current_epoch);
14
15    // 2. Get staker rewards
16    println!("2. Getting staker rewards (limit 5)...");
17    let rewards = client.get_staker_rewards(Some(5)).await.unwrap();
18    println!("   Found {} staker rewards:", rewards.rewards.len());
19    for (i, reward) in rewards.rewards.iter().enumerate() {
20        println!(
21            "   {}. Stake Account: {}",
22            i + 1,
23            &reward.stake_account[..8]
24        );
25        println!("      MEV Rewards: {} lamports", reward.mev_rewards);
26        println!("      Epoch: {}", reward.epoch);
27        println!("      Claimed: {}", reward.mev_claimed);
28    }
29    println!();
30
31    // 3. Get validator information
32    println!("3. Getting validators running Jito...");
33    let jito_validators = client.get_jito_validators().await.unwrap();
34    println!("   Found {} validators running Jito", jito_validators.len());
35
36    // Show top 5 by stake
37    let top_5_by_stake = jito_validators.iter().take(5);
38    for (i, validator) in top_5_by_stake.enumerate() {
39        println!(
40            "   {}. Vote Account: {}",
41            i + 1,
42            &validator.vote_account[..8]
43        );
44        println!("      Active Stake: {} lamports", validator.active_stake);
45        println!("      MEV Commission: {} bps", validator.mev_commission_bps);
46    }
47    println!();
48
49    // 4. Get network MEV statistics
50    println!("4. Getting MEV network statistics...");
51    let mev_stats = client.get_mev_rewards(None).await.unwrap();
52    println!("   Epoch: {}", mev_stats.epoch);
53    println!(
54        "   Total Network MEV: {} lamports",
55        mev_stats.total_network_mev_lamports
56    );
57    println!(
58        "   Jito Stake Weight: {} lamports",
59        mev_stats.jito_stake_weight_lamports
60    );
61    println!(
62        "   MEV per lamport: {:.10}",
63        mev_stats.mev_reward_per_lamport
64    );
65    println!();
66
67    // 5. Get validator rewards
68    println!("5. Getting validator rewards...");
69    let validator_rewards = client.get_validator_rewards(None, Some(3)).await.unwrap();
70    println!("   Top 3 validators by rewards:");
71    for (i, validator) in validator_rewards.validators.iter().enumerate() {
72        println!(
73            "   {}. Vote Account: {}",
74            i + 1,
75            &validator.vote_account[..8]
76        );
77        println!("      MEV Rewards: {} lamports", validator.mev_rewards);
78        if let Some(pf_rewards) = validator.priority_fee_rewards {
79            println!("      Priority Fee Rewards: {} lamports", pf_rewards);
80        }
81    }
82    println!();
83
84    // 6. Get historical validator data
85    println!("6. Getting historical data for a validator...");
86    if let Some(first_validator) = jito_validators.first() {
87        let history = client
88            .get_validator_history(&first_validator.vote_account)
89            .await
90            .unwrap();
91        println!("   Validator: {}", &first_validator.vote_account[..8]);
92        println!("   Historical data (last 3 epochs):");
93        for (i, entry) in history.iter().take(3).enumerate() {
94            println!(
95                "   {}. Epoch {}: {} lamports",
96                i + 1,
97                entry.epoch,
98                entry.mev_rewards
99            );
100        }
101    }
102    println!();
103
104    // 7. Get MEV commission averages
105    println!("7. Getting MEV commission averages...");
106    let commission_avg = client.get_mev_commission_average_over_time().await.unwrap();
107    println!(
108        "   Aggregated MEV Rewards: {} lamports",
109        commission_avg.aggregated_mev_rewards
110    );
111    if let Some(latest_apy) = commission_avg.apy.first() {
112        println!("   Latest APY: {:.2}%", latest_apy.data * 100.0);
113    }
114    if let Some(latest_tvl) = commission_avg.tvl.first() {
115        println!("   Latest TVL: {} lamports", latest_tvl.data);
116    }
117    println!();
118
119    // 8. Check specific validator
120    println!("8. Checking specific validator status...");
121    let test_vote_account = "GdRKUZKdiXMEATjddQW6q4W8bPgXRBYJKayfeqdQcEPa";
122    let is_running_jito = client
123        .is_validator_running_jito(test_vote_account)
124        .await
125        .unwrap();
126    println!("   Vote Account: {}", &test_vote_account[..8]);
127    println!("   Running Jito: {}", is_running_jito);
128
129    if let Some(commission) = client
130        .get_validator_mev_commission(test_vote_account)
131        .await
132        .unwrap()
133    {
134        println!("   MEV Commission: {} bps", commission);
135    }
136    println!();
137
138    // 9. Calculate total MEV for epoch range
139    println!("9. Calculating total MEV rewards...");
140    let start_epoch = current_epoch.saturating_sub(5);
141    let end_epoch = current_epoch.saturating_sub(1);
142    let total_mev = client
143        .calculate_total_mev_rewards(start_epoch, end_epoch)
144        .await
145        .unwrap();
146    println!(
147        "   Total MEV from epoch {} to {}: {} lamports",
148        start_epoch, end_epoch, total_mev
149    );
150    println!();
151
152    println!("=== Example completed successfully! ===");
153}
Source

pub async fn get_validators( &self, epoch: Option<u64>, ) -> Result<ValidatorsResponse, KobeApiError>

Get all validators for a given epoch

Returns validator state for a given epoch (defaults to latest).

§Arguments
  • epoch - Optional epoch number (defaults to latest)
Source

pub async fn get_jitosol_validators( &self, epoch: Option<u64>, ) -> Result<ValidatorsResponse, KobeApiError>

Get JitoSOL stake pool validators for a given epoch

Returns only validators that are actively part of the JitoSOL validator set.

Source

pub async fn get_validator_history( &self, vote_account: &str, ) -> Result<Vec<ValidatorHistory>, KobeApiError>

Get historical data for a single validator

Returns historical reward data for a validator, sorted by epoch (descending).

§Arguments
  • vote_account - The validator’s vote account public key
Examples found in repository?
examples/basic.rs (line 88)
4async fn main() {
5    // Create a client with mainnet defaults
6    let client = KobeClient::mainnet();
7
8    println!("=== Jito API Client - Basic Example ===\n");
9
10    // 1. Get current epoch
11    println!("1. Getting current epoch...");
12    let current_epoch = client.get_current_epoch().await.unwrap();
13    println!("   Current epoch: {}\n", current_epoch);
14
15    // 2. Get staker rewards
16    println!("2. Getting staker rewards (limit 5)...");
17    let rewards = client.get_staker_rewards(Some(5)).await.unwrap();
18    println!("   Found {} staker rewards:", rewards.rewards.len());
19    for (i, reward) in rewards.rewards.iter().enumerate() {
20        println!(
21            "   {}. Stake Account: {}",
22            i + 1,
23            &reward.stake_account[..8]
24        );
25        println!("      MEV Rewards: {} lamports", reward.mev_rewards);
26        println!("      Epoch: {}", reward.epoch);
27        println!("      Claimed: {}", reward.mev_claimed);
28    }
29    println!();
30
31    // 3. Get validator information
32    println!("3. Getting validators running Jito...");
33    let jito_validators = client.get_jito_validators().await.unwrap();
34    println!("   Found {} validators running Jito", jito_validators.len());
35
36    // Show top 5 by stake
37    let top_5_by_stake = jito_validators.iter().take(5);
38    for (i, validator) in top_5_by_stake.enumerate() {
39        println!(
40            "   {}. Vote Account: {}",
41            i + 1,
42            &validator.vote_account[..8]
43        );
44        println!("      Active Stake: {} lamports", validator.active_stake);
45        println!("      MEV Commission: {} bps", validator.mev_commission_bps);
46    }
47    println!();
48
49    // 4. Get network MEV statistics
50    println!("4. Getting MEV network statistics...");
51    let mev_stats = client.get_mev_rewards(None).await.unwrap();
52    println!("   Epoch: {}", mev_stats.epoch);
53    println!(
54        "   Total Network MEV: {} lamports",
55        mev_stats.total_network_mev_lamports
56    );
57    println!(
58        "   Jito Stake Weight: {} lamports",
59        mev_stats.jito_stake_weight_lamports
60    );
61    println!(
62        "   MEV per lamport: {:.10}",
63        mev_stats.mev_reward_per_lamport
64    );
65    println!();
66
67    // 5. Get validator rewards
68    println!("5. Getting validator rewards...");
69    let validator_rewards = client.get_validator_rewards(None, Some(3)).await.unwrap();
70    println!("   Top 3 validators by rewards:");
71    for (i, validator) in validator_rewards.validators.iter().enumerate() {
72        println!(
73            "   {}. Vote Account: {}",
74            i + 1,
75            &validator.vote_account[..8]
76        );
77        println!("      MEV Rewards: {} lamports", validator.mev_rewards);
78        if let Some(pf_rewards) = validator.priority_fee_rewards {
79            println!("      Priority Fee Rewards: {} lamports", pf_rewards);
80        }
81    }
82    println!();
83
84    // 6. Get historical validator data
85    println!("6. Getting historical data for a validator...");
86    if let Some(first_validator) = jito_validators.first() {
87        let history = client
88            .get_validator_history(&first_validator.vote_account)
89            .await
90            .unwrap();
91        println!("   Validator: {}", &first_validator.vote_account[..8]);
92        println!("   Historical data (last 3 epochs):");
93        for (i, entry) in history.iter().take(3).enumerate() {
94            println!(
95                "   {}. Epoch {}: {} lamports",
96                i + 1,
97                entry.epoch,
98                entry.mev_rewards
99            );
100        }
101    }
102    println!();
103
104    // 7. Get MEV commission averages
105    println!("7. Getting MEV commission averages...");
106    let commission_avg = client.get_mev_commission_average_over_time().await.unwrap();
107    println!(
108        "   Aggregated MEV Rewards: {} lamports",
109        commission_avg.aggregated_mev_rewards
110    );
111    if let Some(latest_apy) = commission_avg.apy.first() {
112        println!("   Latest APY: {:.2}%", latest_apy.data * 100.0);
113    }
114    if let Some(latest_tvl) = commission_avg.tvl.first() {
115        println!("   Latest TVL: {} lamports", latest_tvl.data);
116    }
117    println!();
118
119    // 8. Check specific validator
120    println!("8. Checking specific validator status...");
121    let test_vote_account = "GdRKUZKdiXMEATjddQW6q4W8bPgXRBYJKayfeqdQcEPa";
122    let is_running_jito = client
123        .is_validator_running_jito(test_vote_account)
124        .await
125        .unwrap();
126    println!("   Vote Account: {}", &test_vote_account[..8]);
127    println!("   Running Jito: {}", is_running_jito);
128
129    if let Some(commission) = client
130        .get_validator_mev_commission(test_vote_account)
131        .await
132        .unwrap()
133    {
134        println!("   MEV Commission: {} bps", commission);
135    }
136    println!();
137
138    // 9. Calculate total MEV for epoch range
139    println!("9. Calculating total MEV rewards...");
140    let start_epoch = current_epoch.saturating_sub(5);
141    let end_epoch = current_epoch.saturating_sub(1);
142    let total_mev = client
143        .calculate_total_mev_rewards(start_epoch, end_epoch)
144        .await
145        .unwrap();
146    println!(
147        "   Total MEV from epoch {} to {}: {} lamports",
148        start_epoch, end_epoch, total_mev
149    );
150    println!();
151
152    println!("=== Example completed successfully! ===");
153}
Source

pub async fn get_mev_rewards( &self, epoch: Option<u64>, ) -> Result<MevRewards, KobeApiError>

Get MEV rewards network statistics for an epoch

Returns network-level statistics including total MEV, stake weight, and reward per lamport.

§Arguments
  • epoch - Optional epoch number (defaults to latest)
Examples found in repository?
examples/basic.rs (line 51)
4async fn main() {
5    // Create a client with mainnet defaults
6    let client = KobeClient::mainnet();
7
8    println!("=== Jito API Client - Basic Example ===\n");
9
10    // 1. Get current epoch
11    println!("1. Getting current epoch...");
12    let current_epoch = client.get_current_epoch().await.unwrap();
13    println!("   Current epoch: {}\n", current_epoch);
14
15    // 2. Get staker rewards
16    println!("2. Getting staker rewards (limit 5)...");
17    let rewards = client.get_staker_rewards(Some(5)).await.unwrap();
18    println!("   Found {} staker rewards:", rewards.rewards.len());
19    for (i, reward) in rewards.rewards.iter().enumerate() {
20        println!(
21            "   {}. Stake Account: {}",
22            i + 1,
23            &reward.stake_account[..8]
24        );
25        println!("      MEV Rewards: {} lamports", reward.mev_rewards);
26        println!("      Epoch: {}", reward.epoch);
27        println!("      Claimed: {}", reward.mev_claimed);
28    }
29    println!();
30
31    // 3. Get validator information
32    println!("3. Getting validators running Jito...");
33    let jito_validators = client.get_jito_validators().await.unwrap();
34    println!("   Found {} validators running Jito", jito_validators.len());
35
36    // Show top 5 by stake
37    let top_5_by_stake = jito_validators.iter().take(5);
38    for (i, validator) in top_5_by_stake.enumerate() {
39        println!(
40            "   {}. Vote Account: {}",
41            i + 1,
42            &validator.vote_account[..8]
43        );
44        println!("      Active Stake: {} lamports", validator.active_stake);
45        println!("      MEV Commission: {} bps", validator.mev_commission_bps);
46    }
47    println!();
48
49    // 4. Get network MEV statistics
50    println!("4. Getting MEV network statistics...");
51    let mev_stats = client.get_mev_rewards(None).await.unwrap();
52    println!("   Epoch: {}", mev_stats.epoch);
53    println!(
54        "   Total Network MEV: {} lamports",
55        mev_stats.total_network_mev_lamports
56    );
57    println!(
58        "   Jito Stake Weight: {} lamports",
59        mev_stats.jito_stake_weight_lamports
60    );
61    println!(
62        "   MEV per lamport: {:.10}",
63        mev_stats.mev_reward_per_lamport
64    );
65    println!();
66
67    // 5. Get validator rewards
68    println!("5. Getting validator rewards...");
69    let validator_rewards = client.get_validator_rewards(None, Some(3)).await.unwrap();
70    println!("   Top 3 validators by rewards:");
71    for (i, validator) in validator_rewards.validators.iter().enumerate() {
72        println!(
73            "   {}. Vote Account: {}",
74            i + 1,
75            &validator.vote_account[..8]
76        );
77        println!("      MEV Rewards: {} lamports", validator.mev_rewards);
78        if let Some(pf_rewards) = validator.priority_fee_rewards {
79            println!("      Priority Fee Rewards: {} lamports", pf_rewards);
80        }
81    }
82    println!();
83
84    // 6. Get historical validator data
85    println!("6. Getting historical data for a validator...");
86    if let Some(first_validator) = jito_validators.first() {
87        let history = client
88            .get_validator_history(&first_validator.vote_account)
89            .await
90            .unwrap();
91        println!("   Validator: {}", &first_validator.vote_account[..8]);
92        println!("   Historical data (last 3 epochs):");
93        for (i, entry) in history.iter().take(3).enumerate() {
94            println!(
95                "   {}. Epoch {}: {} lamports",
96                i + 1,
97                entry.epoch,
98                entry.mev_rewards
99            );
100        }
101    }
102    println!();
103
104    // 7. Get MEV commission averages
105    println!("7. Getting MEV commission averages...");
106    let commission_avg = client.get_mev_commission_average_over_time().await.unwrap();
107    println!(
108        "   Aggregated MEV Rewards: {} lamports",
109        commission_avg.aggregated_mev_rewards
110    );
111    if let Some(latest_apy) = commission_avg.apy.first() {
112        println!("   Latest APY: {:.2}%", latest_apy.data * 100.0);
113    }
114    if let Some(latest_tvl) = commission_avg.tvl.first() {
115        println!("   Latest TVL: {} lamports", latest_tvl.data);
116    }
117    println!();
118
119    // 8. Check specific validator
120    println!("8. Checking specific validator status...");
121    let test_vote_account = "GdRKUZKdiXMEATjddQW6q4W8bPgXRBYJKayfeqdQcEPa";
122    let is_running_jito = client
123        .is_validator_running_jito(test_vote_account)
124        .await
125        .unwrap();
126    println!("   Vote Account: {}", &test_vote_account[..8]);
127    println!("   Running Jito: {}", is_running_jito);
128
129    if let Some(commission) = client
130        .get_validator_mev_commission(test_vote_account)
131        .await
132        .unwrap()
133    {
134        println!("   MEV Commission: {} bps", commission);
135    }
136    println!();
137
138    // 9. Calculate total MEV for epoch range
139    println!("9. Calculating total MEV rewards...");
140    let start_epoch = current_epoch.saturating_sub(5);
141    let end_epoch = current_epoch.saturating_sub(1);
142    let total_mev = client
143        .calculate_total_mev_rewards(start_epoch, end_epoch)
144        .await
145        .unwrap();
146    println!(
147        "   Total MEV from epoch {} to {}: {} lamports",
148        start_epoch, end_epoch, total_mev
149    );
150    println!();
151
152    println!("=== Example completed successfully! ===");
153}
Source

pub async fn get_daily_mev_tips( &self, ) -> Result<Vec<DailyMevTips>, KobeApiError>

Get daily MEV tips

Returns aggregated MEV tips per calendar day.

Source

pub async fn get_jito_stake_over_time( &self, ) -> Result<JitoStakeOverTime, KobeApiError>

Get Jito stake over time

Returns a map of epoch to percentage of all Solana stake delegated to Jito-running validators.

Source

pub async fn get_mev_commission_average_over_time( &self, ) -> Result<MevCommissionAverageOverTime, KobeApiError>

Get MEV commission average over time

Returns stake-weighted average MEV commission along with other metrics.

Examples found in repository?
examples/basic.rs (line 106)
4async fn main() {
5    // Create a client with mainnet defaults
6    let client = KobeClient::mainnet();
7
8    println!("=== Jito API Client - Basic Example ===\n");
9
10    // 1. Get current epoch
11    println!("1. Getting current epoch...");
12    let current_epoch = client.get_current_epoch().await.unwrap();
13    println!("   Current epoch: {}\n", current_epoch);
14
15    // 2. Get staker rewards
16    println!("2. Getting staker rewards (limit 5)...");
17    let rewards = client.get_staker_rewards(Some(5)).await.unwrap();
18    println!("   Found {} staker rewards:", rewards.rewards.len());
19    for (i, reward) in rewards.rewards.iter().enumerate() {
20        println!(
21            "   {}. Stake Account: {}",
22            i + 1,
23            &reward.stake_account[..8]
24        );
25        println!("      MEV Rewards: {} lamports", reward.mev_rewards);
26        println!("      Epoch: {}", reward.epoch);
27        println!("      Claimed: {}", reward.mev_claimed);
28    }
29    println!();
30
31    // 3. Get validator information
32    println!("3. Getting validators running Jito...");
33    let jito_validators = client.get_jito_validators().await.unwrap();
34    println!("   Found {} validators running Jito", jito_validators.len());
35
36    // Show top 5 by stake
37    let top_5_by_stake = jito_validators.iter().take(5);
38    for (i, validator) in top_5_by_stake.enumerate() {
39        println!(
40            "   {}. Vote Account: {}",
41            i + 1,
42            &validator.vote_account[..8]
43        );
44        println!("      Active Stake: {} lamports", validator.active_stake);
45        println!("      MEV Commission: {} bps", validator.mev_commission_bps);
46    }
47    println!();
48
49    // 4. Get network MEV statistics
50    println!("4. Getting MEV network statistics...");
51    let mev_stats = client.get_mev_rewards(None).await.unwrap();
52    println!("   Epoch: {}", mev_stats.epoch);
53    println!(
54        "   Total Network MEV: {} lamports",
55        mev_stats.total_network_mev_lamports
56    );
57    println!(
58        "   Jito Stake Weight: {} lamports",
59        mev_stats.jito_stake_weight_lamports
60    );
61    println!(
62        "   MEV per lamport: {:.10}",
63        mev_stats.mev_reward_per_lamport
64    );
65    println!();
66
67    // 5. Get validator rewards
68    println!("5. Getting validator rewards...");
69    let validator_rewards = client.get_validator_rewards(None, Some(3)).await.unwrap();
70    println!("   Top 3 validators by rewards:");
71    for (i, validator) in validator_rewards.validators.iter().enumerate() {
72        println!(
73            "   {}. Vote Account: {}",
74            i + 1,
75            &validator.vote_account[..8]
76        );
77        println!("      MEV Rewards: {} lamports", validator.mev_rewards);
78        if let Some(pf_rewards) = validator.priority_fee_rewards {
79            println!("      Priority Fee Rewards: {} lamports", pf_rewards);
80        }
81    }
82    println!();
83
84    // 6. Get historical validator data
85    println!("6. Getting historical data for a validator...");
86    if let Some(first_validator) = jito_validators.first() {
87        let history = client
88            .get_validator_history(&first_validator.vote_account)
89            .await
90            .unwrap();
91        println!("   Validator: {}", &first_validator.vote_account[..8]);
92        println!("   Historical data (last 3 epochs):");
93        for (i, entry) in history.iter().take(3).enumerate() {
94            println!(
95                "   {}. Epoch {}: {} lamports",
96                i + 1,
97                entry.epoch,
98                entry.mev_rewards
99            );
100        }
101    }
102    println!();
103
104    // 7. Get MEV commission averages
105    println!("7. Getting MEV commission averages...");
106    let commission_avg = client.get_mev_commission_average_over_time().await.unwrap();
107    println!(
108        "   Aggregated MEV Rewards: {} lamports",
109        commission_avg.aggregated_mev_rewards
110    );
111    if let Some(latest_apy) = commission_avg.apy.first() {
112        println!("   Latest APY: {:.2}%", latest_apy.data * 100.0);
113    }
114    if let Some(latest_tvl) = commission_avg.tvl.first() {
115        println!("   Latest TVL: {} lamports", latest_tvl.data);
116    }
117    println!();
118
119    // 8. Check specific validator
120    println!("8. Checking specific validator status...");
121    let test_vote_account = "GdRKUZKdiXMEATjddQW6q4W8bPgXRBYJKayfeqdQcEPa";
122    let is_running_jito = client
123        .is_validator_running_jito(test_vote_account)
124        .await
125        .unwrap();
126    println!("   Vote Account: {}", &test_vote_account[..8]);
127    println!("   Running Jito: {}", is_running_jito);
128
129    if let Some(commission) = client
130        .get_validator_mev_commission(test_vote_account)
131        .await
132        .unwrap()
133    {
134        println!("   MEV Commission: {} bps", commission);
135    }
136    println!();
137
138    // 9. Calculate total MEV for epoch range
139    println!("9. Calculating total MEV rewards...");
140    let start_epoch = current_epoch.saturating_sub(5);
141    let end_epoch = current_epoch.saturating_sub(1);
142    let total_mev = client
143        .calculate_total_mev_rewards(start_epoch, end_epoch)
144        .await
145        .unwrap();
146    println!(
147        "   Total MEV from epoch {} to {}: {} lamports",
148        start_epoch, end_epoch, total_mev
149    );
150    println!();
151
152    println!("=== Example completed successfully! ===");
153}
Source

pub async fn get_jitosol_sol_ratio( &self, start: DateTime<Utc>, end: DateTime<Utc>, ) -> Result<JitoSolRatio, KobeApiError>

Get JitoSOL to SOL exchange ratio over time

§Arguments
  • start - Start datetime for the range
  • end - End datetime for the range
Source

pub async fn get_stake_pool_stats( &self, epoch: Option<u64>, ) -> Result<StakePoolStats, KobeApiError>

Get stake pool statistics for an epoch

§Arguments
  • epoch - Optional epoch number (defaults to latest)
Source

pub async fn get_current_epoch(&self) -> Result<u64, KobeApiError>

Get the current epoch from the latest MEV rewards data

Examples found in repository?
examples/basic.rs (line 12)
4async fn main() {
5    // Create a client with mainnet defaults
6    let client = KobeClient::mainnet();
7
8    println!("=== Jito API Client - Basic Example ===\n");
9
10    // 1. Get current epoch
11    println!("1. Getting current epoch...");
12    let current_epoch = client.get_current_epoch().await.unwrap();
13    println!("   Current epoch: {}\n", current_epoch);
14
15    // 2. Get staker rewards
16    println!("2. Getting staker rewards (limit 5)...");
17    let rewards = client.get_staker_rewards(Some(5)).await.unwrap();
18    println!("   Found {} staker rewards:", rewards.rewards.len());
19    for (i, reward) in rewards.rewards.iter().enumerate() {
20        println!(
21            "   {}. Stake Account: {}",
22            i + 1,
23            &reward.stake_account[..8]
24        );
25        println!("      MEV Rewards: {} lamports", reward.mev_rewards);
26        println!("      Epoch: {}", reward.epoch);
27        println!("      Claimed: {}", reward.mev_claimed);
28    }
29    println!();
30
31    // 3. Get validator information
32    println!("3. Getting validators running Jito...");
33    let jito_validators = client.get_jito_validators().await.unwrap();
34    println!("   Found {} validators running Jito", jito_validators.len());
35
36    // Show top 5 by stake
37    let top_5_by_stake = jito_validators.iter().take(5);
38    for (i, validator) in top_5_by_stake.enumerate() {
39        println!(
40            "   {}. Vote Account: {}",
41            i + 1,
42            &validator.vote_account[..8]
43        );
44        println!("      Active Stake: {} lamports", validator.active_stake);
45        println!("      MEV Commission: {} bps", validator.mev_commission_bps);
46    }
47    println!();
48
49    // 4. Get network MEV statistics
50    println!("4. Getting MEV network statistics...");
51    let mev_stats = client.get_mev_rewards(None).await.unwrap();
52    println!("   Epoch: {}", mev_stats.epoch);
53    println!(
54        "   Total Network MEV: {} lamports",
55        mev_stats.total_network_mev_lamports
56    );
57    println!(
58        "   Jito Stake Weight: {} lamports",
59        mev_stats.jito_stake_weight_lamports
60    );
61    println!(
62        "   MEV per lamport: {:.10}",
63        mev_stats.mev_reward_per_lamport
64    );
65    println!();
66
67    // 5. Get validator rewards
68    println!("5. Getting validator rewards...");
69    let validator_rewards = client.get_validator_rewards(None, Some(3)).await.unwrap();
70    println!("   Top 3 validators by rewards:");
71    for (i, validator) in validator_rewards.validators.iter().enumerate() {
72        println!(
73            "   {}. Vote Account: {}",
74            i + 1,
75            &validator.vote_account[..8]
76        );
77        println!("      MEV Rewards: {} lamports", validator.mev_rewards);
78        if let Some(pf_rewards) = validator.priority_fee_rewards {
79            println!("      Priority Fee Rewards: {} lamports", pf_rewards);
80        }
81    }
82    println!();
83
84    // 6. Get historical validator data
85    println!("6. Getting historical data for a validator...");
86    if let Some(first_validator) = jito_validators.first() {
87        let history = client
88            .get_validator_history(&first_validator.vote_account)
89            .await
90            .unwrap();
91        println!("   Validator: {}", &first_validator.vote_account[..8]);
92        println!("   Historical data (last 3 epochs):");
93        for (i, entry) in history.iter().take(3).enumerate() {
94            println!(
95                "   {}. Epoch {}: {} lamports",
96                i + 1,
97                entry.epoch,
98                entry.mev_rewards
99            );
100        }
101    }
102    println!();
103
104    // 7. Get MEV commission averages
105    println!("7. Getting MEV commission averages...");
106    let commission_avg = client.get_mev_commission_average_over_time().await.unwrap();
107    println!(
108        "   Aggregated MEV Rewards: {} lamports",
109        commission_avg.aggregated_mev_rewards
110    );
111    if let Some(latest_apy) = commission_avg.apy.first() {
112        println!("   Latest APY: {:.2}%", latest_apy.data * 100.0);
113    }
114    if let Some(latest_tvl) = commission_avg.tvl.first() {
115        println!("   Latest TVL: {} lamports", latest_tvl.data);
116    }
117    println!();
118
119    // 8. Check specific validator
120    println!("8. Checking specific validator status...");
121    let test_vote_account = "GdRKUZKdiXMEATjddQW6q4W8bPgXRBYJKayfeqdQcEPa";
122    let is_running_jito = client
123        .is_validator_running_jito(test_vote_account)
124        .await
125        .unwrap();
126    println!("   Vote Account: {}", &test_vote_account[..8]);
127    println!("   Running Jito: {}", is_running_jito);
128
129    if let Some(commission) = client
130        .get_validator_mev_commission(test_vote_account)
131        .await
132        .unwrap()
133    {
134        println!("   MEV Commission: {} bps", commission);
135    }
136    println!();
137
138    // 9. Calculate total MEV for epoch range
139    println!("9. Calculating total MEV rewards...");
140    let start_epoch = current_epoch.saturating_sub(5);
141    let end_epoch = current_epoch.saturating_sub(1);
142    let total_mev = client
143        .calculate_total_mev_rewards(start_epoch, end_epoch)
144        .await
145        .unwrap();
146    println!(
147        "   Total MEV from epoch {} to {}: {} lamports",
148        start_epoch, end_epoch, total_mev
149    );
150    println!();
151
152    println!("=== Example completed successfully! ===");
153}
Source

pub async fn get_jito_validators( &self, ) -> Result<Vec<ValidatorInfo>, KobeApiError>

Get all validators currently running Jito

Examples found in repository?
examples/basic.rs (line 33)
4async fn main() {
5    // Create a client with mainnet defaults
6    let client = KobeClient::mainnet();
7
8    println!("=== Jito API Client - Basic Example ===\n");
9
10    // 1. Get current epoch
11    println!("1. Getting current epoch...");
12    let current_epoch = client.get_current_epoch().await.unwrap();
13    println!("   Current epoch: {}\n", current_epoch);
14
15    // 2. Get staker rewards
16    println!("2. Getting staker rewards (limit 5)...");
17    let rewards = client.get_staker_rewards(Some(5)).await.unwrap();
18    println!("   Found {} staker rewards:", rewards.rewards.len());
19    for (i, reward) in rewards.rewards.iter().enumerate() {
20        println!(
21            "   {}. Stake Account: {}",
22            i + 1,
23            &reward.stake_account[..8]
24        );
25        println!("      MEV Rewards: {} lamports", reward.mev_rewards);
26        println!("      Epoch: {}", reward.epoch);
27        println!("      Claimed: {}", reward.mev_claimed);
28    }
29    println!();
30
31    // 3. Get validator information
32    println!("3. Getting validators running Jito...");
33    let jito_validators = client.get_jito_validators().await.unwrap();
34    println!("   Found {} validators running Jito", jito_validators.len());
35
36    // Show top 5 by stake
37    let top_5_by_stake = jito_validators.iter().take(5);
38    for (i, validator) in top_5_by_stake.enumerate() {
39        println!(
40            "   {}. Vote Account: {}",
41            i + 1,
42            &validator.vote_account[..8]
43        );
44        println!("      Active Stake: {} lamports", validator.active_stake);
45        println!("      MEV Commission: {} bps", validator.mev_commission_bps);
46    }
47    println!();
48
49    // 4. Get network MEV statistics
50    println!("4. Getting MEV network statistics...");
51    let mev_stats = client.get_mev_rewards(None).await.unwrap();
52    println!("   Epoch: {}", mev_stats.epoch);
53    println!(
54        "   Total Network MEV: {} lamports",
55        mev_stats.total_network_mev_lamports
56    );
57    println!(
58        "   Jito Stake Weight: {} lamports",
59        mev_stats.jito_stake_weight_lamports
60    );
61    println!(
62        "   MEV per lamport: {:.10}",
63        mev_stats.mev_reward_per_lamport
64    );
65    println!();
66
67    // 5. Get validator rewards
68    println!("5. Getting validator rewards...");
69    let validator_rewards = client.get_validator_rewards(None, Some(3)).await.unwrap();
70    println!("   Top 3 validators by rewards:");
71    for (i, validator) in validator_rewards.validators.iter().enumerate() {
72        println!(
73            "   {}. Vote Account: {}",
74            i + 1,
75            &validator.vote_account[..8]
76        );
77        println!("      MEV Rewards: {} lamports", validator.mev_rewards);
78        if let Some(pf_rewards) = validator.priority_fee_rewards {
79            println!("      Priority Fee Rewards: {} lamports", pf_rewards);
80        }
81    }
82    println!();
83
84    // 6. Get historical validator data
85    println!("6. Getting historical data for a validator...");
86    if let Some(first_validator) = jito_validators.first() {
87        let history = client
88            .get_validator_history(&first_validator.vote_account)
89            .await
90            .unwrap();
91        println!("   Validator: {}", &first_validator.vote_account[..8]);
92        println!("   Historical data (last 3 epochs):");
93        for (i, entry) in history.iter().take(3).enumerate() {
94            println!(
95                "   {}. Epoch {}: {} lamports",
96                i + 1,
97                entry.epoch,
98                entry.mev_rewards
99            );
100        }
101    }
102    println!();
103
104    // 7. Get MEV commission averages
105    println!("7. Getting MEV commission averages...");
106    let commission_avg = client.get_mev_commission_average_over_time().await.unwrap();
107    println!(
108        "   Aggregated MEV Rewards: {} lamports",
109        commission_avg.aggregated_mev_rewards
110    );
111    if let Some(latest_apy) = commission_avg.apy.first() {
112        println!("   Latest APY: {:.2}%", latest_apy.data * 100.0);
113    }
114    if let Some(latest_tvl) = commission_avg.tvl.first() {
115        println!("   Latest TVL: {} lamports", latest_tvl.data);
116    }
117    println!();
118
119    // 8. Check specific validator
120    println!("8. Checking specific validator status...");
121    let test_vote_account = "GdRKUZKdiXMEATjddQW6q4W8bPgXRBYJKayfeqdQcEPa";
122    let is_running_jito = client
123        .is_validator_running_jito(test_vote_account)
124        .await
125        .unwrap();
126    println!("   Vote Account: {}", &test_vote_account[..8]);
127    println!("   Running Jito: {}", is_running_jito);
128
129    if let Some(commission) = client
130        .get_validator_mev_commission(test_vote_account)
131        .await
132        .unwrap()
133    {
134        println!("   MEV Commission: {} bps", commission);
135    }
136    println!();
137
138    // 9. Calculate total MEV for epoch range
139    println!("9. Calculating total MEV rewards...");
140    let start_epoch = current_epoch.saturating_sub(5);
141    let end_epoch = current_epoch.saturating_sub(1);
142    let total_mev = client
143        .calculate_total_mev_rewards(start_epoch, end_epoch)
144        .await
145        .unwrap();
146    println!(
147        "   Total MEV from epoch {} to {}: {} lamports",
148        start_epoch, end_epoch, total_mev
149    );
150    println!();
151
152    println!("=== Example completed successfully! ===");
153}
Source

pub async fn get_validators_by_mev_rewards( &self, epoch: Option<u64>, limit: usize, ) -> Result<Vec<ValidatorInfo>, KobeApiError>

Get validators sorted by MEV rewards

Source

pub async fn get_validators_by_stake( &self, epoch: Option<u64>, limit: usize, ) -> Result<Vec<ValidatorInfo>, KobeApiError>

Get validators sorted by active stake

Source

pub async fn is_validator_running_jito( &self, vote_account: &str, ) -> Result<bool, KobeApiError>

Check if a validator is running Jito

Examples found in repository?
examples/basic.rs (line 123)
4async fn main() {
5    // Create a client with mainnet defaults
6    let client = KobeClient::mainnet();
7
8    println!("=== Jito API Client - Basic Example ===\n");
9
10    // 1. Get current epoch
11    println!("1. Getting current epoch...");
12    let current_epoch = client.get_current_epoch().await.unwrap();
13    println!("   Current epoch: {}\n", current_epoch);
14
15    // 2. Get staker rewards
16    println!("2. Getting staker rewards (limit 5)...");
17    let rewards = client.get_staker_rewards(Some(5)).await.unwrap();
18    println!("   Found {} staker rewards:", rewards.rewards.len());
19    for (i, reward) in rewards.rewards.iter().enumerate() {
20        println!(
21            "   {}. Stake Account: {}",
22            i + 1,
23            &reward.stake_account[..8]
24        );
25        println!("      MEV Rewards: {} lamports", reward.mev_rewards);
26        println!("      Epoch: {}", reward.epoch);
27        println!("      Claimed: {}", reward.mev_claimed);
28    }
29    println!();
30
31    // 3. Get validator information
32    println!("3. Getting validators running Jito...");
33    let jito_validators = client.get_jito_validators().await.unwrap();
34    println!("   Found {} validators running Jito", jito_validators.len());
35
36    // Show top 5 by stake
37    let top_5_by_stake = jito_validators.iter().take(5);
38    for (i, validator) in top_5_by_stake.enumerate() {
39        println!(
40            "   {}. Vote Account: {}",
41            i + 1,
42            &validator.vote_account[..8]
43        );
44        println!("      Active Stake: {} lamports", validator.active_stake);
45        println!("      MEV Commission: {} bps", validator.mev_commission_bps);
46    }
47    println!();
48
49    // 4. Get network MEV statistics
50    println!("4. Getting MEV network statistics...");
51    let mev_stats = client.get_mev_rewards(None).await.unwrap();
52    println!("   Epoch: {}", mev_stats.epoch);
53    println!(
54        "   Total Network MEV: {} lamports",
55        mev_stats.total_network_mev_lamports
56    );
57    println!(
58        "   Jito Stake Weight: {} lamports",
59        mev_stats.jito_stake_weight_lamports
60    );
61    println!(
62        "   MEV per lamport: {:.10}",
63        mev_stats.mev_reward_per_lamport
64    );
65    println!();
66
67    // 5. Get validator rewards
68    println!("5. Getting validator rewards...");
69    let validator_rewards = client.get_validator_rewards(None, Some(3)).await.unwrap();
70    println!("   Top 3 validators by rewards:");
71    for (i, validator) in validator_rewards.validators.iter().enumerate() {
72        println!(
73            "   {}. Vote Account: {}",
74            i + 1,
75            &validator.vote_account[..8]
76        );
77        println!("      MEV Rewards: {} lamports", validator.mev_rewards);
78        if let Some(pf_rewards) = validator.priority_fee_rewards {
79            println!("      Priority Fee Rewards: {} lamports", pf_rewards);
80        }
81    }
82    println!();
83
84    // 6. Get historical validator data
85    println!("6. Getting historical data for a validator...");
86    if let Some(first_validator) = jito_validators.first() {
87        let history = client
88            .get_validator_history(&first_validator.vote_account)
89            .await
90            .unwrap();
91        println!("   Validator: {}", &first_validator.vote_account[..8]);
92        println!("   Historical data (last 3 epochs):");
93        for (i, entry) in history.iter().take(3).enumerate() {
94            println!(
95                "   {}. Epoch {}: {} lamports",
96                i + 1,
97                entry.epoch,
98                entry.mev_rewards
99            );
100        }
101    }
102    println!();
103
104    // 7. Get MEV commission averages
105    println!("7. Getting MEV commission averages...");
106    let commission_avg = client.get_mev_commission_average_over_time().await.unwrap();
107    println!(
108        "   Aggregated MEV Rewards: {} lamports",
109        commission_avg.aggregated_mev_rewards
110    );
111    if let Some(latest_apy) = commission_avg.apy.first() {
112        println!("   Latest APY: {:.2}%", latest_apy.data * 100.0);
113    }
114    if let Some(latest_tvl) = commission_avg.tvl.first() {
115        println!("   Latest TVL: {} lamports", latest_tvl.data);
116    }
117    println!();
118
119    // 8. Check specific validator
120    println!("8. Checking specific validator status...");
121    let test_vote_account = "GdRKUZKdiXMEATjddQW6q4W8bPgXRBYJKayfeqdQcEPa";
122    let is_running_jito = client
123        .is_validator_running_jito(test_vote_account)
124        .await
125        .unwrap();
126    println!("   Vote Account: {}", &test_vote_account[..8]);
127    println!("   Running Jito: {}", is_running_jito);
128
129    if let Some(commission) = client
130        .get_validator_mev_commission(test_vote_account)
131        .await
132        .unwrap()
133    {
134        println!("   MEV Commission: {} bps", commission);
135    }
136    println!();
137
138    // 9. Calculate total MEV for epoch range
139    println!("9. Calculating total MEV rewards...");
140    let start_epoch = current_epoch.saturating_sub(5);
141    let end_epoch = current_epoch.saturating_sub(1);
142    let total_mev = client
143        .calculate_total_mev_rewards(start_epoch, end_epoch)
144        .await
145        .unwrap();
146    println!(
147        "   Total MEV from epoch {} to {}: {} lamports",
148        start_epoch, end_epoch, total_mev
149    );
150    println!();
151
152    println!("=== Example completed successfully! ===");
153}
Source

pub async fn get_validator_mev_commission( &self, vote_account: &str, ) -> Result<Option<u16>, KobeApiError>

Get validator MEV commission

Examples found in repository?
examples/basic.rs (line 130)
4async fn main() {
5    // Create a client with mainnet defaults
6    let client = KobeClient::mainnet();
7
8    println!("=== Jito API Client - Basic Example ===\n");
9
10    // 1. Get current epoch
11    println!("1. Getting current epoch...");
12    let current_epoch = client.get_current_epoch().await.unwrap();
13    println!("   Current epoch: {}\n", current_epoch);
14
15    // 2. Get staker rewards
16    println!("2. Getting staker rewards (limit 5)...");
17    let rewards = client.get_staker_rewards(Some(5)).await.unwrap();
18    println!("   Found {} staker rewards:", rewards.rewards.len());
19    for (i, reward) in rewards.rewards.iter().enumerate() {
20        println!(
21            "   {}. Stake Account: {}",
22            i + 1,
23            &reward.stake_account[..8]
24        );
25        println!("      MEV Rewards: {} lamports", reward.mev_rewards);
26        println!("      Epoch: {}", reward.epoch);
27        println!("      Claimed: {}", reward.mev_claimed);
28    }
29    println!();
30
31    // 3. Get validator information
32    println!("3. Getting validators running Jito...");
33    let jito_validators = client.get_jito_validators().await.unwrap();
34    println!("   Found {} validators running Jito", jito_validators.len());
35
36    // Show top 5 by stake
37    let top_5_by_stake = jito_validators.iter().take(5);
38    for (i, validator) in top_5_by_stake.enumerate() {
39        println!(
40            "   {}. Vote Account: {}",
41            i + 1,
42            &validator.vote_account[..8]
43        );
44        println!("      Active Stake: {} lamports", validator.active_stake);
45        println!("      MEV Commission: {} bps", validator.mev_commission_bps);
46    }
47    println!();
48
49    // 4. Get network MEV statistics
50    println!("4. Getting MEV network statistics...");
51    let mev_stats = client.get_mev_rewards(None).await.unwrap();
52    println!("   Epoch: {}", mev_stats.epoch);
53    println!(
54        "   Total Network MEV: {} lamports",
55        mev_stats.total_network_mev_lamports
56    );
57    println!(
58        "   Jito Stake Weight: {} lamports",
59        mev_stats.jito_stake_weight_lamports
60    );
61    println!(
62        "   MEV per lamport: {:.10}",
63        mev_stats.mev_reward_per_lamport
64    );
65    println!();
66
67    // 5. Get validator rewards
68    println!("5. Getting validator rewards...");
69    let validator_rewards = client.get_validator_rewards(None, Some(3)).await.unwrap();
70    println!("   Top 3 validators by rewards:");
71    for (i, validator) in validator_rewards.validators.iter().enumerate() {
72        println!(
73            "   {}. Vote Account: {}",
74            i + 1,
75            &validator.vote_account[..8]
76        );
77        println!("      MEV Rewards: {} lamports", validator.mev_rewards);
78        if let Some(pf_rewards) = validator.priority_fee_rewards {
79            println!("      Priority Fee Rewards: {} lamports", pf_rewards);
80        }
81    }
82    println!();
83
84    // 6. Get historical validator data
85    println!("6. Getting historical data for a validator...");
86    if let Some(first_validator) = jito_validators.first() {
87        let history = client
88            .get_validator_history(&first_validator.vote_account)
89            .await
90            .unwrap();
91        println!("   Validator: {}", &first_validator.vote_account[..8]);
92        println!("   Historical data (last 3 epochs):");
93        for (i, entry) in history.iter().take(3).enumerate() {
94            println!(
95                "   {}. Epoch {}: {} lamports",
96                i + 1,
97                entry.epoch,
98                entry.mev_rewards
99            );
100        }
101    }
102    println!();
103
104    // 7. Get MEV commission averages
105    println!("7. Getting MEV commission averages...");
106    let commission_avg = client.get_mev_commission_average_over_time().await.unwrap();
107    println!(
108        "   Aggregated MEV Rewards: {} lamports",
109        commission_avg.aggregated_mev_rewards
110    );
111    if let Some(latest_apy) = commission_avg.apy.first() {
112        println!("   Latest APY: {:.2}%", latest_apy.data * 100.0);
113    }
114    if let Some(latest_tvl) = commission_avg.tvl.first() {
115        println!("   Latest TVL: {} lamports", latest_tvl.data);
116    }
117    println!();
118
119    // 8. Check specific validator
120    println!("8. Checking specific validator status...");
121    let test_vote_account = "GdRKUZKdiXMEATjddQW6q4W8bPgXRBYJKayfeqdQcEPa";
122    let is_running_jito = client
123        .is_validator_running_jito(test_vote_account)
124        .await
125        .unwrap();
126    println!("   Vote Account: {}", &test_vote_account[..8]);
127    println!("   Running Jito: {}", is_running_jito);
128
129    if let Some(commission) = client
130        .get_validator_mev_commission(test_vote_account)
131        .await
132        .unwrap()
133    {
134        println!("   MEV Commission: {} bps", commission);
135    }
136    println!();
137
138    // 9. Calculate total MEV for epoch range
139    println!("9. Calculating total MEV rewards...");
140    let start_epoch = current_epoch.saturating_sub(5);
141    let end_epoch = current_epoch.saturating_sub(1);
142    let total_mev = client
143        .calculate_total_mev_rewards(start_epoch, end_epoch)
144        .await
145        .unwrap();
146    println!(
147        "   Total MEV from epoch {} to {}: {} lamports",
148        start_epoch, end_epoch, total_mev
149    );
150    println!();
151
152    println!("=== Example completed successfully! ===");
153}
Source

pub async fn calculate_total_mev_rewards( &self, start_epoch: u64, end_epoch: u64, ) -> Result<u64, KobeApiError>

Calculate total MEV rewards for a time period

Examples found in repository?
examples/basic.rs (line 143)
4async fn main() {
5    // Create a client with mainnet defaults
6    let client = KobeClient::mainnet();
7
8    println!("=== Jito API Client - Basic Example ===\n");
9
10    // 1. Get current epoch
11    println!("1. Getting current epoch...");
12    let current_epoch = client.get_current_epoch().await.unwrap();
13    println!("   Current epoch: {}\n", current_epoch);
14
15    // 2. Get staker rewards
16    println!("2. Getting staker rewards (limit 5)...");
17    let rewards = client.get_staker_rewards(Some(5)).await.unwrap();
18    println!("   Found {} staker rewards:", rewards.rewards.len());
19    for (i, reward) in rewards.rewards.iter().enumerate() {
20        println!(
21            "   {}. Stake Account: {}",
22            i + 1,
23            &reward.stake_account[..8]
24        );
25        println!("      MEV Rewards: {} lamports", reward.mev_rewards);
26        println!("      Epoch: {}", reward.epoch);
27        println!("      Claimed: {}", reward.mev_claimed);
28    }
29    println!();
30
31    // 3. Get validator information
32    println!("3. Getting validators running Jito...");
33    let jito_validators = client.get_jito_validators().await.unwrap();
34    println!("   Found {} validators running Jito", jito_validators.len());
35
36    // Show top 5 by stake
37    let top_5_by_stake = jito_validators.iter().take(5);
38    for (i, validator) in top_5_by_stake.enumerate() {
39        println!(
40            "   {}. Vote Account: {}",
41            i + 1,
42            &validator.vote_account[..8]
43        );
44        println!("      Active Stake: {} lamports", validator.active_stake);
45        println!("      MEV Commission: {} bps", validator.mev_commission_bps);
46    }
47    println!();
48
49    // 4. Get network MEV statistics
50    println!("4. Getting MEV network statistics...");
51    let mev_stats = client.get_mev_rewards(None).await.unwrap();
52    println!("   Epoch: {}", mev_stats.epoch);
53    println!(
54        "   Total Network MEV: {} lamports",
55        mev_stats.total_network_mev_lamports
56    );
57    println!(
58        "   Jito Stake Weight: {} lamports",
59        mev_stats.jito_stake_weight_lamports
60    );
61    println!(
62        "   MEV per lamport: {:.10}",
63        mev_stats.mev_reward_per_lamport
64    );
65    println!();
66
67    // 5. Get validator rewards
68    println!("5. Getting validator rewards...");
69    let validator_rewards = client.get_validator_rewards(None, Some(3)).await.unwrap();
70    println!("   Top 3 validators by rewards:");
71    for (i, validator) in validator_rewards.validators.iter().enumerate() {
72        println!(
73            "   {}. Vote Account: {}",
74            i + 1,
75            &validator.vote_account[..8]
76        );
77        println!("      MEV Rewards: {} lamports", validator.mev_rewards);
78        if let Some(pf_rewards) = validator.priority_fee_rewards {
79            println!("      Priority Fee Rewards: {} lamports", pf_rewards);
80        }
81    }
82    println!();
83
84    // 6. Get historical validator data
85    println!("6. Getting historical data for a validator...");
86    if let Some(first_validator) = jito_validators.first() {
87        let history = client
88            .get_validator_history(&first_validator.vote_account)
89            .await
90            .unwrap();
91        println!("   Validator: {}", &first_validator.vote_account[..8]);
92        println!("   Historical data (last 3 epochs):");
93        for (i, entry) in history.iter().take(3).enumerate() {
94            println!(
95                "   {}. Epoch {}: {} lamports",
96                i + 1,
97                entry.epoch,
98                entry.mev_rewards
99            );
100        }
101    }
102    println!();
103
104    // 7. Get MEV commission averages
105    println!("7. Getting MEV commission averages...");
106    let commission_avg = client.get_mev_commission_average_over_time().await.unwrap();
107    println!(
108        "   Aggregated MEV Rewards: {} lamports",
109        commission_avg.aggregated_mev_rewards
110    );
111    if let Some(latest_apy) = commission_avg.apy.first() {
112        println!("   Latest APY: {:.2}%", latest_apy.data * 100.0);
113    }
114    if let Some(latest_tvl) = commission_avg.tvl.first() {
115        println!("   Latest TVL: {} lamports", latest_tvl.data);
116    }
117    println!();
118
119    // 8. Check specific validator
120    println!("8. Checking specific validator status...");
121    let test_vote_account = "GdRKUZKdiXMEATjddQW6q4W8bPgXRBYJKayfeqdQcEPa";
122    let is_running_jito = client
123        .is_validator_running_jito(test_vote_account)
124        .await
125        .unwrap();
126    println!("   Vote Account: {}", &test_vote_account[..8]);
127    println!("   Running Jito: {}", is_running_jito);
128
129    if let Some(commission) = client
130        .get_validator_mev_commission(test_vote_account)
131        .await
132        .unwrap()
133    {
134        println!("   MEV Commission: {} bps", commission);
135    }
136    println!();
137
138    // 9. Calculate total MEV for epoch range
139    println!("9. Calculating total MEV rewards...");
140    let start_epoch = current_epoch.saturating_sub(5);
141    let end_epoch = current_epoch.saturating_sub(1);
142    let total_mev = client
143        .calculate_total_mev_rewards(start_epoch, end_epoch)
144        .await
145        .unwrap();
146    println!(
147        "   Total MEV from epoch {} to {}: {} lamports",
148        start_epoch, end_epoch, total_mev
149    );
150    println!();
151
152    println!("=== Example completed successfully! ===");
153}

Trait Implementations§

Source§

impl Clone for KobeClient

Source§

fn clone(&self) -> KobeClient

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for KobeClient

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,