Skip to content

Commit a9a6825

Browse files
[cli][cherry-pick] Cherry pick cli fix ptb output (#25592)
## Description This fixes the output for the `sui client ptb` to match what we used to have before the gRPC migration. ## Test plan Manually, locally via a few transactions with these flags. ``` --dry-run --summary --preview --json ``` --- ## Release notes Check each box that your changes affect. If none of the boxes relate to your changes, release notes aren't required. For each box you select, include information after the relevant heading that describes the impact of your changes that a user might notice and any actions they must take to implement updates. - [ ] Protocol: - [ ] Nodes (Validators and Full nodes): - [ ] gRPC: - [ ] JSON-RPC: - [ ] GraphQL: - [x] CLI: Fixed a bug to re-enable pretty printing of `sui client ptb` output. - [ ] Rust SDK: - [ ] Indexing Framework:
1 parent ee98574 commit a9a6825

File tree

1 file changed

+4
-3
lines changed
  • crates/sui/src/client_ptb

1 file changed

+4
-3
lines changed

crates/sui/src/client_ptb/ptb.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -268,19 +268,20 @@ impl PTB {
268268
}
269269
};
270270

271+
let command_result = SuiClientCommandResult::TransactionBlock(transaction_response);
272+
271273
if program_metadata.json_set {
272274
let json_string = if program_metadata.summary_set {
273275
serde_json::to_string_pretty(&serde_json::json!(summary))
274276
.map_err(|_| anyhow!("Cannot serialize PTB result to json"))?
275277
} else {
276-
serde_json::to_string_pretty(&serde_json::json!(transaction_response))
277-
.map_err(|_| anyhow!("Cannot serialize PTB result to json"))?
278+
format!("{:?}", command_result)
278279
};
279280
println!("{}", json_string);
280281
} else if program_metadata.summary_set {
281282
println!("{}", Pretty(&summary));
282283
} else {
283-
println!("{}", serde_json::to_string_pretty(&transaction_response)?);
284+
println!("{}", command_result);
284285
}
285286

286287
Ok(())

0 commit comments

Comments
 (0)