From 218c2d25ce18be52c45142cec17cce34c780e319 Mon Sep 17 00:00:00 2001 From: armaniferrante Date: Wed, 14 Apr 2021 21:03:08 -0700 Subject: [PATCH] cli: Print common cluster urls --- cli/src/main.rs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/cli/src/main.rs b/cli/src/main.rs index a88e2fe8..1b075bc8 100644 --- a/cli/src/main.rs +++ b/cli/src/main.rs @@ -123,6 +123,11 @@ pub enum Command { #[clap(short, long)] url: Option, }, + /// Cluster commands. + Cluster { + #[clap(subcommand)] + subcmd: ClusterCommand, + }, } #[derive(Debug, Clap)] @@ -197,6 +202,12 @@ pub enum IdlCommand { }, } +#[derive(Debug, Clap)] +pub enum ClusterCommand { + /// Prints common cluster urls. + List, +} + fn main() -> Result<()> { let opts = Opts::parse(); match opts.command { @@ -223,6 +234,7 @@ fn main() -> Result<()> { } => test(skip_deploy, skip_local_validator, file), #[cfg(feature = "dev")] Command::Airdrop { url } => airdrop(url), + Command::Cluster { subcmd } => cluster(subcmd), } } @@ -1493,3 +1505,12 @@ fn airdrop(url: Option) -> Result<()> { std::thread::sleep(std::time::Duration::from_millis(10000)); } } + +fn cluster(_cmd: ClusterCommand) -> Result<()> { + println!("Cluster Endpoints:\n"); + println!("* Mainnet - https://solana-api.projectserum.com"); + println!("* Mainnet - https://api.mainnet-beta.solana.com"); + println!("* Devnet - https://devnet.solana.com"); + println!("* Testnet - https://testnet.solana.com"); + Ok(()) +}