use serde::Serialize;
#[derive(Debug, Clone, Default, Serialize)]
pub struct StakingDefiOffersRequest {
#[serde(rename = "productId", skip_serializing_if = "Option::is_none")]
product_id: Option<String>,
#[serde(rename = "protocolType", skip_serializing_if = "Option::is_none")]
protocol_type: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
ccy: Option<String>,
}
impl StakingDefiOffersRequest {
pub fn new() -> Self {
Self::default()
}
pub fn product_id(mut self, value: impl Into<String>) -> Self {
self.product_id = Some(value.into());
self
}
pub fn protocol_type(mut self, value: impl Into<String>) -> Self {
self.protocol_type = Some(value.into());
self
}
pub fn currency(mut self, value: impl Into<String>) -> Self {
self.ccy = Some(value.into());
self
}
}
#[derive(Debug, Clone, Serialize)]
pub struct StakingDefiInvestment {
ccy: String,
amt: String,
}
impl StakingDefiInvestment {
pub fn new(ccy: impl Into<String>, amt: impl Into<String>) -> Self {
Self {
ccy: ccy.into(),
amt: amt.into(),
}
}
}
#[derive(Debug, Clone, Serialize)]
pub struct StakingDefiPurchaseRequest {
#[serde(rename = "productId")]
product_id: String,
#[serde(rename = "investData")]
invest_data: Vec<StakingDefiInvestment>,
#[serde(skip_serializing_if = "Option::is_none")]
term: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
tag: Option<String>,
}
impl StakingDefiPurchaseRequest {
pub fn new(product_id: impl Into<String>, invest_data: Vec<StakingDefiInvestment>) -> Self {
Self {
product_id: product_id.into(),
invest_data,
term: None,
tag: None,
}
}
pub fn term(mut self, value: impl Into<String>) -> Self {
self.term = Some(value.into());
self
}
pub fn tag(mut self, value: impl Into<String>) -> Self {
self.tag = Some(value.into());
self
}
}
#[derive(Debug, Clone, Serialize)]
pub struct StakingDefiRedeemRequest {
#[serde(rename = "ordId")]
ord_id: String,
#[serde(rename = "protocolType")]
protocol_type: String,
#[serde(rename = "allowEarlyRedeem", skip_serializing_if = "Option::is_none")]
allow_early_redeem: Option<bool>,
}
impl StakingDefiRedeemRequest {
pub fn new(ord_id: impl Into<String>, protocol_type: impl Into<String>) -> Self {
Self {
ord_id: ord_id.into(),
protocol_type: protocol_type.into(),
allow_early_redeem: None,
}
}
pub fn allow_early_redeem(mut self, value: bool) -> Self {
self.allow_early_redeem = Some(value);
self
}
}
#[derive(Debug, Clone, Serialize)]
pub struct StakingDefiCancelRequest {
#[serde(rename = "ordId")]
ord_id: String,
#[serde(rename = "protocolType")]
protocol_type: String,
}
impl StakingDefiCancelRequest {
pub fn new(ord_id: impl Into<String>, protocol_type: impl Into<String>) -> Self {
Self {
ord_id: ord_id.into(),
protocol_type: protocol_type.into(),
}
}
}
#[derive(Debug, Clone, Default, Serialize)]
pub struct StakingDefiActiveOrdersRequest {
#[serde(rename = "productId", skip_serializing_if = "Option::is_none")]
product_id: Option<String>,
#[serde(rename = "protocolType", skip_serializing_if = "Option::is_none")]
protocol_type: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
ccy: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
state: Option<String>,
}
impl StakingDefiActiveOrdersRequest {
pub fn new() -> Self {
Self::default()
}
pub fn product_id(mut self, value: impl Into<String>) -> Self {
self.product_id = Some(value.into());
self
}
pub fn protocol_type(mut self, value: impl Into<String>) -> Self {
self.protocol_type = Some(value.into());
self
}
pub fn currency(mut self, value: impl Into<String>) -> Self {
self.ccy = Some(value.into());
self
}
pub fn state(mut self, value: impl Into<String>) -> Self {
self.state = Some(value.into());
self
}
}
#[derive(Debug, Clone, Default, Serialize)]
pub struct StakingDefiOrderHistoryRequest {
#[serde(rename = "productId", skip_serializing_if = "Option::is_none")]
product_id: Option<String>,
#[serde(rename = "protocolType", skip_serializing_if = "Option::is_none")]
protocol_type: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
ccy: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
after: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
before: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
limit: Option<u32>,
}
impl StakingDefiOrderHistoryRequest {
pub fn new() -> Self {
Self::default()
}
pub fn product_id(mut self, value: impl Into<String>) -> Self {
self.product_id = Some(value.into());
self
}
pub fn protocol_type(mut self, value: impl Into<String>) -> Self {
self.protocol_type = Some(value.into());
self
}
pub fn currency(mut self, value: impl Into<String>) -> Self {
self.ccy = Some(value.into());
self
}
pub fn after(mut self, value: impl Into<String>) -> Self {
self.after = Some(value.into());
self
}
pub fn before(mut self, value: impl Into<String>) -> Self {
self.before = Some(value.into());
self
}
pub fn limit(mut self, value: u32) -> Self {
self.limit = Some(value);
self
}
}