25 unstable releases (5 breaking)

0.7.7 Jul 8, 2024
0.7.4 May 14, 2024
0.7.0 Mar 30, 2024
0.5.4 Dec 28, 2023
0.3.1 Jul 30, 2023

#1220 in Magic Beans

Download history 8346/week @ 2024-03-26 9734/week @ 2024-04-02 9694/week @ 2024-04-09 11357/week @ 2024-04-16 13232/week @ 2024-04-23 15753/week @ 2024-04-30 13276/week @ 2024-05-07 14679/week @ 2024-05-14 12901/week @ 2024-05-21 11829/week @ 2024-05-28 13883/week @ 2024-06-04 14768/week @ 2024-06-11 19125/week @ 2024-06-18 15161/week @ 2024-06-25 16520/week @ 2024-07-02 14976/week @ 2024-07-09

68,956 downloads per month
Used in 53 crates (21 directly)

MIT/Apache

520KB
11K 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 called JsonAbi and also contains the fallback and receive functions
  • the Param and EventParam 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

~4–6.5MB
~133K SLoC