Added Tendermint version notes and fixed tests

This commit is contained in:
Riccardo Montagnin 2021-05-27 13:40:23 +02:00 committed by Simon Warta
parent be6b56b078
commit cd74f2523b
2 changed files with 8 additions and 2 deletions

View File

@ -244,7 +244,7 @@ function defaultTestSuite(rpcFactory: () => RpcClient, expected: ExpectedValues)
// second page
const s2 = await client.blockSearch({ query: query, page: 2, per_page: 2 });
expect(s2.totalCount).toEqual(3);
expect(s2.blocks.length).toEqual(2);
expect(s2.blocks.length).toEqual(1);
client.disconnect();
});

View File

@ -99,7 +99,10 @@ export class Tendermint34Client {
}
/**
* Search for events that are in a block
* Search for events that are in a block.
*
* NOTE
* This method will error on any node that is running a Tendermint version lower than 0.34.9.
*
* @see https://docs.tendermint.com/master/rpc/#/Info/block_search
*/
@ -115,6 +118,9 @@ export class Tendermint34Client {
// this should paginate through all blockSearch options to ensure it returns all results.
// starts with page 1 or whatever was provided (eg. to start on page 7)
//
// NOTE
// This method will error on any node that is running a Tendermint version lower than 0.34.9.
public async blockSearchAll(params: requests.BlockSearchParams): Promise<responses.BlockSearchResponse> {
let page = params.page || 1;
const blocks: responses.BlockResponse[] = [];