Skip to content

nextCursor does not work for suix_queryEvents #21508

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

Open
tsuigeo-wm opened this issue Mar 17, 2025 · 4 comments
Open

nextCursor does not work for suix_queryEvents #21508

tsuigeo-wm opened this issue Mar 17, 2025 · 4 comments
Assignees
Labels

Comments

@tsuigeo-wm
Copy link

tsuigeo-wm commented Mar 17, 2025

I seem to be running into problems with pagination using nextCursor for suix_queryEvents - i think there may be a bug in the sui client?

    has_next_page = True
    next_cursor = None
    while has_next_page:
        res = requests.post(
            http_rpc_url,
            json = {'id': 2,
                    'jsonrpc': '2.0',
                    'method': 'suix_queryEvents',
                    'params': [
                        {'TimeRange': {'startTime': '1742194272716', 'endTime': '1742194273716'}},
                        next_cursor,
                        50,
                        False
                    ]
            }
        )
        data = res.json()
        next_cursor = data['result']['nextCursor']
        has_next_page = data['result']['hasNextPage']
        print(next_cursor)
        print(f"has_next_page={has_next_page}")
        await asyncio.sleep(1)

When I run this, it seems to be giving me the same nextCursor all the time, and loops infinitely:

{'txDigest': 'kmM2kvaQkUccfiqa6YChaLWGQhWAPsnQbjP7kBdAUEZ', 'eventSeq': '27'}
has_next_page=True
{'txDigest': 'kmM2kvaQkUccfiqa6YChaLWGQhWAPsnQbjP7kBdAUEZ', 'eventSeq': '28'}
has_next_page=True
{'txDigest': 'kmM2kvaQkUccfiqa6YChaLWGQhWAPsnQbjP7kBdAUEZ', 'eventSeq': '28'}
has_next_page=True
{'txDigest': 'kmM2kvaQkUccfiqa6YChaLWGQhWAPsnQbjP7kBdAUEZ', 'eventSeq': '28'}
has_next_page=True
{'txDigest': 'kmM2kvaQkUccfiqa6YChaLWGQhWAPsnQbjP7kBdAUEZ', 'eventSeq': '28'}
has_next_page=True
## loops infinitely like this

Am I doing something wrong here or is there a bug with the sui client?

Copy link
Contributor

Thank you for opening this issue, a team member will review it shortly. Until then, please do not interact with any users that claim to be from Sui support and do not click on any links!

@denyskozak
Copy link
Contributor

denyskozak commented Mar 17, 2025

have other problem with GraphQL (devnet)
just no result coming after added after
can re-check? please


async function getChampionships(game: string, after: string) {
  const chainIdentifierQuery = graphql(`
	query {
      objects(first: 10, ${after ? "after: $after," : ""} filter: {type: "${objectType}"}) {
        pageInfo {
          hasNextPage
          endCursor
        }
        nodes {
          address
          digest
          asMoveObject {
            contents { json }
          }
        } 
      }
    }
`);

  const result = await gqlClient.query({
    query: chainIdentifierQuery,
    variables: { after },
  });

  return result.data;
}

@tsuigeo-wm
Copy link
Author

Hi team - any update on this?

@hayes-mysten hayes-mysten assigned bmwill and unassigned bmwill Mar 21, 2025
@hayes-mysten
Copy link
Contributor

I've passed this along to the appropriate team, and they are aware of the issue, but don't have a solution yet

@hayes-mysten hayes-mysten assigned bmwill and unassigned hayes-mysten Mar 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants