Add GetDistribution query (#227)

Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
This commit is contained in:
Jürgen Eckel 2023-12-12 10:13:27 +01:00 committed by GitHub
parent ede70b073b
commit 73b0d1b4c8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 718 additions and 50 deletions

View File

@ -47013,6 +47013,71 @@ paths:
format: int64
tags:
- Query
/planetmint/planetmint-go/dao/get_distribution/{lastPopHeight}:
get:
summary: Queries a list of GetDistribution items.
operationId: PlanetmintgoDaoGetDistribution
responses:
'200':
description: A successful response.
schema:
type: object
properties:
distribution:
type: object
properties:
daoAddr:
type: string
daoAmount:
type: string
daoTxID:
type: string
investorAddr:
type: string
investorAmount:
type: string
investorTxID:
type: string
popAddr:
type: string
popAmount:
type: string
popTxID:
type: string
firstPop:
type: string
format: int64
lastPop:
type: string
format: int64
proposer:
type: string
default:
description: An unexpected error response.
schema:
type: object
properties:
code:
type: integer
format: int32
message:
type: string
details:
type: array
items:
type: object
properties:
'@type':
type: string
additionalProperties: {}
parameters:
- name: lastPopHeight
in: path
required: true
type: string
format: int64
tags:
- Query
/planetmint/machine/get_machine_by_address/{address}:
get:
summary: Queries a list of GetMachineByAddress items.
@ -76188,6 +76253,38 @@ definitions:
type: boolean
finished:
type: boolean
planetmintgo.dao.QueryGetDistributionResponse:
type: object
properties:
distribution:
type: object
properties:
daoAddr:
type: string
daoAmount:
type: string
daoTxID:
type: string
investorAddr:
type: string
investorAmount:
type: string
investorTxID:
type: string
popAddr:
type: string
popAmount:
type: string
popTxID:
type: string
firstPop:
type: string
format: int64
lastPop:
type: string
format: int64
proposer:
type: string
planetmintgo.dao.QueryGetMintRequestsByHashResponse:
type: object
properties:

View File

@ -10,6 +10,7 @@ import "planetmintgo/dao/mint_request.proto";
import "planetmintgo/dao/mint_requests.proto";
import "planetmintgo/dao/reissuance.proto";
import "planetmintgo/dao/challenge.proto";
import "planetmintgo/dao/distribution_order.proto";
option go_package = "github.com/planetmint/planetmint-go/x/dao/types";
@ -51,6 +52,12 @@ service Query {
option (google.api.http).get = "/planetmint/planetmint-go/dao/get_challenge/{height}";
}
// Queries a list of GetDistribution items.
rpc GetDistribution (QueryGetDistributionRequest) returns (QueryGetDistributionResponse) {
option (google.api.http).get = "/planetmint/planetmint-go/dao/get_distribution/{lastPopHeight}";
}
}
// QueryParamsRequest is request type for the Query/Params RPC method.
message QueryParamsRequest {}
@ -103,3 +110,11 @@ message QueryGetChallengeResponse {
Challenge challenge = 1;
}
message QueryGetDistributionRequest {
int64 lastPopHeight = 1;
}
message QueryGetDistributionResponse {
DistributionOrder distribution = 1;
}

View File

@ -32,6 +32,8 @@ func GetQueryCmd(_ string) *cobra.Command {
cmd.AddCommand(CmdGetChallenge())
cmd.AddCommand(CmdGetDistribution())
// this line is used by starport scaffolding # 1
return cmd

View File

@ -0,0 +1,50 @@
package cli
import (
"strconv"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/planetmint/planetmint-go/x/dao/types"
"github.com/spf13/cast"
"github.com/spf13/cobra"
)
var _ = strconv.Itoa(0)
func CmdGetDistribution() *cobra.Command {
cmd := &cobra.Command{
Use: "get-distribution [block-height]",
Short: "Query get_distribution",
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) (err error) {
reqLastPopHeight, err := cast.ToInt64E(args[0])
if err != nil {
return err
}
clientCtx, err := client.GetClientQueryContext(cmd)
if err != nil {
return err
}
queryClient := types.NewQueryClient(clientCtx)
params := &types.QueryGetDistributionRequest{
LastPopHeight: reqLastPopHeight,
}
res, err := queryClient.GetDistribution(cmd.Context(), params)
if err != nil {
return err
}
return clientCtx.PrintProto(res)
},
}
flags.AddQueryFlagsToCmd(cmd)
return cmd
}

View File

@ -0,0 +1,25 @@
package keeper
import (
"context"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/planetmint/planetmint-go/x/dao/types"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
)
func (k Keeper) GetDistribution(goCtx context.Context, req *types.QueryGetDistributionRequest) (*types.QueryGetDistributionResponse, error) {
if req == nil {
return nil, status.Error(codes.InvalidArgument, "invalid request")
}
ctx := sdk.UnwrapSDKContext(goCtx)
distribution, found := k.LookupDistributionOrder(ctx, req.GetLastPopHeight())
if !found {
return nil, status.Error(codes.NotFound, "distribution not found")
}
return &types.QueryGetDistributionResponse{Distribution: &distribution}, nil
}

View File

@ -561,6 +561,94 @@ func (m *QueryGetChallengeResponse) GetChallenge() *Challenge {
return nil
}
type QueryGetDistributionRequest struct {
LastPopHeight int64 `protobuf:"varint,1,opt,name=lastPopHeight,proto3" json:"lastPopHeight,omitempty"`
}
func (m *QueryGetDistributionRequest) Reset() { *m = QueryGetDistributionRequest{} }
func (m *QueryGetDistributionRequest) String() string { return proto.CompactTextString(m) }
func (*QueryGetDistributionRequest) ProtoMessage() {}
func (*QueryGetDistributionRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_07bad0eeb5b27724, []int{12}
}
func (m *QueryGetDistributionRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryGetDistributionRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryGetDistributionRequest.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 *QueryGetDistributionRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryGetDistributionRequest.Merge(m, src)
}
func (m *QueryGetDistributionRequest) XXX_Size() int {
return m.Size()
}
func (m *QueryGetDistributionRequest) XXX_DiscardUnknown() {
xxx_messageInfo_QueryGetDistributionRequest.DiscardUnknown(m)
}
var xxx_messageInfo_QueryGetDistributionRequest proto.InternalMessageInfo
func (m *QueryGetDistributionRequest) GetLastPopHeight() int64 {
if m != nil {
return m.LastPopHeight
}
return 0
}
type QueryGetDistributionResponse struct {
Distribution *DistributionOrder `protobuf:"bytes,1,opt,name=distribution,proto3" json:"distribution,omitempty"`
}
func (m *QueryGetDistributionResponse) Reset() { *m = QueryGetDistributionResponse{} }
func (m *QueryGetDistributionResponse) String() string { return proto.CompactTextString(m) }
func (*QueryGetDistributionResponse) ProtoMessage() {}
func (*QueryGetDistributionResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_07bad0eeb5b27724, []int{13}
}
func (m *QueryGetDistributionResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryGetDistributionResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryGetDistributionResponse.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 *QueryGetDistributionResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryGetDistributionResponse.Merge(m, src)
}
func (m *QueryGetDistributionResponse) XXX_Size() int {
return m.Size()
}
func (m *QueryGetDistributionResponse) XXX_DiscardUnknown() {
xxx_messageInfo_QueryGetDistributionResponse.DiscardUnknown(m)
}
var xxx_messageInfo_QueryGetDistributionResponse proto.InternalMessageInfo
func (m *QueryGetDistributionResponse) GetDistribution() *DistributionOrder {
if m != nil {
return m.Distribution
}
return nil
}
func init() {
proto.RegisterType((*QueryParamsRequest)(nil), "planetmintgo.dao.QueryParamsRequest")
proto.RegisterType((*QueryParamsResponse)(nil), "planetmintgo.dao.QueryParamsResponse")
@ -574,61 +662,70 @@ func init() {
proto.RegisterType((*QueryGetReissuancesResponse)(nil), "planetmintgo.dao.QueryGetReissuancesResponse")
proto.RegisterType((*QueryGetChallengeRequest)(nil), "planetmintgo.dao.QueryGetChallengeRequest")
proto.RegisterType((*QueryGetChallengeResponse)(nil), "planetmintgo.dao.QueryGetChallengeResponse")
proto.RegisterType((*QueryGetDistributionRequest)(nil), "planetmintgo.dao.QueryGetDistributionRequest")
proto.RegisterType((*QueryGetDistributionResponse)(nil), "planetmintgo.dao.QueryGetDistributionResponse")
}
func init() { proto.RegisterFile("planetmintgo/dao/query.proto", fileDescriptor_07bad0eeb5b27724) }
var fileDescriptor_07bad0eeb5b27724 = []byte{
// 780 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x96, 0xcd, 0x4e, 0xdb, 0x4a,
0x14, 0xc7, 0x63, 0x2e, 0x37, 0x88, 0x81, 0x7b, 0x75, 0x35, 0x17, 0x50, 0x1a, 0xc0, 0x80, 0x4b,
0x4b, 0xc5, 0x87, 0x5d, 0x42, 0x44, 0x3f, 0x04, 0xaa, 0x9a, 0x4a, 0x85, 0x2e, 0x90, 0xa8, 0x17,
0x5d, 0xb0, 0x89, 0x26, 0xc9, 0xc8, 0xb6, 0x9a, 0x78, 0x42, 0xc6, 0xa9, 0x1a, 0x45, 0xd9, 0xf4,
0x09, 0x2a, 0x55, 0xea, 0xba, 0x8b, 0xf6, 0x2d, 0xaa, 0xae, 0x59, 0x22, 0x75, 0xd3, 0x55, 0x55,
0x85, 0x3e, 0x48, 0x95, 0xf1, 0x71, 0x3c, 0x8e, 0x13, 0x93, 0x4a, 0xdd, 0xa0, 0xb1, 0xe7, 0x7f,
0xce, 0xf9, 0x9d, 0x63, 0xfe, 0x07, 0xd0, 0x52, 0xbd, 0x4a, 0x5c, 0xea, 0xd5, 0x1c, 0xd7, 0xb3,
0x98, 0x51, 0x21, 0xcc, 0x38, 0x6f, 0xd2, 0x46, 0x4b, 0xaf, 0x37, 0x98, 0xc7, 0xf0, 0x7f, 0xf2,
0xad, 0x5e, 0x21, 0x2c, 0x3b, 0x67, 0x31, 0x8b, 0x89, 0x4b, 0xa3, 0x77, 0xf2, 0x75, 0xd9, 0x25,
0x8b, 0x31, 0xab, 0x4a, 0x0d, 0x52, 0x77, 0x0c, 0xe2, 0xba, 0xcc, 0x23, 0x9e, 0xc3, 0x5c, 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, 0xf6, 0xbd, 0x6d, 0xb4, 0xfd, 0xdd, 0xd1, 0x29, 0x3c,
0xbb, 0xe8, 0xaa, 0xca, 0x65, 0x57, 0x55, 0x7e, 0x74, 0x55, 0xe5, 0xed, 0x95, 0x9a, 0xba, 0xbc,
0x52, 0x53, 0xdf, 0xae, 0xd4, 0xd4, 0x99, 0x61, 0x39, 0x9e, 0xdd, 0x2c, 0xe9, 0x65, 0x56, 0x1b,
0x9d, 0xf9, 0xb5, 0xc8, 0xed, 0xb5, 0xea, 0x94, 0x97, 0xd2, 0xe2, 0x1f, 0x83, 0xbd, 0x5f, 0x01,
0x00, 0x00, 0xff, 0xff, 0x46, 0xfb, 0x24, 0x20, 0x59, 0x09, 0x00, 0x00,
// 882 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x96, 0xcf, 0x6f, 0xe3, 0x44,
0x14, 0xc7, 0xe3, 0x65, 0x09, 0xea, 0x6b, 0x17, 0xd0, 0xb0, 0xbb, 0x0a, 0xde, 0xac, 0xb7, 0x9d,
0x2d, 0x2c, 0xec, 0x0f, 0x9b, 0xcd, 0x46, 0xcb, 0x0f, 0xb5, 0xfc, 0x48, 0x51, 0x5b, 0x0e, 0x15,
0xc5, 0x07, 0x0e, 0xbd, 0x44, 0x93, 0x64, 0x64, 0x5b, 0x24, 0x1e, 0xd7, 0xe3, 0x20, 0xa2, 0x28,
0x17, 0xfe, 0x02, 0x24, 0x24, 0x6e, 0x48, 0x1c, 0xe0, 0x7f, 0xe0, 0x80, 0x38, 0xf7, 0x58, 0x89,
0x0b, 0x27, 0x84, 0x5a, 0xfe, 0x10, 0xe4, 0xf1, 0x38, 0x1e, 0xc7, 0x8e, 0x1b, 0x24, 0x2e, 0xd5,
0x78, 0xe6, 0xfb, 0xde, 0xfb, 0xbc, 0x67, 0xcf, 0xb7, 0x81, 0x66, 0x30, 0x24, 0x3e, 0x8d, 0x46,
0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x27, 0x96, 0xe3, 0x45,
0xee, 0xb8, 0x67, 0xf6, 0xd9, 0x68, 0x79, 0x8d, 0x6f, 0x44, 0x95, 0x68, 0x12, 0x50, 0xde, 0xab,
0x8b, 0x5f, 0x60, 0xcf, 0xfe, 0x0d, 0x00, 0x00, 0xff, 0xff, 0x68, 0x69, 0x5f, 0x39, 0xed, 0x0a,
0x00, 0x00,
}
// Reference imports to suppress errors if they are not otherwise used.
@ -655,6 +752,8 @@ type QueryClient interface {
GetReissuances(ctx context.Context, in *QueryGetReissuancesRequest, opts ...grpc.CallOption) (*QueryGetReissuancesResponse, error)
// Queries a list of GetChallenge items.
GetChallenge(ctx context.Context, in *QueryGetChallengeRequest, opts ...grpc.CallOption) (*QueryGetChallengeResponse, error)
// Queries a list of GetDistribution items.
GetDistribution(ctx context.Context, in *QueryGetDistributionRequest, opts ...grpc.CallOption) (*QueryGetDistributionResponse, error)
}
type queryClient struct {
@ -719,6 +818,15 @@ func (c *queryClient) GetChallenge(ctx context.Context, in *QueryGetChallengeReq
return out, nil
}
func (c *queryClient) GetDistribution(ctx context.Context, in *QueryGetDistributionRequest, opts ...grpc.CallOption) (*QueryGetDistributionResponse, error) {
out := new(QueryGetDistributionResponse)
err := c.cc.Invoke(ctx, "/planetmintgo.dao.Query/GetDistribution", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// QueryServer is the server API for Query service.
type QueryServer interface {
// Parameters queries the parameters of the module.
@ -733,6 +841,8 @@ type QueryServer interface {
GetReissuances(context.Context, *QueryGetReissuancesRequest) (*QueryGetReissuancesResponse, error)
// Queries a list of GetChallenge items.
GetChallenge(context.Context, *QueryGetChallengeRequest) (*QueryGetChallengeResponse, error)
// Queries a list of GetDistribution items.
GetDistribution(context.Context, *QueryGetDistributionRequest) (*QueryGetDistributionResponse, error)
}
// UnimplementedQueryServer can be embedded to have forward compatible implementations.
@ -757,6 +867,9 @@ func (*UnimplementedQueryServer) GetReissuances(ctx context.Context, req *QueryG
func (*UnimplementedQueryServer) GetChallenge(ctx context.Context, req *QueryGetChallengeRequest) (*QueryGetChallengeResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetChallenge not implemented")
}
func (*UnimplementedQueryServer) GetDistribution(ctx context.Context, req *QueryGetDistributionRequest) (*QueryGetDistributionResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetDistribution not implemented")
}
func RegisterQueryServer(s grpc1.Server, srv QueryServer) {
s.RegisterService(&_Query_serviceDesc, srv)
@ -870,6 +983,24 @@ func _Query_GetChallenge_Handler(srv interface{}, ctx context.Context, dec func(
return interceptor(ctx, in, info, handler)
}
func _Query_GetDistribution_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QueryGetDistributionRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QueryServer).GetDistribution(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/planetmintgo.dao.Query/GetDistribution",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).GetDistribution(ctx, req.(*QueryGetDistributionRequest))
}
return interceptor(ctx, in, info, handler)
}
var _Query_serviceDesc = grpc.ServiceDesc{
ServiceName: "planetmintgo.dao.Query",
HandlerType: (*QueryServer)(nil),
@ -898,6 +1029,10 @@ var _Query_serviceDesc = grpc.ServiceDesc{
MethodName: "GetChallenge",
Handler: _Query_GetChallenge_Handler,
},
{
MethodName: "GetDistribution",
Handler: _Query_GetDistribution_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "planetmintgo/dao/query.proto",
@ -1297,6 +1432,69 @@ func (m *QueryGetChallengeResponse) MarshalToSizedBuffer(dAtA []byte) (int, erro
return len(dAtA) - i, nil
}
func (m *QueryGetDistributionRequest) 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 *QueryGetDistributionRequest) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryGetDistributionRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if m.LastPopHeight != 0 {
i = encodeVarintQuery(dAtA, i, uint64(m.LastPopHeight))
i--
dAtA[i] = 0x8
}
return len(dAtA) - i, nil
}
func (m *QueryGetDistributionResponse) 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 *QueryGetDistributionResponse) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryGetDistributionResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if m.Distribution != nil {
{
size, err := m.Distribution.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
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
@ -1460,6 +1658,31 @@ func (m *QueryGetChallengeResponse) Size() (n int) {
return n
}
func (m *QueryGetDistributionRequest) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if m.LastPopHeight != 0 {
n += 1 + sovQuery(uint64(m.LastPopHeight))
}
return n
}
func (m *QueryGetDistributionResponse) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if m.Distribution != nil {
l = m.Distribution.Size()
n += 1 + l + sovQuery(uint64(l))
}
return n
}
func sovQuery(x uint64) (n int) {
return (math_bits.Len64(x|1) + 6) / 7
}
@ -2453,6 +2676,161 @@ func (m *QueryGetChallengeResponse) Unmarshal(dAtA []byte) error {
}
return nil
}
func (m *QueryGetDistributionRequest) 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: QueryGetDistributionRequest: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryGetDistributionRequest: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field LastPopHeight", wireType)
}
m.LastPopHeight = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.LastPopHeight |= int64(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 (m *QueryGetDistributionResponse) 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: QueryGetDistributionResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryGetDistributionResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Distribution", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if m.Distribution == nil {
m.Distribution = &DistributionOrder{}
}
if err := m.Distribution.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

View File

@ -303,6 +303,60 @@ func local_request_Query_GetChallenge_0(ctx context.Context, marshaler runtime.M
}
func request_Query_GetDistribution_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryGetDistributionRequest
var metadata runtime.ServerMetadata
var (
val string
ok bool
err error
_ = err
)
val, ok = pathParams["lastPopHeight"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "lastPopHeight")
}
protoReq.LastPopHeight, err = runtime.Int64(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "lastPopHeight", err)
}
msg, err := client.GetDistribution(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Query_GetDistribution_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryGetDistributionRequest
var metadata runtime.ServerMetadata
var (
val string
ok bool
err error
_ = err
)
val, ok = pathParams["lastPopHeight"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "lastPopHeight")
}
protoReq.LastPopHeight, err = runtime.Int64(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "lastPopHeight", err)
}
msg, err := server.GetDistribution(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.
@ -447,6 +501,29 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv
})
mux.Handle("GET", pattern_Query_GetDistribution_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_GetDistribution_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_GetDistribution_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
return nil
}
@ -608,6 +685,26 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie
})
mux.Handle("GET", pattern_Query_GetDistribution_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_GetDistribution_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_GetDistribution_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
return nil
}
@ -623,6 +720,8 @@ var (
pattern_Query_GetReissuances_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"planetmint", "dao", "get_reissuances"}, "", runtime.AssumeColonVerbOpt(true)))
pattern_Query_GetChallenge_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"planetmint", "planetmint-go", "dao", "get_challenge", "height"}, "", runtime.AssumeColonVerbOpt(true)))
pattern_Query_GetDistribution_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"planetmint", "planetmint-go", "dao", "get_distribution", "lastPopHeight"}, "", runtime.AssumeColonVerbOpt(true)))
)
var (
@ -637,4 +736,6 @@ var (
forward_Query_GetReissuances_0 = runtime.ForwardResponseMessage
forward_Query_GetChallenge_0 = runtime.ForwardResponseMessage
forward_Query_GetDistribution_0 = runtime.ForwardResponseMessage
)