1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/*
* 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 SubaccountBalanceDto {
/// Id representing the subaccount
#[serde(rename = "subaccountId")]
pub subaccount_id: uuid::Uuid,
/// Id representing the token
#[serde(rename = "tokenId")]
pub token_id: uuid::Uuid,
/// ERC20 deposited token address (non-checksummed, zero address if virtual)
#[serde(rename = "tokenAddress")]
pub token_address: String,
/// The unique exchange defined token name driven by addToken onchain
#[serde(rename = "tokenName")]
pub token_name: String,
/// Token balance in native units expressed as a decimal (precision: 9)
#[serde(rename = "amount")]
pub amount: rust_decimal::Decimal,
/// Portion of balance transferrable in native units expressed as a decimal (precision: 9)
#[serde(rename = "available")]
pub available: rust_decimal::Decimal,
/// Portion of balance non-transferrable in native units expressed as a decimal (precision: 9)
#[serde(rename = "totalUsed")]
pub total_used: rust_decimal::Decimal,
/// Token balance last updated timestamp (ms since Unix Epoch)
#[serde(rename = "updatedAt")]
pub updated_at: f64,
}
impl SubaccountBalanceDto {
pub fn new(
subaccount_id: uuid::Uuid,
token_id: uuid::Uuid,
token_address: String,
token_name: String,
amount: rust_decimal::Decimal,
available: rust_decimal::Decimal,
total_used: rust_decimal::Decimal,
updated_at: f64,
) -> SubaccountBalanceDto {
SubaccountBalanceDto {
subaccount_id,
token_id,
token_address,
token_name,
amount,
available,
total_used,
updated_at,
}
}
}