-
Notifications
You must be signed in to change notification settings - Fork 2
feat(swap): simplify status endpoint response format #167
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR simplifies the swap status endpoint by removing detailed transaction information from the response and moving source/destination metadata to the request. The changes streamline the API contract by having clients provide what they already know (source/destination coins/chains) and receive only essential status information.
Changes:
- Simplified
SwapStatusResponseto only includestatus,internal_status, andexplorer_urlfields - Added source/destination coin and chain fields to
SwapStatusRequest - Removed
SwapDetailsandSwapTransactionDetailsmodel classes that are no longer needed - Simplified
NearIntentsStatusResponseto only include status field - Updated
from_near_intents_statustransformation to use request data instead of performing token lookups
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| app/api/swap/models.py | Removed SwapDetails and SwapTransactionDetails classes; simplified SwapStatusResponse from extending SwapSupportRequest to SwapBaseModel with only 3 fields; added source/destination metadata to SwapStatusRequest |
| app/api/swap/providers/near_intents/models.py | Simplified NearIntentsStatusResponse to only include status field, removing quote_response, updated_at, and swap_details |
| app/api/swap/providers/near_intents/transformations.py | Removed unused imports and helper function; simplified from_near_intents_status to accept request instead of supported_tokens |
| app/api/swap/providers/near_intents/client.py | Updated get_status to pass request instead of fetching supported_tokens |
| app/api/swap/providers/near_intents/test_client.py | Updated all tests to include new required fields in SwapStatusRequest; updated assertions to check new response format |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| mock_response.json.return_value = { | ||
| "quoteResponse": { | ||
| "quoteRequest": MOCK_QUOTE_REQUEST, | ||
| "quote": MOCK_FIRM_QUOTE, | ||
| "quote": { | ||
| **MOCK_FIRM_QUOTE, | ||
| "depositAddress": "4Rqnz7SPU4EqSUravxbKTSBti4RNf1XGaqvBmnLfvH83", | ||
| }, | ||
| }, | ||
| "status": "SUCCESS", | ||
| "updatedAt": "2025-12-11T13:48:50.883000Z", |
Copilot
AI
Jan 19, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The mock response includes fields that are no longer part of the NearIntentsStatusResponse model. The model now only expects a 'status' field. The extra fields 'quoteResponse', 'updatedAt', and 'swapDetails' should be removed from the mock to keep the test data aligned with the actual model structure and improve test maintainability.
| "quoteRequest": MOCK_QUOTE_REQUEST, | ||
| "quote": MOCK_INDICATIVE_QUOTE, | ||
| }, | ||
| "status": "PENDING", | ||
| "status": "PENDING_DEPOSIT", | ||
| "updatedAt": "2025-12-11T13:48:50.883000Z", | ||
| "swapDetails": {}, | ||
| } |
Copilot
AI
Jan 19, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The mock response includes fields that are no longer part of the NearIntentsStatusResponse model. The model now only expects a 'status' field. The extra fields 'quoteResponse', 'updatedAt', and 'swapDetails' should be removed from the mock to keep the test data aligned with the actual model structure and improve test maintainability.
We remove fields that are not needed by brave-core. This makes the endpoint more resilient to API contract changes.