Skip to content

fix: Flash V2 API serves at root, not /v2 (fixes markets 404) - #2

Merged
Kaleb-Rupe merged 1 commit into
mainfrom
fix/flash-api-base-root
Jul 7, 2026
Merged

Kaleb-Rupe merged 1 commit into
mainfrom
fix/flash-api-base-root

Conversation

@Kaleb-Rupe

Copy link
Copy Markdown
Collaborator

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 root flashapi.trade/*. The old /v2 paths now 404, but the SDK's default apiBase still carried the /v2 suffix, so every read (prices, tokens, owner, pool-data) failed.

Fix

  • packages/flash-v2/src/network.ts — default apiBase → 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.)
  • examples + docs — strip the stale /v2 from env-example hints, READMEs, AGENTS.md, llms.txt/llms-full.txt, and endpoint-path comments.

Verification (against the live API)

Path root /v2
/prices 200 ✅ 404
/tokens 200 ✅ 404
/owner/{pubkey} 200 ✅ 404
/pool-data 200 ✅ 404

All 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 /v2 is 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, custody tokenMint→mint, maxInitialLeverage→maxInitLeverage, and the spread model changed from per-side Long/Short to Min/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-chain Pricing semantics — tracked separately. This PR only restores the base URL so reads succeed.

🤖 Generated with Claude Code

https://claude.ai/code/session_018mbtvTiYt1YDqKKfrVvjUu

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
@Kaleb-Rupe
Kaleb-Rupe merged commit 143a9a7 into main Jul 7, 2026
1 check passed
@Kaleb-Rupe
Kaleb-Rupe deleted the fix/flash-api-base-root branch July 7, 2026 05:19
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.

1 participant