feat(stellar): retry + exponential backoff for Soroban RPC#28
Conversation
- Add withRetry(fn, opts) helper with 4 attempts, exponential backoff (200/400/800/1600ms ±25% jitter), and AbortSignal support - Retry on HTTP 408/429/502/503/504, TypeError (network), SyntaxError (JSON) - Skip retry on other 4xx, AbortError, and StellarRetryExhaustedError - Emit onRetry telemetry hook for future PostHog integration - Wire withRetry into all Stellar fetches in StellarSend and StellarReceive - Show 'Network unstable — try again.' + retry button on exhaustion - 16 unit tests covering all retry/no-retry paths
|
@gregemax is attempting to deploy a commit to the truthixify's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
@gregemax 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! 🚀 |
|
Closing as duplicate. Issue #2 is being handled in #15 which was opened first (currently waiting on a rebase). If #15 doesn't include the specific retry classifications you have here (your Other open Stellar Wave issues you'd be a fit for: https://github.com/wraith-protocol/demo/issues?q=is%3Aopen+label%3A%22Stellar+Wave%22 Thanks @gregemax. |
|
@truthixify i could't find any free issue to apply |
Summary
Implements task #2 — a shared retry primitive for all Stellar HTTP calls, wiring it into
StellarSendandStellarReceive.Changes
src/lib/stellar/retry.ts(new)StellarRetryExhaustedError— typed error carrying the last underlying error as.causewithRetry(fn, opts)— generic retry wrapper:TypeError(network/fetch) ·SyntaxError(JSON parse — RPC returns HTML on overload)AbortError·StellarRetryExhaustedErroritselfAbortSignalsupport — cancels cleanly mid-backoffonRetrytelemetry hook — emits{ attempt, error, delayMs }on each retry (ready for PostHog)src/lib/stellar/retry.test.ts(new)vitest+ fake timers covering every retry/no-retry pathsrc/components/StellarSend.tsxwithRetryStellarRetryExhaustedErrorcaught → shows "Network unstable — try again." + inline Retry buttonsrc/components/StellarReceive.tsxgetEventsloop, balance fetch, and withdraw fetches all wrapped withwithRetryTest results
Closes #2