Skip to content

Commit

Permalink
wip: normalizing stargate dex responses
Browse files Browse the repository at this point in the history
  • Loading branch information
sotnikov-s committed Dec 1, 2023
1 parent 2666e97 commit 5a8bcfd
Showing 1 changed file with 1 addition and 22 deletions.
23 changes: 1 addition & 22 deletions packages/neutron-sdk/src/stargate/types_dex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ pub struct AllTickLiquidityRequest {

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
pub struct AllTickLiquidityResponse {
pub tick_liquidity: Vec<TickLiquidity>,
pub tick_liquidity: Vec<Liquidity>,
pub pagination: Option<PageResponse>,
}

Expand Down Expand Up @@ -464,7 +464,6 @@ impl From<DepositOptions> for DepositOptionsGen {
}

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub struct Params {
pub fee_tiers: Vec<Uint64>,
pub max_true_taker_spread: String,
Expand Down Expand Up @@ -499,7 +498,6 @@ impl TryFrom<i32> for LimitOrderType {
}

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub struct LimitOrderTrancheUser {
pub trade_pair_id: TradePairID,
pub tick_index_taker_to_maker: Int64,
Expand All @@ -512,15 +510,13 @@ pub struct LimitOrderTrancheUser {
}

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub struct LimitOrderTrancheKey {
pub trade_pair_id: TradePairID,
pub tick_index_taker_to_maker: Int64,
pub tranche_key: String,
}

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub struct LimitOrderTranche {
pub key: LimitOrderTrancheKey,
pub reserves_maker_denom: Int128,
Expand All @@ -532,7 +528,6 @@ pub struct LimitOrderTranche {
}

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub struct DepositRecord {
pub pair_id: PairID,
pub shares_owned: Int128,
Expand All @@ -543,28 +538,18 @@ pub struct DepositRecord {
}

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema, Default)]
#[serde(rename_all = "snake_case")]
pub struct PairID {
pub token0: String,
pub token1: String,
}

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub struct TickLiquidity {
#[serde(rename = "Liquidity")]
pub liquidity: Liquidity,
}

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum Liquidity {
PoolReserves(PoolReserves),
LimitOrderTranche(LimitOrderTranche),
}

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub struct PoolReserves {
pub key: PoolReservesKey,
pub reserves_maker_denom: Int128,
Expand All @@ -573,32 +558,26 @@ pub struct PoolReserves {
}

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub struct PoolReservesKey {
pub trade_pair_id: TradePairID,
pub tick_index_taker_to_maker: Int64,
pub fee: Option<Uint64>,
}

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub struct TradePairID {
pub maker_denom: String,
pub taker_denom: String,
}

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub struct Pool {
#[serde(default)]
pub id: Uint64,
pub lower_tick0: Option<PoolReserves>,
pub lower_tick1: Option<PoolReserves>,
}

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema, Default)]
#[serde(rename_all = "snake_case")]
#[serde(default)]
pub struct PoolMetadata {
pub id: Uint64,
pub tick: Int64,
Expand Down

0 comments on commit 5a8bcfd

Please sign in to comment.