Crate linera_alloy_json_abi

Source
Expand description

§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;

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 linera_alloy_sol_type_parser as parser;

Modules§

serde_state_mutability_compat
serde implementation for StateMutability for backwards compatibility with older versions of the JSON ABI.

Structs§

Constructor
A JSON ABI constructor function.
ContractObject
Represents a generic contract’s ABI, bytecode and deployed bytecode.
Error
A JSON ABI error.
Event
A JSON ABI event.
EventParam
A Solidity Event parameter.
Fallback
A JSON ABI fallback function.
Function
A JSON ABI function.
IntoItems
An iterator over items in an ABI.
Items
An iterator over immutable references of items in an ABI.
JsonAbi
The JSON contract ABI, as specified in the Solidity ABI spec.
Param
JSON specification of a parameter.
Receive
A JSON ABI receive function.
ToSolConfig
Configuration for JsonAbi::to_sol.

Enums§

AbiItem
A JSON ABI item.
InternalType
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.
StateMutability
A JSON ABI function’s state mutability.