1 unstable release

0.7.4 May 30, 2024

#38 in #parse-json

Download history 37/week @ 2024-06-20 48/week @ 2024-06-27 36/week @ 2024-07-04 79/week @ 2024-07-11 77/week @ 2024-07-18 112/week @ 2024-07-25 67/week @ 2024-08-01 125/week @ 2024-08-08 138/week @ 2024-08-15 92/week @ 2024-08-22 155/week @ 2024-08-29 248/week @ 2024-09-05 246/week @ 2024-09-12 345/week @ 2024-09-19 231/week @ 2024-09-26 173/week @ 2024-10-03

1,053 downloads per month
Used in 17 crates (6 directly)

MIT/Apache

510KB
11K SLoC

linera-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 linera_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.5–7.5MB
~143K SLoC