diff --git a/src/commands/contract/call_function/as_read_only/mod.rs b/src/commands/contract/call_function/as_read_only/mod.rs index c0309b783..81bac8163 100644 --- a/src/commands/contract/call_function/as_read_only/mod.rs +++ b/src/commands/contract/call_function/as_read_only/mod.rs @@ -77,7 +77,15 @@ impl FunctionContext { let function_name = scope.function_name.clone(); move |network_config, block_reference| { - call_view_function(network_config, &account_id, &function_name, function_args.clone(), function_args_type.clone(), block_reference) + call_view_function( + network_config, + &account_id, + &function_name, + function_args.clone(), + function_args_type.clone(), + block_reference, + &previous_context.global_context.verbosity, + ) } }); @@ -117,6 +125,7 @@ fn call_view_function( function_args: String, function_args_type: super::call_function_args_type::FunctionArgsType, block_reference: &near_primitives::types::BlockReference, + verbosity: &crate::Verbosity, ) -> crate::CliResult { let args = super::call_function_args_type::function_args(function_args, function_args_type)?; let call_result = network_config @@ -142,10 +151,14 @@ fn call_view_function( } else { info_str.push_str("\nThe returned value is not printable (binary data)"); } + + if let crate::Verbosity::Quiet = verbosity { + println!("{}", info_str); + }; info_str.push_str("\n------------------------------------"); tracing::info!( parent: &tracing::Span::none(), - "--- Result -------------------------{}\n", + "--- Result -------------------------\n{}", crate::common::indent_payload(&info_str) ); Ok(()) diff --git a/src/commands/transaction/send_signed_transaction/mod.rs b/src/commands/transaction/send_signed_transaction/mod.rs index 6bf62acc1..7c463982f 100644 --- a/src/commands/transaction/send_signed_transaction/mod.rs +++ b/src/commands/transaction/send_signed_transaction/mod.rs @@ -30,7 +30,7 @@ pub enum SignedTransactionType { #[derive(Debug, Clone)] pub struct SignedTransactionContext { - config: crate::config::Config, + global_context: crate::GlobalContext, signed_transaction: near_primitives::transaction::SignedTransaction, } @@ -54,7 +54,7 @@ impl Base64SignedTransactionContext { scope: &::InteractiveClapContextScope, ) -> color_eyre::eyre::Result { Ok(Self(SignedTransactionContext { - config: previous_context.config, + global_context: previous_context, signed_transaction: scope.signed_action.inner.clone(), })) } @@ -99,7 +99,7 @@ impl FileWithBase64SignedTransactionContext { .signed_transaction; Ok(Self(SignedTransactionContext { - config: previous_context.config, + global_context: previous_context, signed_transaction, })) } diff --git a/src/commands/transaction/send_signed_transaction/network/mod.rs b/src/commands/transaction/send_signed_transaction/network/mod.rs index 7920f4674..71d7abd2e 100644 --- a/src/commands/transaction/send_signed_transaction/network/mod.rs +++ b/src/commands/transaction/send_signed_transaction/network/mod.rs @@ -14,6 +14,7 @@ pub struct Network { #[derive(Debug, Clone)] pub struct NetworkContext { + global_context: crate::GlobalContext, signed_transaction: near_primitives::transaction::SignedTransaction, network_config: crate::config::NetworkConfig, } @@ -24,6 +25,7 @@ impl NetworkContext { scope: &::InteractiveClapContextScope, ) -> color_eyre::eyre::Result { let network_config = previous_context + .global_context .config .network_connection .get(&scope.network_name) @@ -31,6 +33,7 @@ impl NetworkContext { .clone(); Ok(Self { + global_context: previous_context.global_context, signed_transaction: previous_context.signed_transaction, network_config, }) @@ -42,7 +45,7 @@ impl Network { context: &super::SignedTransactionContext, ) -> color_eyre::eyre::Result> { crate::common::input_network_name( - &context.config, + &context.global_context.config, &[context.signed_transaction.transaction.receiver_id().clone()], ) } @@ -73,6 +76,10 @@ impl SubmitContext { &previous_context.signed_transaction, )?; - crate::common::print_transaction_status(&transaction_info, &previous_context.network_config) + crate::common::print_transaction_status( + &transaction_info, + &previous_context.network_config, + &previous_context.global_context.verbosity, + ) } } diff --git a/src/transaction_signature_options/send/mod.rs b/src/transaction_signature_options/send/mod.rs index 43effa9ca..feef9ce3b 100644 --- a/src/transaction_signature_options/send/mod.rs +++ b/src/transaction_signature_options/send/mod.rs @@ -35,6 +35,7 @@ impl SendContext { crate::common::print_transaction_status( &transaction_info, &previous_context.network_config, + &previous_context.global_context.verbosity, )?; (previous_context.on_after_sending_transaction_callback)(