fix(notifications): scope events to connected wallet (#279)#418
Merged
Austinaminu2 merged 1 commit intoJul 26, 2026
Conversation
…ar#279 fetchContractEvents filtered Soroban events only by contractIds, so every connected wallet received notifications for streams belonging to unrelated users — a privacy/information-leak. Fix: after fetching raw events, call fetchStreamsForAddress for the connected address to build sentIds and receivedIds sets, then only surface a notification when the event's stream_id is in the matching set: - StreamCreatedEvent -> only if wallet is recipient - CancelEvent -> only if wallet is recipient - WithdrawEvent -> only if wallet is sender Events whose stream_id does not belong to the connected wallet are silently dropped, so counterparty addresses, amounts, and timing are no longer observable via the notification feed. Closes FlowwStar#279
brightfootlimited-collab
had a problem deploying
to
staging
July 26, 2026 16:21 — with
GitHub Actions
Failure
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem etchContractEvents (hooks/use-notifications.ts) filtered incoming Soroban events only by contractIds, with no per-wallet scoping. Since the contract emits one shared event stream, every connected wallet received notifications for streams belonging to unrelated users — exposing counterparty addresses, amounts, and timing. Fixes #279 ## Root cause The polling loop fetched all contract events and fired a notification for every StreamCreatedEvent, WithdrawEvent, and CancelEvent without checking whether the connected wallet was actually a party to the stream. ## Fix After receiving raw events, call etchStreamsForAddress for the connected address to build two sets: - sentIds — stream IDs where the wallet is the sender -
eceivedIds — stream IDs where the wallet is the recipient Then gate each notification on membership in the correct set: | Event | Condition | |---|---| | StreamCreatedEvent |
eceivedIds.has(streamId) | | CancelEvent |
eceivedIds.has(streamId) | | WithdrawEvent | sentIds.has(streamId) | Events whose stream_id does not belong to the connected wallet are silently dropped. ## Changes - hooks/use-notifications.ts — add decodeEventStreamId helper to extract stream_id from event XDR payload; add etchStreamsForAddress cross-reference before surfacing any notification