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
use crate::assets::Asset;
use crate::types::deserialize_str_u64;
use bigdecimal::BigDecimal;
use serde_derive::{Deserialize, Serialize};

#[derive(Debug, Serialize, Deserialize, Clone, Default)]
#[serde(rename_all = "camelCase")]
#[allow(dead_code)]
pub struct SupportedAsset {
  pub id: Asset,
  pub name: String,
  #[serde(rename = "type")]
  pub asset_type: String,
  pub contract_address: String,
  pub native_asset: String,
  pub decimals: i32,
}

#[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
#[allow(dead_code)]
pub struct AssetResponse {
  #[serde(deserialize_with = "deserialize_str_u64", default)]
  pub vault_id: u64,
  pub asset_id: Asset,
  pub total: BigDecimal,
  pub locked_amount: BigDecimal,
  pub available: BigDecimal,
  pub pending: BigDecimal,
  pub frozen: BigDecimal,
  pub block_height: Option<String>,
  pub block_hash: Option<String>,
}

#[derive(Debug, Serialize, Deserialize, Default, Clone)]
#[serde(rename_all = "camelCase")]
#[allow(dead_code)]
pub struct AccountAsset {
  pub id: String,
  pub total: BigDecimal,
  pub available: BigDecimal,
  pub pending: BigDecimal,
  pub frozen: BigDecimal,
  pub locked_amount: BigDecimal,
  pub staked: BigDecimal,

  #[serde(rename = "totalStakedCPU")]
  pub total_staked_cpu: Option<BigDecimal>,
  pub total_staked_network: Option<String>,
  #[serde(rename = "selfStakedCPU")]
  pub self_staked_cpu: Option<BigDecimal>,
  pub self_staked_network: Option<String>,
  #[serde(rename = "pendingRefundCPU")]
  pub pending_refund_cpu: Option<BigDecimal>,
  pub pending_refund_network: Option<String>,

  pub block_height: Option<String>,
  pub block_hash: Option<String>,
}