#convert #compat #ethereum-types #alloy-primitives

no-std alloy-compat

conversions between ethereum_types and alloy_primitives

3 unstable releases

0.2.0 Nov 7, 2024
0.1.1 Nov 7, 2024
0.1.0 Aug 31, 2024

#13 in #compat

Download history 7/week @ 2025-06-02 84/week @ 2025-06-09 441/week @ 2025-06-16 593/week @ 2025-06-23 10/week @ 2025-06-30 8/week @ 2025-07-07 4/week @ 2025-07-14 1/week @ 2025-08-11 9/week @ 2025-08-18 10/week @ 2025-08-25 8/week @ 2025-09-01 42/week @ 2025-09-08 8/week @ 2025-09-15

70 downloads per month
Used in 2 crates

MIT/Apache

9KB
131 lines

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());

Dependencies

~5.5MB
~105K SLoC