Crates.io | alloy-compat |
lib.rs | alloy-compat |
version | 0.2.0 |
source | src |
created_at | 2024-08-31 12:57:52.698683 |
updated_at | 2024-11-07 15:46:30.118313 |
description | conversions between `ethereum_types` and `alloy_primitives` |
homepage | https://crates.io/crates/alloy-compat |
repository | https://github.com/aatifsyed/alloy-compat |
max_upload_size | |
id | 1358810 |
size | 8,133 |
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());