Skip to content

feat: error report, low reserve alert, balance refetch, realtime stream - #823

Merged
Jaydbrown merged 1 commit into
conduit-protocol:mainfrom
Gbemi-programmer:feat/error-report-reserve-balance-realtime-755-758
Oct 18, 2026
Merged

Jaydbrown merged 1 commit into
conduit-protocol:mainfrom
Gbemi-programmer:feat/error-report-reserve-balance-realtime-755-758

Conversation

@Gbemi-programmer

Copy link
Copy Markdown
Contributor

Closes #758
Closes #757
Closes #756
Closes #755

Changes

#758 Error page: troubleshooting steps and copyable error report

  • New lib/error-report.ts:
    • categorizeError() sorts an error into network, wallet, contract or unknown.
    • Each category has its own troubleshooting suggestions.
    • buildErrorReport() builds a report with the error message, digest, URL, user agent and stack trace.
  • app/error.tsx shows the suggestions for the error's category and adds a Copy Error Report button.

#757 Low native XLM reserve alert

  • New hooks/useWalletBalance.ts:
    • Fetches the native balance from Horizon using queryKeys.wallet.balance(address).
    • Exposes isLowReserve, which is true when the balance is below 2.0 XLM.

#756 Refetch token balance after deposit

  • New hooks/useTokenBalance.ts:
    • useTokenBalance uses the query key ['tokenBalance', address, token].
    • invalidateTokenBalance() invalidates that key.
  • app/create/page.tsx calls invalidateTokenBalance() after a stream is created, so the displayed balance updates straight away.

#755 Realtime stream updates

  • New hooks/useStreamRealtime.ts:
    • useStreamRealtime(streamId) opens a Horizon server-sent events stream (/accounts/{id}/operations?cursor=now) and invalidates that stream's queries on every event. Horizon has no /events endpoint for contracts, so this endpoint is used instead.
    • It does nothing when Horizon or EventSource is unavailable, so the existing polling stays as the fallback.

Tests

  • lib/error-report.test.ts: error categories and report contents.
  • hooks/__tests__/balanceHooks.test.tsx: the 2 XLM threshold, isLowReserve from a mocked Horizon response, and a refetch after invalidation.
  • hooks/__tests__/useStreamRealtime.test.tsx: the stream URL, invalidation on each event, closing on unmount, and no stream when there is no id.
  • npx vitest run on these files and app/create: 34 passed.
  • tsc shows no errors in the changed files. eslint is clean except for one exhaustive-deps warning in app/create/page.tsx that is already on main.

Notes

main already has failing tests in unrelated files. This PR does not touch them.

@drips-wave

drips-wave Bot commented Oct 18, 2026

Copy link
Copy Markdown

@Gbemi-programmer 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

@Jaydbrown
Jaydbrown merged commit 617f920 into conduit-protocol:main Oct 18, 2026
2 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment