KobeApiClientBuilder

Struct KobeApiClientBuilder 

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

Builder for creating a JitoClient with custom configuration

Implementations§

Source§

impl KobeApiClientBuilder

Source

pub fn new() -> Self

Create a new builder with mainnet defaults

Examples found in repository?
examples/bam_validators.rs (line 5)
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}
More examples
Hide additional examples
examples/bam_delegation_blacklist.rs (line 5)
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}
examples/bam_epoch_metrics.rs (line 5)
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}
examples/daily_mev_rewards.rs (line 7)
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}
examples/jito_stake_over_time.rs (line 7)
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}
examples/mev_rewards.rs (line 7)
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 fn base_url(self, base_url: impl Into<String>) -> Self

Set the base URL

Examples found in repository?
examples/bam_validators.rs (line 6)
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}
More examples
Hide additional examples
examples/bam_delegation_blacklist.rs (line 6)
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}
examples/bam_epoch_metrics.rs (line 6)
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 fn timeout(self, timeout: Duration) -> Self

Set the request timeout

Examples found in repository?
examples/daily_mev_rewards.rs (line 8)
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}
More examples
Hide additional examples
examples/jito_stake_over_time.rs (line 8)
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}
examples/mev_rewards.rs (line 8)
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}
examples/validator_by_vote_account.rs (line 8)
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}
examples/validators.rs (line 8)
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 8)
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 fn user_agent(self, user_agent: impl Into<String>) -> Self

Set the user agent

Source

pub fn retry(self, enabled: bool) -> Self

Enable or disable retries

Examples found in repository?
examples/daily_mev_rewards.rs (line 9)
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}
More examples
Hide additional examples
examples/jito_stake_over_time.rs (line 9)
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}
examples/mev_rewards.rs (line 9)
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}
examples/validator_by_vote_account.rs (line 9)
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}
examples/validators.rs (line 9)
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 9)
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 fn max_retries(self, max_retries: u32) -> Self

Set maximum number of retries

Examples found in repository?
examples/daily_mev_rewards.rs (line 10)
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}
More examples
Hide additional examples
examples/jito_stake_over_time.rs (line 10)
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}
examples/mev_rewards.rs (line 10)
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}
examples/validator_by_vote_account.rs (line 10)
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}
examples/validators.rs (line 10)
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 10)
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 fn build(self) -> KobeClient

Build the client

Examples found in repository?
examples/bam_validators.rs (line 7)
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}
More examples
Hide additional examples
examples/bam_delegation_blacklist.rs (line 7)
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}
examples/bam_epoch_metrics.rs (line 7)
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}
examples/daily_mev_rewards.rs (line 11)
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}
examples/jito_stake_over_time.rs (line 11)
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}
examples/mev_rewards.rs (line 11)
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}

Trait Implementations§

Source§

impl Default for KobeApiClientBuilder

Source§

fn default() -> Self

Returns the “default value” for a type. 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> 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, 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,