alloy-compat

Crates.ioalloy-compat
lib.rsalloy-compat
version0.2.0
sourcesrc
created_at2024-08-31 12:57:52.698683
updated_at2024-11-07 15:46:30.118313
descriptionconversions between `ethereum_types` and `alloy_primitives`
homepagehttps://crates.io/crates/alloy-compat
repositoryhttps://github.com/aatifsyed/alloy-compat
max_upload_size
id1358810
size8,133
Robin Salen (Nashtare)

documentation

https://docs.rs/alloy-compat

README

Conversions between [ethereum_types] and [alloy_primitives].

use alloy_compat::Compat as _;

// from alloy to ethereum_types
let address = alloy::address!("deadbeefdeadbeefdeadbeefdeadbeef00000000");
let _: eth::Address = address.compat();

// from ethereum_types to alloy
let hash = eth::H256::zero();
let _: alloy::B256 = hash.compat();

// integers are supported
let int = eth::U128::MAX;
assert_eq!(alloy::U128::MAX, int.compat());
Commit count: 10

cargo fmt