Skip to content

Commit

Permalink
feat(ecocredit/core): query classes by admin address (#954)
Browse files Browse the repository at this point in the history
* feat: query classes by admin address

* chore: godoc

Co-authored-by: technicallyty <48813565+tytech3@users.noreply.github.com>
Co-authored-by: Ryan Christoffersen <12519942+ryanchristo@users.noreply.github.com>
  • Loading branch information
3 people authored Mar 31, 2022
1 parent 2852972 commit 29c8666
Show file tree
Hide file tree
Showing 7 changed files with 3,271 additions and 1,248 deletions.
3,298 changes: 2,261 additions & 1,037 deletions api/regen/ecocredit/v1/query.pulsar.go

Large diffs are not rendered by default.

40 changes: 40 additions & 0 deletions api/regen/ecocredit/v1/query_grpc.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

52 changes: 39 additions & 13 deletions proto/regen/ecocredit/v1/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@ service Query {
option (google.api.http).get = "/regen/ecocredit/v1/classes";
}

// ClassesByAdmin queries for all credit classes with a specific admin
// address.
rpc ClassesByAdmin(QueryClassesByAdminRequest)
returns (QueryClassesByAdminResponse) {
option (google.api.http).get = "/regen/ecocredit/v1/classes/admin/{admin}";
}

// ClassInfo queries for information on a credit class.
rpc ClassInfo(QueryClassInfoRequest) returns (QueryClassInfoResponse) {
option (google.api.http).get = "/regen/ecocredit/v1/classes/{class_id}";
Expand Down Expand Up @@ -67,9 +74,8 @@ service Query {

// Balances queries all credit balances the given account holds.
rpc Balances(QueryBalancesRequest) returns (QueryBalancesResponse) {
option (google.api.http).get =
"/regen/ecocredit/v1/balances/{account}";
}
option (google.api.http).get = "/regen/ecocredit/v1/balances/{account}";
}

// Supply queries the tradable and retired supply of a credit batch.
rpc Supply(QuerySupplyRequest) returns (QuerySupplyResponse) {
Expand All @@ -89,15 +95,6 @@ service Query {
}
}

// QueryParamsRequest is the Query/Params request type.
message QueryParamsRequest {}

// QueryParamsResponse is the Query/Params response type.
message QueryParamsResponse {
// params defines the parameters of the ecocredit module.
Params params = 1;
}

// QueryClassesRequest is the Query/Classes request type.
message QueryClassesRequest {
// pagination defines an optional pagination for the request.
Expand All @@ -113,6 +110,25 @@ message QueryClassesResponse {
cosmos.base.query.v1beta1.PageResponse pagination = 2;
}

// QueryClassesByAdminRequest is the Query/ClassesByAdmin request type.
message QueryClassesByAdminRequest {

// admin is the address of the admin of the class.
string admin = 1;

// pagination defines an optional pagination for the request.
cosmos.base.query.v1beta1.PageRequest pagination = 2;
}

// QueryClassesByAdminResponse is the Query/ClassesByAdmin response type.
message QueryClassesByAdminResponse {
// classes are the fetched credit classes.
repeated ClassInfo classes = 1;

// pagination defines the pagination in the response.
cosmos.base.query.v1beta1.PageResponse pagination = 2;
}

// QueryClassInfoRequest is the Query/ClassInfo request type.
message QueryClassInfoRequest {

Expand Down Expand Up @@ -261,7 +277,8 @@ message QueryBalancesRequest {
// QueryBalancesResponse is the Query/Balances response type.
message QueryBalancesResponse {

// balances are a list of balances from different credit batches that the account holds.
// balances are a list of balances from different credit batches that the
// account holds.
repeated BatchBalance balances = 1;

// pagination defines the pagination in the response.
Expand Down Expand Up @@ -299,3 +316,12 @@ message QueryCreditTypesResponse {
// list of credit types
repeated CreditType credit_types = 1;
}

// QueryParamsRequest is the Query/Params request type.
message QueryParamsRequest {}

// QueryParamsResponse is the Query/Params response type.
message QueryParamsResponse {
// params defines the parameters of the ecocredit module.
Params params = 1;
}
Loading

0 comments on commit 29c8666

Please sign in to comment.