Skip to content

Conversation

@llvm-x86
Copy link
Contributor

…contexts (includes mark price, current funding, open interest, etc.)`

llvm-x86 added 4 commits May 14, 2025 18:28
…contexts (includes mark price, current funding, open interest, etc.)`
Introduce `AssetContext` and `MetaAndAssetCtxs` as generic
versions of `SpotAssetContext` and `SpotMetaAndAssetCtxs` respectively.
These new types allow for more flexible handling of metadata and
context for various asset types beyond spot.

The `AssetMeta` struct is enhanced with `max_leverage` and
`only_isolated` fields to better describe diverse asset
characteristics, such as those for perpetual contracts.

These changes facilitate broader asset type support within the system.
The `meta_and_asset_contexts` method in `InfoClient` now returns `Result<Vec<MetaAndAssetCtxs>>` instead of `Result<Vec<Meta>>`.

This change aligns the function's return type with the actual data structure provided by the corresponding API endpoint, which includes both metadata and asset contexts. This improves type safety and ensures clients receive the complete expected information.
Modify `meta_and_asset_contexts` to return `(Meta, Vec<AssetContext>)`.
This change enhances robustness by deserializing `AssetContext`
entries individually from raw JSON values, skipping any that fail.
Previously, a single malformed context could cause the entire
`MetaAndAssetCtxs` request to fail.

Additionally, removed `#[allow(dead_code)]` attributes from
`MetaAndAssetCtxs` enum variants and related structs in `meta.rs`
as part of this refinement.
@llvm-x86 llvm-x86 requested a review from lmlmt July 6, 2025 22:52
@llvm-x86
Copy link
Contributor Author

llvm-x86 commented Jul 6, 2025

error: 'cargo-fmt' is not installed for the toolchain 'nightly-x86_64-unknown-linux-gnu'.
To install, run rustup component add --toolchain nightly-x86_64-unknown-linux-gnu rustfmt

@lmlmt lmlmt merged commit 9f7c0cd into hyperliquid-dex:master Jul 8, 2025
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants