fireblocks_sdk/models/
abi_function.rs

1// Fireblocks API
2//
3// Fireblocks provides a suite of applications to manage digital asset operations and a complete development platform to build your business on the blockchain.  - Visit our website for more information: [Fireblocks Website](https://fireblocks.com) - Visit our developer docs: [Fireblocks DevPortal](https://developers.fireblocks.com)
4//
5// The version of the OpenAPI document: 1.8.0
6// Contact: developers@fireblocks.com
7// Generated by: https://openapi-generator.tech
8
9use {
10    crate::models,
11    serde::{Deserialize, Serialize},
12};
13
14#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
15pub struct AbiFunction {
16    /// The name of the contract function as it appears in the ABI
17    #[serde(rename = "name", skip_serializing_if = "Option::is_none")]
18    pub name: Option<String>,
19    /// The state mutability of the contract function as it appears in the ABI
20    #[serde(rename = "stateMutability", skip_serializing_if = "Option::is_none")]
21    pub state_mutability: Option<StateMutability>,
22    /// The type if the function
23    #[serde(rename = "type")]
24    pub r#type: Type,
25    /// The parameters that this function/constructor posses
26    #[serde(rename = "inputs")]
27    pub inputs: Vec<models::Parameter>,
28    /// The parameters that this 'read' function returns
29    #[serde(rename = "outputs", skip_serializing_if = "Option::is_none")]
30    pub outputs: Option<Vec<models::Parameter>>,
31    /// The documentation of this function (if has any)
32    #[serde(rename = "description", skip_serializing_if = "Option::is_none")]
33    pub description: Option<String>,
34}
35
36impl AbiFunction {
37    pub fn new(r#type: Type, inputs: Vec<models::Parameter>) -> AbiFunction {
38        AbiFunction {
39            name: None,
40            state_mutability: None,
41            r#type,
42            inputs,
43            outputs: None,
44            description: None,
45        }
46    }
47}
48/// The state mutability of the contract function as it appears in the ABI
49#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
50pub enum StateMutability {
51    #[serde(rename = "pure")]
52    Pure,
53    #[serde(rename = "view")]
54    View,
55    #[serde(rename = "nonpayable")]
56    Nonpayable,
57    #[serde(rename = "payable")]
58    Payable,
59}
60
61impl Default for StateMutability {
62    fn default() -> StateMutability {
63        Self::Pure
64    }
65}
66/// The type if the function
67#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
68pub enum Type {
69    #[serde(rename = "function")]
70    Function,
71    #[serde(rename = "constructor")]
72    Constructor,
73}
74
75impl Default for Type {
76    fn default() -> Type {
77        Self::Function
78    }
79}