Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ COPY --from=builder /home/root/app/${APP} ./
ENTRYPOINT ["/app/jito-searcher-client"]


FROM base_image as backrun
FROM base_image as backrun_example
ENV APP="jito-backrun-example"
WORKDIR /app
COPY --from=builder /home/root/app/${APP} ./
Expand Down
14 changes: 7 additions & 7 deletions cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,41 +21,41 @@ Subscribe to transactions that write-lock the Pyth SOL/USDC account (H6Ar...QJEG
```bash
./target/release/jito-searcher-cli \
--block-engine-url https://frankfurt.mainnet.block-engine.jito.wtf \
--keypair-path auth.json \
mempool-accounts H6ARHf6YXhGYeQfUzQNGk6rDNnLBQKrenN712K4AQJEG
--auth-keypair-path auth.json \
mempool-accounts --accounts H6ARHf6YXhGYeQfUzQNGk6rDNnLBQKrenN712K4AQJEG
```

### Printing out the next scheduled leader
```bash
./target/release/jito-searcher-cli \
--block-engine-url https://frankfurt.mainnet.block-engine.jito.wtf \
--keypair-path auth.json \
--auth-keypair-path auth.json \
next-scheduled-leader
```

### Getting the connected leaders
```bash
./target/release/jito-searcher-cli \
--block-engine-url https://frankfurt.mainnet.block-engine.jito.wtf \
--keypair-path auth.json \
--auth-keypair-path auth.json \
connected-leaders
```

### Getting tip accounts
```bash
./target/release/jito-searcher-cli \
--block-engine-url https://frankfurt.mainnet.block-engine.jito.wtf \
--keypair-path auth.json \
--auth-keypair-path auth.json \
tip-accounts
```

### Sending a bundle
```bash
./target/release/jito-searcher-cli \
--block-engine-url https://frankfurt.mainnet.block-engine.jito.wtf \
--keypair-path auth.json \
--auth-keypair-path auth.json \
send-bundle \
--payer payer.json \
--payer-keypair-path payer.json \
--message "im testing jito bundles right now this is pretty sick bro" \
--num-txs 5 \
--lamports 100000 \
Expand Down
48 changes: 25 additions & 23 deletions cli/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use std::{env, str::FromStr, sync::Arc, time::Duration};
use std::path::PathBuf;
use std::{env, sync::Arc, time::Duration};

use clap::{Parser, Subcommand};
use env_logger::TimestampPrecision;
Expand Down Expand Up @@ -29,15 +30,15 @@ use tokio::time::{sleep, timeout};
use tonic::{codegen::InterceptedService, transport::Channel, Streaming};

#[derive(Parser, Debug)]
#[clap(author, version, about, long_about = None)]
#[command(author, version, about, long_about = None)]
struct Args {
/// URL of the block engine
#[clap(long, env)]
#[arg(long, env)]
block_engine_url: String,

/// Filepath to a keypair that's authenticated with the block engine
#[clap(long, env)]
keypair_path: String,
#[arg(long, env)]
auth_keypair_path: PathBuf,

/// Subcommand to run
#[command(subcommand)]
Expand All @@ -48,14 +49,14 @@ struct Args {
enum Commands {
/// Subscribe to mempool accounts
MempoolAccounts {
/// A space-separated list of accounts to subscribe to
#[clap(required = true)]
/// A comma-separated list of accounts to subscribe to
#[arg(long, value_delimiter = ',', required = true)]
accounts: Vec<String>,
},
/// Subscribe to mempool by program IDs
MempoolPrograms {
/// A space-separated list of programs to subscribe to
#[clap(required = true)]
/// A comma-separated list of programs to subscribe to
#[arg(long, value_delimiter = ',', required = true)]
programs: Vec<String>,
},
/// Print out information on the next scheduled leader
Expand All @@ -64,31 +65,31 @@ enum Commands {
ConnectedLeaders,
/// Prints out connected leaders with their leader slot percentage
ConnectedLeadersInfo {
#[clap(long, required = true)]
#[arg(long)]
rpc_url: String,
},
/// Prints out information on the tip accounts
TipAccounts,
/// Sends a 1 lamport bundle
SendBundle {
/// RPC URL
#[clap(long, required = true)]
#[arg(long)]
rpc_url: String,
/// Filepath to keypair that can afford the transaction payments with 1 lamport tip
#[clap(long, required = true)]
payer: String,
#[arg(long)]
payer_keypair_path: PathBuf,
/// Message you'd like the bundle to say
#[clap(long, required = true)]
#[arg(long)]
message: String,
/// Number of transactions in the bundle (must be <= 5)
#[clap(long, required = true)]
#[arg(long)]
num_txs: usize,
/// Amount of lamports to tip in each transaction
#[clap(long, required = true)]
#[arg(long)]
lamports: u64,
/// One of the tip accounts
#[clap(long, required = true)]
tip_account: String,
#[arg(long)]
tip_account: Pubkey,
},
}

Expand All @@ -110,15 +111,16 @@ async fn print_next_leader_info(
#[tokio::main]
async fn main() {
let args: Args = Args::parse();

dbg!(&args);
if env::var("RUST_LOG").is_err() {
env::set_var("RUST_LOG", "info")
}
env_logger::builder()
.format_timestamp(Some(TimestampPrecision::Micros))
.init();

let keypair = Arc::new(read_keypair_file(args.keypair_path).expect("reads keypair at path"));
let keypair =
Arc::new(read_keypair_file(args.auth_keypair_path).expect("reads keypair at path"));

let mut client = get_searcher_client(&args.block_engine_url, &keypair)
.await
Expand Down Expand Up @@ -222,14 +224,14 @@ async fn main() {
}
Commands::SendBundle {
rpc_url,
payer,
payer_keypair_path,
message,
num_txs,
lamports,
tip_account,
} => {
let payer_keypair = read_keypair_file(payer).expect("reads keypair at path");
let tip_account = Pubkey::from_str(&tip_account).expect("valid pubkey for tip account");
let payer_keypair =
read_keypair_file(payer_keypair_path).expect("reads keypair at path");
let rpc_client = RpcClient::new_with_commitment(rpc_url, CommitmentConfig::confirmed());
let balance = rpc_client
.get_balance(&payer_keypair.pubkey())
Expand Down
4 changes: 2 additions & 2 deletions searcher_client/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ pub async fn send_bundle_with_confirmation(
Some(Reason::WinningBatchBidRejected(WinningBatchBidRejected {
auction_id,
simulated_bid_lamports,
msg: _
msg: _,
})) => {
return Err(Box::new(BundleRejectionError::WinningBatchBidRejected(
auction_id,
Expand All @@ -131,7 +131,7 @@ pub async fn send_bundle_with_confirmation(
Some(Reason::StateAuctionBidRejected(StateAuctionBidRejected {
auction_id,
simulated_bid_lamports,
msg: _
msg: _,
})) => {
return Err(Box::new(BundleRejectionError::StateAuctionBidRejected(
auction_id,
Expand Down