45 releases

new 0.8.19 Jan 15, 2025
0.8.15 Dec 9, 2024
0.8.14 Nov 28, 2024
0.7.7 Jul 8, 2024
0.3.1 Jul 30, 2023

#28 in #ethereum

Download history 33554/week @ 2024-09-26 46358/week @ 2024-10-03 51484/week @ 2024-10-10 52549/week @ 2024-10-17 55236/week @ 2024-10-24 47064/week @ 2024-10-31 50827/week @ 2024-11-07 50050/week @ 2024-11-14 54700/week @ 2024-11-21 58513/week @ 2024-11-28 63118/week @ 2024-12-05 79561/week @ 2024-12-12 55305/week @ 2024-12-19 37252/week @ 2024-12-26 72897/week @ 2025-01-02 92249/week @ 2025-01-09

275,514 downloads per month
Used in 167 crates (26 directly)

MIT/Apache

585KB
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
~160K SLoC