Struct ethane_abi::Abi[][src]

pub struct Abi {
    pub functions: HashMap<String, Function>,
}

Parses a .json file containing ABI encoded Solidity functions.

It stores the functions in a HashMap with the function name being the key and the parsed function the value.

Fields

functions: HashMap<String, Function>

Implementations

impl Abi[src]

pub fn new() -> Self[src]

Creates a new Abi instance with an empty HashMap within.

pub fn parse_json(&mut self, abi: Value) -> Result<(), AbiParserError>[src]

Parses an ABI value into the Abi instance.

pub fn parse_file(&mut self, path_to_abi: &Path) -> Result<(), AbiParserError>[src]

Parses an ABI .json file into the Abi instance.

pub fn get_state_mutability(
    &self,
    function_name: &str
) -> Option<StateMutability>
[src]

pub fn encode(
    &self,
    function_name: &str,
    parameters: Vec<Parameter>
) -> Result<Vec<u8>, AbiParserError>
[src]

Encodes a function call according to Solidity’s contract ABI specification.

If the given function is found in the parsed ABI file, the function encodes the function signature and the input data provided in the form of a Parameter vector.

pub fn decode(
    &self,
    function_name: &str,
    hash: &[u8]
) -> Result<Vec<Parameter>, AbiParserError>
[src]

Decodes a hash into a Parameter vector.

Based on the given ABI function name, the Abi parser iterates over that function’s output parameter types and decodes the output hash accordingly.

Trait Implementations

impl Default for Abi[src]

Auto Trait Implementations

impl RefUnwindSafe for Abi

impl Send for Abi

impl Sync for Abi

impl Unpin for Abi

impl UnwindSafe for Abi

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.