diff --git a/crates/apps_lib/src/cli.rs b/crates/apps_lib/src/cli.rs index b0c4578a6f..bc48cb09e2 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"); @@ -6135,6 +6136,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 +6146,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 +6163,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)