Skip to content

Commit

Permalink
fix: add back commented out CLI commands
Browse files Browse the repository at this point in the history
  • Loading branch information
qti3e committed May 7, 2024
1 parent c5398a7 commit 57df704
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
11 changes: 7 additions & 4 deletions core/cli/src/commands/keys.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,15 @@ use resolved_pathbuf::ResolvedPathBuf;
use crate::args::KeySubCmd;

pub async fn exec<C: Collection>(cmd: KeySubCmd, config_path: ResolvedPathBuf) -> Result<()> {
let provider = TomlConfigProvider::<C>::load_or_write_config(config_path).await?;
let config = provider.get::<C::KeystoreInterface>();
let config_provider = TomlConfigProvider::<C>::load_or_write_config(config_path).await?;
let config = config_provider.get::<C::KeystoreInterface>();

match cmd {
KeySubCmd::Generate => C::KeystoreInterface::generate_keys(config, false),
// KeySubCmd::Show => C::KeystoreInterface::init(config).map(|_| ()),
_ => todo!(),
KeySubCmd::Show => {
let mut provider = fdi::Provider::default().with(config_provider);
let mut g = C::build_graph();
g.init_one::<C::KeystoreInterface>(&mut provider)
},
}
}
14 changes: 7 additions & 7 deletions core/cli/src/commands/opt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -232,13 +232,13 @@ async fn get_epoch_end_delta(
async fn load_secret_key<C: Collection>(
config_path: ResolvedPathBuf,
) -> Result<(NodePublicKey, NodeSecretKey)> {
let provider = TomlConfigProvider::<C>::load_or_write_config(config_path).await?;
let _config = provider.get::<C::KeystoreInterface>();
todo!()
// C::KeystoreInterface::init(config).map(|keystore| {
// let sk = keystore.get_ed25519_sk();
// (sk.to_pk(), sk)
// })
let config_provider = TomlConfigProvider::<C>::load_or_write_config(config_path).await;
let mut provider = fdi::Provider::default().with(config_provider);
let mut g = C::build_graph();
g.init_one::<C::KeystoreInterface>(&mut provider)?;
let keystore = provider.get::<C::KeystoreInterface>();
let sk = keystore.get_ed25519_sk();
Ok((sk.to_pk(), sk))
}

fn create_update_request(
Expand Down

0 comments on commit 57df704

Please sign in to comment.