2 unstable releases
0.2.0 | Jan 1, 2024 |
---|---|
0.1.0 | Jan 1, 2024 |
#6 in #u256
559 downloads per month
Used in 2 crates
6KB
79 lines
Crate for Safe Typecasting between Ethers and Alloy types
Currently supporting type conversion for:
ethers::types::H160
toalloy_primitives::Address
alloy_primitives::Address
toethers::types::H160
ethers::types::U256
toalloy_primitives::U256
alloy_primitives::U256
toethers::types::U256
ethers::types::Bytes
toalloy_primitives::Bytes
alloy_primitives::Bytes
toethers::types::Bytes
Example
let ethers_address: ethers::types::H160 = ethers::types::H160::random();
let alloy_address: alloy_primitives::Address = ethers_address_to_alloy(ethers_address);
let ethers_u256: ethers::types::U256 = ethers::types::U256::from_dec_str("126731272983");
let alloy_u256: alloy_primitives::U256 = ethers_u256_to_alloy(ethers_u256);
Dependencies
~27–44MB
~817K SLoC