Skip to content
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

Add TxsByEvent gRPC endpoint #7842

Merged
merged 27 commits into from
Nov 12, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
081369f
add service definition for TxsByEvents
aleem1314 Nov 6, 2020
3bee1ff
add TxsByEvent gRPC endpoint
aleem1314 Nov 6, 2020
1cda4ff
fix lint
aleem1314 Nov 6, 2020
ca102d8
fix test
aleem1314 Nov 6, 2020
7e18e49
Merge branch 'master' of https://github.com/cosmos/cosmos-sdk into al…
aleem1314 Nov 7, 2020
867f6eb
Merge branch 'master' into aleem/7355-grpc-endpoints
aleem1314 Nov 9, 2020
df5444e
Merge branch 'master' into aleem/7355-grpc-endpoints
aleem1314 Nov 9, 2020
8be084a
review changes
aleem1314 Nov 9, 2020
f6de842
Merge branch 'master' of https://github.com/cosmos/cosmos-sdk into al…
aleem1314 Nov 9, 2020
a46de40
Merge branch 'aleem/7355-grpc-endpoints' of https://github.com/cosmos…
aleem1314 Nov 9, 2020
44ccc1d
review changes
aleem1314 Nov 10, 2020
5869b49
Merge branch 'master' of https://github.com/cosmos/cosmos-sdk into al…
aleem1314 Nov 10, 2020
c422541
fix proto descriptions
aleem1314 Nov 10, 2020
efa1f45
Merge branch 'master' into aleem/7355-grpc-endpoints
alexanderbez Nov 10, 2020
94f7986
review changes
aleem1314 Nov 11, 2020
fb5bf71
Merge branch 'master' of https://github.com/cosmos/cosmos-sdk into al…
aleem1314 Nov 11, 2020
1e1bf06
fix lint
aleem1314 Nov 11, 2020
c43abaa
review changes
aleem1314 Nov 11, 2020
985b330
Update proto/cosmos/tx/v1beta1/service.proto
aleem1314 Nov 11, 2020
919d10e
Merge branch 'master' into aleem/7355-grpc-endpoints
aleem1314 Nov 11, 2020
d411845
Merge branch 'master' into aleem/7355-grpc-endpoints
mergify[bot] Nov 11, 2020
5d3307d
Merge branch 'master' into aleem/7355-grpc-endpoints
mergify[bot] Nov 11, 2020
846a677
Merge branch 'master' into aleem/7355-grpc-endpoints
mergify[bot] Nov 11, 2020
ff3b552
review changes
aleem1314 Nov 11, 2020
439dddf
Merge branch 'master' into aleem/7355-grpc-endpoints
mergify[bot] Nov 11, 2020
6d52e94
Merge branch 'master' into aleem/7355-grpc-endpoints
mergify[bot] Nov 12, 2020
cad1dd4
Merge branch 'master' into aleem/7355-grpc-endpoints
mergify[bot] Nov 12, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 31 additions & 3 deletions proto/cosmos/tx/v1beta1/service.proto
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ package cosmos.tx.v1beta1;
import "google/api/annotations.proto";
import "cosmos/base/abci/v1beta1/abci.proto";
import "cosmos/tx/v1beta1/tx.proto";
import "cosmos/base/query/v1beta1/pagination.proto";

option go_package = "github.com/cosmos/cosmos-sdk/types/tx";

Expand All @@ -17,6 +18,31 @@ service Service {
rpc GetTx(GetTxRequest) returns (GetTxResponse) {
option (google.api.http).get = "/cosmos/tx/v1beta1/tx/{hash}";
}

// GetTxsEvent fetches txs by event.
rpc GetTxsEvent(GetTxsEventRequest) returns (GetTxsEventResponse) {
option (google.api.http).get = "/cosmos/tx/v1beta1/txs";
}
}

// GetTxsEventRequest is the request type for the Service.TxsByEvents
// RPC method.
message GetTxsEventRequest {
// event is the transaction event type.
string event = 1;
// pagination defines an pagination for the request.
cosmos.base.query.v1beta1.PageRequest pagination = 2;
}

// GetTxsEventResponse is the response type for the Service.TxsByEvents
// RPC method.
message GetTxsEventResponse {
// txs is the list of queried transactions.
repeated cosmos.tx.v1beta1.Tx txs = 1;
aleem1314 marked this conversation as resolved.
Show resolved Hide resolved
// tx_responses is the list of queried TxResponses.
repeated cosmos.base.abci.v1beta1.TxResponse tx_responses = 2;
// pagination defines an pagination for the response.
cosmos.base.query.v1beta1.PageResponse pagination = 3;
}

// SimulateRequest is the request type for the Service.Simulate
Expand All @@ -35,15 +61,17 @@ message SimulateResponse {
cosmos.base.abci.v1beta1.Result result = 2;
}

// GetTx is the request type for the Service.GetTx
// GetTxRequest is the request type for the Service.GetTx
// RPC method.
message GetTxRequest {
// hash is the tx hash to query, encoded as a hex string.
string hash = 1;
}

// GetTxResponse is the response type for the Service.GetTx method.
message GetTxResponse {
// tx is the queried transaction.
cosmos.tx.v1beta1.Tx tx = 1;
}
// tx_response is the queried TxResponses.
cosmos.base.abci.v1beta1.TxResponse tx_response = 2;
}
2 changes: 1 addition & 1 deletion types/query/filtered_pagination.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func FilteredPaginate(
}

if limit == 0 {
limit = defaultLimit
limit = DefaultLimit

// count total results when the limit is zero/not supplied
countTotal = true
Expand Down
8 changes: 4 additions & 4 deletions types/query/pagination.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import (
"github.com/cosmos/cosmos-sdk/store/types"
)

// defaultLimit is the default `limit` for queries
// if the `limit` is not supplied, paginate will use `defaultLimit`
const defaultLimit = 100
// DefaultLimit is the default `limit` for queries
// if the `limit` is not supplied, paginate will use `DefaultLimit`
const DefaultLimit = 100

// Paginate does pagination of all the results in the PrefixStore based on the
// provided PageRequest. onResult should be used to do actual unmarshaling.
Expand All @@ -33,7 +33,7 @@ func Paginate(
}

if limit == 0 {
limit = defaultLimit
limit = DefaultLimit

// count total results when the limit is zero/not supplied
countTotal = true
Expand Down
Loading