Feedbacks & QnA

Ask a Question
Back to all

Graphql API not returning events on Aptos mainnet

This is a followup on the discussion: https://developer.nodit.io/discuss/6881fc04803c4d94a8db313a

My observation:

I dont think such a query finds all events that have been emitted. I am wondering if I could just do:

query TxVersionQuery {
account_transactions(
offset: 0
limit: 100
where: { account_address: {_eq: "0x39ddcd9e1a39fa14f25e3f9ec8a86074d05cc0881cbf667df8a6ee70942016fb"} }
) {
transaction_version
}
}

and use the returned tx_versions to construct this:

query EventQuery {
events(
offset: 0
limit: 100
where: {
transaction_version: {
_in: [
2886125013,
2886137819,
...

]

) {
transaction_version
account_address
creation_number
event_index
type
data
}
}

I have tried this appraoch and it seems to work, but somehow when I apply it to our testnet contract, it returns 52 transaction_versions which is the same as the mainnet contract. I am getting somehow 100 events for testnet and 104 for mainnet which is not possible as there is nearly nothing on mainnet yet. I am using a gql client btw. as the UI only does mainnet queries.

Is my approach correct ? Would such a query work ? DO I need some pagination maybe ?
Why is there (at least I see this) no clear separation between testnet and mainnet for the second query.