one-click-sdk-rs 0.1.17

API for One-Click Swaps
Documentation
/*
 * 1Click Swap API
 *
 * API for One-Click Swaps
 *
 * The version of the OpenAPI document: 0.1
 * 
 * Generated by: https://openapi-generator.tech
 */

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

#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct TokenResponse {
    /// Unique asset identifier
    #[serde(rename = "assetId")]
    pub asset_id: String,
    /// Number of decimals for the token
    #[serde(rename = "decimals")]
    pub decimals: f64,
    /// Blockchain associated with the token
    #[serde(rename = "blockchain")]
    pub blockchain: Blockchain,
    /// Token symbol (e.g. BTC, ETH)
    #[serde(rename = "symbol")]
    pub symbol: String,
    /// Current price of the token in USD
    #[serde(rename = "price")]
    pub price: f64,
    /// Date when the token price was last updated
    #[serde(rename = "priceUpdatedAt")]
    pub price_updated_at: String,
    /// Contract address of the token
    #[serde(rename = "contractAddress", skip_serializing_if = "Option::is_none")]
    pub contract_address: Option<String>,
}

impl TokenResponse {
    pub fn new(asset_id: String, decimals: f64, blockchain: Blockchain, symbol: String, price: f64, price_updated_at: String) -> TokenResponse {
        TokenResponse {
            asset_id,
            decimals,
            blockchain,
            symbol,
            price,
            price_updated_at,
            contract_address: None,
        }
    }
}
/// Blockchain associated with the token
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Blockchain {
    #[serde(rename = "near")]
    Near,
    #[serde(rename = "eth")]
    Eth,
    #[serde(rename = "base")]
    Base,
    #[serde(rename = "arb")]
    Arb,
    #[serde(rename = "btc")]
    Btc,
    #[serde(rename = "sol")]
    Sol,
    #[serde(rename = "ton")]
    Ton,
    #[serde(rename = "doge")]
    Doge,
    #[serde(rename = "xrp")]
    Xrp,
    #[serde(rename = "zec")]
    Zec,
    #[serde(rename = "gnosis")]
    Gnosis,
    #[serde(rename = "bera")]
    Bera,
    #[serde(rename = "bsc")]
    Bsc,
    #[serde(rename = "pol")]
    Pol,
    #[serde(rename = "tron")]
    Tron,
}

impl Default for Blockchain {
    fn default() -> Blockchain {
        Self::Near
    }
}