1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
use Deserialize;
/// Struct representing a function from an ABI (Application Binary Interface).
///
/// # Fields
/// - `name`: The name of the function.
/// - `inputs`: A list of input parameter types for the function.
/// - `outputs`: A list of output parameter types for the function.
/// - `payable`: Indicates whether the function accepts Ether.
/// - `constant`: Indicates whether the function is constant (i.e., does not change state).
/// Parses the given ABI JSON string and returns a vector of `AbiFunction`.
///
/// # Arguments
/// * `abi_json`: A string slice representing the ABI in JSON format.
///
/// # Returns
/// `Result<Vec<AbiFunction>, String>` - A result containing either a vector of parsed functions or an error message.
///
/// # Errors
/// - If the provided JSON is empty, it returns an error.
/// - If the JSON is invalid, it returns a detailed parsing error.