Repository navigation
fix: Flash V2 API serves at root, not /v2 (fixes markets 404) - #2
Merged
Merged
Conversation
The hosted Flash V2 API moved from flashapi.trade/v2/* to the root flashapi.trade/*; the old /v2 paths now 404. The SDK's default apiBase still carried the /v2 suffix, so every read (prices, tokens, owner, pool-data) failed. The predict app showed "Couldn't load markets: [http-other] /prices"; tap-trade and copy-trade silently 404'd on the same default. - packages/flash-v2: default apiBase -> https://flashapi.trade (no suffix). The owner WebSocket derives its URL from the same base, so it is fixed too. Env override already normalizes a trailing slash. - examples + docs: strip the stale /v2 from env hints, READMEs, AGENTS.md, llms.txt/llms-full.txt, and endpoint-path comments. Verified against the live API this change targets: /prices, /tokens, /owner/{pubkey}, /pool-data all return 200 at root; every /v2/* returns 404. Left intentionally unchanged: - fstats.io/v2/api/v1 (copy-trade leaderboard) is a different API where /v2 is correct. - openapi.v2.json is a generated spec; regenerate from the live server. Scope note: a deeper API-contract divergence remains (token field mintKey->mint, custody leverage/spread field renames) that keeps the predict odds in a skeleton state. Tracked separately; this change only restores the base URL so reads succeed. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018mbtvTiYt1YDqKKfrVvjUu
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.
Problem
The predict app showed "Couldn't load markets: [http-other] /prices" and the console logged
GET https://flashapi.trade/v2/prices 404. tap-trade and copy-trade hit the same dead default silently.Root cause: the hosted Flash V2 API moved from
flashapi.trade/v2/*to the rootflashapi.trade/*. The old/v2paths now 404, but the SDK's defaultapiBasestill carried the/v2suffix, so every read (prices, tokens, owner, pool-data) failed.Fix
packages/flash-v2/src/network.ts— defaultapiBase→https://flashapi.trade(no suffix). The owner WebSocket derives its URL from the same base, so it's fixed too. (The env override already normalizes a trailing slash.)/v2from env-example hints, READMEs,AGENTS.md,llms.txt/llms-full.txt, and endpoint-path comments.Verification (against the live API)
/v2/prices/tokens/owner/{pubkey}/pool-dataAll four example apps + the SDK package typecheck clean. Ran locally: predict now renders the market grid with live prices (banner gone).
Left intentionally unchanged
fstats.io/v2/api/v1(copy-trade leaderboard) — a different API where/v2is correct.openapi.v2.json— generated spec; regenerate from the live server.Known follow-up (not in this PR)
A deeper API-contract divergence remains: the live API also renamed fields (
token.mintKey→mint, custodytokenMint→mint,maxInitialLeverage→maxInitLeverage, and the spread model changed from per-sideLong/ShorttoMin/Max). This keeps the predict odds in a skeleton state and affects the collateral-mint/deposit path across all three apps. The spread remap is fund-critical and needs Flash's current on-chainPricingsemantics — tracked separately. This PR only restores the base URL so reads succeed.🤖 Generated with Claude Code
https://claude.ai/code/session_018mbtvTiYt1YDqKKfrVvjUu