-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Search transaction usability #5638
Comments
Search for all txs that were sent by some sender? If so, this is possible.
Pagination should allow you to do this.
Define latest transactions? |
No, search for messages sent by some address OR recevied to the same address. Think of an address as an account.
Only in a very sloppy fashion. Say I finished on page 5 at the last request, now I need to re-fetch page 5 every time to see if something was added, wasting bandwidth. Or I would need to ask for page=&limit=1, and then make one more request to see if more than one was added. Again wasting bandwidth and creating unnecessary load on the server.
Think "most recent N transactions". Even most recent page would make sense. |
Yes, you can do this with events. To search for all transactions that contain any message which has a sender A: Each module has it's own
Sure. But in light of this "issue", it would be immediately clear to me that if this is your use case, then you're better off creating a subscription opposed to querying directly. Through a subscription, you'll get these txs in real time! That being said, do you have suggestions on alternatives?
I see. I think we can amend the pagination logic to support such a query. In other words, support both pagination params and |
This sounds great. Can I do something like:
I would be more than happy to have a subscription model available, but it does not seem like the Gaia-lite API supports subsriptions: https://cosmos.network/rpc/#/. I see that the Tendermint API supports subscription models, but there I have to worry about decoding (javascript).
Pagination is fine. What is missing is the starting point of pagination (e.g. block number or date). |
Unfortunately, I do not think Tendermint currently supports the When you query for txs through Gaia REST (
This is what I mean. Subscription through Tendermint RPC. Having it in gaia would serve no benefit really. There are javascript libraries out there that allow you to decode. |
That is what I thought. But doing two queries is not too bad. It is much worse that there is no starting point for querying.
I am only aware of |
@jordansexton @marbar3778 do you know of other JS libraries that help with amino decoding? |
In raw Tendermint you can do both
It should not be super hard to pass |
@webmaster128, correct, the REST server only allows event queries where the values must be an exact match. The REST client was never intended to match the Tendermint RPC query semantics. |
Since we're already handling TxHeightKey in a special manner when handling |
Can you elaborate a bit more please? |
That's the kind of change I mean : gagbo@b4ba3ea Shown inline for easy check (I might force push that commit) commit b4ba3ea71c39be5bb17d389c2c87fc4f83ff0283
Author: Gerry Agbobada
Date: Fri Feb 14 14:34:03 2020 +0100
Add min-height and max-height filters to TxSearch
diff --git a/types/rest/rest.go b/types/rest/rest.go
index a58a56252..0a2f6486a 100644
--- a/types/rest/rest.go
+++ b/types/rest/rest.go
@@ -22,6 +22,8 @@ import (
const (
DefaultPage = 1
DefaultLimit = 30 // should be consistent with tendermint/tendermint/rpc/core/pipe.go:19
+ TxMinHeightKey = "tx.minheight" // Inclusive minimum height filter
+ TxMaxHeightKey = "tx.maxheight" // Inclusive maximum height filter
)
// ResponseWithHeight defines a response object type that wraps an original
@@ -337,6 +339,10 @@ func ParseHTTPArgsWithLimit(r *http.Request, defaultLimit int) (tags []string, p
var tag string
if key == types.TxHeightKey {
tag = fmt.Sprintf("%s=%s", key, value)
+ } else if key == TxMinHeightKey {
+ tag = fmt.Sprintf("%s>=%s", types.TxHeightKey, value)
+ } else if key == TxMaxHeightKey {
+ tag = fmt.Sprintf("%s<=%s", types.TxHeightKey, value)
} else {
tag = fmt.Sprintf("%s='%s'", key, value)
} EDIT : I didn't test it (still running a synchronization to test the changes) so maybe it's not going to work like I expect it to. |
Yeah, I think this should work! Would you like to open a PR? |
Will do if you like for sure ! |
For the record, it did reduce the load on my machine
With height filtering :
From |
Issue:
Using the
GET /txs
gaia-lite API call:Description:
Proposed solution
address
query parameter that searches for recipient OR sender.The text was updated successfully, but these errors were encountered: