ethereal_rust_sdk 0.1.5

Trading client for Ethereal exchange
Documentation
/*
 * Ethereal Exchange API
 *
 * Ethereal HTTP API for real-time trading, order management, and market data access.
 *
 * The version of the OpenAPI document: 0.1.0
 *
 * Generated by: https://openapi-generator.tech
 */

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

#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct WithdrawDto {
    /// Id representing the withdraw
    #[serde(rename = "id")]
    pub id: uuid::Uuid,
    /// Block number the withdraw was initiated on
    #[serde(
        rename = "initiatedBlockNumber",
        skip_serializing_if = "Option::is_none"
    )]
    pub initiated_block_number: Option<String>,
    /// Block number the withdraw was completed on
    #[serde(
        rename = "finalizedBlockNumber",
        skip_serializing_if = "Option::is_none"
    )]
    pub finalized_block_number: Option<String>,
    /// Current status of the withdraw
    #[serde(rename = "status")]
    pub status: Status,
    /// Bytes32 encoded subaccount name (0x prefix, zero padded)
    #[serde(rename = "subaccount")]
    pub subaccount: String,
    /// Address of asset to withdraw (non-checksummed)
    #[serde(rename = "token")]
    pub token: String,
    /// LayerZero destination address (leading 0x bytes32 encoded) for the transfer (if withdraw)
    #[serde(
        rename = "lzDestinationAddress",
        skip_serializing_if = "Option::is_none"
    )]
    pub lz_destination_address: Option<String>,
    /// LayerZero destination endpoint ID for the transfer (if withdraw)
    #[serde(rename = "lzDestinationEid", skip_serializing_if = "Option::is_none")]
    pub lz_destination_eid: Option<f64>,
    /// Amount of asset transferred expressed as a decimal
    #[serde(rename = "amount")]
    pub amount: String,
    /// Withdraw creation timestamp (ms since Unix Epoch)
    #[serde(rename = "createdAt")]
    pub created_at: f64,
    /// Bytes32 hash of the withdraw data (with 0x prefix)
    #[serde(rename = "withdrawDigest")]
    pub withdraw_digest: String,
}

impl WithdrawDto {
    pub fn new(
        id: uuid::Uuid,
        status: Status,
        subaccount: String,
        token: String,
        amount: String,
        created_at: f64,
        withdraw_digest: String,
    ) -> WithdrawDto {
        WithdrawDto {
            id,
            initiated_block_number: None,
            finalized_block_number: None,
            status,
            subaccount,
            token,
            lz_destination_address: None,
            lz_destination_eid: None,
            amount,
            created_at,
            withdraw_digest,
        }
    }
}
/// Current status of the withdraw
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Status {
    #[serde(rename = "SUBMITTED")]
    Submitted,
    #[serde(rename = "PENDING")]
    Pending,
    #[serde(rename = "COMPLETED")]
    Completed,
    #[serde(rename = "REJECTED")]
    Rejected,
}

impl Default for Status {
    fn default() -> Status {
        Self::Submitted
    }
}