Skip to content

feat: Bridge quotestream token warning events#8198

Open
infiniteflower wants to merge 10 commits intomainfrom
bridge-quotestream-token-warning-events
Open

feat: Bridge quotestream token warning events#8198
infiniteflower wants to merge 10 commits intomainfrom
bridge-quotestream-token-warning-events

Conversation

@infiniteflower
Copy link
Contributor

@infiniteflower infiniteflower commented Mar 12, 2026

Explanation

The bridge-api SSE quote stream (getQuoteStream) now emits token_warning events alongside quote events. These warnings come from Blockaid security scanning of the destination token and contain information like whether a token is a honeypot or has unstable pricing.

Previously, fetchBridgeQuoteStream ignored the SSE event: name and attempted to validate every message as a quote response. This meant token_warning events were silently dropped (or caused spurious validation failures).

This PR:

  • Adds event routing in fetchBridgeQuoteStream — only quote events go through quote validation, token_warning events are validated separately via a new superstruct schema and routed to a dedicated handler, and all other event types are skipped.
  • Adds a tokenWarnings: TokenFeature[] field to BridgeControllerState, populated from the SSE stream and cleared on reset / new quote fetch.
  • Renames onValidationFailure to onQuoteValidationFailure and #trackResponseValidationFailures to #trackQuoteValidationFailures for clarity now that there are multiple event types.
  • Exports TokenFeature type and TokenFeatureType enum for use by clients.
Screenshot 2026-03-18 at 5 03 24 PM

References

  • Related to bridge-api token warning implementation in va-mmcx-bridge-api-1

Checklist

  • I've updated the test suite for new or updated code as appropriate
  • I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
  • I've communicated my changes to consumers by updating changelogs for packages I've changed
  • I've introduced breaking changes in this PR and have prepared draft pull requests for clients and consumer packages to resolve them

Note

Medium Risk
Changes the SSE quote-stream parsing/handlers and BridgeControllerState, which can affect quote loading behavior and downstream consumers that assume only quote events or a fixed state shape.

Overview
Adds support for token_warning events in the bridge-api SSE quote stream by routing events by event: name in fetchBridgeQuoteStream (quotes are validated/processed separately from warnings).

BridgeControllerState now includes tokenWarnings, which is reset on new quote requests and resetState, populated via a new onTokenWarning stream handler, and exposed via new exported TokenFeature/TokenFeatureType types. Quote validation failure handling is renamed to onQuoteValidationFailure/#trackQuoteValidationFailures, and tests/snapshots are updated with a warning-capable SSE mock.

Written by Cursor Bugbot for commit 48b28d5. This will update automatically on new commits. Configure here.

@infiniteflower infiniteflower changed the title Bridge quotestream token warning events feat: Bridge quotestream token warning events Mar 12, 2026
@infiniteflower infiniteflower force-pushed the bridge-quotestream-token-warning-events branch from 881e93d to 6d8a822 Compare March 18, 2026 21:06
@infiniteflower infiniteflower marked this pull request as ready for review March 18, 2026 21:07
@infiniteflower infiniteflower requested review from a team as code owners March 18, 2026 21:07
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