47 releases

0.8.21 Feb 10, 2025
0.8.19 Jan 15, 2025
0.8.15 Dec 9, 2024
0.8.14 Nov 28, 2024
0.3.1 Jul 30, 2023

#26 in #ethereum

Download history 52358/week @ 2024-10-28 50745/week @ 2024-11-04 46292/week @ 2024-11-11 54446/week @ 2024-11-18 55303/week @ 2024-11-25 59075/week @ 2024-12-02 76009/week @ 2024-12-09 76995/week @ 2024-12-16 37690/week @ 2024-12-23 48998/week @ 2024-12-30 79753/week @ 2025-01-06 103171/week @ 2025-01-13 96543/week @ 2025-01-20 88497/week @ 2025-01-27 99972/week @ 2025-02-03 116036/week @ 2025-02-10

408,530 downloads per month
Used in 182 crates (27 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
~172K SLoC