-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into support-l2-plus
- Loading branch information
Showing
9 changed files
with
151 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
// Copyright 2022-2024 Protocol Labs | ||
// SPDX-License-Identifier: MIT | ||
//! List subnets cli command | ||
use crate::{get_ipc_provider, CommandLineHandler, GlobalArguments}; | ||
use async_trait::async_trait; | ||
use clap::Args; | ||
use ipc_api::subnet_id::SubnetID; | ||
use std::fmt::Debug; | ||
use std::str::FromStr; | ||
|
||
/// The command to create a new subnet actor. | ||
pub(crate) struct ListValidators; | ||
|
||
#[async_trait] | ||
impl CommandLineHandler for ListValidators { | ||
type Arguments = ListValidatorsArgs; | ||
|
||
async fn handle(global: &GlobalArguments, arguments: &Self::Arguments) -> anyhow::Result<()> { | ||
log::debug!("list validators with args: {:?}", arguments); | ||
|
||
let provider = get_ipc_provider(global)?; | ||
let subnet = SubnetID::from_str(&arguments.subnet)?; | ||
|
||
let validators = provider.list_validators(&subnet).await?; | ||
|
||
for (addr, info) in validators { | ||
println!("{}: {}", addr, info); | ||
} | ||
Ok(()) | ||
} | ||
} | ||
|
||
#[derive(Debug, Args)] | ||
#[command( | ||
name = "list validators", | ||
about = "List the info of all the validators in the subnet, as viewed by the parent" | ||
)] | ||
pub(crate) struct ListValidatorsArgs { | ||
#[arg(long, help = "The target subnet to perform query")] | ||
pub subnet: String, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters