cosmjs icon indicating copy to clipboard operation
cosmjs copied to clipboard

How do i get delegation transactions via cosmJS

Open Goochie opened this issue 3 years ago • 3 comments

I have noticed that the response of CosmosClient.searchTx(query) via cosmjs does not included delegation transactions ....

query: "message.module='bank' AND transfer.sender='someAccount' AND tx.height>=0 AND tx.height<=9007199254740991"

..... and is hardcoded to the bank module.

I have gone through the StargateClient https://cosmos.github.io/cosmjs/latest/stargate/classes/StargateClient.html api and nothing springs out as to returning all transactions ...... the only thing that seems to have potential is the QueryClient https://cosmos.github.io/cosmjs/latest/stargate/classes/QueryClient.html ie i assume you can create your own custom query's - is this the case ?

If so how would i get the bank and distribution (delegation /staking) module transfers ?

Goochie avatar Jun 19 '22 09:06 Goochie

How do you call searchTx?

You probably need to use a tags search. Like this but with different tags:

      const results = await client.searchTx({
        tags: [{ key: "transfer.recipient", value: sendSuccessful.recipient }],
      });

webmaster128 avatar Jun 21 '22 07:06 webmaster128

Thanks that worked. ...

Goochie avatar Jun 22 '22 08:06 Goochie

@Goochie Hey, can you provide some code example about how you achieved this using QueryClient and tags search? Thanks!

micovi avatar May 20 '24 11:05 micovi