added get_reissuance query

Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
This commit is contained in:
Jürgen Eckel 2023-10-06 11:49:51 +02:00
parent a441ff87dd
commit 4dc1485cd7
No known key found for this signature in database
11 changed files with 735 additions and 44 deletions

View File

@ -46721,6 +46721,54 @@ paths:
type: string
tags:
- Query
/planetmint/planetmint-go/dao/get_reissuance/{blockHeight}:
get:
summary: Queries a list of GetReissuance items.
operationId: PlanetmintgoDaoGetReissuance
responses:
'200':
description: A successful response.
schema:
type: object
properties:
reissuance:
type: object
properties:
proposer:
type: string
rawtx:
type: string
txId:
type: string
blockHeight:
type: string
format: uint64
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: blockHeight
in: path
required: true
type: string
format: uint64
tags:
- Query
/planetmint/planetmint-go/dao/mint_requests_by_address/{address}:
get:
summary: Queries a list of MintRequestsByAddress items.
@ -75836,6 +75884,21 @@ definitions:
format: uint64
liquidTxHash:
type: string
planetmintgo.dao.QueryGetReissuanceResponse:
type: object
properties:
reissuance:
type: object
properties:
proposer:
type: string
rawtx:
type: string
txId:
type: string
blockHeight:
type: string
format: uint64
planetmintgo.dao.QueryMintRequestsByAddressResponse:
type: object
properties:
@ -75861,6 +75924,18 @@ definitions:
description: params holds all the parameters of this module.
type: object
description: QueryParamsResponse is response type for the Query/Params RPC method.
planetmintgo.dao.Reissuance:
type: object
properties:
proposer:
type: string
rawtx:
type: string
txId:
type: string
blockHeight:
type: string
format: uint64
planetmintgo.machine.Machine:
type: object
properties:

View File

@ -8,6 +8,7 @@ import "cosmos/base/query/v1beta1/pagination.proto";
import "planetmintgo/dao/params.proto";
import "planetmintgo/dao/mint_request.proto";
import "planetmintgo/dao/mint_requests.proto";
import "planetmintgo/dao/reissuance.proto";
option go_package = "github.com/planetmint/planetmint-go/x/dao/types";
@ -31,6 +32,12 @@ service Query {
option (google.api.http).get = "/planetmint/planetmint-go/dao/mint_requests_by_address/{address}";
}
// Queries a list of GetReissuance items.
rpc GetReissuance (QueryGetReissuanceRequest) returns (QueryGetReissuanceResponse) {
option (google.api.http).get = "/planetmint/planetmint-go/dao/get_reissuance/{blockHeight}";
}
}
// QueryParamsRequest is request type for the Query/Params RPC method.
message QueryParamsRequest {}
@ -58,3 +65,11 @@ message QueryMintRequestsByAddressResponse {
MintRequests mintRequests = 1;
}
message QueryGetReissuanceRequest {
uint64 blockHeight = 1;
}
message QueryGetReissuanceResponse {
Reissuance reissuance = 1;
}

View File

@ -26,6 +26,8 @@ func GetQueryCmd(queryRoute string) *cobra.Command {
cmd.AddCommand(CmdMintRequestsByAddress())
cmd.AddCommand(CmdGetReissuance())
// 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 CmdGetReissuance() *cobra.Command {
cmd := &cobra.Command{
Use: "get-reissuance [block-height]",
Short: "Query get_reissuance",
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) (err error) {
reqBlockHeight, err := cast.ToUint64E(args[0])
if err != nil {
return err
}
clientCtx, err := client.GetClientQueryContext(cmd)
if err != nil {
return err
}
queryClient := types.NewQueryClient(clientCtx)
params := &types.QueryGetReissuanceRequest{
BlockHeight: reqBlockHeight,
}
res, err := queryClient.GetReissuance(cmd.Context(), params)
if err != nil {
return err
}
return clientCtx.PrintProto(res)
},
}
flags.AddQueryFlagsToCmd(cmd)
return cmd
}

View File

@ -2,6 +2,7 @@ package keeper
import (
"context"
"strconv"
errorsmod "cosmossdk.io/errors"
sdk "github.com/cosmos/cosmos-sdk/types"
@ -11,18 +12,18 @@ import (
func (k msgServer) ReissueRDDLResult(goCtx context.Context, msg *types.MsgReissueRDDLResult) (*types.MsgReissueRDDLResultResponse, error) {
ctx := sdk.UnwrapSDKContext(goCtx)
reissuance, found := k.GetReissuance(ctx, msg.GetBlockHeight())
reissuance, found := k.LookupReissuance(ctx, msg.GetBlockHeight())
if found != true {
return nil, errorsmod.Wrapf(types.ErrReissuanceNotFound, " for provided block height %u", msg.GetBlockHeight())
return nil, errorsmod.Wrapf(types.ErrReissuanceNotFound, " for provided block height %s", strconv.FormatUint(msg.GetBlockHeight(), 10))
}
if reissuance.GetBlockHeight() != msg.GetBlockHeight() {
return nil, errorsmod.Wrapf(types.ErrWrongBlockHeight, " for provided block height %u", msg.GetBlockHeight())
return nil, errorsmod.Wrapf(types.ErrWrongBlockHeight, " for provided block height %s", strconv.FormatUint(msg.GetBlockHeight(), 10))
}
if reissuance.GetProposer() != msg.GetProposer() {
return nil, errorsmod.Wrapf(types.ErrInvalidProposer, " for provided block height %u", msg.GetBlockHeight())
return nil, errorsmod.Wrapf(types.ErrInvalidProposer, " for provided block height %s", strconv.FormatUint(msg.GetBlockHeight(), 10))
}
if reissuance.GetTxId() != "" {
return nil, errorsmod.Wrapf(types.ErrTXAlreadySet, " for provided block height %u", msg.GetBlockHeight())
return nil, errorsmod.Wrapf(types.ErrTXAlreadySet, " for provided block height %s", strconv.FormatUint(msg.GetBlockHeight(), 10))
}
reissuance.TxId = msg.GetTxId()
k.StoreReissuance(ctx, reissuance)

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) GetReissuance(goCtx context.Context, req *types.QueryGetReissuanceRequest) (*types.QueryGetReissuanceResponse, error) {
if req == nil {
return nil, status.Error(codes.InvalidArgument, "invalid request")
}
ctx := sdk.UnwrapSDKContext(goCtx)
reissuance, found := k.LookupReissuance(ctx, req.GetBlockHeight())
if !found {
return nil, status.Error(codes.NotFound, "reissuance not found")
}
return &types.QueryGetReissuanceResponse{Reissuance: &reissuance}, nil
}

View File

@ -0,0 +1,45 @@
package keeper_test
import (
"testing"
sdk "github.com/cosmos/cosmos-sdk/types"
keepertest "github.com/planetmint/planetmint-go/testutil/keeper"
"github.com/planetmint/planetmint-go/x/dao/types"
"github.com/stretchr/testify/require"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
)
func TestQueryGetReissuance(t *testing.T) {
keeper, ctx := keepertest.DaoKeeper(t)
wctx := sdk.WrapSDKContext(ctx)
items := createNReissuances(keeper, ctx, 1)
for _, tc := range []struct {
desc string
request *types.QueryGetReissuanceRequest
response *types.QueryGetReissuanceResponse
err error
}{
{
desc: "mint request found",
request: &types.QueryGetReissuanceRequest{BlockHeight: 0},
response: &types.QueryGetReissuanceResponse{Reissuance: &items[0]},
},
{
desc: "mint request not found",
request: &types.QueryGetReissuanceRequest{BlockHeight: 100},
err: status.Error(codes.NotFound, "reissuance not found"),
},
} {
t.Run(tc.desc, func(t *testing.T) {
res, err := keeper.GetReissuance(wctx, tc.request)
if tc.err != nil {
require.ErrorIs(t, err, tc.err)
} else {
require.Equal(t, tc.response, res)
}
})
}
}

View File

@ -14,7 +14,7 @@ func (k Keeper) StoreReissuance(ctx sdk.Context, reissuance types.Reissuance) {
store.Set(getReissuanceBytes(reissuance.BlockHeight), appendValue)
}
func (k Keeper) GetReissuance(ctx sdk.Context, height uint64) (val types.Reissuance, found bool) {
func (k Keeper) LookupReissuance(ctx sdk.Context, height uint64) (val types.Reissuance, found bool) {
store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.ReissuanceBlockHeightKey))
reissuance := store.Get(getReissuanceBytes(height))
if reissuance == nil {

View File

@ -12,7 +12,7 @@ import (
"github.com/planetmint/planetmint-go/x/dao/types"
)
func createNReissuance(keeper *keeper.Keeper, ctx sdk.Context, n int) []types.Reissuance {
func createNReissuances(keeper *keeper.Keeper, ctx sdk.Context, n int) []types.Reissuance {
items := make([]types.Reissuance, n)
for i := range items {
items[i].BlockHeight = uint64(i)
@ -24,12 +24,12 @@ func createNReissuance(keeper *keeper.Keeper, ctx sdk.Context, n int) []types.Re
return items
}
func TestGetResponse(t *testing.T) {
func TestGetReissuances(t *testing.T) {
keeper, ctx := keepertest.DaoKeeper(t)
items := createNChallenge(keeper, ctx, 10)
items := createNReissuances(keeper, ctx, 10)
for _, item := range items {
challenge, found := keeper.GetChallenge(ctx, item.Height)
reissuance, found := keeper.LookupReissuance(ctx, item.BlockHeight)
assert.True(t, found)
assert.Equal(t, item, challenge)
assert.Equal(t, item, reissuance)
}
}

View File

@ -289,6 +289,94 @@ func (m *QueryMintRequestsByAddressResponse) GetMintRequests() *MintRequests {
return nil
}
type QueryGetReissuanceRequest struct {
BlockHeight uint64 `protobuf:"varint,1,opt,name=blockHeight,proto3" json:"blockHeight,omitempty"`
}
func (m *QueryGetReissuanceRequest) Reset() { *m = QueryGetReissuanceRequest{} }
func (m *QueryGetReissuanceRequest) String() string { return proto.CompactTextString(m) }
func (*QueryGetReissuanceRequest) ProtoMessage() {}
func (*QueryGetReissuanceRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_07bad0eeb5b27724, []int{6}
}
func (m *QueryGetReissuanceRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryGetReissuanceRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryGetReissuanceRequest.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 *QueryGetReissuanceRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryGetReissuanceRequest.Merge(m, src)
}
func (m *QueryGetReissuanceRequest) XXX_Size() int {
return m.Size()
}
func (m *QueryGetReissuanceRequest) XXX_DiscardUnknown() {
xxx_messageInfo_QueryGetReissuanceRequest.DiscardUnknown(m)
}
var xxx_messageInfo_QueryGetReissuanceRequest proto.InternalMessageInfo
func (m *QueryGetReissuanceRequest) GetBlockHeight() uint64 {
if m != nil {
return m.BlockHeight
}
return 0
}
type QueryGetReissuanceResponse struct {
Reissuance *Reissuance `protobuf:"bytes,1,opt,name=reissuance,proto3" json:"reissuance,omitempty"`
}
func (m *QueryGetReissuanceResponse) Reset() { *m = QueryGetReissuanceResponse{} }
func (m *QueryGetReissuanceResponse) String() string { return proto.CompactTextString(m) }
func (*QueryGetReissuanceResponse) ProtoMessage() {}
func (*QueryGetReissuanceResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_07bad0eeb5b27724, []int{7}
}
func (m *QueryGetReissuanceResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryGetReissuanceResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryGetReissuanceResponse.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 *QueryGetReissuanceResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryGetReissuanceResponse.Merge(m, src)
}
func (m *QueryGetReissuanceResponse) XXX_Size() int {
return m.Size()
}
func (m *QueryGetReissuanceResponse) XXX_DiscardUnknown() {
xxx_messageInfo_QueryGetReissuanceResponse.DiscardUnknown(m)
}
var xxx_messageInfo_QueryGetReissuanceResponse proto.InternalMessageInfo
func (m *QueryGetReissuanceResponse) GetReissuance() *Reissuance {
if m != nil {
return m.Reissuance
}
return nil
}
func init() {
proto.RegisterType((*QueryParamsRequest)(nil), "planetmintgo.dao.QueryParamsRequest")
proto.RegisterType((*QueryParamsResponse)(nil), "planetmintgo.dao.QueryParamsResponse")
@ -296,44 +384,52 @@ func init() {
proto.RegisterType((*QueryGetMintRequestsByHashResponse)(nil), "planetmintgo.dao.QueryGetMintRequestsByHashResponse")
proto.RegisterType((*QueryMintRequestsByAddressRequest)(nil), "planetmintgo.dao.QueryMintRequestsByAddressRequest")
proto.RegisterType((*QueryMintRequestsByAddressResponse)(nil), "planetmintgo.dao.QueryMintRequestsByAddressResponse")
proto.RegisterType((*QueryGetReissuanceRequest)(nil), "planetmintgo.dao.QueryGetReissuanceRequest")
proto.RegisterType((*QueryGetReissuanceResponse)(nil), "planetmintgo.dao.QueryGetReissuanceResponse")
}
func init() { proto.RegisterFile("planetmintgo/dao/query.proto", fileDescriptor_07bad0eeb5b27724) }
var fileDescriptor_07bad0eeb5b27724 = []byte{
// 508 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x94, 0xcf, 0x6b, 0xd4, 0x40,
0x14, 0xc7, 0x37, 0xb2, 0xae, 0x38, 0xf5, 0x20, 0x63, 0x0b, 0xcb, 0xd2, 0x46, 0x1d, 0x2b, 0x88,
0x60, 0x86, 0x6d, 0xc5, 0x9e, 0xd4, 0x9a, 0x83, 0xd6, 0x43, 0x41, 0x73, 0xf4, 0xb2, 0x4c, 0xba,
0x43, 0x12, 0x68, 0x66, 0xd2, 0xcc, 0xac, 0xb8, 0x94, 0x5e, 0xfc, 0x03, 0x44, 0xf0, 0x5f, 0xf1,
0x8f, 0x28, 0xe2, 0xa1, 0xe0, 0xc5, 0x93, 0xc8, 0xae, 0x7f, 0x88, 0x64, 0xe6, 0x2d, 0x4d, 0x4c,
0x77, 0xd4, 0xcb, 0xf2, 0x92, 0xf7, 0xde, 0xf7, 0x7d, 0xde, 0x8f, 0x0d, 0x5a, 0x2f, 0x0e, 0x99,
0xe0, 0x3a, 0xcf, 0x84, 0x4e, 0x24, 0x1d, 0x33, 0x49, 0x8f, 0x26, 0xbc, 0x9c, 0x06, 0x45, 0x29,
0xb5, 0xc4, 0xd7, 0xeb, 0xde, 0x60, 0xcc, 0xe4, 0x60, 0x35, 0x91, 0x89, 0x34, 0x4e, 0x5a, 0x59,
0x36, 0x6e, 0xb0, 0x9e, 0x48, 0x99, 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0xc7, 0x32, 0x05, 0x00, 0x00,
// 604 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x94, 0x4f, 0x6f, 0xd3, 0x30,
0x18, 0xc6, 0x1b, 0xd4, 0x15, 0xe1, 0x82, 0x84, 0xcc, 0x26, 0x95, 0xa8, 0x0b, 0x9b, 0x19, 0x12,
0xe2, 0x4f, 0xad, 0x6e, 0x88, 0x49, 0x68, 0x83, 0x91, 0x03, 0x94, 0xc3, 0x24, 0xc8, 0x71, 0x97,
0xca, 0x69, 0xad, 0x24, 0xa2, 0x8d, 0xb3, 0xd8, 0x45, 0x54, 0x55, 0x2f, 0x7c, 0x00, 0x84, 0xc4,
0xf7, 0xe0, 0x73, 0x4c, 0x88, 0xc3, 0x24, 0x2e, 0x9c, 0x10, 0x6a, 0xe1, 0x7b, 0xa0, 0xda, 0x0e,
0x4d, 0x48, 0x9b, 0x6d, 0x97, 0xca, 0x89, 0x9f, 0xe7, 0xf5, 0xcf, 0x6f, 0x9e, 0xb7, 0xa0, 0x1e,
0xf5, 0x48, 0x48, 0x45, 0x3f, 0x08, 0x85, 0xc7, 0x70, 0x97, 0x30, 0x7c, 0x3c, 0xa0, 0xf1, 0xb0,
0x11, 0xc5, 0x4c, 0x30, 0x78, 0x3d, 0xbd, 0xdb, 0xe8, 0x12, 0x66, 0xae, 0x7a, 0xcc, 0x63, 0x72,
0x13, 0xcf, 0x56, 0x4a, 0x67, 0xd6, 0x3d, 0xc6, 0xbc, 0x1e, 0xc5, 0x24, 0x0a, 0x30, 0x09, 0x43,
0x26, 0x88, 0x08, 0x58, 0xc8, 0xf5, 0xee, 0xbd, 0x0e, 0xe3, 0x7d, 0xc6, 0xb1, 0x4b, 0x38, 0x55,
0xe5, 0xf1, 0xbb, 0xa6, 0x4b, 0x05, 0x69, 0xe2, 0x88, 0x78, 0x41, 0x28, 0xc5, 0x5a, 0xbb, 0x9e,
0xe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,
0x98, 0x27, 0x1b, 0x8f, 0x52, 0x23, 0x34, 0xb6, 0x5f, 0x9d, 0x4c, 0x2c, 0xe3, 0x74, 0x62, 0x19,
0xbf, 0x26, 0x96, 0xf1, 0x69, 0x6a, 0x95, 0x4e, 0xa7, 0x56, 0xe9, 0xc7, 0xd4, 0x2a, 0x1d, 0x9d,
0x2b, 0x96, 0xef, 0xe5, 0x09, 0x62, 0x18, 0x51, 0xee, 0x56, 0xe4, 0x5f, 0xf0, 0xce, 0xdf, 0x00,
0x00, 0x00, 0xff, 0xff, 0x15, 0x5b, 0x7d, 0x7f, 0xa1, 0x06, 0x00, 0x00,
}
// Reference imports to suppress errors if they are not otherwise used.
@ -354,6 +450,8 @@ type QueryClient interface {
GetMintRequestsByHash(ctx context.Context, in *QueryGetMintRequestsByHashRequest, opts ...grpc.CallOption) (*QueryGetMintRequestsByHashResponse, error)
// Queries a list of MintRequestsByAddress items.
MintRequestsByAddress(ctx context.Context, in *QueryMintRequestsByAddressRequest, opts ...grpc.CallOption) (*QueryMintRequestsByAddressResponse, error)
// Queries a list of GetReissuance items.
GetReissuance(ctx context.Context, in *QueryGetReissuanceRequest, opts ...grpc.CallOption) (*QueryGetReissuanceResponse, error)
}
type queryClient struct {
@ -391,6 +489,15 @@ func (c *queryClient) MintRequestsByAddress(ctx context.Context, in *QueryMintRe
return out, nil
}
func (c *queryClient) GetReissuance(ctx context.Context, in *QueryGetReissuanceRequest, opts ...grpc.CallOption) (*QueryGetReissuanceResponse, error) {
out := new(QueryGetReissuanceResponse)
err := c.cc.Invoke(ctx, "/planetmintgo.dao.Query/GetReissuance", 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.
@ -399,6 +506,8 @@ type QueryServer interface {
GetMintRequestsByHash(context.Context, *QueryGetMintRequestsByHashRequest) (*QueryGetMintRequestsByHashResponse, error)
// Queries a list of MintRequestsByAddress items.
MintRequestsByAddress(context.Context, *QueryMintRequestsByAddressRequest) (*QueryMintRequestsByAddressResponse, error)
// Queries a list of GetReissuance items.
GetReissuance(context.Context, *QueryGetReissuanceRequest) (*QueryGetReissuanceResponse, error)
}
// UnimplementedQueryServer can be embedded to have forward compatible implementations.
@ -414,6 +523,9 @@ func (*UnimplementedQueryServer) GetMintRequestsByHash(ctx context.Context, req
func (*UnimplementedQueryServer) MintRequestsByAddress(ctx context.Context, req *QueryMintRequestsByAddressRequest) (*QueryMintRequestsByAddressResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method MintRequestsByAddress not implemented")
}
func (*UnimplementedQueryServer) GetReissuance(ctx context.Context, req *QueryGetReissuanceRequest) (*QueryGetReissuanceResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetReissuance not implemented")
}
func RegisterQueryServer(s grpc1.Server, srv QueryServer) {
s.RegisterService(&_Query_serviceDesc, srv)
@ -473,6 +585,24 @@ func _Query_MintRequestsByAddress_Handler(srv interface{}, ctx context.Context,
return interceptor(ctx, in, info, handler)
}
func _Query_GetReissuance_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QueryGetReissuanceRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QueryServer).GetReissuance(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/planetmintgo.dao.Query/GetReissuance",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).GetReissuance(ctx, req.(*QueryGetReissuanceRequest))
}
return interceptor(ctx, in, info, handler)
}
var _Query_serviceDesc = grpc.ServiceDesc{
ServiceName: "planetmintgo.dao.Query",
HandlerType: (*QueryServer)(nil),
@ -489,6 +619,10 @@ var _Query_serviceDesc = grpc.ServiceDesc{
MethodName: "MintRequestsByAddress",
Handler: _Query_MintRequestsByAddress_Handler,
},
{
MethodName: "GetReissuance",
Handler: _Query_GetReissuance_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "planetmintgo/dao/query.proto",
@ -680,6 +814,69 @@ func (m *QueryMintRequestsByAddressResponse) MarshalToSizedBuffer(dAtA []byte) (
return len(dAtA) - i, nil
}
func (m *QueryGetReissuanceRequest) 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 *QueryGetReissuanceRequest) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryGetReissuanceRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if m.BlockHeight != 0 {
i = encodeVarintQuery(dAtA, i, uint64(m.BlockHeight))
i--
dAtA[i] = 0x8
}
return len(dAtA) - i, nil
}
func (m *QueryGetReissuanceResponse) 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 *QueryGetReissuanceResponse) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryGetReissuanceResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if m.Reissuance != nil {
{
size, err := m.Reissuance.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
@ -763,6 +960,31 @@ func (m *QueryMintRequestsByAddressResponse) Size() (n int) {
return n
}
func (m *QueryGetReissuanceRequest) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if m.BlockHeight != 0 {
n += 1 + sovQuery(uint64(m.BlockHeight))
}
return n
}
func (m *QueryGetReissuanceResponse) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if m.Reissuance != nil {
l = m.Reissuance.Size()
n += 1 + l + sovQuery(uint64(l))
}
return n
}
func sovQuery(x uint64) (n int) {
return (math_bits.Len64(x|1) + 6) / 7
}
@ -1238,6 +1460,161 @@ func (m *QueryMintRequestsByAddressResponse) Unmarshal(dAtA []byte) error {
}
return nil
}
func (m *QueryGetReissuanceRequest) 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: QueryGetReissuanceRequest: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryGetReissuanceRequest: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field BlockHeight", wireType)
}
m.BlockHeight = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.BlockHeight |= 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 (m *QueryGetReissuanceResponse) 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: QueryGetReissuanceResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryGetReissuanceResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Reissuance", 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.Reissuance == nil {
m.Reissuance = &Reissuance{}
}
if err := m.Reissuance.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

@ -159,6 +159,60 @@ func local_request_Query_MintRequestsByAddress_0(ctx context.Context, marshaler
}
func request_Query_GetReissuance_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryGetReissuanceRequest
var metadata runtime.ServerMetadata
var (
val string
ok bool
err error
_ = err
)
val, ok = pathParams["blockHeight"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "blockHeight")
}
protoReq.BlockHeight, err = runtime.Uint64(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "blockHeight", err)
}
msg, err := client.GetReissuance(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Query_GetReissuance_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryGetReissuanceRequest
var metadata runtime.ServerMetadata
var (
val string
ok bool
err error
_ = err
)
val, ok = pathParams["blockHeight"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "blockHeight")
}
protoReq.BlockHeight, err = runtime.Uint64(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "blockHeight", err)
}
msg, err := server.GetReissuance(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.
@ -234,6 +288,29 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv
})
mux.Handle("GET", pattern_Query_GetReissuance_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_GetReissuance_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_GetReissuance_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
return nil
}
@ -335,6 +412,26 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie
})
mux.Handle("GET", pattern_Query_GetReissuance_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_GetReissuance_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_GetReissuance_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
return nil
}
@ -344,6 +441,8 @@ var (
pattern_Query_GetMintRequestsByHash_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_mint_requests_by_hash", "hash"}, "", runtime.AssumeColonVerbOpt(true)))
pattern_Query_MintRequestsByAddress_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", "mint_requests_by_address", "address"}, "", runtime.AssumeColonVerbOpt(true)))
pattern_Query_GetReissuance_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_reissuance", "blockHeight"}, "", runtime.AssumeColonVerbOpt(true)))
)
var (
@ -352,4 +451,6 @@ var (
forward_Query_GetMintRequestsByHash_0 = runtime.ForwardResponseMessage
forward_Query_MintRequestsByAddress_0 = runtime.ForwardResponseMessage
forward_Query_GetReissuance_0 = runtime.ForwardResponseMessage
)