diff --git a/proto/cosmos/auth/v1beta1/query.proto b/proto/cosmos/auth/v1beta1/query.proto index 4d9759cad..3cb2fcd6d 100644 --- a/proto/cosmos/auth/v1beta1/query.proto +++ b/proto/cosmos/auth/v1beta1/query.proto @@ -28,6 +28,11 @@ service Query { rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { option (google.api.http).get = "/cosmos/auth/v1beta1/params"; } + + // NextAccountNumber queries the next account number assigned + rpc NextAccountNumber(QueryNextAccountNumberRequest) returns (QueryNextAccountNumberResponse) { + option (google.api.http).get = "/cosmos/auth/v1beta1/nextaccountnumber"; + } } // QueryAccountsRequest is the request type for the Query/Accounts RPC method. @@ -72,3 +77,14 @@ message QueryParamsResponse { // params defines the parameters of the module. Params params = 1 [(gogoproto.nullable) = false]; } + + + +// QueryNextAccountRequest is the request type for the Query/NextAccountNumber RPC method. +message QueryNextAccountNumberRequest {} + +// QueryNextAccountResponse is the response type for the Query/NextAccountNumber RPC method. +message QueryNextAccountNumberResponse { + // count defines the next account number. + uint64 count = 1; +} \ No newline at end of file diff --git a/x/auth/client/cli/query.go b/x/auth/client/cli/query.go index e38dac0e3..38f6c110e 100644 --- a/x/auth/client/cli/query.go +++ b/x/auth/client/cli/query.go @@ -43,6 +43,7 @@ func GetQueryCmd() *cobra.Command { GetAccountCmd(), GetAccountsCmd(), QueryParamsCmd(), + QueryNextAccountNumberCmd(), ) return cmd @@ -79,6 +80,38 @@ $ query auth params return cmd } +// QueryNextAccountNumberCmd returns the command handler for evidence parameter querying. +func QueryNextAccountNumberCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: "next-account-number", + Short: "Query the next account number", + Args: cobra.NoArgs, + Long: strings.TrimSpace(`Query the next account number parameters: + +$ query auth next-account-number +`), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + + queryClient := types.NewQueryClient(clientCtx) + res, err := queryClient.NextAccountNumber(cmd.Context(), &types.QueryNextAccountNumberRequest{}) + if err != nil { + return err + } + + fmt.Printf("%d\n", res.Count) + return nil + }, + } + + flags.AddQueryFlagsToCmd(cmd) + + return cmd +} + // GetAccountCmd returns a query account that will display the state of the // account at a given address. func GetAccountCmd() *cobra.Command { diff --git a/x/auth/keeper/grpc_query.go b/x/auth/keeper/grpc_query.go index 4305c1cd0..8f803ccdb 100644 --- a/x/auth/keeper/grpc_query.go +++ b/x/auth/keeper/grpc_query.go @@ -83,3 +83,13 @@ func (ak AccountKeeper) Params(c context.Context, req *types.QueryParamsRequest) return &types.QueryParamsResponse{Params: params}, nil } + +func (ak AccountKeeper) NextAccountNumber(c context.Context, req *types.QueryNextAccountNumberRequest) (*types.QueryNextAccountNumberResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "empty request") + } + ctx := sdk.UnwrapSDKContext(c) + nextAccountNumber := ak.GetNextAccountNumber(ctx) + + return &types.QueryNextAccountNumberResponse{Count: nextAccountNumber}, nil +} diff --git a/x/auth/types/query.pb.go b/x/auth/types/query.pb.go index 4150c3f6f..3dbc12595 100644 --- a/x/auth/types/query.pb.go +++ b/x/auth/types/query.pb.go @@ -305,6 +305,89 @@ func (m *QueryParamsResponse) GetParams() Params { return Params{} } +// QueryNextAccountRequest is the request type for the Query/NextAccountNumber RPC method. +type QueryNextAccountNumberRequest struct { +} + +func (m *QueryNextAccountNumberRequest) Reset() { *m = QueryNextAccountNumberRequest{} } +func (m *QueryNextAccountNumberRequest) String() string { return proto.CompactTextString(m) } +func (*QueryNextAccountNumberRequest) ProtoMessage() {} +func (*QueryNextAccountNumberRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_c451370b3929a27c, []int{6} +} +func (m *QueryNextAccountNumberRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryNextAccountNumberRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryNextAccountNumberRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryNextAccountNumberRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryNextAccountNumberRequest.Merge(m, src) +} +func (m *QueryNextAccountNumberRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryNextAccountNumberRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryNextAccountNumberRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryNextAccountNumberRequest proto.InternalMessageInfo + +// QueryNextAccountResponse is the response type for the Query/NextAccountNumber RPC method. +type QueryNextAccountNumberResponse struct { + // count defines the next account number. + Count uint64 `protobuf:"varint,1,opt,name=count,proto3" json:"count,omitempty"` +} + +func (m *QueryNextAccountNumberResponse) Reset() { *m = QueryNextAccountNumberResponse{} } +func (m *QueryNextAccountNumberResponse) String() string { return proto.CompactTextString(m) } +func (*QueryNextAccountNumberResponse) ProtoMessage() {} +func (*QueryNextAccountNumberResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_c451370b3929a27c, []int{7} +} +func (m *QueryNextAccountNumberResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryNextAccountNumberResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryNextAccountNumberResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryNextAccountNumberResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryNextAccountNumberResponse.Merge(m, src) +} +func (m *QueryNextAccountNumberResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryNextAccountNumberResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryNextAccountNumberResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryNextAccountNumberResponse proto.InternalMessageInfo + +func (m *QueryNextAccountNumberResponse) GetCount() uint64 { + if m != nil { + return m.Count + } + return 0 +} + func init() { proto.RegisterType((*QueryAccountsRequest)(nil), "cosmos.auth.v1beta1.QueryAccountsRequest") proto.RegisterType((*QueryAccountsResponse)(nil), "cosmos.auth.v1beta1.QueryAccountsResponse") @@ -312,46 +395,52 @@ func init() { proto.RegisterType((*QueryAccountResponse)(nil), "cosmos.auth.v1beta1.QueryAccountResponse") proto.RegisterType((*QueryParamsRequest)(nil), "cosmos.auth.v1beta1.QueryParamsRequest") proto.RegisterType((*QueryParamsResponse)(nil), "cosmos.auth.v1beta1.QueryParamsResponse") + proto.RegisterType((*QueryNextAccountNumberRequest)(nil), "cosmos.auth.v1beta1.QueryNextAccountNumberRequest") + proto.RegisterType((*QueryNextAccountNumberResponse)(nil), "cosmos.auth.v1beta1.QueryNextAccountNumberResponse") } func init() { proto.RegisterFile("cosmos/auth/v1beta1/query.proto", fileDescriptor_c451370b3929a27c) } var fileDescriptor_c451370b3929a27c = []byte{ - // 537 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x92, 0x41, 0x6b, 0x13, 0x4f, - 0x18, 0xc6, 0x77, 0xda, 0xff, 0x3f, 0x89, 0x53, 0x4f, 0xd3, 0x08, 0x71, 0x6b, 0x77, 0xcb, 0x8a, - 0x26, 0x29, 0x74, 0x86, 0xc6, 0x53, 0x45, 0x84, 0x46, 0x50, 0xbc, 0xc5, 0xc5, 0x93, 0x07, 0x65, - 0x36, 0x19, 0xb7, 0x41, 0xb3, 0xb3, 0xcd, 0xec, 0x8a, 0x41, 0x04, 0xf1, 0xd4, 0x9b, 0x82, 0x5f, - 0x20, 0x37, 0xbf, 0x80, 0x1f, 0xa2, 0x78, 0x2a, 0x78, 0xf1, 0x24, 0x92, 0x78, 0xf0, 0x63, 0x48, - 0x66, 0xde, 0x89, 0x8d, 0xac, 0x26, 0xa7, 0xdd, 0x99, 0x79, 0x9f, 0xe7, 0xf9, 0x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x63, 0x79, 0x21, 0xe0, 0x5c, 0xd5, - 0x38, 0xdb, 0x64, 0xab, 0x10, 0xc7, 0xdc, 0x54, 0xfb, 0xce, 0xe9, 0xc4, 0x43, 0x67, 0x13, 0x0f, - 0x7d, 0x9f, 0x78, 0xe8, 0xfd, 0xd4, 0x73, 0xce, 0xa6, 0x9e, 0xf3, 0x75, 0xea, 0x39, 0x8f, 0x9a, - 0x71, 0x3f, 0x3b, 0xca, 0x23, 0xda, 0x95, 0x03, 0x6b, 0x60, 0x3e, 0x7b, 0xaa, 0xf7, 0x8c, 0xbd, - 0x34, 0x6e, 0xd9, 0x28, 0x15, 0x2a, 0x2a, 0xe9, 0xb7, 0x77, 0xe3, 0x57, 0x00, 0x00, 0x00, 0xff, - 0xff, 0x2a, 0xe1, 0x81, 0xd3, 0xdf, 0x04, 0x00, 0x00, + // 604 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x93, 0xcf, 0x6b, 0x13, 0x41, + 0x14, 0xc7, 0x77, 0x6b, 0x7f, 0xc4, 0xa9, 0x17, 0xa7, 0x11, 0xe2, 0xd6, 0xec, 0x96, 0x15, 0x9b, + 0xa4, 0xd0, 0x59, 0x9a, 0x82, 0x50, 0x11, 0xa1, 0x11, 0x14, 0x2f, 0x25, 0x2e, 0x9e, 0x3c, 0x28, + 0xb3, 0xc9, 0xb8, 0x0d, 0x9a, 0x9d, 0x6d, 0x66, 0x57, 0x12, 0x44, 0x10, 0x4f, 0xbd, 0x29, 0xf8, + 0x0f, 0xe4, 0x0f, 0xf0, 0xe8, 0x1f, 0x51, 0x3c, 0x15, 0x04, 0xf1, 0x24, 0x92, 0x78, 0xf0, 0xcf, + 0x90, 0xcc, 0xbc, 0x49, 0x1b, 0xdd, 0x98, 0x78, 0xda, 0x9d, 0x99, 0xf7, 0x7d, 0xdf, 0xcf, 0x7b, + 0xf3, 0x06, 0x39, 0x0d, 0x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0x0e, 0x4f, 0x72, 0x54, 0x70, 0xe9, 0x9f, 0x1c, 0xde, 0x2b, 0x18, 0xa3, 0xd7, 0xf8, + 0x8d, 0x89, 0x96, 0xd5, 0xc5, 0xe0, 0xd2, 0x74, 0x9b, 0x89, 0x29, 0xb0, 0xca, 0xb3, 0x03, 0x01, + 0xe7, 0xba, 0xc4, 0x29, 0xe2, 0xf5, 0x4c, 0x1c, 0x35, 0x02, 0xf8, 0xa3, 0x89, 0x2e, 0xff, 0x75, + 0xbb, 0xb8, 0x3a, 0xdd, 0x64, 0xda, 0xac, 0x58, 0xbb, 0xff, 0xa5, 0x01, 0x46, 0x22, 0x19, 0xcb, + 0x78, 0x33, 0x93, 0x31, 0x62, 0xdd, 0x04, 0xda, 0x16, 0x49, 0x5d, 0xed, 0xee, 0xc9, 0xc0, 0x36, + 0x4f, 0x07, 0xb6, 0xf9, 0x63, 0x60, 0x9b, 0xef, 0x87, 0xb6, 0x71, 0x3a, 0xb4, 0x8d, 0x6f, 0x43, + 0xdb, 0x78, 0x5c, 0x09, 0x5b, 0xc9, 0x61, 0x1a, 0x90, 0x06, 0x6f, 0xeb, 0x5c, 0xea, 0xb3, 0x2d, + 0x9a, 0xcf, 0xbd, 0xae, 0x4a, 0x9c, 0xf4, 0x62, 0x26, 0x82, 0x65, 0xf9, 0x06, 0x77, 0x7f, 0x07, + 0x00, 0x00, 0xff, 0xff, 0x91, 0x4c, 0xea, 0x27, 0xe7, 0x05, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -374,6 +463,8 @@ type QueryClient interface { Account(ctx context.Context, in *QueryAccountRequest, opts ...grpc.CallOption) (*QueryAccountResponse, error) // Params queries all parameters. Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) + // NextAccountNumber queries the next account number assigned + NextAccountNumber(ctx context.Context, in *QueryNextAccountNumberRequest, opts ...grpc.CallOption) (*QueryNextAccountNumberResponse, error) } type queryClient struct { @@ -411,6 +502,15 @@ func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts . return out, nil } +func (c *queryClient) NextAccountNumber(ctx context.Context, in *QueryNextAccountNumberRequest, opts ...grpc.CallOption) (*QueryNextAccountNumberResponse, error) { + out := new(QueryNextAccountNumberResponse) + err := c.cc.Invoke(ctx, "/cosmos.auth.v1beta1.Query/NextAccountNumber", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // QueryServer is the server API for Query service. type QueryServer interface { // Accounts returns all the existing accounts @@ -421,6 +521,8 @@ type QueryServer interface { Account(context.Context, *QueryAccountRequest) (*QueryAccountResponse, error) // Params queries all parameters. Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) + // NextAccountNumber queries the next account number assigned + NextAccountNumber(context.Context, *QueryNextAccountNumberRequest) (*QueryNextAccountNumberResponse, error) } // UnimplementedQueryServer can be embedded to have forward compatible implementations. @@ -436,6 +538,9 @@ func (*UnimplementedQueryServer) Account(ctx context.Context, req *QueryAccountR func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsRequest) (*QueryParamsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") } +func (*UnimplementedQueryServer) NextAccountNumber(ctx context.Context, req *QueryNextAccountNumberRequest) (*QueryNextAccountNumberResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method NextAccountNumber not implemented") +} func RegisterQueryServer(s grpc1.Server, srv QueryServer) { s.RegisterService(&_Query_serviceDesc, srv) @@ -495,6 +600,24 @@ func _Query_Params_Handler(srv interface{}, ctx context.Context, dec func(interf return interceptor(ctx, in, info, handler) } +func _Query_NextAccountNumber_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryNextAccountNumberRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).NextAccountNumber(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cosmos.auth.v1beta1.Query/NextAccountNumber", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).NextAccountNumber(ctx, req.(*QueryNextAccountNumberRequest)) + } + return interceptor(ctx, in, info, handler) +} + var _Query_serviceDesc = grpc.ServiceDesc{ ServiceName: "cosmos.auth.v1beta1.Query", HandlerType: (*QueryServer)(nil), @@ -511,6 +634,10 @@ var _Query_serviceDesc = grpc.ServiceDesc{ MethodName: "Params", Handler: _Query_Params_Handler, }, + { + MethodName: "NextAccountNumber", + Handler: _Query_NextAccountNumber_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "cosmos/auth/v1beta1/query.proto", @@ -721,6 +848,57 @@ func (m *QueryParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *QueryNextAccountNumberRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryNextAccountNumberRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryNextAccountNumberRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *QueryNextAccountNumberResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryNextAccountNumberResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryNextAccountNumberResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Count != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.Count)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { offset -= sovQuery(v) base := offset @@ -810,6 +988,27 @@ func (m *QueryParamsResponse) Size() (n int) { return n } +func (m *QueryNextAccountNumberRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *QueryNextAccountNumberResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Count != 0 { + n += 1 + sovQuery(uint64(m.Count)) + } + return n +} + func sovQuery(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -1323,6 +1522,125 @@ func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *QueryNextAccountNumberRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryNextAccountNumberRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryNextAccountNumberRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryNextAccountNumberResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryNextAccountNumberResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryNextAccountNumberResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Count", wireType) + } + m.Count = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Count |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipQuery(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0