Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rainlanguage/alloy-ethers-typecast
https://github.com/rainlanguage/alloy-ethers-typecast
Last synced: 26 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/rainlanguage/alloy-ethers-typecast
- Owner: rainlanguage
- Created: 2023-12-31T06:42:43.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-11-30T03:44:41.000Z (2 months ago)
- Last Synced: 2024-11-30T04:25:14.528Z (2 months ago)
- Language: Rust
- Size: 290 KB
- Stars: 1
- Watchers: 1
- Forks: 2
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## 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
```sh
let ethers_address: ethers::types::H160 = ethers::types::H160::random();
let alloy_address: alloy_primitives::Address = ethers_address_to_alloy(ethers_address);
```
```sh
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);
```