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 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80
use bigdecimal::BigDecimal;
use chrono::{DateTime, Utc};
use serde::Deserialize;
use crate::types::deserialize_str_u64;
#[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
#[allow(dead_code)]
pub struct StakingPosition {
/// The unique identifier of the staking position
pub id: String,
/// The unique identifier of the staking provider
pub provider_id: String,
/// The source vault account to stake from.
#[serde(deserialize_with = "deserialize_str_u64")]
pub vault_account_id: u64,
/// The destination validator address name.
pub validator_name: String,
/// The destination validator provider name.
pub provider_name: String,
/// The blockchain descriptor to use.
pub chain_descriptor: String,
/// Amount of tokens to stake.
pub amount: BigDecimal,
/// The amount staked in the position, measured in the blockchain descriptor unit.
pub rewards_amount: BigDecimal,
/// When was the request made (ISO Date).
pub date_created: DateTime<Utc>,
/// The current status.
// status: PositionStatus;
/// An array of transaction objects related to this position.
/// Each object includes a 'txId' representing the transaction ID
/// and a 'isSuccessful' boolean indicating if the transaction was successful.
// relatedTransactions: RelatedTransactionDto[];
/// Indicates whether there is an ongoing action for this position (true if ongoing, false if not).
pub in_progress: bool,
/// The transaction ID of the ongoing request
pub in_progress_tx_id: Option<String>,
/// Additional fields per blockchain - can be empty or missing if not initialized or no additional info exists.
/// The type depends on the chainDescriptor value.
/// For Solana (SOL), stake account address.
/// For Ethereum (ETH), an empty object is returned as no specific data is available.
// blockchain_position_info: TBlockchainPositionInfo;
/// The destination address of the staking transaction.
pub validator_address: String,
/// An array of available actions that can be performed. for example, actions like "unstake" or "withdraw".
pub available_actions: Vec<String>,
}
#[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
#[allow(dead_code)]
pub struct StakingAmountSummary {
#[serde(rename = "chainDescriptor")]
pub chain: String,
pub amount: BigDecimal,
}
#[derive(Debug, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
#[allow(dead_code)]
pub struct StakingPositionsSummary {
pub active: Vec<StakingAmountSummary>,
pub inactive: Vec<StakingAmountSummary>,
}