Struct ethane_abi::Abi [−][src]
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]
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]
&self,
function_name: &str
) -> Option<StateMutability>
pub fn encode(
&self,
function_name: &str,
parameters: Vec<Parameter>
) -> Result<Vec<u8>, AbiParserError>
[src]
&self,
function_name: &str,
parameters: Vec<Parameter>
) -> Result<Vec<u8>, AbiParserError>
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]
&self,
function_name: &str,
hash: &[u8]
) -> Result<Vec<Parameter>, AbiParserError>
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
Auto Trait Implementations
impl RefUnwindSafe for Abi
impl RefUnwindSafe for Abi
impl UnwindSafe for Abi
impl UnwindSafe for Abi