rpc: fix address formatting in TransactionRequest Display (#8786)
* rpc: fix address formatting in TransactionRequest Display * rpc: use unwrap_or_else when no to address provided
This commit is contained in:
parent
e2a90ce159
commit
b3ea766bd5
@ -69,14 +69,20 @@ impl fmt::Display for TransactionRequest {
|
||||
f,
|
||||
"{} ETH from {} to 0x{:?}",
|
||||
Colour::White.bold().paint(format_ether(eth)),
|
||||
Colour::White.bold().paint(format!("0x{:?}", self.from)),
|
||||
Colour::White.bold().paint(
|
||||
self.from.as_ref()
|
||||
.map(|f| format!("0x{:?}", f))
|
||||
.unwrap_or_else(|| "?".to_string())),
|
||||
to
|
||||
),
|
||||
None => write!(
|
||||
f,
|
||||
"{} ETH from {} for contract creation",
|
||||
Colour::White.bold().paint(format_ether(eth)),
|
||||
Colour::White.bold().paint(format!("0x{:?}", self.from)),
|
||||
Colour::White.bold().paint(
|
||||
self.from.as_ref()
|
||||
.map(|f| format!("0x{:?}", f))
|
||||
.unwrap_or_else(|| "?".to_string())),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user