numbat_wasm_debug/
display_util.rs1use alloc::string::String;
2use numbat_wasm::types::Address;
3
4pub fn address_hex(address: &Address) -> String {
5 alloc::format!("0x{}", hex::encode(address.as_bytes()))
6}
7
8pub fn key_hex(key: &[u8]) -> String {
9 alloc::format!("0x{}", hex::encode(key))
10}
11
12pub fn verbose_hex(value: &[u8]) -> String {
13 alloc::format!("0x{}", hex::encode(value))
14}
15
16pub fn bytes_to_string(bytes: &[u8]) -> String {
18 String::from_utf8(bytes.to_vec()).unwrap_or_else(|_| verbose_hex(bytes))
19}