diff --git a/crates/common/src/fmt/ui.rs b/crates/common/src/fmt/ui.rs index 5549f36abc5fb..3c0220bcd42c3 100644 --- a/crates/common/src/fmt/ui.rs +++ b/crates/common/src/fmt/ui.rs @@ -173,7 +173,7 @@ type {}", serde_json::to_string(logs).unwrap(), logs_bloom.pretty(), root.pretty(), - status.pretty(), + status.map(pretty_status).unwrap_or_else(|| status.pretty()), transaction_hash.pretty(), transaction_index.pretty(), transaction_type.pretty() @@ -374,6 +374,14 @@ pub fn to_bytes(uint: ethers_core::types::U256) -> [u8; 32] { buffer } +pub fn pretty_status(status: ethers_core::types::U64) -> String { + match status { + ethers_core::types::U64([0]) => "0 (failed)".to_string(), + ethers_core::types::U64([1]) => "1 (success)".to_string(), + _ => status.pretty(), + } +} + /// Returns the `UiFmt::pretty()` formatted attribute of the transactions pub fn get_pretty_tx_attr(transaction: &Transaction, attr: &str) -> Option { match attr { @@ -419,7 +427,7 @@ pub fn get_pretty_tx_receipt_attr( "logs" => Some(receipt.receipt.logs.pretty()), "logsBloom" | "logs_bloom" => Some(receipt.receipt.logs_bloom.pretty()), "root" => Some(receipt.receipt.root.pretty()), - "status" => Some(receipt.receipt.status.pretty()), + "status" => receipt.receipt.status.map(pretty_status), "transactionHash" | "transaction_hash" => Some(receipt.receipt.transaction_hash.pretty()), "transactionIndex" | "transaction_index" => { Some(receipt.receipt.transaction_index.pretty())