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

Download history 100722/week @ 2025-01-11 97180/week @ 2025-01-18 89228/week @ 2025-01-25 99020/week @ 2025-02-01 114092/week @ 2025-02-08 106175/week @ 2025-02-15 95592/week @ 2025-02-22 100068/week @ 2025-03-01 108771/week @ 2025-03-08 121117/week @ 2025-03-15 123461/week @ 2025-03-22 108775/week @ 2025-03-29 122577/week @ 2025-04-05 92559/week @ 2025-04-12 115750/week @ 2025-04-19 97350/week @ 2025-04-26

447,432 downloads per month
Used in 332 crates (31 directly)

MIT/Apache

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 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

~6–9MB
~177K SLoC