Skip to content

add interchain security consumer QueryParams #746

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

Merged
merged 1 commit into from
Feb 28, 2023
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
15 changes: 14 additions & 1 deletion proto/interchain_security/ccv/consumer/v1/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ syntax = "proto3";
package interchain_security.ccv.consumer.v1;
option go_package = "github.com/cosmos/interchain-security/x/ccv/consumer/types";

import "gogoproto/gogo.proto";
import "google/api/annotations.proto";

import "interchain_security/ccv/consumer/v1/consumer.proto";

service Query {
// ConsumerGenesis queries the genesis state needed to start a consumer chain
Expand All @@ -14,6 +15,10 @@ service Query {
option (google.api.http).get =
"/interchain_security/ccv/consumer/next-fee-distribution";
}
// QueryParams queries the ccv/consumer module parameters.
rpc QueryParams(QueryParamsRequest) returns (QueryParamsResponse) {
option (google.api.http).get = "/interchain_security/ccv/consumer/params";
}
}

// NextFeeDistributionEstimate holds information about next fee distribution
Expand All @@ -39,3 +44,11 @@ message QueryNextFeeDistributionEstimateRequest { }
message QueryNextFeeDistributionEstimateResponse {
NextFeeDistributionEstimate data = 1;
}

message QueryParamsRequest {}

// QueryParamsResponse is response type for the Query/Params RPC method.
message QueryParamsResponse {
// params holds all the parameters of this module.
Params params = 1 [(gogoproto.nullable) = false];
}
14 changes: 14 additions & 0 deletions x/ccv/consumer/keeper/grpc_query.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,17 @@ func (k Keeper) QueryNextFeeDistribution(c context.Context,

return &types.QueryNextFeeDistributionEstimateResponse{Data: &nextDist}, nil
}

func (k Keeper) QueryParams(c context.Context,
req *types.QueryParamsRequest) (*types.QueryParamsResponse, error) {

ctx := sdk.UnwrapSDKContext(c)

if req == nil {
return nil, status.Errorf(codes.InvalidArgument, "empty request")
}

p := k.GetParams(ctx)

return &types.QueryParamsResponse{Params: p}, nil
}
Loading