Skip to content

Conversation

@SimSef
Copy link
Contributor

@SimSef SimSef commented May 22, 2025

Return cursor None, instead of a number, unisat cursor works like an offset and not another page, meaning chaingate throws an error of supplying the same cursor each time.

@SimSef SimSef self-assigned this May 22, 2025
@SimSef SimSef requested review from Copilot and ladovina May 22, 2025 11:57
Copy link

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 updates Unisat API pagination by always using a fixed limit, resetting the cursor to 0, and returning None for the next cursor to prevent stale offset errors. It also standardizes warning behavior for limit caps and simplifies NFT parsing.

  • Enforce self.limit in fetch_nfts, cap limits for listings/offers, and default cursor to 0.
  • Remove cursor extraction in parse methods; always return cursor=None.
  • Update test expectations by removing outdated updated_time assertions.

Reviewed Changes

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

File Description
blockapi/v2/api/nft/unisat.py Adjusted pagination (limit, cursor) logic and parsing (cursor=None).
blockapi/test/v2/api/nft/test_unisat.py Removed numeric updated_time assertions to align with new parsing logic.
Comments suppressed due to low confidence (1)

blockapi/test/v2/api/nft/test_unisat.py:74

  • The test no longer verifies updated_time. Consider adding an assertion to confirm that updated_time is returned in the expected string format.
-    assert nft2.updated_time == 1672531300

@SimSef SimSef requested a review from Copilot May 22, 2025 13:35
Copy link

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 addresses an issue with cursor handling in the Unisat API integration by removing the cursor parameter and adjusting pagination behavior. Key changes include:

  • Removing the optional 'cursor' parameter from the fetch_nfts method and hard-coding pagination parameters.
  • Updating the pagination logic in fetch_listings and fetch_offers, including warnings and limit truncation.
  • Adjusting tests by removing assertions related to the updated_time field.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
blockapi/v2/api/nft/unisat.py Removes cursor parameter from fetch_nfts, sets query params to use fixed offset, and adjusts pagination limits.
blockapi/test/v2/api/nft/test_unisat.py Removes outdated assertions for updated_time to reflect new type conversion logic.
Comments suppressed due to low confidence (1)

blockapi/test/v2/api/nft/test_unisat.py:55

  • Confirm that the conversion of updated_time from an integer to a string is the intended behavior and update related test documentation if necessary.
assert nft1.updated_time == 1672531200

@SimSef SimSef merged commit 4405348 into master May 22, 2025
5 checks passed
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