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 TransactionResponse {
    /// Fireblocks Transaction ID
    pub id: String,
    /// Unique external transaction identifier provided by the user. Used to
    /// help prevent duplicate transactions.
    #[serde(rename = "externalTxId", skip_serializing_if = "Option::is_none")]
    pub external_tx_id: Option<String>,
    pub status: models::TransactionStatus,
    #[serde(rename = "subStatus", skip_serializing_if = "Option::is_none")]
    pub sub_status: Option<models::TransactionSubStatus>,
    /// The hash of the transaction on the blockchain.  * This parameter exists
    /// if at least one of the following conditions is met:       1. The
    /// transaction’s source type is `UNKNOWN`, `WHITELISTED_ADDRESS`,
    /// `NETWORK_CONNECTION`, `ONE_TIME_ADDRESS`, `FIAT_ACCOUNT` or
    /// `GAS_STATION`.       2. The transaction’s source type is `VAULT` and the
    /// status is either: `CONFIRMING`, `COMPLETED`, or was in any of these
    /// statuses prior to changing to `FAILED` or `REJECTED`. In some instances,
    /// transactions in status `BROADCASTING` will include the txHash as well.
    /// 3. The transaction’s source type is `EXCHANGE_ACCOUNT` and the
    /// transaction’s destination type is `VAULT`, and the status is either:
    /// `CONFIRMING`, `COMPLETED`, or was in any of these status prior to
    /// changing to `FAILED`.   * In addition, the following conditions must be
    /// met:      1. The asset is a crypto asset (not fiat).      2. The
    /// transaction operation is not `RAW` or `TYPED_MESSAGE`.
    #[serde(rename = "txHash", skip_serializing_if = "Option::is_none")]
    pub tx_hash: Option<String>,
    #[serde(rename = "operation", skip_serializing_if = "Option::is_none")]
    pub operation: Option<models::GetTransactionOperation>,
    /// Custom note, not sent to the blockchain, that describes the transaction
    /// at your Fireblocks workspace.
    #[serde(rename = "note", skip_serializing_if = "Option::is_none")]
    pub note: Option<String>,
    /// A JSON used to store additional blockchain-specific data.  **Example:**
    /// In HBAR, this property will have the txHash in addition to the txID.
    #[serde(rename = "blockchainInfo", skip_serializing_if = "Option::is_none")]
    pub blockchain_info: Option<serde_json::Value>,
    /// The ID of the asset for `TRANSFER`, `MINT`, `BURN`, `ENABLE_ASSET`,`STAKE` ,`UNSTAKE` or `WITHDRAW` operations. See the [list of supported assets and their IDs on Fireblocks](https://developers.fireblocks.com/reference/getsupportedassets).
    #[serde(rename = "assetId", skip_serializing_if = "Option::is_none")]
    pub asset_id: Option<String>,
    /// Type classification of the asset
    #[serde(rename = "assetType", skip_serializing_if = "Option::is_none")]
    pub asset_type: Option<String>,
    #[serde(rename = "source", skip_serializing_if = "Option::is_none")]
    pub source: Option<models::SourceTransferPeerPathResponse>,
    /// For account based assets only, the source address of the transaction.
    /// **Note:** If the status is `CONFIRMING`, `COMPLETED`, or has been
    /// `CONFIRMING`; then moved forward to `FAILED` or `REJECTED`, then this
    /// parameter will contain the source address. In any other case, this
    /// parameter will be empty.
    #[serde(rename = "sourceAddress", skip_serializing_if = "Option::is_none")]
    pub source_address: Option<String>,
    /// Source address tag for Tag/Memo supporting assets, or Bank Transfer
    /// Description for the fiat provider BLINC (by BCB Group).
    #[serde(rename = "tag", skip_serializing_if = "Option::is_none")]
    pub tag: Option<String>,
    #[serde(rename = "destination", skip_serializing_if = "Option::is_none")]
    pub destination: Option<models::DestinationTransferPeerPathResponse>,
    /// The transaction’s destinations. **Note:** In case the transaction is
    /// sent to a single destination, the `destination` parameter is used
    /// instead of this.
    #[serde(rename = "destinations", skip_serializing_if = "Option::is_none")]
    pub destinations: Option<Vec<models::TransactionResponseDestination>>,
    /// Address where the asset were transferred. Notes:   - For [Multi destination transactions](https://support.fireblocks.io/hc/en-us/articles/360018447980-Multi-destination-transactions), this parameter will be empty. In this case, you should refer to the destinations field.   - If the status is `CONFIRMING`, `COMPLETED`, or has been `CONFIRMING`; then moved forward to `FAILED` or `REJECTED`, then this parameter will contain the destination address. In any other case, this parameter will be empty.
    #[serde(rename = "destinationAddress", skip_serializing_if = "Option::is_none")]
    pub destination_address: Option<String>,
    /// Description of the destination address.
    #[serde(
        rename = "destinationAddressDescription",
        skip_serializing_if = "Option::is_none"
    )]
    pub destination_address_description: Option<String>,
    /// Destination address tag for Tag/Memo supporting assets, or Bank Transfer
    /// Description for the fiat provider BLINC (by BCB Group).
    #[serde(rename = "destinationTag", skip_serializing_if = "Option::is_none")]
    pub destination_tag: Option<String>,
    #[serde(
        rename = "contractCallDecodedData",
        skip_serializing_if = "Option::is_none"
    )]
    pub contract_call_decoded_data: Option<models::TransactionResponseContractCallDecodedData>,
    #[serde(rename = "amountInfo", skip_serializing_if = "Option::is_none")]
    pub amount_info: Option<models::AmountInfo>,
    /// For transactions initiated via this Fireblocks workspace, when set to
    /// `true`, the fee is deducted from the requested amount.  **Note:** This
    /// parameter can only be considered if a transaction's asset is a base
    /// asset, such as ETH or MATIC. If the asset can't be used for transaction
    /// fees, like USDC, this parameter is ignored and the fee is deducted from
    /// the relevant base asset wallet in the source account.
    #[serde(rename = "treatAsGrossAmount", skip_serializing_if = "Option::is_none")]
    pub treat_as_gross_amount: Option<bool>,
    #[serde(rename = "feeInfo", skip_serializing_if = "Option::is_none")]
    pub fee_info: Option<models::FeeInfo>,
    /// The asset which was withdrawn to pay the transaction fee, for example
    /// ETH for EVM-based blockchains, BTC for Tether Omni.
    #[serde(rename = "feeCurrency", skip_serializing_if = "Option::is_none")]
    pub fee_currency: Option<String>,
    /// In case a single transaction resulted with multiple transfers, for
    /// example a result of a contract call, then this parameter specifies each
    /// transfer that took place on the blockchain.
    #[serde(rename = "networkRecords", skip_serializing_if = "Option::is_none")]
    pub network_records: Option<Vec<models::NetworkRecord>>,
    /// The transaction’s creation date and time, in unix timestamp.
    #[serde(rename = "createdAt", skip_serializing_if = "Option::is_none")]
    pub created_at: Option<f64>,
    /// The transaction’s last update date and time, in unix timestamp.
    #[serde(rename = "lastUpdated", skip_serializing_if = "Option::is_none")]
    pub last_updated: Option<f64>,
    /// User ID of the initiator of the transaction.
    #[serde(rename = "createdBy", skip_serializing_if = "Option::is_none")]
    pub created_by: Option<String>,
    /// User ID’s of the signers of the transaction.
    #[serde(rename = "signedBy", skip_serializing_if = "Option::is_none")]
    pub signed_by: Option<Vec<String>>,
    /// User ID of the user that rejected the transaction (in case it was
    /// rejected).
    #[serde(rename = "rejectedBy", skip_serializing_if = "Option::is_none")]
    pub rejected_by: Option<String>,
    #[serde(rename = "authorizationInfo", skip_serializing_if = "Option::is_none")]
    pub authorization_info: Option<models::AuthorizationInfo>,
    /// If the transaction originated from an exchange, this is the ID of this
    /// transaction at the exchange.
    #[serde(rename = "exchangeTxId", skip_serializing_if = "Option::is_none")]
    pub exchange_tx_id: Option<String>,
    /// The ID for AML providers to associate the owner of funds with
    /// transactions.
    #[serde(rename = "customerRefId", skip_serializing_if = "Option::is_none")]
    pub customer_ref_id: Option<String>,
    #[serde(rename = "amlScreeningResult", skip_serializing_if = "Option::is_none")]
    pub aml_screening_result: Option<models::AmlScreeningResult>,
    #[serde(rename = "complianceResult", skip_serializing_if = "Option::is_none")]
    pub compliance_result: Option<models::ComplianceResult>,
    /// Indicates the transaction was not broadcast by Fireblocks
    #[serde(
        rename = "notBroadcastByFireblocks",
        skip_serializing_if = "Option::is_none"
    )]
    pub not_broadcast_by_fireblocks: Option<bool>,
    /// dApp URL for Web3 transactions
    #[serde(rename = "dappUrl", skip_serializing_if = "Option::is_none")]
    pub dapp_url: Option<String>,
    /// Gas limit for EVM-based blockchain transactions
    #[serde(rename = "gasLimit", skip_serializing_if = "Option::is_none")]
    pub gas_limit: Option<String>,
    /// Blockchain-specific index or identifier for the transaction
    #[serde(rename = "blockchainIndex", skip_serializing_if = "Option::is_none")]
    pub blockchain_index: Option<String>,
    /// Solana rent payment amount
    #[serde(rename = "paidRent", skip_serializing_if = "Option::is_none")]
    pub paid_rent: Option<String>,
    #[serde(rename = "extraParameters", skip_serializing_if = "Option::is_none")]
    pub extra_parameters: Option<models::ExtraParameters>,
    /// An array of signed messages
    #[serde(rename = "signedMessages", skip_serializing_if = "Option::is_none")]
    pub signed_messages: Option<Vec<models::SignedMessage>>,
    /// The number of confirmations of the transaction. The number will increase
    /// until the transaction will be considered completed according to the
    /// confirmation policy.
    #[serde(rename = "numOfConfirmations", skip_serializing_if = "Option::is_none")]
    pub num_of_confirmations: Option<f64>,
    #[serde(rename = "blockInfo", skip_serializing_if = "Option::is_none")]
    pub block_info: Option<models::BlockInfo>,
    /// For UTXO based assets this is the vOut, for Ethereum based, this is the
    /// index of the event of the contract call.  **Note:** This field is not
    /// returned if a transaction uses the `destinations` object with more than
    /// one value.
    #[serde(rename = "index", skip_serializing_if = "Option::is_none")]
    pub index: Option<f64>,
    #[serde(rename = "rewardInfo", skip_serializing_if = "Option::is_none")]
    pub reward_info: Option<models::RewardInfo>,
    #[serde(rename = "feePayerInfo", skip_serializing_if = "Option::is_none")]
    pub fee_payer_info: Option<models::FeePayerInfo>,
    #[serde(rename = "systemMessages", skip_serializing_if = "Option::is_none")]
    pub system_messages: Option<models::SystemMessageInfo>,
    #[serde(rename = "addressType", skip_serializing_if = "Option::is_none")]
    pub address_type: Option<AddressType>,
    /// The amount requested by the user. Deprecated - please use the
    /// `amountInfo` field for accuracy.
    #[serde(rename = "requestedAmount", skip_serializing_if = "Option::is_none")]
    pub requested_amount: Option<f64>,
    /// If the transfer is a withdrawal from an exchange, the actual amount that
    /// was requested to be transferred. Otherwise, the requested amount.
    /// Deprecated - please use the `amountInfo` field for accuracy.
    #[serde(rename = "amount", skip_serializing_if = "Option::is_none")]
    pub amount: Option<f64>,
    /// The net amount of the transaction, after fee deduction. Deprecated -
    /// please use the `amountInfo` field for accuracy.
    #[serde(rename = "netAmount", skip_serializing_if = "Option::is_none")]
    pub net_amount: Option<f64>,
    /// The USD value of the requested amount. Deprecated - please use the
    /// `amountInfo` field for accuracy.
    #[serde(
        rename = "amountUSD",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub amount_usd: Option<Option<f64>>,
    /// The total fee deducted by the exchange from the actual requested amount
    /// (`serviceFee` = `amount` - `netAmount`). Deprecated - please use the
    /// `feeInfo` field for accuracy.
    #[serde(rename = "serviceFee", skip_serializing_if = "Option::is_none")]
    pub service_fee: Option<f64>,
    /// Deprecated - please use the `feeInfo` field for accuracy.
    #[serde(rename = "fee", skip_serializing_if = "Option::is_none")]
    pub fee: Option<f64>,
    /// The fee paid to the network. Deprecated - please use the `feeInfo` field
    /// for accuracy.
    #[serde(rename = "networkFee", skip_serializing_if = "Option::is_none")]
    pub network_fee: Option<f64>,
    /// The transaction's revert reason. This field will be returned when
    /// `subStatus` =  'SMART_CONTRACT_EXECUTION_FAILED'.
    #[serde(rename = "errorDescription", skip_serializing_if = "Option::is_none")]
    pub error_description: Option<String>,
    /// If the transaction is a Replace-By-Fee (RBF) transaction, this is the
    /// hash of the transaction that was replaced.
    #[serde(rename = "replacedTxByHash", skip_serializing_if = "Option::is_none")]
    pub replaced_tx_by_hash: Option<String>,
    /// Blockchain nonce for the transaction
    #[serde(rename = "nonce", skip_serializing_if = "Option::is_none")]
    pub nonce: Option<String>,
}

impl TransactionResponse {
    pub fn new() -> TransactionResponse {
        TransactionResponse {
            id: String::new(),
            external_tx_id: None,
            status: models::TransactionStatus::Submitted,
            sub_status: None,
            tx_hash: None,
            operation: None,
            note: None,
            blockchain_info: None,
            asset_id: None,
            asset_type: None,
            source: None,
            source_address: None,
            tag: None,
            destination: None,
            destinations: None,
            destination_address: None,
            destination_address_description: None,
            destination_tag: None,
            contract_call_decoded_data: None,
            amount_info: None,
            treat_as_gross_amount: None,
            fee_info: None,
            fee_currency: None,
            network_records: None,
            created_at: None,
            last_updated: None,
            created_by: None,
            signed_by: None,
            rejected_by: None,
            authorization_info: None,
            exchange_tx_id: None,
            customer_ref_id: None,
            aml_screening_result: None,
            compliance_result: None,
            not_broadcast_by_fireblocks: None,
            dapp_url: None,
            gas_limit: None,
            blockchain_index: None,
            paid_rent: None,
            extra_parameters: None,
            signed_messages: None,
            num_of_confirmations: None,
            block_info: None,
            index: None,
            reward_info: None,
            fee_payer_info: None,
            system_messages: None,
            address_type: None,
            requested_amount: None,
            amount: None,
            net_amount: None,
            amount_usd: None,
            service_fee: None,
            fee: None,
            network_fee: None,
            error_description: None,
            replaced_tx_by_hash: None,
            nonce: None,
        }
    }
}
///
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum AddressType {
    #[serde(rename = "")]
    Empty,
    #[serde(rename = "WHITELISTED")]
    Whitelisted,
    #[serde(rename = "ONE_TIME")]
    OneTime,
}

impl Default for AddressType {
    fn default() -> AddressType {
        Self::Empty
    }
}