Skip to main content

parse_trx

Function parse_trx 

Source
pub fn parse_trx(s: &str) -> Result<Trx, AmountError>
Expand description

Parse a decimal TRX string into a Trx amount.

Free-function alias for str::parse::<Trx>(), mirroring alloy’s parse_ether for callers who prefer that style.

use tronz_primitives::parse_trx;

assert_eq!(parse_trx("1.5").unwrap().as_sun(), 1_500_000);