diff --git a/Dockerfile b/Dockerfile index 5566cc1..6bea111 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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} ./ diff --git a/cli/README.md b/cli/README.md index 86b99f0..600df70 100644 --- a/cli/README.md +++ b/cli/README.md @@ -21,15 +21,15 @@ 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 ``` @@ -37,7 +37,7 @@ 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 \ + --auth-keypair-path auth.json \ connected-leaders ``` @@ -45,7 +45,7 @@ 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 \ + --auth-keypair-path auth.json \ tip-accounts ``` @@ -53,9 +53,9 @@ 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 \ + --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 \ diff --git a/cli/src/main.rs b/cli/src/main.rs index 35f4553..b38efff 100644 --- a/cli/src/main.rs +++ b/cli/src/main.rs @@ -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; @@ -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)] @@ -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, }, /// 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, }, /// Print out information on the next scheduled leader @@ -64,7 +65,7 @@ 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 @@ -72,23 +73,23 @@ enum Commands { /// 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, }, } @@ -110,7 +111,7 @@ 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") } @@ -118,7 +119,8 @@ async fn main() { .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 @@ -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()) diff --git a/searcher_client/src/lib.rs b/searcher_client/src/lib.rs index e6a1baf..7c3e5a1 100644 --- a/searcher_client/src/lib.rs +++ b/searcher_client/src/lib.rs @@ -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, @@ -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,