Skip to content

Commit 02df8e5

Browse files
committed
Add dependie
1 parent e206819 commit 02df8e5

File tree

2 files changed

+23
-28
lines changed

2 files changed

+23
-28
lines changed

README.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,12 @@ Marginfi liquidator
88

99
Ubuntu
1010
```bash
11-
sudo apt install build-essential libssl-dev pkg-config
11+
sudo apt install build-essential libssl-dev pkg-config unzip
1212
```
1313

14+
Follow this instructions
15+
https://grpc.io/docs/protoc-installation/#install-pre-compiled-binaries-any-os;
16+
1417
### Creating a New Configuration File
1518

1619
To initiate the creation of a new configuration file for the liquidator, execute the following command in your terminal:

src/jito/mod.rs

+19-27
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,29 @@
11
use jito_protos::{
22
bundle::{bundle_result::Result as BundleResultType, rejected::Reason, Bundle},
33
searcher::{
4-
searcher_service_client::SearcherServiceClient, NextScheduledLeaderRequest,
5-
SubscribeBundleResultsRequest, GetTipAccountsRequest
4+
searcher_service_client::SearcherServiceClient, GetTipAccountsRequest,
5+
NextScheduledLeaderRequest, SubscribeBundleResultsRequest,
66
},
77
};
8-
use std::str::FromStr;
98
use jito_searcher_client::{get_searcher_client_no_auth, send_bundle_with_confirmation};
109
use solana_client::nonblocking::rpc_client::RpcClient;
1110
use solana_sdk::{
12-
commitment_config::CommitmentConfig, instruction::Instruction, pubkey::Pubkey, signature::{Keypair, Signer}, system_instruction::transfer, transaction::{Transaction, VersionedTransaction}
11+
commitment_config::CommitmentConfig,
12+
instruction::Instruction,
13+
pubkey::Pubkey,
14+
signature::{Keypair, Signer},
15+
system_instruction::transfer,
16+
transaction::{Transaction, VersionedTransaction},
1317
};
18+
use std::str::FromStr;
1419
use tokio::time::sleep;
1520
use tonic::transport::Channel;
1621

1722
pub struct JitoClient {
1823
rpc: RpcClient,
1924
searcher_client: SearcherServiceClient<Channel>,
2025
keypair: Keypair,
21-
tip_accounts: Vec<String>
26+
tip_accounts: Vec<String>,
2227
}
2328

2429
impl JitoClient {
@@ -32,7 +37,7 @@ impl JitoClient {
3237
rpc,
3338
searcher_client,
3439
keypair,
35-
tip_accounts: Vec::new()
40+
tip_accounts: Vec::new(),
3641
}
3742
}
3843

@@ -48,7 +53,8 @@ impl JitoClient {
4853

4954
let mut is_jito_leader = false;
5055
while !is_jito_leader {
51-
let next_leader = self.searcher_client
56+
let next_leader = self
57+
.searcher_client
5258
.get_next_scheduled_leader(NextScheduledLeaderRequest {})
5359
.await
5460
.expect("Failed to get next scheduled leader")
@@ -63,7 +69,11 @@ impl JitoClient {
6369
Transaction::new_signed_with_payer(
6470
&[
6571
ix,
66-
transfer(&self.keypair.pubkey(), &Pubkey::from_str(&self.tip_accounts[0])?, lamports),
72+
transfer(
73+
&self.keypair.pubkey(),
74+
&Pubkey::from_str(&self.tip_accounts[0])?,
75+
lamports,
76+
),
6777
],
6878
Some(&self.keypair.pubkey()),
6979
&[&self.keypair],
@@ -90,28 +100,10 @@ impl JitoClient {
90100
.await
91101
.expect("Failed to get tip accounts")
92102
.into_inner();
93-
103+
94104
self.tip_accounts = tip_accounts.accounts;
95105

96106
Ok(())
97107
}
98-
99108
}
100109

101-
#[cfg(test)]
102-
mod tests {
103-
use solana_sdk::signer::keypair;
104-
105-
use super::*;
106-
#[tokio::test]
107-
async fn test_leader() {
108-
let keypair = Keypair::new();
109-
let mut jito_client = JitoClient::new(
110-
"https://rpc.ironforge.network/mainnet?apiKey=01HTYZW4C7W74CTK8N8XN2GMR5".to_string(),
111-
keypair,
112-
"https://mainnet.block-engine.jito.wtf".to_string(),
113-
)
114-
.await;
115-
jito_client.get_tip_accounts().await;
116-
}
117-
}

0 commit comments

Comments
 (0)