pub struct KobeApiClientBuilder { /* private fields */ }Expand description
Builder for creating a JitoClient with custom configuration
Implementations§
Source§impl KobeApiClientBuilder
impl KobeApiClientBuilder
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a new builder with mainnet defaults
Examples found in repository?
More examples
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}Additional examples can be found in:
Sourcepub fn base_url(self, base_url: impl Into<String>) -> Self
pub fn base_url(self, base_url: impl Into<String>) -> Self
Set the base URL
Examples found in repository?
More examples
Sourcepub fn timeout(self, timeout: Duration) -> Self
pub fn timeout(self, timeout: Duration) -> Self
Set the request timeout
Examples found in repository?
More examples
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}Additional examples can be found in:
Sourcepub fn user_agent(self, user_agent: impl Into<String>) -> Self
pub fn user_agent(self, user_agent: impl Into<String>) -> Self
Set the user agent
Sourcepub fn retry(self, enabled: bool) -> Self
pub fn retry(self, enabled: bool) -> Self
Enable or disable retries
Examples found in repository?
More examples
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}Additional examples can be found in:
Sourcepub fn max_retries(self, max_retries: u32) -> Self
pub fn max_retries(self, max_retries: u32) -> Self
Set maximum number of retries
Examples found in repository?
More examples
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}Additional examples can be found in:
Sourcepub fn build(self) -> KobeClient
pub fn build(self) -> KobeClient
Build the client
Examples found in repository?
More examples
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}Additional examples can be found in:
Trait Implementations§
Auto Trait Implementations§
impl Freeze for KobeApiClientBuilder
impl RefUnwindSafe for KobeApiClientBuilder
impl Send for KobeApiClientBuilder
impl Sync for KobeApiClientBuilder
impl Unpin for KobeApiClientBuilder
impl UnwindSafe for KobeApiClientBuilder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more