Info endpoints: userBorrowLendInterest, liquidatable - #154
Merged
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #154 +/- ##
==========================================
+ Coverage 69.72% 69.84% +0.11%
==========================================
Files 53 53
Lines 8404 8517 +113
Branches 526 531 +5
==========================================
+ Hits 5860 5949 +89
- Misses 2541 2565 +24
Partials 3 3 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Completes the borrow/lend read-side (userBorrowLendInterest joins
borrowLendUserState/borrowLendReserveState/allBorrowLendReserveStates)
and adds liquidatable risk data, wiring both through RestApi and
WebsocketApi with request-builder and response-parser tests.
userBorrowLendInterest's request/response shape and liquidatable's
{type:"liquidatable"} (no user param) request are cross-checked against
the official @nktkas/hyperliquid TS SDK source and confirmed live
against mainnet (both return an accepted, well-formed empty array for
every account tried - no populated example could be captured live, so
the populated-response field shapes are inferred from the TS SDK
source, not independently confirmed).
Closes #123
Closes #127
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018Le73N2EZjGLsCqmCScAse
Replaces the TS-SDK-derived synthetic fixture with an actual populated
entry from a real testnet account (POST /info
{"type":"userBorrowLendInterest","user":"0x6829..."}), confirming the
parser's field names/types/read-order against genuine wire data rather
than a second-hand schema.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018Le73N2EZjGLsCqmCScAse
TuxedoFish
force-pushed
the
endpoint/borrow-lend-interest-liquidatable
branch
from
September 8, 2026 12:12
c169fdb to
2392d26
Compare
This was referenced Sep 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
userBorrowLendInterest(RestApi::userBorrowLendInterest,WebsocketApi::userBorrowLendInterest) - completes the borrow/lend read-side alongside the existingborrowLendUserState/borrowLendReserveState/allBorrowLendReserveStates.liquidatable(RestApi::liquidatable,WebsocketApi::liquidatable) - liquidation-risk data useful for any trading bot/risk dashboard.RequestTypes.henum/toString/isAuthenticated,ResponseTypes.hstructs,InfoRequestBuilder,RestApiMessageParser(withvalidateStructure()first),RestEndpointListenercallbacks,RestApisync+async,WebsocketApi, tests, README coverage table, and an example extension for each.Closes #123
Closes #127
Field-shape verification (read before relying on this)
Both endpoints were probed live against mainnet (
https://api.hyperliquid.xyz/info) and testnet (https://api.hyperliquid-testnet.xyz/info):liquidatable: confirmed the request takes nouserparam -{"type":"liquidatable"}is accepted and returns[]on both networks. Passing auserfield is silently accepted but ignored (still[]). An invalidtypevalue gets a real deserialization error, confirming"liquidatable"is a recognized type. Third-party doc mirrors (quicknode/chainstack/dwellir) describe a different, single-object,user-scoped shape ({liquidatable, leverage, marginUsed, ...}) - live testing shows that's wrong; the real endpoint is a global, unauthenticated array of currently-liquidatable positions.userBorrowLendInterest: now confirmed against a real populated testnet response, not just the TS SDK (see below).userBorrowLendInterest- real testnet response (populated)This exactly matches
RestApiMessageParser::parseUserBorrowLendInterest's field names, types, and read order (time/token/borrow/supply,borrow/supplyas string-encoded numbers viaparseNumberField).tests/rest_borrow_lend_test.cpp'sParseUserBorrowLendInterestPopulatedtest now uses one of these real entries verbatim instead of a synthetic/TS-SDK-derived one.liquidatable- still no populated example foundNo account (mainnet or testnet, several plausible active/whale/HLP-vault addresses tried) returned a non-empty
liquidatablearray, so the array element shape is still taken from the official@nktkas/hyperliquidTypeScript SDK's source (src/api/info/_methods/liquidatable.ts), not independently confirmed against a live populated payload:liquidatableresponse element:{ user: string, positionIndex: { isolated: { asset: number } }, marginAvailable: [number, number] }. The upstream SDK itself flags two things as unconfirmed: a possiblecrossvariant ofpositionIndex(not modeled here - onlyisolatedis currently confirmed to exist), and the meaning of the twomarginAvailablevalues (kept as an untypedstd::array<double, 2>rather than guessing semantic names).Please double-check
liquidatable's populated-array-element shape before relying on it in a real integration, per this project's documented policy on unverified field shapes.userBorrowLendInterestno longer carries this caveat.Test plan
cmake -S . -B build -DHYPERLIQUID_WARNINGS_AS_ERRORS=ON -DHYPERLIQUID_BUILD_TESTS=ON -DHYPERLIQUID_BUILD_EXAMPLES=ON -DCMAKE_TOOLCHAIN_FILE=$VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake- configures cleancmake --build build -j12- builds with zero warnings/errorsctest --test-dir build- 28/28 test binaries pass (100%)tests/rest_borrow_lend_test.cpp(userBorrowLendInterest, now using a real testnet capture) andtests/rest_market_data_test.cpp(liquidatable), plusWebsocketApiwrapper coverage intests/websocket_api_test.cppmain(post-Info endpoints: twapHistory, userTwapSliceFillsByTime, activeAssetData #157) - README coverage count and a test-file conflict resolved, full clean rebuild/retest after rebasingbuild/removed before committing🤖 Generated with Claude Code
https://claude.ai/code/session_018Le73N2EZjGLsCqmCScAse