-
Notifications
You must be signed in to change notification settings - Fork 11
fix(unisat): cursor fix #231
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
fix(unisat): cursor fix #231
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 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.limitinfetch_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_timeassertions.
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 thatupdated_timeis returned in the expected string format.
- assert nft2.updated_time == 1672531300
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 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
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.