PHANTOM
🇮🇳 IN
Skip to content

fix(swap): convert expires_at to Unix timestamp string#162

Merged
onyb merged 1 commit intomasterfrom
f/swap/deadline-unix
Jan 7, 2026
Merged

fix(swap): convert expires_at to Unix timestamp string#162
onyb merged 1 commit intomasterfrom
f/swap/deadline-unix

Conversation

@onyb
Copy link
Member

@onyb onyb commented Jan 7, 2026

Unix timestamp format is easier to parser and more versatile across swap providers.

@onyb onyb requested a review from a team January 7, 2026 18:20
@onyb onyb self-assigned this Jan 7, 2026
Copilot AI review requested due to automatic review settings January 7, 2026 18:20
@onyb onyb enabled auto-merge (squash) January 7, 2026 18:21
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 converts the expires_at field in the SwapRoute model from a datetime object to a Unix timestamp string, making it easier to parse and more versatile across swap providers.

Key Changes:

  • Modified the SwapRoute model to change expires_at from datetime | None to str | None
  • Added conversion logic to transform the NEAR Intents deadline datetime into a Unix timestamp string
  • Updated tests to verify the timestamp format and validate the conversion

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
app/api/swap/models.py Changed expires_at field type from datetime | None to str | None and removed unused datetime import
app/api/swap/providers/near_intents/transformations.py Added logic to convert the deadline datetime to a Unix timestamp string before setting expires_at
app/api/swap/providers/near_intents/test_client.py Added comprehensive assertions to verify expires_at is a valid Unix timestamp string and matches the expected value

The implementation is clean and well-tested. The conversion properly handles None values (indicative quotes), and the test coverage includes both cases where the deadline is present (firm quotes) and absent (indicative quotes). The use of int() to truncate to seconds is appropriate for Unix timestamps.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@onyb onyb merged commit c85d326 into master Jan 7, 2026
11 checks passed
@onyb onyb deleted the f/swap/deadline-unix branch January 7, 2026 18:24
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