alloy-ethers-typecast 0.2.0

Crate for safe typecasting between ethers and alloy types
Documentation
  • Coverage
  • 85.71%
    6 out of 7 items documented0 out of 6 items with examples
  • Size
  • Source code size: 5.96 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 392.4 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 1m 52s Average build duration of successful builds.
  • all releases: 1m 52s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • Siddharth2207

Crate for Safe Typecasting between Ethers and Alloy types

Currently supporting type conversion for:

  • ethers::types::H160 to alloy_primitives::Address
  • alloy_primitives::Address to ethers::types::H160
  • ethers::types::U256 to alloy_primitives::U256
  • alloy_primitives::U256 to ethers::types::U256
  • ethers::types::Bytes to alloy_primitives::Bytes
  • alloy_primitives::Bytes to ethers::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);