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

Source

pub fn testnet() -> Self

Create a client with testnet defaults

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?;
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
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)
Examples found in repository?
examples/validators.rs (line 16)
6async fn main() {
7    let client = KobeApiClientBuilder::new()
8        .timeout(Duration::from_secs(45))
9        .retry(true)
10        .max_retries(5)
11        .build();
12
13    let current_epoch = client.get_current_epoch().await.unwrap();
14    println!("Current epoch: {}\n", current_epoch);
15
16    let validators = client.get_validators(Some(current_epoch)).await.unwrap();
17
18    println!("Found {} validators", validators.validators.len());
19}
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.

Examples found in repository?
examples/jitosol_validators.rs (line 16)
6async fn main() {
7    let client = KobeApiClientBuilder::new()
8        .timeout(Duration::from_secs(45))
9        .retry(true)
10        .max_retries(5)
11        .build();
12
13    let current_epoch = client.get_current_epoch().await.unwrap();
14    println!("Current epoch: {}\n", current_epoch);
15
16    let jitosol_validators = client.get_jitosol_validators(Some(873)).await.unwrap();
17
18    println!(
19        "Found {} jito_sol Validators",
20        jitosol_validators.validators.len()
21    );
22}
Source

pub async fn get_validator_info_by_vote_account( &self, vote_account: &str, ) -> Result<Vec<ValidatorByVoteAccount>, 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/validator_by_vote_account.rs (line 16)
6async fn main() {
7    let client = KobeApiClientBuilder::new()
8        .timeout(Duration::from_secs(45))
9        .retry(true)
10        .max_retries(5)
11        .build();
12
13    let vote_account = "J1to1yufRnoWn81KYg1XkTWzmKjnYSnmE2VY8DGUJ9Qv";
14
15    let validator_info = client
16        .get_validator_info_by_vote_account(vote_account)
17        .await
18        .unwrap();
19
20    println!("Validator Info Length: {}", validator_info.len());
21}
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/mev_rewards.rs (line 16)
6async fn main() {
7    let client = KobeApiClientBuilder::new()
8        .timeout(Duration::from_secs(45))
9        .retry(true)
10        .max_retries(5)
11        .build();
12
13    let current_epoch = client.get_current_epoch().await.unwrap();
14    println!("Current epoch: {}\n", current_epoch);
15
16    let mev_rewards = client.get_mev_rewards(Some(current_epoch)).await.unwrap();
17
18    println!("MEV Rewards: {:?}", mev_rewards);
19}
Source

pub async fn get_daily_mev_rewards( &self, ) -> Result<Vec<DailyMevRewards>, KobeApiError>

Get daily MEV rewards

Returns aggregated MEV rewards per calendar day.

Examples found in repository?
examples/daily_mev_rewards.rs (line 13)
6async fn main() {
7    let client = KobeApiClientBuilder::new()
8        .timeout(Duration::from_secs(45))
9        .retry(true)
10        .max_retries(5)
11        .build();
12
13    let daily_mev_tips = client.get_daily_mev_rewards().await.unwrap();
14
15    println!("Daily MEV Tips: {:?}", daily_mev_tips);
16}
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.

Examples found in repository?
examples/jito_stake_over_time.rs (line 13)
6async fn main() {
7    let client = KobeApiClientBuilder::new()
8        .timeout(Duration::from_secs(45))
9        .retry(true)
10        .max_retries(5)
11        .build();
12
13    let stake_over_time = client.get_jito_stake_over_time().await.unwrap();
14
15    println!("Stake over time: {:?}", stake_over_time);
16}
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.

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, request: Option<&StakePoolStatsRequest>, ) -> Result<StakePoolStats, KobeApiError>

Get stake pool statistics

Returns stake pool analytics including TVL, APY, validator count, supply metrics, and aggregated MEV rewards over time.

Examples found in repository?
examples/stake_pool_stats.rs (line 25)
7async fn main() {
8    let client = KobeApiClientBuilder::new()
9        .timeout(Duration::from_secs(45))
10        .retry(true)
11        .max_retries(5)
12        .build();
13
14    let current_epoch = client.get_current_epoch().await.unwrap();
15    println!("Current epoch: {}\n", current_epoch);
16
17    let end = Utc::now();
18
19    let start = end - chrono::Duration::days(1);
20    let request = StakePoolStatsRequest::new()
21        .with_bucket_type("Daily")
22        .with_range_filter(start, end)
23        .sort_asc();
24
25    let stake_pool_stats = client.get_stake_pool_stats(Some(&request)).await.unwrap();
26
27    println!("Stake Pool Stats: {:?}", stake_pool_stats);
28}
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/mev_rewards.rs (line 13)
6async fn main() {
7    let client = KobeApiClientBuilder::new()
8        .timeout(Duration::from_secs(45))
9        .retry(true)
10        .max_retries(5)
11        .build();
12
13    let current_epoch = client.get_current_epoch().await.unwrap();
14    println!("Current epoch: {}\n", current_epoch);
15
16    let mev_rewards = client.get_mev_rewards(Some(current_epoch)).await.unwrap();
17
18    println!("MEV Rewards: {:?}", mev_rewards);
19}
More examples
Hide additional examples
examples/validators.rs (line 13)
6async fn main() {
7    let client = KobeApiClientBuilder::new()
8        .timeout(Duration::from_secs(45))
9        .retry(true)
10        .max_retries(5)
11        .build();
12
13    let current_epoch = client.get_current_epoch().await.unwrap();
14    println!("Current epoch: {}\n", current_epoch);
15
16    let validators = client.get_validators(Some(current_epoch)).await.unwrap();
17
18    println!("Found {} validators", validators.validators.len());
19}
examples/jitosol_validators.rs (line 13)
6async fn main() {
7    let client = KobeApiClientBuilder::new()
8        .timeout(Duration::from_secs(45))
9        .retry(true)
10        .max_retries(5)
11        .build();
12
13    let current_epoch = client.get_current_epoch().await.unwrap();
14    println!("Current epoch: {}\n", current_epoch);
15
16    let jitosol_validators = client.get_jitosol_validators(Some(873)).await.unwrap();
17
18    println!(
19        "Found {} jito_sol Validators",
20        jitosol_validators.validators.len()
21    );
22}
examples/stake_pool_stats.rs (line 14)
7async fn main() {
8    let client = KobeApiClientBuilder::new()
9        .timeout(Duration::from_secs(45))
10        .retry(true)
11        .max_retries(5)
12        .build();
13
14    let current_epoch = client.get_current_epoch().await.unwrap();
15    println!("Current epoch: {}\n", current_epoch);
16
17    let end = Utc::now();
18
19    let start = end - chrono::Duration::days(1);
20    let request = StakePoolStatsRequest::new()
21        .with_bucket_type("Daily")
22        .with_range_filter(start, end)
23        .sort_asc();
24
25    let stake_pool_stats = client.get_stake_pool_stats(Some(&request)).await.unwrap();
26
27    println!("Stake Pool Stats: {:?}", stake_pool_stats);
28}
Source

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

Get all validators currently running Jito

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

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

Source

pub async fn get_bam_delegation_blacklist( &self, ) -> Result<Vec<BamDelegationBlacklistEntry>, KobeApiError>

Get BAM Delegation Blacklist

Returns bam delegation blacklist

Examples found in repository?
examples/bam_delegation_blacklist.rs (line 9)
4async fn main() {
5    let client = KobeApiClientBuilder::new()
6        .base_url("http://localhost:8080")
7        .build();
8
9    let blacklist = client.get_bam_delegation_blacklist().await.unwrap();
10
11    println!("Bam Delegation Blacklist: {:?}", blacklist);
12}
Source

pub async fn get_bam_epoch_metrics( &self, epoch: u64, ) -> Result<BamEpochMetricsResponse, KobeApiError>

Get BAM Epoch Metrics

Returns bam epoch metrics

Examples found in repository?
examples/bam_epoch_metrics.rs (line 9)
4async fn main() {
5    let client = KobeApiClientBuilder::new()
6        .base_url("http://localhost:8080")
7        .build();
8
9    let bam_epoch_metrics = client.get_bam_epoch_metrics(892).await.unwrap();
10
11    println!("Bam Epoch Metrics: {:?}", bam_epoch_metrics);
12}
Source

pub async fn get_bam_validators( &self, epoch: u64, ) -> Result<BamValidatorsResponse, KobeApiError>

Get BAM Validators

Returns bam validators

Examples found in repository?
examples/bam_validators.rs (line 9)
4async fn main() {
5    let client = KobeApiClientBuilder::new()
6        .base_url("http://localhost:8080")
7        .build();
8
9    let bam_validators = client.get_bam_validators(892).await.unwrap();
10
11    println!("Bam Validators: {:?}", bam_validators);
12}

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,