Skip to content

feat(wallets): add SSE-based transaction status streaming with polling fallback#1922

Draft
devin-ai-integration[bot] wants to merge 2 commits into
devin/1781045813-evm-latency-benchmarkfrom
devin/1781508967-sse-transaction-events
Draft

feat(wallets): add SSE-based transaction status streaming with polling fallback#1922
devin-ai-integration[bot] wants to merge 2 commits into
devin/1781045813-evm-latency-benchmarkfrom
devin/1781508967-sse-transaction-events

Conversation

@devin-ai-integration

Copy link
Copy Markdown
Contributor

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 — opens GET /events with Accept: text/event-stream
  • parseSSEEvents() utility — minimal frame parser for text/event-stream protocol (no external deps)
  • waitForTransaction() refactored into SSE-first with polling fallback:
    • waitForTransactionSSE() — reads streaming response, handles keepalive pings, parses terminal status
    • waitForTransactionPolling() — existing exponential backoff logic extracted as-is
    • extractTransactionResult() — shared result mapping helper
try SSE → on any error → fall back to polling (identical to current behavior)

Test plan

  • Verified @crossmint/wallets-sdk builds successfully with pnpm build --filter @crossmint/wallets-sdk
  • Lint passes with no new errors
  • SSE fallback tested by design: any non-200 response or missing body triggers immediate fallback to existing polling
  • Existing polling behavior is byte-for-byte identical (extracted into its own method without modification)

Package updates

  • @crossmint/wallets-sdk: patch — Added changeset via .changeset/sse-transaction-events.md

Link to Devin session: https://crossmint.devinenterprise.com/sessions/593844b7bb004442887304cc3ee03d4c

daniil-dovgal and others added 2 commits June 15, 2026 07:39
- 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>
@devin-ai-integration

Copy link
Copy Markdown
Contributor Author
Original prompt from daniil.dovgal

@Paella-Labs/crossbit-main
@Crossmint/crossmint-sdk

The current flow:
User calls SDK.create-transaction => sdk calls /create-transaction api => api => starts temporal workflow => sends tx onchain.
Sdk pools transaction status(with exponential backoff) from mongoDB.

The pooling adds latency for the response.

We have to make sure that api would send even back to the client(sdk)

2 Options
1)Ws connection - probably bad solution(unless we're following same pattern at other parts of our code)
2)Server Side Events - this is the right approach, we want only to return if tx ? succesfull : error response.

I want from you to find sdk files with pooling (EVM,SVM, Stellar).
Also if crossmint used SSE?

After that I want to see an estimated file change for enabling SEE, additionally we have to make sure that connection would be established between sdk <=> api. We cannot establish it with temporal, since worker slots cannot be blocked during the "connection"

@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR that start with 'DevinAI' or '@devin'.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

@changeset-bot

changeset-bot Bot commented Jun 15, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: ae48521

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 9 packages
Name Type
@crossmint/wallets-sdk Patch
@crossmint/wallets-quickstart-devkit Patch
@crossmint/wallets-playground-react Patch
@crossmint/client-sdk-react-base Patch
@crossmint/client-sdk-react-native-ui Patch
@crossmint/client-sdk-react-ui Patch
@crossmint/wallets-playground-expo Patch
@crossmint/auth-ssr-nextjs-demo Patch
@crossmint/client-sdk-nextjs-starter Patch

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

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.

1 participant