cat_gateway/service/common/objects/cardano/
stake_info.rsuse poem_openapi::{types::Example, Object};
use crate::service::{
api::cardano::types::{SlotNumber, StakeAmount},
common::types::cardano::{
asset_name::AssetName, asset_value::AssetValue, hash28::HexEncodedHash28,
},
};
#[derive(Object)]
pub(crate) struct StakedNativeTokenInfo {
pub(crate) policy_hash: HexEncodedHash28,
pub(crate) asset_name: AssetName,
pub(crate) amount: AssetValue,
}
#[derive(Object, Default)]
#[oai(example = true)]
pub(crate) struct StakeInfo {
#[oai(validator(minimum(value = "0"), maximum(value = "9223372036854775807")))]
pub(crate) ada_amount: StakeAmount,
#[oai(validator(minimum(value = "0"), maximum(value = "9223372036854775807")))]
pub(crate) slot_number: SlotNumber,
#[oai(validator(max_items = "1000"))]
pub(crate) native_tokens: Vec<StakedNativeTokenInfo>,
}
impl Example for StakeInfo {
fn example() -> Self {
Self {
slot_number: 5,
ada_amount: 1,
native_tokens: Vec::new(),
}
}
}
#[derive(Object, Default)]
#[oai(example = true)]
pub(crate) struct FullStakeInfo {
pub(crate) volatile: StakeInfo,
pub(crate) persistent: StakeInfo,
}
impl Example for FullStakeInfo {
fn example() -> Self {
Self {
volatile: StakeInfo::example(),
persistent: StakeInfo::example(),
}
}
}