50 releases

new 0.8.24 Mar 21, 2025
0.8.22 Feb 27, 2025
0.8.15 Dec 9, 2024
0.8.14 Nov 28, 2024
0.3.1 Jul 30, 2023

#132 in Magic Beans

Download history 58973/week @ 2024-12-01 75668/week @ 2024-12-08 77019/week @ 2024-12-15 36934/week @ 2024-12-22 48899/week @ 2024-12-29 80139/week @ 2025-01-05 100336/week @ 2025-01-12 98378/week @ 2025-01-19 89869/week @ 2025-01-26 99151/week @ 2025-02-02 115146/week @ 2025-02-09 104362/week @ 2025-02-16 95255/week @ 2025-02-23 99884/week @ 2025-03-02 110916/week @ 2025-03-09 113998/week @ 2025-03-16

425,625 downloads per month
Used in 235 crates (27 directly)

MIT/Apache

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

~5.5–8.5MB
~171K SLoC