54 releases (2 stable)
new 1.1.0 | Apr 30, 2025 |
---|---|
1.0.0-rc.1 | Mar 26, 2025 |
0.8.25 | Mar 26, 2025 |
0.8.15 | Dec 9, 2024 |
0.3.1 | Jul 30, 2023 |
#445 in Magic Beans
447,432 downloads per month
Used in 332 crates
(31 directly)
575KB
12K
SLoC
alloy-json-abi
Full Ethereum JSON-ABI implementation.
This crate is a re-implementation of a part of ethabi's API, with a few main differences:
- the
Contract
struct is now calledJsonAbi
and also contains thefallback
andreceive
functions - the
Param
andEventParam
structs only partially parse the type string instead of fully resolving it into a Solidity type
Examples
Parse a JSON ABI file into a JsonAbi
struct:
use alloy_json_abi::JsonAbi;
# stringify!(
let path = "path/to/abi.json";
let json = std::fs::read_to_string(path).unwrap();
# );
# let json = "[]";
let abi: JsonAbi = serde_json::from_str(&json).unwrap();
for item in abi.items() {
println!("{item:?}");
}
Dependencies
~6–9MB
~177K SLoC