feat(x/auth): define simplified account query service (#13210)

This commit is contained in:
Aaron Craelius
2022-09-16 09:12:41 +00:00
committed by GitHub
parent b37ddcafb3
commit d9ef976412
12 changed files with 1800 additions and 190 deletions
File diff suppressed because it is too large Load Diff
+42
View File
@@ -51,6 +51,10 @@ type QueryClient interface {
//
// Since: cosmos-sdk 0.46
AddressStringToBytes(ctx context.Context, in *AddressStringToBytesRequest, opts ...grpc.CallOption) (*AddressStringToBytesResponse, error)
// AccountInfo queries account info which is common to all account types.
//
// Since: cosmos-sdk 0.47
AccountInfo(ctx context.Context, in *QueryAccountInfoRequest, opts ...grpc.CallOption) (*QueryAccountInfoResponse, error)
}
type queryClient struct {
@@ -133,6 +137,15 @@ func (c *queryClient) AddressStringToBytes(ctx context.Context, in *AddressStrin
return out, nil
}
func (c *queryClient) AccountInfo(ctx context.Context, in *QueryAccountInfoRequest, opts ...grpc.CallOption) (*QueryAccountInfoResponse, error) {
out := new(QueryAccountInfoResponse)
err := c.cc.Invoke(ctx, "/cosmos.auth.v1beta1.Query/AccountInfo", 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
@@ -166,6 +179,10 @@ type QueryServer interface {
//
// Since: cosmos-sdk 0.46
AddressStringToBytes(context.Context, *AddressStringToBytesRequest) (*AddressStringToBytesResponse, error)
// AccountInfo queries account info which is common to all account types.
//
// Since: cosmos-sdk 0.47
AccountInfo(context.Context, *QueryAccountInfoRequest) (*QueryAccountInfoResponse, error)
mustEmbedUnimplementedQueryServer()
}
@@ -197,6 +214,9 @@ func (UnimplementedQueryServer) AddressBytesToString(context.Context, *AddressBy
func (UnimplementedQueryServer) AddressStringToBytes(context.Context, *AddressStringToBytesRequest) (*AddressStringToBytesResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method AddressStringToBytes not implemented")
}
func (UnimplementedQueryServer) AccountInfo(context.Context, *QueryAccountInfoRequest) (*QueryAccountInfoResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method AccountInfo not implemented")
}
func (UnimplementedQueryServer) mustEmbedUnimplementedQueryServer() {}
// UnsafeQueryServer may be embedded to opt out of forward compatibility for this service.
@@ -354,6 +374,24 @@ func _Query_AddressStringToBytes_Handler(srv interface{}, ctx context.Context, d
return interceptor(ctx, in, info, handler)
}
func _Query_AccountInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QueryAccountInfoRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QueryServer).AccountInfo(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/cosmos.auth.v1beta1.Query/AccountInfo",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).AccountInfo(ctx, req.(*QueryAccountInfoRequest))
}
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)
@@ -393,6 +431,10 @@ var Query_ServiceDesc = grpc.ServiceDesc{
MethodName: "AddressStringToBytes",
Handler: _Query_AddressStringToBytes_Handler,
},
{
MethodName: "AccountInfo",
Handler: _Query_AccountInfo_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "cosmos/auth/v1beta1/query.proto",