cosmjs icon indicating copy to clipboard operation
cosmjs copied to clipboard

A way to limit number of transactions that are returned from searchTx func

Open scovic opened this issue 4 years ago • 3 comments
trafficstars

Is there any way to limit number of transactions that are returned from searchTx function? I saw SearchTxFilter with minHeight and maxHeight, but I'm not sure how to use them?

Or is there any other way to get transactions for an address with limit option?

Thank you

scovic avatar Sep 01 '21 22:09 scovic

if i put minHeight as currentBlockHeight - 100, that means that the search will be in the last 100 blocks? Am i right?

scovic avatar Sep 02 '21 14:09 scovic

if i put minHeight as currentBlockHeight - 100, that means that the search will be in the last 100 blocks? Am i right?

exactly!

webmaster128 avatar Sep 30 '21 21:09 webmaster128

The search is implemented via txSearchAll from the Tendermint client, which loops througth the result pages until everything was read. So unfotunatly there is no nice way the pagination is exposed to the user of txSearch. Using the heights to define a search range is workaround that will do the job, but far from ideal. Some serious redesign of StargateClient.txsQuery and StargateClient.searchTx would be needed.

webmaster128 avatar Sep 30 '21 21:09 webmaster128