Skip to content

Commit

Permalink
refactored view-storage for contract
Browse files Browse the repository at this point in the history
  • Loading branch information
FroVolod committed Mar 4, 2025
1 parent 62129ca commit ea3367e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 4 additions & 0 deletions src/commands/contract/view_storage/output_format/as_json.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ impl AsJsonContext {
if let near_jsonrpc_primitives::types::query::QueryResponseKind::ViewState(result) =
query_view_method_response.kind
{
if let crate::Verbosity::Quiet = previous_context.global_context.verbosity {
println!("Contract state (values):\n{}\n", serde_json::to_string_pretty(&result.values)?);
println!("Contract state (proof):\n{:#?}\n", result.proof)
}
tracing::info!(
parent: &tracing::Span::none(),
"Contract state (values):\n{}\n",
Expand Down
6 changes: 3 additions & 3 deletions src/commands/contract/view_storage/output_format/as_text.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ impl AsTextContext {
{
let mut info_str = String::new();
for value in &result.values {
info_str.push_str(&format!("\nkey: {}", key_value_to_string(&value.key)?.green()));
info_str.push_str(&format!("\nvalue: {}", key_value_to_string(&value.value)?.yellow()));
info_str.push_str("\n--------------------------------");
info_str.push_str(&format!("\n\tkey: {}", key_value_to_string(&value.key)?.green()));
info_str.push_str(&format!("\n\tvalue: {}", key_value_to_string(&value.value)?.yellow()));
info_str.push_str("\n\t--------------------------------");
}
tracing::info!(
parent: &tracing::Span::none(),
Expand Down

0 comments on commit ea3367e

Please sign in to comment.