feat: add query groups in x/group (#14879)
Co-authored-by: Likhita Polavarapu <78951027+likhita-809@users.noreply.github.com>
This commit is contained in:
co-authored by
Likhita Polavarapu
parent
bdf4c76daf
commit
a2797c8cd4
+1359
-211
File diff suppressed because it is too large
Load Diff
@@ -52,6 +52,10 @@ type QueryClient interface {
|
||||
// then it simply returns the `final_tally_result` state stored in the
|
||||
// proposal itself.
|
||||
TallyResult(ctx context.Context, in *QueryTallyResultRequest, opts ...grpc.CallOption) (*QueryTallyResultResponse, error)
|
||||
// Groups queries all groups in state.
|
||||
//
|
||||
// Since: cosmos-sdk 0.47.1
|
||||
Groups(ctx context.Context, in *QueryGroupsRequest, opts ...grpc.CallOption) (*QueryGroupsResponse, error)
|
||||
}
|
||||
|
||||
type queryClient struct {
|
||||
@@ -179,6 +183,15 @@ func (c *queryClient) TallyResult(ctx context.Context, in *QueryTallyResultReque
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *queryClient) Groups(ctx context.Context, in *QueryGroupsRequest, opts ...grpc.CallOption) (*QueryGroupsResponse, error) {
|
||||
out := new(QueryGroupsResponse)
|
||||
err := c.cc.Invoke(ctx, "/cosmos.group.v1.Query/Groups", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// QueryServer is the server API for Query service.
|
||||
// All implementations must embed UnimplementedQueryServer
|
||||
// for forward compatibility
|
||||
@@ -213,6 +226,10 @@ type QueryServer interface {
|
||||
// then it simply returns the `final_tally_result` state stored in the
|
||||
// proposal itself.
|
||||
TallyResult(context.Context, *QueryTallyResultRequest) (*QueryTallyResultResponse, error)
|
||||
// Groups queries all groups in state.
|
||||
//
|
||||
// Since: cosmos-sdk 0.47.1
|
||||
Groups(context.Context, *QueryGroupsRequest) (*QueryGroupsResponse, error)
|
||||
mustEmbedUnimplementedQueryServer()
|
||||
}
|
||||
|
||||
@@ -259,6 +276,9 @@ func (UnimplementedQueryServer) GroupsByMember(context.Context, *QueryGroupsByMe
|
||||
func (UnimplementedQueryServer) TallyResult(context.Context, *QueryTallyResultRequest) (*QueryTallyResultResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method TallyResult not implemented")
|
||||
}
|
||||
func (UnimplementedQueryServer) Groups(context.Context, *QueryGroupsRequest) (*QueryGroupsResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method Groups not implemented")
|
||||
}
|
||||
func (UnimplementedQueryServer) mustEmbedUnimplementedQueryServer() {}
|
||||
|
||||
// UnsafeQueryServer may be embedded to opt out of forward compatibility for this service.
|
||||
@@ -506,6 +526,24 @@ func _Query_TallyResult_Handler(srv interface{}, ctx context.Context, dec func(i
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Query_Groups_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(QueryGroupsRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(QueryServer).Groups(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/cosmos.group.v1.Query/Groups",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(QueryServer).Groups(ctx, req.(*QueryGroupsRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
// Query_ServiceDesc is the grpc.ServiceDesc for Query service.
|
||||
// It's only intended for direct use with grpc.RegisterService,
|
||||
// and not to be introspected or modified (even as a copy)
|
||||
@@ -565,6 +603,10 @@ var Query_ServiceDesc = grpc.ServiceDesc{
|
||||
MethodName: "TallyResult",
|
||||
Handler: _Query_TallyResult_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "Groups",
|
||||
Handler: _Query_Groups_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
Metadata: "cosmos/group/v1/query.proto",
|
||||
|
||||
@@ -383,8 +383,8 @@ const (
|
||||
)
|
||||
|
||||
// Module defines the ORM module which adds providers to the app container for
|
||||
// module-scoped DB's. In the future it may provide gRPC services for interacting
|
||||
// with ORM data.
|
||||
// ORM ModuleDB's and in the future will automatically register query
|
||||
// services for modules that use the ORM.
|
||||
type Module struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
|
||||
Reference in New Issue
Block a user