alloy_primitives::utils

Function format_ether

Source
pub fn format_ether<T: Into<ParseUnits>>(amount: T) -> String
Expand description

Formats the given number of Wei as an Ether amount.

ยงExamples

use alloy_primitives::{utils::format_ether, U256};

let eth = format_ether(1395633240123456000_u128);
assert_eq!(format_ether(1395633240123456000_u128), "1.395633240123456000");