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

feat(ecocredit/core): query classes by admin address #954

Merged
merged 3 commits into from
Mar 31, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
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