cosmjs
cosmjs copied to clipboard
How do i get delegation transactions via cosmJS
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 ?
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 }],
});
Thanks that worked. ...
@Goochie Hey, can you provide some code example about how you achieved this using QueryClient and tags search? Thanks!