ethereal_rust_sdk 0.1.6

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 SignerDto {
    /// Id representing the linked signer
    #[serde(rename = "id")]
    pub id: String,
    /// Address of the signer linked with the subaccount (non-checksummed)
    #[serde(rename = "signer")]
    pub signer: String,
    /// Status of the signer
    #[serde(rename = "status")]
    pub status: Status,
    /// Block number the signer has been linked on. Undefined means it has not be processed
    #[serde(rename = "blockNumber", skip_serializing_if = "Option::is_none")]
    pub block_number: Option<String>,
    /// Onchain linkage timestamp (ms since Unix Epoch)
    #[serde(rename = "linkedAt", skip_serializing_if = "Option::is_none")]
    pub linked_at: Option<f64>,
    /// Block number the signer has been revoked on. Undefined means it has not be processed
    #[serde(rename = "revokedBlockNumber", skip_serializing_if = "Option::is_none")]
    pub revoked_block_number: Option<String>,
    /// Onchain revocation timestamp (ms since Unix Epoch)
    #[serde(rename = "revokedAt", skip_serializing_if = "Option::is_none")]
    pub revoked_at: Option<f64>,
    /// Signer expiry timestamp (ms since Unix Epoch)
    #[serde(rename = "expiresAt")]
    pub expires_at: f64,
    /// Link signer submission timestamp (ms since Unix Epoch)
    #[serde(rename = "createdAt")]
    pub created_at: f64,
}

impl SignerDto {
    pub fn new(
        id: String,
        signer: String,
        status: Status,
        expires_at: f64,
        created_at: f64,
    ) -> SignerDto {
        SignerDto {
            id,
            signer,
            status,
            block_number: None,
            linked_at: None,
            revoked_block_number: None,
            revoked_at: None,
            expires_at,
            created_at,
        }
    }
}
/// Status of the signer
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Status {
    #[serde(rename = "PENDING")]
    Pending,
    #[serde(rename = "ACTIVE")]
    Active,
    #[serde(rename = "PENDING_REVOKE")]
    PendingRevoke,
    #[serde(rename = "REVOKED")]
    Revoked,
    #[serde(rename = "REJECTED")]
    Rejected,
}

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