Struct ethane_abi::Abi[][src]

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

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]

fn default() -> Self[src]

Returns the “default value” for a type. Read more

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]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

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

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

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

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

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

pub fn from(t: T) -> T[src]

Performs the conversion.

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

pub fn into(self) -> U[src]

Performs the conversion.

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.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

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.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.