3 unstable releases
0.2.0 | Nov 7, 2024 |
---|---|
0.1.1 | Nov 7, 2024 |
0.1.0 | Aug 31, 2024 |
#530 in Magic Beans
1,300 downloads per month
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());
lib.rs
:
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
~100K SLoC