diff --git a/.changelog/unreleased/improvements/3805-better-conversions-logging.md b/.changelog/unreleased/improvements/3805-better-conversions-logging.md new file mode 100644 index 0000000000..38e535ad94 --- /dev/null +++ b/.changelog/unreleased/improvements/3805-better-conversions-logging.md @@ -0,0 +1,2 @@ +- Improve the logging options for querying MASP conversions. + ([\#3805](https://github.com/anoma/namada/pull/3805)) \ No newline at end of file diff --git a/crates/apps_lib/src/cli.rs b/crates/apps_lib/src/cli.rs index b0c4578a6f..57d0aeeea6 100644 --- a/crates/apps_lib/src/cli.rs +++ b/crates/apps_lib/src/cli.rs @@ -3364,6 +3364,7 @@ pub mod args { pub const DRY_RUN_TX: ArgFlag = flag("dry-run"); pub const DRY_RUN_WRAPPER_TX: ArgFlag = flag("dry-run-wrapper"); pub const DUMP_TX: ArgFlag = flag("dump-tx"); + pub const DUMP_CONVERSION_TREE: ArgFlag = flag("dump-conversion-tree"); pub const EPOCH: ArgOpt = arg_opt("epoch"); pub const ERC20: Arg = arg("erc20"); pub const ETH_CONFIRMATIONS: Arg = arg("confirmations"); @@ -4960,7 +4961,8 @@ pub mod args { produce the signature." ))) .arg(RECEIVER.def().help(wrap!( - "The receiver address on the destination chain as string." + "The receiver address on the destination chain as a \ + string." ))) .arg(TOKEN.def().help(wrap!("The transfer token."))) .arg( @@ -4979,13 +4981,14 @@ pub mod args { .help(wrap!("The timeout as seconds.")), ) .arg(REFUND_TARGET.def().help(wrap!( - "The refund target address when IBC shielded transfer \ - failure." + "The refund target address to use if the IBC shielded \ + transfer fails." ))) .arg(IBC_SHIELDING_DATA_PATH.def().help(wrap!( - "The file path of the IBC shielding data for the \ - destination Namada. This can't be set with --ibc-memo at \ - the same time." + "Used only when shielding over IBC from one instance of \ + the Namada blockchain to another. The file path of the \ + IBC shielding data for the destination Namada chain. \ + This can't be set with --ibc-memo at the same time." ))) .arg( IBC_MEMO @@ -6135,6 +6138,7 @@ pub mod args { query: self.query.to_sdk(ctx)?, token: self.token.map(|x| ctx.borrow_chain_or_exit().get(&x)), epoch: self.epoch, + dump_tree: self.dump_tree, }) } } @@ -6144,10 +6148,12 @@ pub mod args { let query = Query::parse(matches); let token = TOKEN_OPT.parse(matches); let epoch = MASP_EPOCH.parse(matches); + let dump_tree = DUMP_CONVERSION_TREE.parse(matches); Self { query, epoch, token, + dump_tree, } } @@ -6159,6 +6165,9 @@ pub mod args { .arg(TOKEN_OPT.def().help(wrap!( "The token address for which to query conversions." ))) + .arg(DUMP_CONVERSION_TREE.def().help(wrap!( + "Dumps the full conversion tree if the flag is set." + ))) } } diff --git a/crates/apps_lib/src/client/rpc.rs b/crates/apps_lib/src/client/rpc.rs index ca4a7fdfc2..5f0cb7f48c 100644 --- a/crates/apps_lib/src/client/rpc.rs +++ b/crates/apps_lib/src/client/rpc.rs @@ -1885,7 +1885,7 @@ pub async fn query_conversions( let total_rewards = rpc::query_masp_total_rewards(context.client()) .await .expect("MASP total rewards should be present"); - display!( + display_line!( context.io(), "Total rewards of native token minted for shielded pool: {}", total_rewards.to_string_native() @@ -1900,6 +1900,11 @@ pub async fn query_conversions( let conversions = rpc::query_conversions(context.client()) .await .expect("Conversions should be defined"); + + if args.dump_tree { + display_line!(context.io(), "Conversions: {conversions:?}"); + } + // Track whether any non-sentinel conversions are found let mut conversions_found = false; for (addr, _denom, digit, epoch, amt) in conversions.values() { @@ -1945,7 +1950,7 @@ pub async fn query_conversions( if !conversions_found { display_line!( context.io(), - "No conversions found satisfying specified criteria." + "\nNo conversions found satisfying specified criteria." ); } } diff --git a/crates/sdk/src/args.rs b/crates/sdk/src/args.rs index fce5205935..0a71c488ad 100644 --- a/crates/sdk/src/args.rs +++ b/crates/sdk/src/args.rs @@ -1587,6 +1587,8 @@ pub struct QueryConversions { pub token: Option, /// Epoch of the asset pub epoch: Option, + /// Flag to dump the conversion tree + pub dump_tree: bool, } /// Query token balance(s)