fireblocks-sdk 2026.3.27

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 ContractTemplateDto {
    /// The unique identifier of the contract template
    #[serde(rename = "id")]
    pub id: String,
    /// 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>,
    #[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>,
    /// 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>,
    /// The workspace id of the owner of this contract template. If it's a
    /// private contract, only this workspace will be allowed to deploy it
    #[serde(rename = "owner", skip_serializing_if = "Option::is_none")]
    pub owner: Option<String>,
    /// The details of the vendor of this contract template. Applicable only for
    /// public contract templates
    #[serde(rename = "vendor", skip_serializing_if = "Option::is_none")]
    pub vendor: Option<models::VendorDto>,
    /// Is this a contract that is viewable by all fireblocks's users or is it
    /// visible only for this workspace
    #[serde(rename = "isPublic")]
    pub is_public: bool,
    /// True if the workspace allowed to deploy this contract, false otherwise
    #[serde(rename = "canDeploy", skip_serializing_if = "Option::is_none")]
    pub can_deploy: Option<bool>,
    /// The type of the contract template
    #[serde(rename = "type", skip_serializing_if = "Option::is_none")]
    pub r#type: Option<Type>,
    #[serde(
        rename = "implementationContractId",
        skip_serializing_if = "Option::is_none"
    )]
    pub implementation_contract_id: Option<String>,
    /// For standalone contracts use ON_DEPLOYMENT and for contracts that are
    /// behind proxies use POST_DEPLOYMENT
    #[serde(rename = "initializationPhase")]
    pub initialization_phase: InitializationPhase,
}

impl ContractTemplateDto {
    pub fn new(
        id: String,
        name: String,
        description: String,
        abi: Vec<Vec<models::AbiFunction>>,
        is_public: bool,
        initialization_phase: InitializationPhase,
    ) -> ContractTemplateDto {
        ContractTemplateDto {
            id,
            name,
            description,
            long_description: None,
            abi,
            attributes: None,
            docs: None,
            owner: None,
            vendor: None,
            is_public,
            can_deploy: None,
            r#type: None,
            implementation_contract_id: None,
            initialization_phase,
        }
    }
}
/// 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
    }
}
/// For standalone contracts use ON_DEPLOYMENT and for contracts that are behind
/// proxies use POST_DEPLOYMENT
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum InitializationPhase {
    #[serde(rename = "ON_DEPLOYMENT")]
    OnDeployment,
    #[serde(rename = "POST_DEPLOYMENT")]
    PostDeployment,
}

impl Default for InitializationPhase {
    fn default() -> InitializationPhase {
        Self::OnDeployment
    }
}