fix(sdks): use outcomeId in GET query for fetchOHLCV/fetchTrades#1162
Merged
Conversation
SDKs were sending '?id=...' for GET reads, but server method-verbs spec defines the first arg as 'outcomeId'. The GET dispatcher uses spec names to peel primitive args, then bundles every other query key into the object arg. So outcomeId arrived as undefined and the raw key 'id' ended up inside params. fromMarketId(undefined) crashed with 'Cannot read properties of undefined (reading match)'. POST path was unaffected because it sends positional args directly. Also: default HL fetchOHLCV params to a benign value so the build fix from #1161 type-checks (resolution is required on OHLCVParams). Verified locally against npm run server with both Python and TS SDKs: fetch_markets, fetch_events, fetch_order_book, fetch_ohlcv, fetch_trades all return data for exchange='hyperliquid'.
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
?id=...for GET reads, but the server'smethod-verbs.jsonspec forfetchOHLCVandfetchTradesdeclares the first positional arg asoutcomeId. The GET dispatcher (queryToArgsincore/src/server/app.ts) peels primitive args by spec name, then bundles every remaining query key into the object arg. Result:outcomeIdarrivedundefined, and the raw keyidended up insideparams. DownstreamfromMarketId(undefined)crashed withCannot read properties of undefined (reading 'match').args: [outcomeId, params]directly), which is whyfetchOrderBooketc. never tripped.fetchOHLCVparamsto{ resolution: '1h' }so the typecheck from fix(hyperliquid): default fetchOHLCV params to {} #1161 passes (resolutionis required onOHLCVParams).Verified locally
Started
npm run server --workspace=pmxt-coreon port 3847, then ran both SDKs:Python SDK:
TypeScript SDK:
All for
exchange='hyperliquid'.Test plan
resolution; this PR fixes that too)fetchOHLCV/fetchTradescalls succeed with named params for any venue, not just HLNote on hosted MCP
The original failures I saw via the hosted MCP (
fetchMarkets/fetchEventsreturning[]for HL) do not reproduce locally against currentmain. Likely hosted-server version drift. Not in scope for this PR.