diff --git a/proto/juno/mint/query.proto b/proto/juno/mint/query.proto index 63afd0e0e..43d3242ef 100755 --- a/proto/juno/mint/query.proto +++ b/proto/juno/mint/query.proto @@ -24,6 +24,12 @@ service Query { returns (QueryAnnualProvisionsResponse) { option (google.api.http).get = "/cosmos/mint/v1beta1/annual_provisions"; } + + // TargetSupply current target supply for this phase value. + rpc TargetSupply(QueryTargetSupplyRequest) + returns (QueryTargetSupplyResponse) { + option (google.api.http).get = "/cosmos/mint/v1beta1/target_supply"; + } } // QueryParamsRequest is the request type for the Query/Params RPC method. @@ -61,3 +67,17 @@ message QueryAnnualProvisionsResponse { (gogoproto.nullable) = false ]; } + +// QueryTargetSupplyRequest is the request type for the +// Query/TargetSupply RPC method. +message QueryTargetSupplyRequest {} + +// QueryTargetSupplyResponse is the response type for the +// Query/TargetSupply RPC method. +message QueryTargetSupplyResponse { + // target_supply is the target supply for this phase value. + bytes target_supply = 1 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.nullable) = false + ]; +} diff --git a/x/mint/client/cli/query.go b/x/mint/client/cli/query.go index 0becc883e..274fe72ab 100644 --- a/x/mint/client/cli/query.go +++ b/x/mint/client/cli/query.go @@ -25,6 +25,7 @@ func GetQueryCmd() *cobra.Command { GetCmdQueryParams(), GetCmdQueryInflation(), GetCmdQueryAnnualProvisions(), + GetCmqQueryTargetSupply(), ) return mintingQueryCmd @@ -116,3 +117,31 @@ func GetCmdQueryAnnualProvisions() *cobra.Command { return cmd } + +// GetCmqQueryTargetSupply implements a command to return the current target supply value. +func GetCmqQueryTargetSupply() *cobra.Command { + cmd := &cobra.Command{ + Use: "target-supply", + Short: "Query the current target supply for this phase value", + Args: cobra.NoArgs, + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + queryClient := types.NewQueryClient(clientCtx) + + params := &types.QueryTargetSupplyRequest{} + res, err := queryClient.TargetSupply(cmd.Context(), params) + if err != nil { + return err + } + + return clientCtx.PrintString(fmt.Sprintf("%s\n", res.TargetSupply)) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + + return cmd +} diff --git a/x/mint/keeper/grpc_query.go b/x/mint/keeper/grpc_query.go index 08f8bbda7..0dab5cb4c 100644 --- a/x/mint/keeper/grpc_query.go +++ b/x/mint/keeper/grpc_query.go @@ -33,3 +33,11 @@ func (k Keeper) AnnualProvisions(c context.Context, _ *types.QueryAnnualProvisio return &types.QueryAnnualProvisionsResponse{AnnualProvisions: minter.AnnualProvisions}, nil } + +// Target supply returns minter.TargetSupply of the mint module. +func (k Keeper) TargetSupply(c context.Context, _ *types.QueryTargetSupplyRequest) (*types.QueryTargetSupplyResponse, error) { + ctx := sdk.UnwrapSDKContext(c) + minter := k.GetMinter(ctx) + + return &types.QueryTargetSupplyResponse{TargetSupply: minter.TargetSupply}, nil +} diff --git a/x/mint/types/query.pb.go b/x/mint/types/query.pb.go index d569d9693..14963cb6e 100644 --- a/x/mint/types/query.pb.go +++ b/x/mint/types/query.pb.go @@ -268,6 +268,84 @@ func (m *QueryAnnualProvisionsResponse) XXX_DiscardUnknown() { var xxx_messageInfo_QueryAnnualProvisionsResponse proto.InternalMessageInfo +// QueryTargetSupplyRequest is the request type for the +// Query/TargetSupply RPC method. +type QueryTargetSupplyRequest struct { +} + +func (m *QueryTargetSupplyRequest) Reset() { *m = QueryTargetSupplyRequest{} } +func (m *QueryTargetSupplyRequest) String() string { return proto.CompactTextString(m) } +func (*QueryTargetSupplyRequest) ProtoMessage() {} +func (*QueryTargetSupplyRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_a6f0d4f2a25816bd, []int{6} +} +func (m *QueryTargetSupplyRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryTargetSupplyRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryTargetSupplyRequest.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 *QueryTargetSupplyRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryTargetSupplyRequest.Merge(m, src) +} +func (m *QueryTargetSupplyRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryTargetSupplyRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryTargetSupplyRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryTargetSupplyRequest proto.InternalMessageInfo + +// QueryTargetSupplyResponse is the response type for the +// Query/TargetSupply RPC method. +type QueryTargetSupplyResponse struct { + // target_supply is the target supply for this phase value. + TargetSupply github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,1,opt,name=target_supply,json=targetSupply,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"target_supply"` +} + +func (m *QueryTargetSupplyResponse) Reset() { *m = QueryTargetSupplyResponse{} } +func (m *QueryTargetSupplyResponse) String() string { return proto.CompactTextString(m) } +func (*QueryTargetSupplyResponse) ProtoMessage() {} +func (*QueryTargetSupplyResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_a6f0d4f2a25816bd, []int{7} +} +func (m *QueryTargetSupplyResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryTargetSupplyResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryTargetSupplyResponse.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 *QueryTargetSupplyResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryTargetSupplyResponse.Merge(m, src) +} +func (m *QueryTargetSupplyResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryTargetSupplyResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryTargetSupplyResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryTargetSupplyResponse proto.InternalMessageInfo + func init() { proto.RegisterType((*QueryParamsRequest)(nil), "juno.mint.QueryParamsRequest") proto.RegisterType((*QueryParamsResponse)(nil), "juno.mint.QueryParamsResponse") @@ -275,40 +353,47 @@ func init() { proto.RegisterType((*QueryInflationResponse)(nil), "juno.mint.QueryInflationResponse") proto.RegisterType((*QueryAnnualProvisionsRequest)(nil), "juno.mint.QueryAnnualProvisionsRequest") proto.RegisterType((*QueryAnnualProvisionsResponse)(nil), "juno.mint.QueryAnnualProvisionsResponse") + proto.RegisterType((*QueryTargetSupplyRequest)(nil), "juno.mint.QueryTargetSupplyRequest") + proto.RegisterType((*QueryTargetSupplyResponse)(nil), "juno.mint.QueryTargetSupplyResponse") } func init() { proto.RegisterFile("juno/mint/query.proto", fileDescriptor_a6f0d4f2a25816bd) } var fileDescriptor_a6f0d4f2a25816bd = []byte{ - // 447 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x53, 0x4f, 0xaf, 0xd2, 0x40, - 0x1c, 0x6c, 0xfd, 0x43, 0xc2, 0xea, 0xe1, 0xbd, 0x95, 0xa7, 0xa6, 0x3e, 0xf6, 0x61, 0x4d, 0x90, - 0x83, 0xee, 0x06, 0xfc, 0x04, 0x82, 0x21, 0x31, 0xf1, 0x80, 0x1c, 0xf5, 0x60, 0x96, 0xba, 0xd4, - 0x6a, 0xbb, 0x5b, 0xba, 0x5b, 0x02, 0x89, 0x27, 0x2f, 0x5e, 0x4d, 0x8c, 0xdf, 0x89, 0x23, 0x89, - 0x17, 0xe3, 0x81, 0x18, 0xf0, 0x83, 0x98, 0x6e, 0xff, 0x80, 0x05, 0x34, 0x79, 0x17, 0x68, 0x66, - 0x7e, 0x99, 0x99, 0xcc, 0x64, 0xc1, 0xd9, 0xfb, 0x98, 0x0b, 0x12, 0x78, 0x5c, 0x91, 0x49, 0xcc, - 0xa2, 0x39, 0x0e, 0x23, 0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 0x63, 0x9d, 0xd0, 0x92, - 0x49, 0xe7, 0xf3, 0x55, 0x70, 0x5d, 0xdb, 0x43, 0x1f, 0x54, 0xd2, 0x02, 0x61, 0x7d, 0xa7, 0xd3, - 0xfd, 0x65, 0x2c, 0x74, 0x8c, 0x4e, 0xf3, 0xda, 0x0f, 0x3e, 0x7d, 0xff, 0xfd, 0xf5, 0x4a, 0x1d, - 0xde, 0xcb, 0xa3, 0xe8, 0xc1, 0xa7, 0xed, 0x11, 0x53, 0xb4, 0x4d, 0xd2, 0x59, 0xe0, 0x0c, 0x54, - 0x8b, 0xe2, 0x61, 0xa3, 0xac, 0x58, 0x1e, 0xcb, 0xba, 0xff, 0x8f, 0x8b, 0xcc, 0xb6, 0xa9, 0x6d, - 0x1b, 0x10, 0x1d, 0xb4, 0x2d, 0xf6, 0x80, 0xdf, 0x4c, 0x70, 0x52, 0xee, 0x1a, 0x3e, 0x2c, 0xeb, - 0x1f, 0x59, 0xcb, 0x6a, 0xfd, 0xff, 0x30, 0xcb, 0x83, 0x75, 0x9e, 0x16, 0x6c, 0x1e, 0xcc, 0xb3, - 0xb7, 0x68, 0xb7, 0xbf, 0x58, 0x23, 0x73, 0xb9, 0x46, 0xe6, 0xaf, 0x35, 0x32, 0xbf, 0x6c, 0x90, - 0xb1, 0xdc, 0x20, 0xe3, 0xc7, 0x06, 0x19, 0xaf, 0x1e, 0xed, 0xac, 0xdb, 0xd3, 0x5a, 0x3d, 0xc1, - 0x55, 0x44, 0x1d, 0x25, 0x89, 0x7e, 0x51, 0xb3, 0x54, 0x5b, 0xef, 0x3c, 0xaa, 0xe8, 0x57, 0xf5, - 0xe4, 0x4f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x81, 0x01, 0x52, 0xe9, 0xc3, 0x03, 0x00, 0x00, + // 521 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x94, 0xc1, 0x6b, 0x13, 0x41, + 0x14, 0xc6, 0xb3, 0x52, 0x0b, 0x79, 0x46, 0x68, 0xc7, 0x54, 0xeb, 0xda, 0x6c, 0xe3, 0xb6, 0xc4, + 0x20, 0xba, 0x43, 0xeb, 0x5f, 0x60, 0x2a, 0x85, 0x82, 0x87, 0x9a, 0x7a, 0xd2, 0x43, 0x99, 0xc4, + 0xed, 0xba, 0xba, 0x99, 0x99, 0xee, 0xcc, 0x96, 0x06, 0x3c, 0x09, 0x9e, 0x15, 0xc4, 0xff, 0xa9, + 0xc7, 0x82, 0x17, 0xf1, 0x50, 0x24, 0xf1, 0x0f, 0x91, 0x7d, 0x3b, 0x9b, 0xa6, 0xdb, 0x4d, 0x85, + 0x5e, 0x92, 0xf0, 0xbe, 0xc7, 0xf7, 0xfd, 0xc8, 0xfb, 0x18, 0x58, 0xfa, 0x90, 0x70, 0x41, 0x07, + 0x21, 0xd7, 0xf4, 0x30, 0xf1, 0xe3, 0xa1, 0x27, 0x63, 0xa1, 0x05, 0xa9, 0xa6, 0x63, 0x2f, 0x1d, + 0xdb, 0xf5, 0x40, 0x04, 0x02, 0xa7, 0x34, 0xfd, 0x95, 0x2d, 0xd8, 0x2b, 0x81, 0x10, 0x41, 0xe4, + 0x53, 0x26, 0x43, 0xca, 0x38, 0x17, 0x9a, 0xe9, 0x50, 0x70, 0x65, 0xd4, 0xfa, 0xb9, 0x6b, 0xfa, + 0x91, 0x4d, 0xdd, 0x3a, 0x90, 0x57, 0x69, 0xc6, 0x2e, 0x8b, 0xd9, 0x40, 0x75, 0xfd, 0xc3, 0xc4, + 0x57, 0xda, 0xdd, 0x86, 0x3b, 0x17, 0xa6, 0x4a, 0x0a, 0xae, 0x7c, 0x42, 0x61, 0x5e, 0xe2, 0x64, + 0xd9, 0x6a, 0x5a, 0xed, 0x5b, 0x9b, 0x8b, 0xde, 0x04, 0xc9, 0xcb, 0x56, 0x3b, 0x73, 0x27, 0x67, + 0xab, 0x95, 0xae, 0x59, 0x73, 0xef, 0xc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c, 0x43, 0x75, 0x52, 0x03, 0xd2, + 0x2c, 0x3a, 0x16, 0xab, 0x63, 0x3f, 0xbc, 0x62, 0xc3, 0xc4, 0xb6, 0x30, 0xb6, 0x49, 0x9c, 0xd2, + 0xd8, 0x49, 0x3b, 0xc8, 0x0f, 0x0b, 0x16, 0x8a, 0x97, 0x27, 0x8f, 0x8a, 0xfe, 0x33, 0xba, 0x63, + 0xb7, 0xff, 0xbf, 0x68, 0x78, 0x3c, 0xe4, 0x69, 0x93, 0x56, 0x29, 0xcf, 0xa5, 0x7e, 0x91, 0x2f, + 0x16, 0xd4, 0xa6, 0xef, 0x4e, 0xd6, 0x8a, 0x51, 0x25, 0x8d, 0xb1, 0xd7, 0xaf, 0x5e, 0x32, 0x2c, + 0x8f, 0x91, 0x65, 0x9d, 0xb8, 0xa5, 0x2c, 0x17, 0x5a, 0xd5, 0xd9, 0x3e, 0x19, 0x39, 0xd6, 0xe9, + 0xc8, 0xb1, 0xfe, 0x8c, 0x1c, 0xeb, 0xdb, 0xd8, 0xa9, 0x9c, 0x8e, 0x9d, 0xca, 0xaf, 0xb1, 0x53, + 0x79, 0xf3, 0x64, 0xaa, 0x61, 0x5b, 0xe8, 0xb3, 0x25, 0xb8, 0x8e, 0x59, 0x5f, 0x2b, 0x8a, 0xef, + 0xcc, 0x71, 0xe6, 0x8b, 0x5d, 0xeb, 0xcd, 0xe3, 0x5b, 0xf3, 0xec, 0x5f, 0x00, 0x00, 0x00, 0xff, + 0xff, 0xa7, 0x3d, 0x8c, 0xe6, 0xd9, 0x04, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -329,6 +414,8 @@ type QueryClient interface { Inflation(ctx context.Context, in *QueryInflationRequest, opts ...grpc.CallOption) (*QueryInflationResponse, error) // AnnualProvisions current minting annual provisions value. AnnualProvisions(ctx context.Context, in *QueryAnnualProvisionsRequest, opts ...grpc.CallOption) (*QueryAnnualProvisionsResponse, error) + // TargetSupply current target supply for this phase value. + TargetSupply(ctx context.Context, in *QueryTargetSupplyRequest, opts ...grpc.CallOption) (*QueryTargetSupplyResponse, error) } type queryClient struct { @@ -366,6 +453,15 @@ func (c *queryClient) AnnualProvisions(ctx context.Context, in *QueryAnnualProvi return out, nil } +func (c *queryClient) TargetSupply(ctx context.Context, in *QueryTargetSupplyRequest, opts ...grpc.CallOption) (*QueryTargetSupplyResponse, error) { + out := new(QueryTargetSupplyResponse) + err := c.cc.Invoke(ctx, "/juno.mint.Query/TargetSupply", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // QueryServer is the server API for Query service. type QueryServer interface { // Params returns the total set of minting parameters. @@ -374,6 +470,8 @@ type QueryServer interface { Inflation(context.Context, *QueryInflationRequest) (*QueryInflationResponse, error) // AnnualProvisions current minting annual provisions value. AnnualProvisions(context.Context, *QueryAnnualProvisionsRequest) (*QueryAnnualProvisionsResponse, error) + // TargetSupply current target supply for this phase value. + TargetSupply(context.Context, *QueryTargetSupplyRequest) (*QueryTargetSupplyResponse, error) } // UnimplementedQueryServer can be embedded to have forward compatible implementations. @@ -389,6 +487,9 @@ func (*UnimplementedQueryServer) Inflation(ctx context.Context, req *QueryInflat func (*UnimplementedQueryServer) AnnualProvisions(ctx context.Context, req *QueryAnnualProvisionsRequest) (*QueryAnnualProvisionsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method AnnualProvisions not implemented") } +func (*UnimplementedQueryServer) TargetSupply(ctx context.Context, req *QueryTargetSupplyRequest) (*QueryTargetSupplyResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method TargetSupply not implemented") +} func RegisterQueryServer(s grpc1.Server, srv QueryServer) { s.RegisterService(&_Query_serviceDesc, srv) @@ -448,6 +549,24 @@ func _Query_AnnualProvisions_Handler(srv interface{}, ctx context.Context, dec f return interceptor(ctx, in, info, handler) } +func _Query_TargetSupply_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryTargetSupplyRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).TargetSupply(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/juno.mint.Query/TargetSupply", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).TargetSupply(ctx, req.(*QueryTargetSupplyRequest)) + } + return interceptor(ctx, in, info, handler) +} + var _Query_serviceDesc = grpc.ServiceDesc{ ServiceName: "juno.mint.Query", HandlerType: (*QueryServer)(nil), @@ -464,6 +583,10 @@ var _Query_serviceDesc = grpc.ServiceDesc{ MethodName: "AnnualProvisions", Handler: _Query_AnnualProvisions_Handler, }, + { + MethodName: "TargetSupply", + Handler: _Query_TargetSupply_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "juno/mint/query.proto", @@ -637,6 +760,62 @@ func (m *QueryAnnualProvisionsResponse) MarshalToSizedBuffer(dAtA []byte) (int, return len(dAtA) - i, nil } +func (m *QueryTargetSupplyRequest) 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 *QueryTargetSupplyRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryTargetSupplyRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *QueryTargetSupplyResponse) 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 *QueryTargetSupplyResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryTargetSupplyResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size := m.TargetSupply.Size() + i -= size + if _, err := m.TargetSupply.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { offset -= sovQuery(v) base := offset @@ -708,6 +887,26 @@ func (m *QueryAnnualProvisionsResponse) Size() (n int) { return n } +func (m *QueryTargetSupplyRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *QueryTargetSupplyResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.TargetSupply.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + func sovQuery(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -1113,6 +1312,139 @@ func (m *QueryAnnualProvisionsResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *QueryTargetSupplyRequest) 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: QueryTargetSupplyRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryTargetSupplyRequest: 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 *QueryTargetSupplyResponse) 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: QueryTargetSupplyResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryTargetSupplyResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TargetSupply", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.TargetSupply.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + 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 diff --git a/x/mint/types/query.pb.gw.go b/x/mint/types/query.pb.gw.go index a9166ea00..b573727e4 100644 --- a/x/mint/types/query.pb.gw.go +++ b/x/mint/types/query.pb.gw.go @@ -87,6 +87,24 @@ func local_request_Query_AnnualProvisions_0(ctx context.Context, marshaler runti } +func request_Query_TargetSupply_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryTargetSupplyRequest + var metadata runtime.ServerMetadata + + msg, err := client.TargetSupply(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_TargetSupply_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryTargetSupplyRequest + var metadata runtime.ServerMetadata + + msg, err := server.TargetSupply(ctx, &protoReq) + return msg, metadata, err + +} + // RegisterQueryHandlerServer registers the http handlers for service Query to "mux". // UnaryRPC :call QueryServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. @@ -162,6 +180,29 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv }) + mux.Handle("GET", pattern_Query_TargetSupply_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_TargetSupply_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_TargetSupply_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -263,6 +304,26 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie }) + mux.Handle("GET", pattern_Query_TargetSupply_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_TargetSupply_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_TargetSupply_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -272,6 +333,8 @@ var ( pattern_Query_Inflation_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"cosmos", "mint", "v1beta1", "inflation"}, "", runtime.AssumeColonVerbOpt(false))) pattern_Query_AnnualProvisions_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"cosmos", "mint", "v1beta1", "annual_provisions"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_TargetSupply_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"cosmos", "mint", "v1beta1", "target_supply"}, "", runtime.AssumeColonVerbOpt(false))) ) var ( @@ -280,4 +343,6 @@ var ( forward_Query_Inflation_0 = runtime.ForwardResponseMessage forward_Query_AnnualProvisions_0 = runtime.ForwardResponseMessage + + forward_Query_TargetSupply_0 = runtime.ForwardResponseMessage )