pcli/command/
threshold.rsuse anyhow::Result;
use penumbra_custody::threshold::Terminal;
use crate::{
config::{CustodyConfig, GovernanceCustodyConfig},
terminal::ActualTerminal,
App,
};
#[derive(Debug, clap::Subcommand)]
pub enum ThresholdCmd {
Sign,
}
impl ThresholdCmd {
pub fn offline(&self) -> bool {
match self {
ThresholdCmd::Sign => true,
}
}
#[tracing::instrument(skip(self, app))]
pub async fn exec(&self, app: &mut App) -> Result<()> {
let config = match app.config.custody.clone() {
CustodyConfig::Threshold(config) => Some(config),
CustodyConfig::Encrypted(config) => {
let password = ActualTerminal::default().get_password().await?;
config.convert_to_threshold(&password)?
}
_ => None, };
let governance_config = match &app.config.governance_custody {
Some(GovernanceCustodyConfig::Threshold(governance_config)) => {
Some(governance_config.clone())
}
None => config.clone(), _ => None, };
match self {
ThresholdCmd::Sign => {
penumbra_custody::threshold::follow(
config.as_ref(),
governance_config.as_ref(),
&ActualTerminal::default(),
)
.await
}
}
}
}