telescope icon indicating copy to clipboard operation
telescope copied to clipboard

Query the block results

Open Segfaultd opened this issue 10 months ago • 3 comments

Hi,

I'm unable to find a way to query block results (begin / end events, val updates) from my SDK generated through Telescope. I do see Telescope has a few references over these but they are never included in the final clients, nor consumable.

CosmJS do have a method for it, but i'd like to avoid as much as possible creating a second client. https://github.com/cosmos/cosmjs/blob/68e1ec8d9cc51263f38cdb13da0a01e9f8b729fd/packages/tendermint-rpc/src/comet38/comet38client.ts#L98

Am I doing something wrong?

Thanks

Segfaultd avatar Jan 20 '25 11:01 Segfaultd

Only workaround for now is to manually query with a simple HTTP payload

try {
            const customRequest = {
                jsonrpc: '2.0',
                id: 1,
                method: 'block_results',
                params: [height.toString()],
            };

            const response = await lastValueFrom(
                this._httpService.post(chainRpcUrl, customRequest, {
                    headers: {
                        'Content-Type': 'application/json',
                    },
                }),
            );
            if (!response || response.status > 201) {
                return null;
            }

            // Gives you the height, txs_results, begin_block_events, end_block_events, validator_updates and consensus_param_updates
            console.dir(response.data, { depth: 4 });
        } catch (e) {
            console.error(e);
            return null;
        }

Segfaultd avatar Jan 20 '25 11:01 Segfaultd

cc @Zetazzz let's look into this

pyramation avatar Apr 15 '25 03:04 pyramation

Hi, I believe a query for the block is a nested rest API provided by cosmos sdk(like apis listed in the below link):

https://rpc.osmosis.zone

Meaning, it's not a part of ABCI query(generated queries using telescope).

So this part of the functionality can be only provided in cosmjs client.

or interchianjs client: https://github.com/hyperweb-io/interchainjs/blob/0446d457022881b104f584e7582d3ad8a61a2abc/networks/cosmos/src/signing-client.ts#L333

Thank you very much!

Zetazzz avatar Apr 16 '25 01:04 Zetazzz