Skip to content
Merged
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
27 changes: 27 additions & 0 deletions src/hypercore/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -851,6 +851,8 @@ pub struct PerpMarket {
pub growth_mode: bool,
/// Whether the quote token is aligned for this market
pub aligned_quote_token: bool,
/// Whether this market is delisted
pub delisted: bool,
/// Price tick configuration for valid price increments
pub table: PriceTick,
}
Expand Down Expand Up @@ -1690,6 +1692,7 @@ pub async fn perp_markets(
deployer_fee_scale: perp.deployer_fee_scale,
growth_mode: perp.growth_mode,
aligned_quote_token: perp.aligned_quote_token,
delisted: perp.delisted,
table: PriceTick::for_perp(perp.sz_decimals),
}
})
Expand Down Expand Up @@ -1843,6 +1846,8 @@ struct PerpUniverseItem {
growth_mode: bool,
#[serde(default, alias = "isAlignedQuoteToken", alias = "isQuoteTokenAligned")]
aligned_quote_token: bool,
#[serde(default, alias = "isDelisted")]
delisted: bool,
// margin_table_id: u64,
}

Expand Down Expand Up @@ -2118,6 +2123,28 @@ mod tests {
assert!(!spots.is_empty());
}

#[tokio::test]
async fn test_http_delisted_markets() {
let exp = [
(0, "BTC", false),
(1, "ETH", false),
(3, "MATIC", true),
(5, "SOL", false),
(30, "MKR", true),
(66, "TON", true),
];

let client = hypercore::mainnet();
let perps = client.perps().await.unwrap();

for (index, name, delisted) in exp {
let market = perps.get(index).unwrap();
assert_eq!(market.index, index);
assert_eq!(market.name, name);
assert_eq!(market.delisted, delisted);
}
}

#[test]
fn test_nonce_handler_uniqueness_single_thread() {
let handler = NonceHandler::default();
Expand Down