Skip to content

feat: replace dummy candle fallback with Pyth Benchmarks (#141) and add TxStatus component (#142)#170

Merged
AbelOsaretin merged 1 commit into
SO4-Markets:mainfrom
MarvyNwaokobia:feat/pyth-benchmarks-candles-and-tx-status
May 31, 2026
Merged

feat: replace dummy candle fallback with Pyth Benchmarks (#141) and add TxStatus component (#142)#170
AbelOsaretin merged 1 commit into
SO4-Markets:mainfrom
MarvyNwaokobia:feat/pyth-benchmarks-candles-and-tx-status

Conversation

@MarvyNwaokobia
Copy link
Copy Markdown
Contributor

Summary

Resolves two issues from the Phase 9 — Shared UX & Polish milestone:


#141 — Replace dummy candle fallback with Pyth historical data

generateDummyBars() in oracle.ts has been removed and replaced with fetchPythBenchmarkCandles(), which fetches real historical OHLC data from the Pyth Benchmarks TradingView shim API.

Fallback chain is now:

  1. Binance klines (primary)
  2. GMX oracle candles (secondary)
  3. Pyth Benchmarks (tertiary — was previously random dummy bars)
  4. Empty array [] if all three fail

The function maps each supported symbol to its Crypto.{SYM}/USD Pyth feed name and converts the period string to the corresponding Benchmarks resolution (1, 5, 15, 60, 240, 1D). The from/to window is computed from limit × intervalSeconds so the number of bars matches the original request.


#142 — Create TxStatus shared component

New file: apps/web/src/shared/components/TxStatus.tsx

A self-contained React component that renders all three transaction lifecycle states via a discriminated union prop (TxStatusState):

State UI
pending Spinner + "Waiting for confirmation…"
success Checkmark + truncated hash + "View on Stellar Expert →" link (via explorerTxUrl)
failed Error icon + human-readable message via parseSorobanError

Works inside toast.custom(t => <TxStatus state={...} />) as well as inline anywhere in the component tree.

Test plan

  • Chart loads real candle history on symbols where Binance is blocked/unavailable (e.g. geo-restricted regions)
  • When all three data sources fail, the chart renders empty (no dummy bars)
  • TxStatus pending state renders spinner and copy
  • TxStatus success state shows hash, correct Stellar Expert URL, and correct network (testnet/mainnet)
  • TxStatus failed state renders a human-readable error via parseSorobanError
  • Component renders correctly inside a toast.custom Sonner toast

🤖 Generated with Claude Code

…atus component

Closes SO4-Markets#141, closes SO4-Markets#142

- Replace generateDummyBars() in oracle.ts with fetchPythBenchmarkCandles(),
  which fetches real OHLC history from the Pyth Benchmarks TradingView shim
  (https://benchmarks.pyth.network). Fallback chain is now: Binance → GMX oracle
  → Pyth Benchmarks → empty array. The dummy random bars are removed entirely.

- Create apps/web/src/shared/components/TxStatus.tsx, a shared component that
  renders the transaction lifecycle: pending (spinner), success (checkmark + hash
  + Stellar Expert link), and failed (error icon + parseSorobanError message).
  Works both inside toast.custom and as an inline component.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented May 31, 2026

@MarvyNwaokobia Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@AbelOsaretin AbelOsaretin merged commit 9754491 into SO4-Markets:main May 31, 2026
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.

#106 — Create TxStatus shared component #105 — Replace dummy candle fallback with Pyth historical data

2 participants