Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions src/info/response_structs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ use alloy::primitives::Address;

use crate::{
info::{AssetPosition, Level, MarginSummary},
DailyUserVlm, Delta, FeeSchedule, Leverage, OrderInfo, Referrer, ReferrerState,
UserTokenBalance,
ActiveStakingDiscount, DailyUserVlm, Delta, FeeSchedule, Leverage, OrderInfo, Referrer,
ReferrerState, StakingLink, TrialInfo, UserTokenBalance,
};
// NOTE: The `trial` field appears but the schema is undocumented; capture it as raw JSON for now.

#[derive(Deserialize, Debug)]
#[serde(rename_all = "camelCase")]
Expand All @@ -30,6 +31,14 @@ pub struct UserFeesResponse {
pub fee_schedule: FeeSchedule,
pub user_add_rate: String,
pub user_cross_rate: String,
pub user_spot_cross_rate: String,
pub user_spot_add_rate: String,
#[serde(default)]
pub trial: Option<TrialInfo>,
pub fee_trial_reward: String,
pub next_trial_available_timestamp: Option<u64>,
pub staking_link: Option<StakingLink>,
pub active_staking_discount: ActiveStakingDiscount,
}

#[derive(serde::Deserialize, Debug)]
Expand Down
34 changes: 34 additions & 0 deletions src/info/sub_structs.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use alloy::primitives::Address;
use serde::{Deserialize, Serialize};
use serde_json::Value;

#[derive(Deserialize, Serialize, Debug, Clone)]
#[serde(rename_all = "camelCase")]
Expand Down Expand Up @@ -83,7 +84,10 @@ pub struct DailyUserVlm {
pub struct FeeSchedule {
pub add: String,
pub cross: String,
pub spot_cross: String,
pub spot_add: String,
pub referral_discount: String,
pub staking_discount_tiers: Vec<StakingDiscountTier>,
pub tiers: Tiers,
}

Expand All @@ -105,6 +109,8 @@ pub struct Mm {
pub struct Vip {
pub add: String,
pub cross: String,
pub spot_cross: String,
pub spot_add: String,
pub ntl_cutoff: String,
}

Expand All @@ -117,6 +123,34 @@ pub struct UserTokenBalance {
pub entry_ntl: String,
}

#[derive(Deserialize, Debug, Clone)]
#[serde(rename_all = "camelCase")]
pub struct StakingLink {
#[serde(rename = "type")]
pub link_type: String,
#[serde(default)]
pub staking_user: Option<String>,
#[serde(default)]
pub trading_user: Option<String>,
}

#[derive(Deserialize, Debug)]
#[serde(rename_all = "camelCase")]
pub struct StakingDiscountTier {
pub bps_of_max_supply: String,
pub discount: String,
}

#[derive(Deserialize, Debug)]
#[serde(rename_all = "camelCase")]
pub struct ActiveStakingDiscount {
pub bps_of_max_supply: String,
pub discount: String,
}

/// The API exposes a `trial` object whose schema is not yet documented; capture it raw for now.
pub type TrialInfo = Value;

#[derive(Deserialize, Clone, Debug)]
#[serde(rename_all = "camelCase")]
pub struct OrderInfo {
Expand Down
Loading