cosmjs
cosmjs copied to clipboard
nextKey is not returned when calling GetTxsEvent
It appears that the pagination does not work properly when calling QueryClient.queryUnverified().
Here's the pagination object I am passing into the function.
pagination: {
countTotal: true,
key: new Uint8Array(),
offset: Long.fromNumber(0, true),
limit: Long.fromNumber(5, true),
reverse: false,
}
There are two issues I found in the response:
nextKeyis always an empty array.offsetandlimitkeys don't work correctly. When I passed offset=4, limit=7, it just returned the result from the beginning. The response had the transactions of indexes 0-6.
Edit: To give you a bit more context on this issue, I am pasting the whole code snippet here.
import { Tendermint34Client } from "@cosmjs/tendermint-rpc"
import { QueryClient } from "@cosmjs/stargate"
import { GetTxsEventRequest } from "cosmjs-types/cosmos/tx/v1beta1/service"
const client = QueryClient.withExtensions(
await Tendermint34Client.connect({rpc_endpoint}),
)
client.queryUnverified("/cosmos.tx.v1beta1.Service/GetTxsEvent", GetTxsEventRequest.encode({
events: [
"message.action='delegate'",
"delegate.validator='{validator_address}'",
],
pagination: {
countTotal: true,
key: new Uint8Array(),
offset: Long.fromNumber(0, true),
limit: Long.fromNumber(5, true),
reverse: false,
},
orderBy: OrderBy.ORDER_BY_ASC,
}).finish())
This issue seems to be specific for that query. Which Cosmos SDK version are you using in your backend? What value do you get returned in total in the response?