Pārlūkot izejas kodu

cli: Print common cluster urls

armaniferrante 4 gadi atpakaļ
vecāks
revīzija
218c2d25ce
1 mainītis faili ar 21 papildinājumiem un 0 dzēšanām
  1. 21 0
      cli/src/main.rs

+ 21 - 0
cli/src/main.rs

@@ -123,6 +123,11 @@ pub enum Command {
         #[clap(short, long)]
         url: Option<String>,
     },
+    /// 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<String>) -> 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(())
+}