fireblocks-sdk 2.1.0

Rust implementation of the Fireblocks SDK
Documentation
// Fireblocks API
//
// 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)
//
// The version of the OpenAPI document: 1.8.0
// Contact: developers@fireblocks.com
// Generated by: https://openapi-generator.tech

use {
    crate::models,
    serde::{Deserialize, Serialize},
};

#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct ContractUploadRequest {
    /// The name of the contract template
    #[serde(rename = "name")]
    pub name: String,
    /// A short description of the contract template
    #[serde(rename = "description")]
    pub description: String,
    /// A full description of the contract template. May contain   to break the
    /// lines
    #[serde(rename = "longDescription", skip_serializing_if = "Option::is_none")]
    pub long_description: Option<String>,
    /// The compiled artifact of this smart contract. Used for deployment of
    /// this contract template
    #[serde(rename = "bytecode")]
    pub bytecode: String,
    /// The source code of the contract. Optional.
    #[serde(rename = "sourcecode", skip_serializing_if = "Option::is_none")]
    pub sourcecode: Option<String>,
    /// The type of the contract template
    #[serde(rename = "type", skip_serializing_if = "Option::is_none")]
    pub r#type: Option<Type>,
    /// A `natspec` compliant documentation json. Can be retrieved from the
    /// output json after compilation
    #[serde(rename = "docs", skip_serializing_if = "Option::is_none")]
    pub docs: Option<models::ContractDoc>,
    #[serde(rename = "abi")]
    pub abi: Vec<Vec<models::AbiFunction>>,
    /// The attributes related to this contract template. It will be displayed
    /// in the tokenization page
    #[serde(rename = "attributes", skip_serializing_if = "Option::is_none")]
    pub attributes: Option<models::ContractAttributes>,
}

impl ContractUploadRequest {
    pub fn new(
        name: String,
        description: String,
        bytecode: String,
        abi: Vec<Vec<models::AbiFunction>>,
    ) -> ContractUploadRequest {
        ContractUploadRequest {
            name,
            description,
            long_description: None,
            bytecode,
            sourcecode: None,
            r#type: None,
            docs: None,
            abi,
            attributes: None,
        }
    }
}
/// The type of the contract template
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Type {
    #[serde(rename = "FUNGIBLE_TOKEN")]
    FungibleToken,
    #[serde(rename = "NON_FUNGIBLE_TOKEN")]
    NonFungibleToken,
    #[serde(rename = "TOKEN_UTILITY")]
    TokenUtility,
}

impl Default for Type {
    fn default() -> Type {
        Self::FungibleToken
    }
}