Skip to content

feat: add topic-based filtering to the intents WebSocket gateway - #161

Open
Phantomcall wants to merge 2 commits into
stellar-vortex-protocol:mainfrom
Phantomcall:feature/ws-topic-subscriptions
Open

feat: add topic-based filtering to the intents WebSocket gateway#161
Phantomcall wants to merge 2 commits into
stellar-vortex-protocol:mainfrom
Phantomcall:feature/ws-topic-subscriptions

Conversation

@Phantomcall

Copy link
Copy Markdown

Adds topic-based subscription filtering to the IntentsGateway so clients can receive only events for chains they care about.

Changes

Modified File: src/intents/intents.gateway.ts

  • Changed subscribers from Set<WebSocket> to Map<WebSocket, SubscriberFilter> to track per-subscriber chain filters
  • Added handleMessage private method that processes incoming WebSocket messages
  • Clients can send { type: "subscribe", chains: ["stellar"] } after connecting to filter events
  • broadcast() now checks each subscriber's filter before sending; events without a matching chain are skipped
  • Added getEventChain() helper that resolves the chain from events (looks up srcChain from intent objects for events that only have intentId)

Modified File: scripts/solver-bot.ts

  • Added SOLVER_CHAINS environment variable (defaults to all supported chains)
  • Bot subscribes to configured chains after connecting via { type: "subscribe", chains: [...] }
  • Bot skips intents on non-subscribed chains in tryFillOpenIntent()

Verification

  • npm run lint passes
  • npm run typecheck passes
  • npm test passes
  • npm run test:e2e passes

Closes #79

- Track per-subscriber chain filters in a Map<WebSocket, SubscriberFilter>
- Clients can send { type: 'subscribe', chains: ['stellar'] } after connecting
- broadcast() filters events by subscriber's chain filter, looking up
  srcChain from intent objects for events that only have intentId
- solver-bot.ts now subscribes to configured chains and skips intents
  on non-subscribed chains
@drips-wave

drips-wave Bot commented Jul 28, 2026

Copy link
Copy Markdown

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

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.

Add topic-based subscriptions to the WebSocket gateway

1 participant