-
Notifications
You must be signed in to change notification settings - Fork 977
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'bat/feature/refactor-cli' (#1738)
* origin/bat/feature/refactor-cli: channgelog: add #1738 [feat]: Moved cli commands common to testing, cli, and sdk out into apps
- Loading branch information
Showing
11 changed files
with
821 additions
and
228 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
- Refactored CLI into libraries for future re-use in integration tests and | ||
to enable generic IO. ([\#1738](https://github.com/anoma/namada/pull/1738)) |
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 was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,9 +1,10 @@ | ||
mod cli; | ||
use color_eyre::eyre::Result; | ||
use namada_apps::cli; | ||
use namada_apps::cli::api::CliApi; | ||
|
||
pub fn main() -> Result<()> { | ||
color_eyre::install()?; | ||
|
||
let (cmd, ctx) = cli::namada_wallet_cli()?; | ||
// run the CLI | ||
cli::main() | ||
CliApi::<()>::handle_wallet_command(cmd, ctx) | ||
} |
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,29 @@ | ||
use std::marker::PhantomData; | ||
|
||
use namada::ledger::queries::Client; | ||
use namada::ledger::rpc::wait_until_node_is_synched; | ||
use namada::tendermint_rpc::HttpClient; | ||
use namada::types::control_flow::Halt; | ||
use tendermint_config::net::Address as TendermintAddress; | ||
|
||
use crate::client::utils; | ||
|
||
/// Trait for clients that can be used with the CLI. | ||
#[async_trait::async_trait(?Send)] | ||
pub trait CliClient: Client + Sync { | ||
fn from_tendermint_address(address: &mut TendermintAddress) -> Self; | ||
async fn wait_until_node_is_synced(&self) -> Halt<()>; | ||
} | ||
|
||
#[async_trait::async_trait(?Send)] | ||
impl CliClient for HttpClient { | ||
fn from_tendermint_address(address: &mut TendermintAddress) -> Self { | ||
HttpClient::new(utils::take_config_address(address)).unwrap() | ||
} | ||
|
||
async fn wait_until_node_is_synced(&self) -> Halt<()> { | ||
wait_until_node_is_synched(self).await | ||
} | ||
} | ||
|
||
pub struct CliApi<IO>(PhantomData<IO>); |
Oops, something went wrong.