Repository navigation
fix: align token/custody field names with live API (renders predict odds) - #4
Merged
Merged
Conversation
…redict odds) Second half of the API-version divergence (follows the /v2->root fix). The live Flash V2 API renamed fields the vendored SDK + all three apps still read under the old names, so every read returned undefined at runtime and the predict market cards were stuck on the loading skeleton (limits never built). Only compiled because the SDK type lied about the shape. Renames (verified against flashapi.trade this change targets): - TokenInfo.mintKey -> mint (packages/flash-v2 type + all consumers) - custody account.tokenMint -> mint (hooks.ts custody parse only; the deposit/withdraw REQUEST field stays tokenMint, confirmed in the live DepositDirectDto/RequestWithdrawalDto — funds.ts/lifecycle.ts untouched) - pricing.minInitialLeverage/maxInitialLeverage -> minInitLeverage/maxInitLeverage - pricing.tradeSpreadLong/tradeSpreadShort (per-side, gone) -> tradeSpreadMin (the base spread), and the SCALE changed: /10_000 -> /1_000_000 The spread scale was derived empirically, not guessed: quoting real positions via /transaction-builder/open-position (owner omitted) gives an effective fill spread of entry/oracle-1 that matches tradeSpreadMin/1e6 exactly on SOL (0.010%), BTC (0.010%) and ETH (0.020%), and grows toward tradeSpreadMax with size. The old code's /1e4 was 100x too large. Verified end-to-end against the live API by running the real headlineMarket engine with live-derived limits: limits build, odds render sane (SOL 55/45, BTC 59/41, ETH 77/23), spread matches the live quote. All four packages typecheck clean. Fixes the collateral-mint (usdc.mint) path used by deposit/withdraw across all three apps as a side effect. Refs the tracking issue. 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.
Follow-up to #2 (now merged). #2 restored the base reads; the predict market cards were still stuck on the loading skeleton because the live API also renamed fields the SDK + all three apps read under old names —
undefinedat runtime (compiles only because the SDK type lied about the shape).Renames (verified against the live API)
TokenInfo.mintKeymintaccount.tokenMintminthooks.tscustody parse only*pricing.minInitialLeverage/maxInitialLeverageminInitLeverage/maxInitLeveragepricing.tradeSpreadLong/tradeSpreadShort(per-side, gone)tradeSpreadMin(base spread)/10_000/1_000_000*The deposit/withdraw request field stays
tokenMint(confirmed in the liveDepositDirectDto/RequestWithdrawalDto) —funds.ts/lifecycle.tsuntouched.The spread was derived empirically, not guessed
Quoting real positions via
/transaction-builder/open-position(owner omitted): effective fill spreadentry/oracle − 1matchestradeSpreadMin / 1e6exactly — SOL 0.010%, BTC 0.010%, ETH 0.020% — and grows towardtradeSpreadMaxwith size. The old/1e4was 100× too large.Verification (end-to-end, live)
Ran the real
headlineMarketengine with live-derived limits:All four packages (
flash-v2,predict,tap-trade,copy-trade) typecheck clean. Also fixes the collateral-mint (usdc.mint) deposit/withdraw path in all three apps.Closes #3.
🤖 Generated with Claude Code
https://claude.ai/code/session_018mbtvTiYt1YDqKKfrVvjUu