added nft query

Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
This commit is contained in:
Jürgen Eckel 2025-05-21 12:11:51 +02:00
parent 67e6e1dc05
commit 24ac3eca63
No known key found for this signature in database
7 changed files with 663 additions and 26 deletions

View File

@ -47711,6 +47711,50 @@ paths:
type: string type: string
tags: tags:
- Query - Query
/planetmint/der/nft/{zigbeeID}:
get:
summary: Queries a list of Nft items.
operationId: PlanetmintgoDerNft
responses:
'200':
description: A successful response.
schema:
type: object
properties:
derNft:
type: object
properties:
zigbeeID:
type: string
plmntAddress:
type: string
assetID:
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: zigbeeID
in: path
required: true
type: string
tags:
- Query
/planetmint/der/params: /planetmint/der/params:
get: get:
summary: Parameters queries the parameters of the module. summary: Parameters queries the parameters of the module.
@ -77536,6 +77580,18 @@ definitions:
type: string type: string
liquidAddress: liquidAddress:
type: string type: string
planetmintgo.der.QueryNftResponse:
type: object
properties:
derNft:
type: object
properties:
zigbeeID:
type: string
plmntAddress:
type: string
assetID:
type: string
planetmintgo.der.QueryParamsResponse: planetmintgo.der.QueryParamsResponse:
type: object type: object
properties: properties:

View File

@ -7,6 +7,7 @@ import "google/api/annotations.proto";
import "cosmos/base/query/v1beta1/pagination.proto"; import "cosmos/base/query/v1beta1/pagination.proto";
import "planetmintgo/der/params.proto"; import "planetmintgo/der/params.proto";
import "planetmintgo/der/der.proto"; import "planetmintgo/der/der.proto";
import "planetmintgo/der/liquid_der_asset.proto";
option go_package = "github.com/planetmint/planetmint-go/x/der/types"; option go_package = "github.com/planetmint/planetmint-go/x/der/types";
@ -24,6 +25,12 @@ service Query {
option (google.api.http).get = "/planetmint/der/der/{zigbeeID}"; option (google.api.http).get = "/planetmint/der/der/{zigbeeID}";
} }
// Queries a list of Nft items.
rpc Nft (QueryNftRequest) returns (QueryNftResponse) {
option (google.api.http).get = "/planetmint/der/nft/{zigbeeID}";
}
} }
// QueryParamsRequest is request type for the Query/Params RPC method. // QueryParamsRequest is request type for the Query/Params RPC method.
message QueryParamsRequest {} message QueryParamsRequest {}
@ -43,3 +50,11 @@ message QueryDerResponse {
DER der = 1; DER der = 1;
} }
message QueryNftRequest {
string zigbeeID = 1;
}
message QueryNftResponse {
LiquidDerAsset derNft = 1;
}

View File

@ -27,6 +27,8 @@ func GetQueryCmd(queryRoute string) *cobra.Command {
cmd.AddCommand(CmdQueryParams()) cmd.AddCommand(CmdQueryParams())
cmd.AddCommand(CmdDer()) cmd.AddCommand(CmdDer())
cmd.AddCommand(CmdNft())
// this line is used by starport scaffolding # 1 // this line is used by starport scaffolding # 1
return cmd return cmd

View File

@ -0,0 +1,46 @@
package cli
import (
"strconv"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/planetmint/planetmint-go/x/der/types"
"github.com/spf13/cobra"
)
var _ = strconv.Itoa(0)
func CmdNft() *cobra.Command {
cmd := &cobra.Command{
Use: "nft [zigbee-id]",
Short: "Query nft",
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) (err error) {
reqZigbeeID := args[0]
clientCtx, err := client.GetClientQueryContext(cmd)
if err != nil {
return err
}
queryClient := types.NewQueryClient(clientCtx)
params := &types.QueryNftRequest{
ZigbeeID: reqZigbeeID,
}
res, err := queryClient.Nft(cmd.Context(), params)
if err != nil {
return err
}
return clientCtx.PrintProto(res)
},
}
flags.AddQueryFlagsToCmd(cmd)
return cmd
}

25
x/der/keeper/query_nft.go Normal file
View File

@ -0,0 +1,25 @@
package keeper
import (
"context"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/planetmint/planetmint-go/x/der/types"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
)
func (k Keeper) Nft(goCtx context.Context, req *types.QueryNftRequest) (*types.QueryNftResponse, error) {
if req == nil {
return nil, status.Error(codes.InvalidArgument, "invalid request")
}
ctx := sdk.UnwrapSDKContext(goCtx)
derNft, found := k.LookupLiquidDerAsset(ctx, req.ZigbeeID)
if !found {
return nil, status.Error(codes.NotFound, "error zigbeeID not found: "+req.ZigbeeID)
}
return &types.QueryNftResponse{DerNft: &derNft}, nil
}

View File

@ -201,42 +201,137 @@ func (m *QueryDerResponse) GetDer() *DER {
return nil return nil
} }
type QueryNftRequest struct {
ZigbeeID string `protobuf:"bytes,1,opt,name=zigbeeID,proto3" json:"zigbeeID,omitempty"`
}
func (m *QueryNftRequest) Reset() { *m = QueryNftRequest{} }
func (m *QueryNftRequest) String() string { return proto.CompactTextString(m) }
func (*QueryNftRequest) ProtoMessage() {}
func (*QueryNftRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_44ad24dfc974d8be, []int{4}
}
func (m *QueryNftRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryNftRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryNftRequest.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 *QueryNftRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryNftRequest.Merge(m, src)
}
func (m *QueryNftRequest) XXX_Size() int {
return m.Size()
}
func (m *QueryNftRequest) XXX_DiscardUnknown() {
xxx_messageInfo_QueryNftRequest.DiscardUnknown(m)
}
var xxx_messageInfo_QueryNftRequest proto.InternalMessageInfo
func (m *QueryNftRequest) GetZigbeeID() string {
if m != nil {
return m.ZigbeeID
}
return ""
}
type QueryNftResponse struct {
DerNft *LiquidDerAsset `protobuf:"bytes,1,opt,name=derNft,proto3" json:"derNft,omitempty"`
}
func (m *QueryNftResponse) Reset() { *m = QueryNftResponse{} }
func (m *QueryNftResponse) String() string { return proto.CompactTextString(m) }
func (*QueryNftResponse) ProtoMessage() {}
func (*QueryNftResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_44ad24dfc974d8be, []int{5}
}
func (m *QueryNftResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryNftResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryNftResponse.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 *QueryNftResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryNftResponse.Merge(m, src)
}
func (m *QueryNftResponse) XXX_Size() int {
return m.Size()
}
func (m *QueryNftResponse) XXX_DiscardUnknown() {
xxx_messageInfo_QueryNftResponse.DiscardUnknown(m)
}
var xxx_messageInfo_QueryNftResponse proto.InternalMessageInfo
func (m *QueryNftResponse) GetDerNft() *LiquidDerAsset {
if m != nil {
return m.DerNft
}
return nil
}
func init() { func init() {
proto.RegisterType((*QueryParamsRequest)(nil), "planetmintgo.der.QueryParamsRequest") proto.RegisterType((*QueryParamsRequest)(nil), "planetmintgo.der.QueryParamsRequest")
proto.RegisterType((*QueryParamsResponse)(nil), "planetmintgo.der.QueryParamsResponse") proto.RegisterType((*QueryParamsResponse)(nil), "planetmintgo.der.QueryParamsResponse")
proto.RegisterType((*QueryDerRequest)(nil), "planetmintgo.der.QueryDerRequest") proto.RegisterType((*QueryDerRequest)(nil), "planetmintgo.der.QueryDerRequest")
proto.RegisterType((*QueryDerResponse)(nil), "planetmintgo.der.QueryDerResponse") proto.RegisterType((*QueryDerResponse)(nil), "planetmintgo.der.QueryDerResponse")
proto.RegisterType((*QueryNftRequest)(nil), "planetmintgo.der.QueryNftRequest")
proto.RegisterType((*QueryNftResponse)(nil), "planetmintgo.der.QueryNftResponse")
} }
func init() { proto.RegisterFile("planetmintgo/der/query.proto", fileDescriptor_44ad24dfc974d8be) } func init() { proto.RegisterFile("planetmintgo/der/query.proto", fileDescriptor_44ad24dfc974d8be) }
var fileDescriptor_44ad24dfc974d8be = []byte{ var fileDescriptor_44ad24dfc974d8be = []byte{
// 398 bytes of a gzipped FileDescriptorProto // 469 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x92, 0x4f, 0x8b, 0xd3, 0x40, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x93, 0x41, 0x6b, 0xd4, 0x40,
0x18, 0x87, 0x13, 0xab, 0x45, 0xc7, 0x83, 0x65, 0xac, 0x52, 0x42, 0x1d, 0x6b, 0xf0, 0x1f, 0x42, 0x1c, 0xc5, 0x37, 0xad, 0x2e, 0x3a, 0x1e, 0x2c, 0x63, 0x95, 0x25, 0xd4, 0x71, 0x0d, 0x6a, 0x45,
0x33, 0xb4, 0x82, 0x17, 0x6f, 0x25, 0x1e, 0x7a, 0x10, 0x34, 0x47, 0x6f, 0x93, 0xe6, 0x65, 0x0c, 0x68, 0x86, 0x56, 0x10, 0xc1, 0x93, 0x25, 0x1e, 0x0a, 0x75, 0xd1, 0x1c, 0xbd, 0x94, 0x49, 0xf3,
0x34, 0x99, 0x74, 0x66, 0x22, 0x56, 0xf1, 0xe2, 0x27, 0x10, 0xfc, 0x52, 0x3d, 0x16, 0xf6, 0xb2, 0xdf, 0x71, 0x60, 0x77, 0x26, 0x3b, 0x33, 0x11, 0xab, 0x78, 0xf1, 0x13, 0x08, 0x7e, 0xa9, 0x1e,
0xa7, 0x65, 0x69, 0xf7, 0x23, 0xec, 0x07, 0x58, 0x32, 0x49, 0x37, 0xdd, 0x86, 0xdd, 0x3d, 0x04, 0x0b, 0x5e, 0x3c, 0x89, 0xec, 0x7a, 0xf2, 0x53, 0x48, 0x26, 0xd3, 0x26, 0x36, 0xac, 0xf6, 0x10,
0x26, 0x79, 0x9f, 0xf7, 0xf9, 0xbd, 0xf3, 0x12, 0xd4, 0xcf, 0xe6, 0x2c, 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, 0xfd, 0x19, 0xd8, 0xa2, 0xd5, 0x04, 0x34, 0xbe, 0xbb, 0x24, 0xad,
0xa8, 0x8f, 0x43, 0x2e, 0xe8, 0x4f, 0xe3, 0xd3, 0xcb, 0x0c, 0x54, 0xd8, 0x36, 0x7f, 0xc6, 0xfb, 0x39, 0x80, 0x30, 0xfa, 0x97, 0xc5, 0xd3, 0x1e, 0x38, 0xda, 0x10, 0x93, 0xf3, 0xb4, 0xea, 0xf9,
0x8b, 0x00, 0x00, 0x00, 0xff, 0xff, 0x0f, 0x59, 0x83, 0x68, 0xe6, 0x02, 0x00, 0x00, 0x78, 0xda, 0xe1, 0xa7, 0x8a, 0x3a, 0x1a, 0xdb, 0xa5, 0xd4, 0xe6, 0x28, 0x96, 0x52, 0x5b, 0xf5,
0x2f, 0xa7, 0xca, 0xb1, 0x6d, 0x51, 0x77, 0xf7, 0x8e, 0xe7, 0x24, 0x38, 0x99, 0x93, 0xe0, 0xe7,
0x9c, 0x04, 0x5f, 0x16, 0xa4, 0x77, 0xb2, 0x20, 0xbd, 0xef, 0x0b, 0xd2, 0x7b, 0x43, 0xb9, 0xb0,
0x6f, 0xcb, 0x2c, 0x3e, 0x54, 0xd3, 0x76, 0x46, 0xb3, 0xdc, 0xe2, 0x8a, 0xbe, 0x77, 0x99, 0xf6,
0xa8, 0x00, 0x93, 0xf5, 0xdd, 0x65, 0x78, 0xfc, 0x27, 0x00, 0x00, 0xff, 0xff, 0x7e, 0x3b, 0xea,
0x59, 0x02, 0x04, 0x00, 0x00,
} }
// Reference imports to suppress errors if they are not otherwise used. // Reference imports to suppress errors if they are not otherwise used.
@ -255,6 +350,8 @@ type QueryClient interface {
Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error)
// Queries a list of Der items. // Queries a list of Der items.
Der(ctx context.Context, in *QueryDerRequest, opts ...grpc.CallOption) (*QueryDerResponse, error) Der(ctx context.Context, in *QueryDerRequest, opts ...grpc.CallOption) (*QueryDerResponse, error)
// Queries a list of Nft items.
Nft(ctx context.Context, in *QueryNftRequest, opts ...grpc.CallOption) (*QueryNftResponse, error)
} }
type queryClient struct { type queryClient struct {
@ -283,12 +380,23 @@ func (c *queryClient) Der(ctx context.Context, in *QueryDerRequest, opts ...grpc
return out, nil return out, nil
} }
func (c *queryClient) Nft(ctx context.Context, in *QueryNftRequest, opts ...grpc.CallOption) (*QueryNftResponse, error) {
out := new(QueryNftResponse)
err := c.cc.Invoke(ctx, "/planetmintgo.der.Query/Nft", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// QueryServer is the server API for Query service. // QueryServer is the server API for Query service.
type QueryServer interface { type QueryServer interface {
// Parameters queries the parameters of the module. // Parameters queries the parameters of the module.
Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error)
// Queries a list of Der items. // Queries a list of Der items.
Der(context.Context, *QueryDerRequest) (*QueryDerResponse, error) Der(context.Context, *QueryDerRequest) (*QueryDerResponse, error)
// Queries a list of Nft items.
Nft(context.Context, *QueryNftRequest) (*QueryNftResponse, error)
} }
// UnimplementedQueryServer can be embedded to have forward compatible implementations. // UnimplementedQueryServer can be embedded to have forward compatible implementations.
@ -301,6 +409,9 @@ func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsReq
func (*UnimplementedQueryServer) Der(ctx context.Context, req *QueryDerRequest) (*QueryDerResponse, error) { func (*UnimplementedQueryServer) Der(ctx context.Context, req *QueryDerRequest) (*QueryDerResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method Der not implemented") return nil, status.Errorf(codes.Unimplemented, "method Der not implemented")
} }
func (*UnimplementedQueryServer) Nft(ctx context.Context, req *QueryNftRequest) (*QueryNftResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method Nft not implemented")
}
func RegisterQueryServer(s grpc1.Server, srv QueryServer) { func RegisterQueryServer(s grpc1.Server, srv QueryServer) {
s.RegisterService(&_Query_serviceDesc, srv) s.RegisterService(&_Query_serviceDesc, srv)
@ -342,6 +453,24 @@ func _Query_Der_Handler(srv interface{}, ctx context.Context, dec func(interface
return interceptor(ctx, in, info, handler) return interceptor(ctx, in, info, handler)
} }
func _Query_Nft_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QueryNftRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QueryServer).Nft(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/planetmintgo.der.Query/Nft",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).Nft(ctx, req.(*QueryNftRequest))
}
return interceptor(ctx, in, info, handler)
}
var Query_serviceDesc = _Query_serviceDesc var Query_serviceDesc = _Query_serviceDesc
var _Query_serviceDesc = grpc.ServiceDesc{ var _Query_serviceDesc = grpc.ServiceDesc{
ServiceName: "planetmintgo.der.Query", ServiceName: "planetmintgo.der.Query",
@ -355,6 +484,10 @@ var _Query_serviceDesc = grpc.ServiceDesc{
MethodName: "Der", MethodName: "Der",
Handler: _Query_Der_Handler, Handler: _Query_Der_Handler,
}, },
{
MethodName: "Nft",
Handler: _Query_Nft_Handler,
},
}, },
Streams: []grpc.StreamDesc{}, Streams: []grpc.StreamDesc{},
Metadata: "planetmintgo/der/query.proto", Metadata: "planetmintgo/der/query.proto",
@ -481,6 +614,71 @@ func (m *QueryDerResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
return len(dAtA) - i, nil return len(dAtA) - i, nil
} }
func (m *QueryNftRequest) 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 *QueryNftRequest) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryNftRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if len(m.ZigbeeID) > 0 {
i -= len(m.ZigbeeID)
copy(dAtA[i:], m.ZigbeeID)
i = encodeVarintQuery(dAtA, i, uint64(len(m.ZigbeeID)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *QueryNftResponse) 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 *QueryNftResponse) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryNftResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if m.DerNft != nil {
{
size, err := m.DerNft.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 { func encodeVarintQuery(dAtA []byte, offset int, v uint64) int {
offset -= sovQuery(v) offset -= sovQuery(v)
base := offset base := offset
@ -538,6 +736,32 @@ func (m *QueryDerResponse) Size() (n int) {
return n return n
} }
func (m *QueryNftRequest) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.ZigbeeID)
if l > 0 {
n += 1 + l + sovQuery(uint64(l))
}
return n
}
func (m *QueryNftResponse) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if m.DerNft != nil {
l = m.DerNft.Size()
n += 1 + l + sovQuery(uint64(l))
}
return n
}
func sovQuery(x uint64) (n int) { func sovQuery(x uint64) (n int) {
return (math_bits.Len64(x|1) + 6) / 7 return (math_bits.Len64(x|1) + 6) / 7
} }
@ -845,6 +1069,174 @@ func (m *QueryDerResponse) Unmarshal(dAtA []byte) error {
} }
return nil return nil
} }
func (m *QueryNftRequest) 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: QueryNftRequest: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryNftRequest: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field ZigbeeID", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.ZigbeeID = string(dAtA[iNdEx:postIndex])
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 (m *QueryNftResponse) 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: QueryNftResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryNftResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field DerNft", 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.DerNft == nil {
m.DerNft = &LiquidDerAsset{}
}
if err := m.DerNft.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) { func skipQuery(dAtA []byte) (n int, err error) {
l := len(dAtA) l := len(dAtA)
iNdEx := 0 iNdEx := 0

View File

@ -105,6 +105,60 @@ func local_request_Query_Der_0(ctx context.Context, marshaler runtime.Marshaler,
} }
func request_Query_Nft_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryNftRequest
var metadata runtime.ServerMetadata
var (
val string
ok bool
err error
_ = err
)
val, ok = pathParams["zigbeeID"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "zigbeeID")
}
protoReq.ZigbeeID, err = runtime.String(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "zigbeeID", err)
}
msg, err := client.Nft(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Query_Nft_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryNftRequest
var metadata runtime.ServerMetadata
var (
val string
ok bool
err error
_ = err
)
val, ok = pathParams["zigbeeID"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "zigbeeID")
}
protoReq.ZigbeeID, err = runtime.String(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "zigbeeID", err)
}
msg, err := server.Nft(ctx, &protoReq)
return msg, metadata, err
}
// RegisterQueryHandlerServer registers the http handlers for service Query to "mux". // RegisterQueryHandlerServer registers the http handlers for service Query to "mux".
// UnaryRPC :call QueryServer directly. // UnaryRPC :call QueryServer directly.
// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906.
@ -157,6 +211,29 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv
}) })
mux.Handle("GET", pattern_Query_Nft_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_Nft_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_Nft_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
return nil return nil
} }
@ -238,6 +315,26 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie
}) })
mux.Handle("GET", pattern_Query_Nft_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_Nft_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_Nft_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
return nil return nil
} }
@ -245,10 +342,14 @@ var (
pattern_Query_Params_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"planetmint", "der", "params"}, "", runtime.AssumeColonVerbOpt(true))) pattern_Query_Params_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"planetmint", "der", "params"}, "", runtime.AssumeColonVerbOpt(true)))
pattern_Query_Der_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 1, 1, 0, 4, 1, 5, 2}, []string{"planetmint", "der", "zigbeeID"}, "", runtime.AssumeColonVerbOpt(true))) pattern_Query_Der_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 1, 1, 0, 4, 1, 5, 2}, []string{"planetmint", "der", "zigbeeID"}, "", runtime.AssumeColonVerbOpt(true)))
pattern_Query_Nft_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"planetmint", "der", "nft", "zigbeeID"}, "", runtime.AssumeColonVerbOpt(true)))
) )
var ( var (
forward_Query_Params_0 = runtime.ForwardResponseMessage forward_Query_Params_0 = runtime.ForwardResponseMessage
forward_Query_Der_0 = runtime.ForwardResponseMessage forward_Query_Der_0 = runtime.ForwardResponseMessage
forward_Query_Nft_0 = runtime.ForwardResponseMessage
) )