Skip to content

fix(notifications): scope events to connected wallet (#279)#418

Merged
Austinaminu2 merged 1 commit into
FlowwStar:mainfrom
brightfootlimited-collab:fix/issue-279-scope-notifications-per-wallet
Jul 26, 2026
Merged

fix(notifications): scope events to connected wallet (#279)#418
Austinaminu2 merged 1 commit into
FlowwStar:mainfrom
brightfootlimited-collab:fix/issue-279-scope-notifications-per-wallet

Conversation

@brightfootlimited-collab

Copy link
Copy Markdown
Contributor

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

…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
@Austinaminu2
Austinaminu2 merged commit 351aaa0 into FlowwStar:main Jul 26, 2026
0 of 6 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.

bug: notifications are not scoped per-wallet — users see other wallets' stream activity

2 participants