feat(wallets): add SSE-based transaction status streaming with polling fallback#1922
Conversation
- Add streamTransactionEvents() to API client for SSE connection - Add minimal SSE frame parser (no external deps) - Refactor waitForTransaction() to try SSE first, fallback to polling - Extract polling into waitForTransactionPolling() for clarity - Extract result mapping into extractTransactionResult() helper - Existing polling behavior preserved as fallback when SSE unavailable Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Original prompt from daniil.dovgal
|
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
🦋 Changeset detectedLatest commit: ae48521 The changes in this PR will be included in the next version bump. This PR includes changesets to release 9 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Description
Adds SSE (Server-Sent Events) consumer to
waitForTransaction()for real-time transaction status updates, eliminating exponential backoff polling latency. Existing polling is preserved as automatic fallback.Changes:
streamTransactionEvents()in API client — opensGET /eventswithAccept: text/event-streamparseSSEEvents()utility — minimal frame parser fortext/event-streamprotocol (no external deps)waitForTransaction()refactored into SSE-first with polling fallback:waitForTransactionSSE()— reads streaming response, handles keepalive pings, parses terminal statuswaitForTransactionPolling()— existing exponential backoff logic extracted as-isextractTransactionResult()— shared result mapping helperTest plan
@crossmint/wallets-sdkbuilds successfully withpnpm build --filter @crossmint/wallets-sdkPackage updates
@crossmint/wallets-sdk: patch — Added changeset via.changeset/sse-transaction-events.mdLink to Devin session: https://crossmint.devinenterprise.com/sessions/593844b7bb004442887304cc3ee03d4c