19 releases (5 breaking)

new 0.7.1 Apr 23, 2024
0.7.0 Mar 30, 2024
0.6.4 Feb 29, 2024
0.5.4 Dec 28, 2023
0.3.1 Jul 30, 2023

#1063 in Magic Beans

Download history 3804/week @ 2024-01-02 5224/week @ 2024-01-09 6135/week @ 2024-01-16 6848/week @ 2024-01-23 7595/week @ 2024-01-30 8147/week @ 2024-02-06 9605/week @ 2024-02-13 8330/week @ 2024-02-20 8568/week @ 2024-02-27 8939/week @ 2024-03-05 10832/week @ 2024-03-12 9557/week @ 2024-03-19 8346/week @ 2024-03-26 9734/week @ 2024-04-02 9694/week @ 2024-04-09 9288/week @ 2024-04-16

38,503 downloads per month
Used in 26 crates (14 directly)

MIT/Apache

505KB
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
~135K SLoC