Skip to content
Merged
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
788 changes: 731 additions & 57 deletions Cargo.lock

Large diffs are not rendered by default.

62 changes: 61 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,60 @@
[workspace]
resolver = "2"
members = ["crates/mempool-rebroadcaster", "crates/sidecrush"]
members = ["crates/*", "bin/*"]
exclude = [".github/"]

[workspace.package]
version = "0.0.0"
edition = "2024"
license = "MIT"

[workspace.lints.rust]
missing-debug-implementations = "warn"
unreachable-pub = "warn"
unused-must-use = "deny"
unnameable-types = "warn"

[workspace.lints.clippy]
all = { level = "warn", priority = -1 }
missing-const-for-fn = "warn"
redundant-clone = "warn"
clone-on-ref-ptr = "warn"
unnecessary-to-owned = "warn"
cloned-instead-of-copied = "warn"
flat-map-option = "warn"
implicit-clone = "warn"
or-fun-call = "warn"
use-self = "warn"
option-if-let-else = "warn"
uninlined-format-args = "warn"
manual-string-new = "warn"
single-char-pattern = "warn"
redundant-else = "warn"
match-same-arms = "warn"
undocumented-unsafe-blocks = "warn"
doc-markdown = "warn"
dbg-macro = "warn"
branches-sharing-code = "warn"
derive-partial-eq-without-eq = "warn"
explicit-into-iter-loop = "warn"
explicit-iter-loop = "warn"
iter-with-drain = "warn"
needless-pass-by-ref-mut = "warn"
string-lit-as-bytes = "warn"

[workspace.dependencies]
clap = { version = "4.0", features = ["derive", "env"] }
tokio-tungstenite = { version = "0.26", features = ["native-tls"] }
futures-util = "0.3"
url = "2.5"
ratatui = "0.29"
crossterm = { version = "0.28", features = ["event-stream"] }
chrono = "0.4"
anyhow = "1.0"
serde_yaml = "0.9"
dirs = "6.0"
dotenvy = "0.15.7"
async-trait = "0.1"
tracing = "0.1"
tracing-subscriber = { version = "0.3", default-features = false, features = ["env-filter", "fmt", "ansi", "json"] }
tokio = { version = "1.0", features = ["full"] }
Expand All @@ -16,6 +67,7 @@ cadence = "1.4"
# alloy
alloy-primitives = { version = "1.5.2", default-features = false, features = [
"map-foldhash",
"serde",
] }
alloy-genesis = { version = "1.5.2", default-features = false }
alloy-eips = { version = "1.5.2", default-features = false }
Expand All @@ -28,8 +80,16 @@ alloy-provider = { version = "1.5.2" }
alloy-hardforks = { version = "0.5" }
alloy-rpc-client = { version = "1.5.2" }
alloy-transport-http = { version = "1.5.2" }
alloy-sol-types = { version = "1.5.2" }
alloy-contract = { version = "1.5.2" }

# op-alloy
op-alloy-rpc-types = { version = "0.22.0", default-features = false }
op-alloy-rpc-types-engine = { version = "0.22.0", default-features = false }
op-alloy-consensus = { version = "0.22.0", default-features = false }

# base
base-flashtypes = { git = "https://github.com/base/base.git" }

# internal
basectl-cli = { path = "crates/basectl" }
18 changes: 17 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
![Base](assets/logo.png)

# Base Infra
# Base Infra

## Installation

### basectl

Install `basectl` directly from the repository using cargo:

```bash
cargo install --git https://github.com/base/infra --package basectl
```

Or from a specific branch:

```bash
cargo install --git https://github.com/base/infra --branch main --package basectl
```
18 changes: 18 additions & 0 deletions bin/basectl/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[package]
name = "basectl"
version.workspace = true
edition.workspace = true
license.workspace = true

[lints]
workspace = true

[[bin]]
name = "basectl"
path = "main.rs"

[dependencies]
basectl-cli = { workspace = true }
clap = { workspace = true }
tokio = { workspace = true }
anyhow = { workspace = true }
62 changes: 62 additions & 0 deletions bin/basectl/main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
use basectl_cli::{
commands::{
config::{ConfigCommand, default_view, run_config},
flashblocks::{FlashblocksCommand, default_subscribe, run_flashblocks},
},
config::ChainConfig,
tui::{HomeSelection, NavResult, run_homescreen},
};
use clap::{Parser, Subcommand};

#[derive(Debug, Parser)]
#[command(name = "basectl")]
#[command(about = "Base infrastructure control CLI")]
struct Cli {
/// Chain configuration (mainnet, sepolia, or path to config file)
#[arg(short = 'c', long = "config", default_value = "mainnet", global = true)]
config: String,

#[command(subcommand)]
command: Option<Commands>,
}

#[derive(Debug, Subcommand)]
enum Commands {
/// Chain configuration operations
#[command(visible_alias = "c")]
Config {
#[command(subcommand)]
command: ConfigCommand,
},
/// Flashblocks operations
#[command(visible_alias = "f")]
Flashblocks {
#[command(subcommand)]
command: FlashblocksCommand,
},
}

#[tokio::main]
async fn main() -> anyhow::Result<()> {
let cli = Cli::parse();

let chain_config = ChainConfig::load(&cli.config)?;

match cli.command {
Some(Commands::Config { command }) => run_config(command, &chain_config).await,
Some(Commands::Flashblocks { command }) => run_flashblocks(command, &chain_config).await,
None => {
// Show homescreen when no command provided
loop {
let next = match run_homescreen()? {
HomeSelection::Config => default_view(&chain_config).await?,
HomeSelection::Flashblocks => default_subscribe(&chain_config).await?,
HomeSelection::Quit => return Ok(()),
};
if next == NavResult::Quit {
return Ok(());
}
}
}
}
}
29 changes: 29 additions & 0 deletions crates/basectl/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
[package]
name = "basectl-cli"
version.workspace = true
edition.workspace = true
license.workspace = true

[lints]
workspace = true

[dependencies]
clap = { workspace = true }
tokio = { workspace = true }
serde_json = { workspace = true }
tokio-tungstenite = { workspace = true }
futures-util = { workspace = true }
ratatui = { workspace = true }
crossterm = { workspace = true }
chrono = { workspace = true }
anyhow = { workspace = true }
serde = { workspace = true }
serde_yaml = { workspace = true }
dirs = { workspace = true }
alloy-provider = { workspace = true }
alloy-rpc-types-eth = { workspace = true }
base-flashtypes = { workspace = true }
url = { workspace = true }
alloy-primitives = { workspace = true }
alloy-sol-types = { workspace = true }
alloy-contract = { workspace = true }
Loading