Skip to content

Commit

Permalink
Merge pull request #405 from chainbound/fix/send-cmd
Browse files Browse the repository at this point in the history
fix(cli): update `send` command to new bolt-rpc specs
  • Loading branch information
thedevbirb authored Nov 21, 2024
2 parents ed6e38c + 7f1c3cb commit f87141b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
6 changes: 1 addition & 5 deletions bolt-cli/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,7 @@ pub struct PubkeysCommand {
#[derive(Debug, Clone, Parser)]
pub struct SendCommand {
/// Bolt RPC URL to send requests to and fetch lookahead info from.
#[clap(
long,
env = "BOLT_RPC_URL",
default_value = "https://rpc-holesky.bolt.chainbound.io/rpc"
)]
#[clap(long, env = "BOLT_RPC_URL", default_value = "https://rpc-holesky.bolt.chainbound.io")]
pub bolt_rpc_url: Url,

/// The private key to sign the transaction with.
Expand Down
8 changes: 4 additions & 4 deletions bolt-cli/src/commands/send.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,23 +42,23 @@ impl SendCommand {
let provider = ProviderBuilder::new()
.with_recommended_fillers()
.wallet(transaction_signer)
.on_http(self.bolt_rpc_url.clone());
.on_http(self.bolt_rpc_url.join("/rpc")?);

// Fetch the lookahead info from the Bolt RPC server
let mut lookahead_url = self.bolt_rpc_url.join(BOLT_LOOKAHEAD_PATH)?;

// Note: it's possible for users to override the target sidecar URL
// for testing and development purposes. In most cases, the sidecar will
// reject a request for a slot that it is not responsible for.
let target_url = if let Some(sidecar_url) = &self.override_bolt_sidecar_url {
let target_url = if let Some(sidecar_url) = self.override_bolt_sidecar_url {
// If using the override URL, we don't need to fetch the active proposers only.
// we will set the next slot as the target slot.
sidecar_url.clone()
sidecar_url
} else {
// Filter out slots that are not active or in the past, to fetch the next
// active proposer slot.
lookahead_url.set_query(Some("activeOnly=true&futureOnly=true"));
self.bolt_rpc_url.clone()
self.bolt_rpc_url.join("/rpc")?
};

let lookahead_res = reqwest::get(lookahead_url).await?.json::<Vec<LookaheadSlot>>().await?;
Expand Down

0 comments on commit f87141b

Please sign in to comment.