24 releases (5 breaking)

new 0.7.6 Jun 10, 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

#1164 in Magic Beans

Download history 8415/week @ 2024-02-22 8554/week @ 2024-02-29 9394/week @ 2024-03-07 11600/week @ 2024-03-14 8114/week @ 2024-03-21 8830/week @ 2024-03-28 9814/week @ 2024-04-04 10209/week @ 2024-04-11 11873/week @ 2024-04-18 13174/week @ 2024-04-25 15785/week @ 2024-05-02 13750/week @ 2024-05-09 14641/week @ 2024-05-16 12255/week @ 2024-05-23 12420/week @ 2024-05-30 11691/week @ 2024-06-06

53,196 downloads per month
Used in 36 crates (18 directly)

MIT/Apache

515KB
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
~134K SLoC