Skip to content

[TSSDK] When doing queryTransactionBlocks, the query does not get the data. #21002

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
vladilen11 opened this issue Jan 29, 2025 · 6 comments
Open
Assignees

Comments

@vladilen11
Copy link
Contributor

Why I can't get data when I use client's queryTransactionBlocks to query the testnet for object changes? Is there any limitation on the testnet? Does the mainnet have the same limitation? How should I call the query for this?

this is my object id:
https://testnet.suivision.xyz/object/0x2334d0cb7ff274291965cecadbe87b76229426310117f2e96cb41bf8c87ed6ed

this is my code:

const publicClient = new SuiClient({
    url: getFullnodeUrl('testnet');,
});

    const response = await publicClient.queryTransactionBlocks({
        filter: {
            ChangedObject: "0x2334d0cb7ff274291965cecadbe87b76229426310117f2e96cb41bf8c87ed6ed",
        },
        order: 'ascending',
        cursor: lastTxRecord,
        limit: 50,
        options: {
            showEvents: true,
        },
    });
    console.log('response: ', response);

this is the log info: response: { data: [], nextCursor: null, hasNextPage: false }

BTW I don't have this problem with localnet.

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!

@vladilen11
Copy link
Contributor Author

I found a way to query via graphql from the repository, but the client, constructed via graphql client, is not able to query the correct event data.

	publicClient = new SuiClient({
		transport: new SuiClientGraphQLTransport({
			url: 'https://sui-testnet.mystenlabs.com/graphql',
			fallbackFullNodeUrl: getFullnodeUrl('testnet'),
		}),
	});
	const response = await publicClient.queryTransactionBlocks({
		filter: {
			ChangedObject: "0x24e696d7d84890903f48b2c034816db56915d57bf2d5baaa96646a12cf50d7a4",
		},
		order: 'ascending',
		cursor: lastTxRecord,
		limit: argv.syncLimit,
		options: {
			showEvents: true,
		},
	});
	console.log('response:', JSON.stringify(response, null, 2));

this is my log:

response: {
  "hasNextPage": false,
  "nextCursor": "eyJjIjoxNTc2MjAxNjgsInQiOjIwODM5ODY1MTksImkiOmZhbHNlfQ",
  "data": [
    {
      "checkpoint": "157615501",
      "timestampMs": "1738148660290",
      "digest": "LafcVddJ3tfySYJu2FwTWUHohAcJzBe1mATDc4utLrn",
      "events": []
    },
    {
      "checkpoint": "157615630",
      "timestampMs": "1738148691968",
      "digest": "2k2nLLXYKYV6kAaEapQreyCesVq6veR7A4cSeSUW5nqj",
      "events": []
    },
    {
      "checkpoint": "157615644",
      "timestampMs": "1738148695547",
      "digest": "CLPV1bUYJTe1ktQcAtFXRBQVQYgLyXrmhhMdC4Mg3v5j",
      "events": []
    }
  ]
}

we can see the latest tx CLPV1bUYJTe1ktQcAtFXRBQVQYgLyXrmhhMdC4Mg3v5j
You can see that there are two events in this transaction, but it's not querying them.
Image

@wlmyng
Copy link
Contributor

wlmyng commented Jan 31, 2025

Interesting, I see events being returned when I query graphql through graphiql.
@hayes-mysten would you mind taking a look? The gql request below will return a tx with digest CLPV1bUYJTe1ktQcAtFXRBQVQYgLyXrmhhMdC4Mg3v5j, and it has some counter_system module calls

{
  transactionBlocks(
    filter: {changedObject: "0x24e696d7d84890903f48b2c034816db56915d57bf2d5baaa96646a12cf50d7a4"}
  ) {
    pageInfo {
      hasNextPage
      endCursor
    }
    nodes {
      digest
      effects {
        events {
          nodes {
            timestamp
            sendingModule {
              package {
                address
              }
              name
            }
            sender {
              address
            }
          }
        }
        checkpoint {
          sequenceNumber
        }
      }
    }
  }
}

@hayes-mysten
Copy link
Contributor

It looks like it depends on what RPC node you are hitting. Using suiscans rpc node this works fine: https://stackblitz.com/edit/typescript-tvriknbs?file=index.ts

@hayes-mysten
Copy link
Contributor

Could the be an indexer vs fullnode issue?

@vladilen11
Copy link
Contributor Author

@hayes-mysten So the official rpc doesn't support this feature? Also I found some inconsistencies between the graphql query return and the query return from sdk using rpc calls to queryTransactionBlocks. #21006 (comment)

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

No branches or pull requests

4 participants