feat: define swap QuoteResponse V2 schema validators - #9724
Open
micaelae wants to merge 4 commits into
Open
Conversation
This reverts commit 158b79f.
schema
micaelae
marked this pull request as ready for review
July 31, 2026 04:36
micaelae
enabled auto-merge
July 31, 2026 04:36
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit e9fc1d7. Configure here.
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.

Explanation
Implements schema definitions and validators based on this ADR: https://github.com/MetaMask/decisions/blob/main/decisions/trading/0057-swap-bridge-quote-metadata-migration.md
References
Checklist
Note
Medium Risk
Introduces new quote/asset validation contracts for swap-bridge migration without switching the live fetch path yet; export relocation of
BridgeAssetmay affect consumers that imported it fromtypes.Overview
Adds superstruct schemas and
validateQuoteResponsefor the ADR-aligned QuoteResponse V2 shape, alongside existing V1 (validateQuoteResponseV1/QuoteResponseV1exports are unchanged for controller state and fetch).V2 quotes use
AmountsAndAssetfor src/dest and fee line items,QuoteSchemaV2(nestedpriceData, array-basedfeeData, requiredprotocols), andStepSchemaV2.BridgeAssetV2/MinimalAssetadd CAIP-centric assets with optional security metadata; legacyBridgeAssetmoves tovalidators/bridge-asset.jsand is marked deprecated.Package exports now include
validateQuoteResponse,validateBridgeAssetV2, and related schemas/types. Internal imports were updated to pullBridgeAssetfrom the validator module. Test fixtures use lowercase EVM addresses; Stellar CAIP formatting no longer special-cases testnet informatChainIdToCaip.Reviewed by Cursor Bugbot for commit e9fc1d7. Bugbot is set up for automated code reviews on this repo. Configure here.