Skip to content

feat: add GraphQL subscriptions for live transfer and host-fn log streams - #168

Merged
Miracle656 merged 3 commits into
Miracle656:mainfrom
collinsezedike:feat/graphql-subscriptions
Aug 27, 2026
Merged

feat: add GraphQL subscriptions for live transfer and host-fn log streams#168
Miracle656 merged 3 commits into
Miracle656:mainfrom
collinsezedike:feat/graphql-subscriptions

Conversation

@collinsezedike

Copy link
Copy Markdown
Contributor

Summary

  • Adds a Subscription type over WebSocket at /graphql/subscriptions, streaming transferAdded and hostFnLogAdded events as they're ingested, each filterable by contractId
  • Wires the indexer to emit host-fn log events alongside the existing transfer events so subscribers see both in real time
  • Adds a bounded, drop-oldest async iterator plus a bufferedAmount check on send so a slow consumer can't grow server memory unboundedly

Implementation notes

Built directly on the graphql and ws packages already in package.json rather than adding graphql-ws, using a small graphql-ws-style JSON protocol (subscribe / next / complete / error) and attaching resolvers onto a buildSchema-built schema the same way makeExecutableSchema does internally.

Files ended up under src/graphql/ (alongside the existing src/graphql/server.ts) rather than the src/api/graphql.ts / src/api/subscriptions.ts paths mentioned in the issue, to match the repo's existing GraphQL code layout.

Test plan

  • npx tsc --noEmit passes
  • npm test passes (24 suites / 244 tests, including 6 new subscription tests covering subscribe/receive, contractId filtering on both channels, unsubscribe via complete, and rapid-fire backpressure)
  • Manual verification against a live RPC-backed deployment (not done — no live Soroban RPC access in this environment)

Closes #99

@drips-wave

drips-wave Bot commented Aug 27, 2026

Copy link
Copy Markdown

@collinsezedike 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

@Miracle656
Miracle656 merged commit 262f96f into Miracle656:main Aug 27, 2026
4 checks passed
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.

GraphQL subscriptions for live transfer streams

2 participants