Expand description
§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 calledJsonAbi
and also contains thefallback
andreceive
functions - the
Param
andEventParam
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;
let path = "path/to/abi.json";
let json = std::fs::read_to_string(path).unwrap();
let abi: JsonAbi = serde_json::from_str(&json).unwrap();
for item in abi.items() {
println!("{item:?}");
}
Re-exports§
pub extern crate alloy_sol_type_parser as parser;
Modules§
serde
implementation forStateMutability
for backwards compatibility with older versions of the JSON ABI.
Structs§
- A JSON ABI constructor function.
- Represents a generic contract’s ABI, bytecode and deployed bytecode.
- A JSON ABI error.
- A JSON ABI event.
- A Solidity Event parameter.
- A JSON ABI fallback function.
- A JSON ABI function.
- An iterator over items in an ABI.
- An iterator over immutable references of items in an ABI.
- The JSON contract ABI, as specified in the Solidity ABI spec.
- JSON specification of a parameter.
- A JSON ABI receive function.
- Configuration for
JsonAbi::to_sol
.
Enums§
- A JSON ABI item.
- The contract internal type. This could be a regular Solidity type, a user-defined type, an enum, a struct, a contract, or an address payable.
- A JSON ABI function’s state mutability.