File tree Expand file tree Collapse file tree 11 files changed +820
-229
lines changed
Expand file tree Collapse file tree 11 files changed +820
-229
lines changed Original file line number Diff line number Diff line change 1- mod cli;
2-
31use color_eyre:: eyre:: Result ;
4- use namada_apps:: logging;
2+ use namada_apps:: cli:: api:: CliApi ;
3+ use namada_apps:: facade:: tendermint_rpc:: HttpClient ;
4+ use namada_apps:: { cli, logging} ;
55use tracing_subscriber:: filter:: LevelFilter ;
66
77#[ tokio:: main]
@@ -13,5 +13,9 @@ async fn main() -> Result<()> {
1313 let _log_guard = logging:: init_from_env_or ( LevelFilter :: INFO ) ?;
1414
1515 // run the CLI
16- cli:: main ( ) . await
16+ CliApi :: < ( ) > :: handle_client_command :: < HttpClient > (
17+ None ,
18+ cli:: namada_client_cli ( ) ?,
19+ )
20+ . await
1721}
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1- mod cli;
2-
31use color_eyre:: eyre:: Result ;
4- use namada_apps:: logging;
2+ use namada:: tendermint_rpc:: HttpClient ;
3+ use namada_apps:: cli:: api:: CliApi ;
4+ use namada_apps:: { cli, logging} ;
55use tracing_subscriber:: filter:: LevelFilter ;
66
77#[ tokio:: main]
@@ -12,6 +12,7 @@ async fn main() -> Result<()> {
1212 // init logging
1313 logging:: init_from_env_or ( LevelFilter :: INFO ) ?;
1414
15+ let ( cmd, _) = cli:: namada_relayer_cli ( ) ?;
1516 // run the CLI
16- cli :: main ( ) . await
17+ CliApi :: < ( ) > :: handle_relayer_command :: < HttpClient > ( None , cmd ) . await
1718}
Original file line number Diff line number Diff line change 1- mod cli;
21use color_eyre:: eyre:: Result ;
2+ use namada_apps:: cli;
3+ use namada_apps:: cli:: api:: CliApi ;
34
45pub fn main ( ) -> Result < ( ) > {
56 color_eyre:: install ( ) ?;
6-
7+ let ( cmd , ctx ) = cli :: namada_wallet_cli ( ) ? ;
78 // run the CLI
8- cli :: main ( )
9+ CliApi :: < ( ) > :: handle_wallet_command ( cmd , ctx )
910}
Original file line number Diff line number Diff line change 66//! client can be dispatched via `namada node ...` or `namada client ...`,
77//! respectively.
88
9+ pub mod api;
10+ pub mod client;
911pub mod context;
12+ pub mod relayer;
1013mod utils;
14+ pub mod wallet;
1115
1216use clap:: { ArgGroup , ArgMatches , ColorChoice } ;
1317use color_eyre:: eyre:: Result ;
Original file line number Diff line number Diff line change 1+ use std:: marker:: PhantomData ;
2+
3+ use namada:: ledger:: queries:: Client ;
4+ use namada:: ledger:: rpc:: wait_until_node_is_synched;
5+ use namada:: tendermint_rpc:: HttpClient ;
6+ use namada:: types:: control_flow:: Halt ;
7+ use tendermint_config:: net:: Address as TendermintAddress ;
8+
9+ use crate :: client:: utils;
10+
11+ /// Trait for clients that can be used with the CLI.
12+ #[ async_trait:: async_trait( ?Send ) ]
13+ pub trait CliClient : Client + Sync {
14+ fn from_tendermint_address ( address : & mut TendermintAddress ) -> Self ;
15+ async fn wait_until_node_is_synced ( & self ) -> Halt < ( ) > ;
16+ }
17+
18+ #[ async_trait:: async_trait( ?Send ) ]
19+ impl CliClient for HttpClient {
20+ fn from_tendermint_address ( address : & mut TendermintAddress ) -> Self {
21+ HttpClient :: new ( utils:: take_config_address ( address) ) . unwrap ( )
22+ }
23+
24+ async fn wait_until_node_is_synced ( & self ) -> Halt < ( ) > {
25+ wait_until_node_is_synched ( self ) . await
26+ }
27+ }
28+
29+ pub struct CliApi < IO > ( PhantomData < IO > ) ;
You can’t perform that action at this time.
0 commit comments