Function ethers_core::utils::parse_ether
source · pub fn parse_ether<S: ToString>(eth: S) -> Result<U256, ConversionError>
Expand description
Converts the input to a U256 and converts from Ether to Wei.
use ethers_core::{types::U256, utils::{parse_ether, WEI_IN_ETHER}};
let eth = U256::from(WEI_IN_ETHER);
assert_eq!(eth, parse_ether(1u8).unwrap());
assert_eq!(eth, parse_ether(1usize).unwrap());
assert_eq!(eth, parse_ether("1").unwrap());