This repository has been archived by the owner on Jan 11, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
cryptoAtwill
committed
Nov 3, 2023
1 parent
6d69633
commit 2582069
Showing
6 changed files
with
151 additions
and
5 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
// Copyright 2022-2023 Protocol Labs | ||
// SPDX-License-Identifier: MIT | ||
//! Get the validator information | ||
use async_trait::async_trait; | ||
use clap::Args; | ||
use fvm_shared::address::Address; | ||
use ipc_sdk::subnet_id::SubnetID; | ||
use std::fmt::Debug; | ||
use std::str::FromStr; | ||
|
||
use crate::{get_ipc_provider, CommandLineHandler, GlobalArguments}; | ||
|
||
/// The command to get the validator information | ||
pub(crate) struct ValidatorInfo; | ||
|
||
#[async_trait] | ||
impl CommandLineHandler for ValidatorInfo { | ||
type Arguments = ValidatorInfoArgs; | ||
|
||
async fn handle(global: &GlobalArguments, arguments: &Self::Arguments) -> anyhow::Result<()> { | ||
log::debug!("get validator info with args: {:?}", arguments); | ||
|
||
let provider = get_ipc_provider(global)?; | ||
let subnet = SubnetID::from_str(&arguments.subnet)?; | ||
let validator = Address::from_str(&arguments.validator)?; | ||
|
||
let validator_info = provider.get_validator_info(&subnet, &validator).await?; | ||
println!("{}", validator_info); | ||
|
||
Ok(()) | ||
} | ||
} | ||
|
||
#[derive(Debug, Args)] | ||
#[command(name = "validator-info", about = "Get the validator info")] | ||
pub(crate) struct ValidatorInfoArgs { | ||
#[arg(long, short, help = "The subnet id to query validator info")] | ||
pub subnet: String, | ||
#[arg(long, short, help = "The validator address")] | ||
pub validator: 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