Skip to content

Conversation

@onyb
Copy link
Member

@onyb onyb commented Jan 19, 2026

We remove fields that are not needed by brave-core. This makes the endpoint more resilient to API contract changes.

@onyb onyb requested a review from a team January 19, 2026 18:42
@onyb onyb self-assigned this Jan 19, 2026
Copilot AI review requested due to automatic review settings January 19, 2026 18:42
@onyb onyb enabled auto-merge (squash) January 19, 2026 18:44
Copy link
Contributor

Copilot AI left a 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 SwapStatusResponse to only include status, internal_status, and explorer_url fields
  • Added source/destination coin and chain fields to SwapStatusRequest
  • Removed SwapDetails and SwapTransactionDetails model classes that are no longer needed
  • Simplified NearIntentsStatusResponse to only include status field
  • Updated from_near_intents_status transformation 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.

Comment on lines 1098 to 1107
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",
Copy link

Copilot AI Jan 19, 2026

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.

Copilot uses AI. Check for mistakes.
Comment on lines 1173 to 1179
"quoteRequest": MOCK_QUOTE_REQUEST,
"quote": MOCK_INDICATIVE_QUOTE,
},
"status": "PENDING",
"status": "PENDING_DEPOSIT",
"updatedAt": "2025-12-11T13:48:50.883000Z",
"swapDetails": {},
}
Copy link

Copilot AI Jan 19, 2026

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.

Copilot uses AI. Check for mistakes.
@onyb onyb merged commit 40ba307 into master Jan 19, 2026
11 checks passed
@onyb onyb deleted the simplify-status-endpoint branch January 19, 2026 21:04
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.

3 participants