feat(x/nft): add new queries for nft modules that support query string (#18355)
Co-authored-by: Julien Robert <julien@rbrt.fr>
This commit is contained in:
parent
a27cfa067a
commit
d322b23dd2
File diff suppressed because it is too large
Load Diff
@ -19,13 +19,18 @@ import (
|
||||
const _ = grpc.SupportPackageIsVersion7
|
||||
|
||||
const (
|
||||
Query_Balance_FullMethodName = "/cosmos.nft.v1beta1.Query/Balance"
|
||||
Query_Owner_FullMethodName = "/cosmos.nft.v1beta1.Query/Owner"
|
||||
Query_Supply_FullMethodName = "/cosmos.nft.v1beta1.Query/Supply"
|
||||
Query_NFTs_FullMethodName = "/cosmos.nft.v1beta1.Query/NFTs"
|
||||
Query_NFT_FullMethodName = "/cosmos.nft.v1beta1.Query/NFT"
|
||||
Query_Class_FullMethodName = "/cosmos.nft.v1beta1.Query/Class"
|
||||
Query_Classes_FullMethodName = "/cosmos.nft.v1beta1.Query/Classes"
|
||||
Query_Balance_FullMethodName = "/cosmos.nft.v1beta1.Query/Balance"
|
||||
Query_BalanceByQueryString_FullMethodName = "/cosmos.nft.v1beta1.Query/BalanceByQueryString"
|
||||
Query_Owner_FullMethodName = "/cosmos.nft.v1beta1.Query/Owner"
|
||||
Query_OwnerByQueryString_FullMethodName = "/cosmos.nft.v1beta1.Query/OwnerByQueryString"
|
||||
Query_Supply_FullMethodName = "/cosmos.nft.v1beta1.Query/Supply"
|
||||
Query_SupplyByQueryString_FullMethodName = "/cosmos.nft.v1beta1.Query/SupplyByQueryString"
|
||||
Query_NFTs_FullMethodName = "/cosmos.nft.v1beta1.Query/NFTs"
|
||||
Query_NFT_FullMethodName = "/cosmos.nft.v1beta1.Query/NFT"
|
||||
Query_NFTByQueryString_FullMethodName = "/cosmos.nft.v1beta1.Query/NFTByQueryString"
|
||||
Query_Class_FullMethodName = "/cosmos.nft.v1beta1.Query/Class"
|
||||
Query_ClassByQueryString_FullMethodName = "/cosmos.nft.v1beta1.Query/ClassByQueryString"
|
||||
Query_Classes_FullMethodName = "/cosmos.nft.v1beta1.Query/Classes"
|
||||
)
|
||||
|
||||
// QueryClient is the client API for Query service.
|
||||
@ -34,17 +39,27 @@ const (
|
||||
type QueryClient interface {
|
||||
// Balance queries the number of NFTs of a given class owned by the owner, same as balanceOf in ERC721
|
||||
Balance(ctx context.Context, in *QueryBalanceRequest, opts ...grpc.CallOption) (*QueryBalanceResponse, error)
|
||||
// BalancebyQueryString queries the number of NFTs of a given class owned by the owner, same as balanceOf in ERC721
|
||||
BalanceByQueryString(ctx context.Context, in *QueryBalanceByQueryStringRequest, opts ...grpc.CallOption) (*QueryBalanceByQueryStringResponse, error)
|
||||
// Owner queries the owner of the NFT based on its class and id, same as ownerOf in ERC721
|
||||
Owner(ctx context.Context, in *QueryOwnerRequest, opts ...grpc.CallOption) (*QueryOwnerResponse, error)
|
||||
// OwnerByQueryString queries the owner of the NFT based on its class and id, same as ownerOf in ERC721
|
||||
OwnerByQueryString(ctx context.Context, in *QueryOwnerByQueryStringRequest, opts ...grpc.CallOption) (*QueryOwnerByQueryStringResponse, error)
|
||||
// Supply queries the number of NFTs from the given class, same as totalSupply of ERC721.
|
||||
Supply(ctx context.Context, in *QuerySupplyRequest, opts ...grpc.CallOption) (*QuerySupplyResponse, error)
|
||||
// SupplyByQueryString queries the number of NFTs from the given class, same as totalSupply of ERC721.
|
||||
SupplyByQueryString(ctx context.Context, in *QuerySupplyByQueryStringRequest, opts ...grpc.CallOption) (*QuerySupplyByQueryStringResponse, error)
|
||||
// NFTs queries all NFTs of a given class or owner,choose at least one of the two, similar to tokenByIndex in
|
||||
// ERC721Enumerable
|
||||
NFTs(ctx context.Context, in *QueryNFTsRequest, opts ...grpc.CallOption) (*QueryNFTsResponse, error)
|
||||
// NFT queries an NFT based on its class and id.
|
||||
NFT(ctx context.Context, in *QueryNFTRequest, opts ...grpc.CallOption) (*QueryNFTResponse, error)
|
||||
// NFTByQueryString queries an NFT based on its class and id.
|
||||
NFTByQueryString(ctx context.Context, in *QueryNFTByQueryStringRequest, opts ...grpc.CallOption) (*QueryNFTByQueryStringResponse, error)
|
||||
// Class queries an NFT class based on its id
|
||||
Class(ctx context.Context, in *QueryClassRequest, opts ...grpc.CallOption) (*QueryClassResponse, error)
|
||||
// Class queries an NFT class based on its id
|
||||
ClassByQueryString(ctx context.Context, in *QueryClassByQueryStringRequest, opts ...grpc.CallOption) (*QueryClassByQueryStringResponse, error)
|
||||
// Classes queries all NFT classes
|
||||
Classes(ctx context.Context, in *QueryClassesRequest, opts ...grpc.CallOption) (*QueryClassesResponse, error)
|
||||
}
|
||||
@ -66,6 +81,15 @@ func (c *queryClient) Balance(ctx context.Context, in *QueryBalanceRequest, opts
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *queryClient) BalanceByQueryString(ctx context.Context, in *QueryBalanceByQueryStringRequest, opts ...grpc.CallOption) (*QueryBalanceByQueryStringResponse, error) {
|
||||
out := new(QueryBalanceByQueryStringResponse)
|
||||
err := c.cc.Invoke(ctx, Query_BalanceByQueryString_FullMethodName, in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *queryClient) Owner(ctx context.Context, in *QueryOwnerRequest, opts ...grpc.CallOption) (*QueryOwnerResponse, error) {
|
||||
out := new(QueryOwnerResponse)
|
||||
err := c.cc.Invoke(ctx, Query_Owner_FullMethodName, in, out, opts...)
|
||||
@ -75,6 +99,15 @@ func (c *queryClient) Owner(ctx context.Context, in *QueryOwnerRequest, opts ...
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *queryClient) OwnerByQueryString(ctx context.Context, in *QueryOwnerByQueryStringRequest, opts ...grpc.CallOption) (*QueryOwnerByQueryStringResponse, error) {
|
||||
out := new(QueryOwnerByQueryStringResponse)
|
||||
err := c.cc.Invoke(ctx, Query_OwnerByQueryString_FullMethodName, in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *queryClient) Supply(ctx context.Context, in *QuerySupplyRequest, opts ...grpc.CallOption) (*QuerySupplyResponse, error) {
|
||||
out := new(QuerySupplyResponse)
|
||||
err := c.cc.Invoke(ctx, Query_Supply_FullMethodName, in, out, opts...)
|
||||
@ -84,6 +117,15 @@ func (c *queryClient) Supply(ctx context.Context, in *QuerySupplyRequest, opts .
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *queryClient) SupplyByQueryString(ctx context.Context, in *QuerySupplyByQueryStringRequest, opts ...grpc.CallOption) (*QuerySupplyByQueryStringResponse, error) {
|
||||
out := new(QuerySupplyByQueryStringResponse)
|
||||
err := c.cc.Invoke(ctx, Query_SupplyByQueryString_FullMethodName, in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *queryClient) NFTs(ctx context.Context, in *QueryNFTsRequest, opts ...grpc.CallOption) (*QueryNFTsResponse, error) {
|
||||
out := new(QueryNFTsResponse)
|
||||
err := c.cc.Invoke(ctx, Query_NFTs_FullMethodName, in, out, opts...)
|
||||
@ -102,6 +144,15 @@ func (c *queryClient) NFT(ctx context.Context, in *QueryNFTRequest, opts ...grpc
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *queryClient) NFTByQueryString(ctx context.Context, in *QueryNFTByQueryStringRequest, opts ...grpc.CallOption) (*QueryNFTByQueryStringResponse, error) {
|
||||
out := new(QueryNFTByQueryStringResponse)
|
||||
err := c.cc.Invoke(ctx, Query_NFTByQueryString_FullMethodName, in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *queryClient) Class(ctx context.Context, in *QueryClassRequest, opts ...grpc.CallOption) (*QueryClassResponse, error) {
|
||||
out := new(QueryClassResponse)
|
||||
err := c.cc.Invoke(ctx, Query_Class_FullMethodName, in, out, opts...)
|
||||
@ -111,6 +162,15 @@ func (c *queryClient) Class(ctx context.Context, in *QueryClassRequest, opts ...
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *queryClient) ClassByQueryString(ctx context.Context, in *QueryClassByQueryStringRequest, opts ...grpc.CallOption) (*QueryClassByQueryStringResponse, error) {
|
||||
out := new(QueryClassByQueryStringResponse)
|
||||
err := c.cc.Invoke(ctx, Query_ClassByQueryString_FullMethodName, in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *queryClient) Classes(ctx context.Context, in *QueryClassesRequest, opts ...grpc.CallOption) (*QueryClassesResponse, error) {
|
||||
out := new(QueryClassesResponse)
|
||||
err := c.cc.Invoke(ctx, Query_Classes_FullMethodName, in, out, opts...)
|
||||
@ -126,17 +186,27 @@ func (c *queryClient) Classes(ctx context.Context, in *QueryClassesRequest, opts
|
||||
type QueryServer interface {
|
||||
// Balance queries the number of NFTs of a given class owned by the owner, same as balanceOf in ERC721
|
||||
Balance(context.Context, *QueryBalanceRequest) (*QueryBalanceResponse, error)
|
||||
// BalancebyQueryString queries the number of NFTs of a given class owned by the owner, same as balanceOf in ERC721
|
||||
BalanceByQueryString(context.Context, *QueryBalanceByQueryStringRequest) (*QueryBalanceByQueryStringResponse, error)
|
||||
// Owner queries the owner of the NFT based on its class and id, same as ownerOf in ERC721
|
||||
Owner(context.Context, *QueryOwnerRequest) (*QueryOwnerResponse, error)
|
||||
// OwnerByQueryString queries the owner of the NFT based on its class and id, same as ownerOf in ERC721
|
||||
OwnerByQueryString(context.Context, *QueryOwnerByQueryStringRequest) (*QueryOwnerByQueryStringResponse, error)
|
||||
// Supply queries the number of NFTs from the given class, same as totalSupply of ERC721.
|
||||
Supply(context.Context, *QuerySupplyRequest) (*QuerySupplyResponse, error)
|
||||
// SupplyByQueryString queries the number of NFTs from the given class, same as totalSupply of ERC721.
|
||||
SupplyByQueryString(context.Context, *QuerySupplyByQueryStringRequest) (*QuerySupplyByQueryStringResponse, error)
|
||||
// NFTs queries all NFTs of a given class or owner,choose at least one of the two, similar to tokenByIndex in
|
||||
// ERC721Enumerable
|
||||
NFTs(context.Context, *QueryNFTsRequest) (*QueryNFTsResponse, error)
|
||||
// NFT queries an NFT based on its class and id.
|
||||
NFT(context.Context, *QueryNFTRequest) (*QueryNFTResponse, error)
|
||||
// NFTByQueryString queries an NFT based on its class and id.
|
||||
NFTByQueryString(context.Context, *QueryNFTByQueryStringRequest) (*QueryNFTByQueryStringResponse, error)
|
||||
// Class queries an NFT class based on its id
|
||||
Class(context.Context, *QueryClassRequest) (*QueryClassResponse, error)
|
||||
// Class queries an NFT class based on its id
|
||||
ClassByQueryString(context.Context, *QueryClassByQueryStringRequest) (*QueryClassByQueryStringResponse, error)
|
||||
// Classes queries all NFT classes
|
||||
Classes(context.Context, *QueryClassesRequest) (*QueryClassesResponse, error)
|
||||
mustEmbedUnimplementedQueryServer()
|
||||
@ -149,21 +219,36 @@ type UnimplementedQueryServer struct {
|
||||
func (UnimplementedQueryServer) Balance(context.Context, *QueryBalanceRequest) (*QueryBalanceResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method Balance not implemented")
|
||||
}
|
||||
func (UnimplementedQueryServer) BalanceByQueryString(context.Context, *QueryBalanceByQueryStringRequest) (*QueryBalanceByQueryStringResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method BalanceByQueryString not implemented")
|
||||
}
|
||||
func (UnimplementedQueryServer) Owner(context.Context, *QueryOwnerRequest) (*QueryOwnerResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method Owner not implemented")
|
||||
}
|
||||
func (UnimplementedQueryServer) OwnerByQueryString(context.Context, *QueryOwnerByQueryStringRequest) (*QueryOwnerByQueryStringResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method OwnerByQueryString not implemented")
|
||||
}
|
||||
func (UnimplementedQueryServer) Supply(context.Context, *QuerySupplyRequest) (*QuerySupplyResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method Supply not implemented")
|
||||
}
|
||||
func (UnimplementedQueryServer) SupplyByQueryString(context.Context, *QuerySupplyByQueryStringRequest) (*QuerySupplyByQueryStringResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method SupplyByQueryString not implemented")
|
||||
}
|
||||
func (UnimplementedQueryServer) NFTs(context.Context, *QueryNFTsRequest) (*QueryNFTsResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method NFTs not implemented")
|
||||
}
|
||||
func (UnimplementedQueryServer) NFT(context.Context, *QueryNFTRequest) (*QueryNFTResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method NFT not implemented")
|
||||
}
|
||||
func (UnimplementedQueryServer) NFTByQueryString(context.Context, *QueryNFTByQueryStringRequest) (*QueryNFTByQueryStringResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method NFTByQueryString not implemented")
|
||||
}
|
||||
func (UnimplementedQueryServer) Class(context.Context, *QueryClassRequest) (*QueryClassResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method Class not implemented")
|
||||
}
|
||||
func (UnimplementedQueryServer) ClassByQueryString(context.Context, *QueryClassByQueryStringRequest) (*QueryClassByQueryStringResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method ClassByQueryString not implemented")
|
||||
}
|
||||
func (UnimplementedQueryServer) Classes(context.Context, *QueryClassesRequest) (*QueryClassesResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method Classes not implemented")
|
||||
}
|
||||
@ -198,6 +283,24 @@ func _Query_Balance_Handler(srv interface{}, ctx context.Context, dec func(inter
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Query_BalanceByQueryString_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(QueryBalanceByQueryStringRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(QueryServer).BalanceByQueryString(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: Query_BalanceByQueryString_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(QueryServer).BalanceByQueryString(ctx, req.(*QueryBalanceByQueryStringRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Query_Owner_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(QueryOwnerRequest)
|
||||
if err := dec(in); err != nil {
|
||||
@ -216,6 +319,24 @@ func _Query_Owner_Handler(srv interface{}, ctx context.Context, dec func(interfa
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Query_OwnerByQueryString_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(QueryOwnerByQueryStringRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(QueryServer).OwnerByQueryString(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: Query_OwnerByQueryString_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(QueryServer).OwnerByQueryString(ctx, req.(*QueryOwnerByQueryStringRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Query_Supply_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(QuerySupplyRequest)
|
||||
if err := dec(in); err != nil {
|
||||
@ -234,6 +355,24 @@ func _Query_Supply_Handler(srv interface{}, ctx context.Context, dec func(interf
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Query_SupplyByQueryString_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(QuerySupplyByQueryStringRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(QueryServer).SupplyByQueryString(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: Query_SupplyByQueryString_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(QueryServer).SupplyByQueryString(ctx, req.(*QuerySupplyByQueryStringRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Query_NFTs_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(QueryNFTsRequest)
|
||||
if err := dec(in); err != nil {
|
||||
@ -270,6 +409,24 @@ func _Query_NFT_Handler(srv interface{}, ctx context.Context, dec func(interface
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Query_NFTByQueryString_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(QueryNFTByQueryStringRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(QueryServer).NFTByQueryString(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: Query_NFTByQueryString_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(QueryServer).NFTByQueryString(ctx, req.(*QueryNFTByQueryStringRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Query_Class_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(QueryClassRequest)
|
||||
if err := dec(in); err != nil {
|
||||
@ -288,6 +445,24 @@ func _Query_Class_Handler(srv interface{}, ctx context.Context, dec func(interfa
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Query_ClassByQueryString_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(QueryClassByQueryStringRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(QueryServer).ClassByQueryString(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: Query_ClassByQueryString_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(QueryServer).ClassByQueryString(ctx, req.(*QueryClassByQueryStringRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Query_Classes_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(QueryClassesRequest)
|
||||
if err := dec(in); err != nil {
|
||||
@ -317,14 +492,26 @@ var Query_ServiceDesc = grpc.ServiceDesc{
|
||||
MethodName: "Balance",
|
||||
Handler: _Query_Balance_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "BalanceByQueryString",
|
||||
Handler: _Query_BalanceByQueryString_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "Owner",
|
||||
Handler: _Query_Owner_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "OwnerByQueryString",
|
||||
Handler: _Query_OwnerByQueryString_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "Supply",
|
||||
Handler: _Query_Supply_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "SupplyByQueryString",
|
||||
Handler: _Query_SupplyByQueryString_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "NFTs",
|
||||
Handler: _Query_NFTs_Handler,
|
||||
@ -333,10 +520,18 @@ var Query_ServiceDesc = grpc.ServiceDesc{
|
||||
MethodName: "NFT",
|
||||
Handler: _Query_NFT_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "NFTByQueryString",
|
||||
Handler: _Query_NFTByQueryString_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "Class",
|
||||
Handler: _Query_Class_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "ClassByQueryString",
|
||||
Handler: _Query_ClassByQueryString_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "Classes",
|
||||
Handler: _Query_Classes_Handler,
|
||||
|
||||
2057
client/docs/swagger-ui/swagger.yaml
vendored
2057
client/docs/swagger-ui/swagger.yaml
vendored
File diff suppressed because it is too large
Load Diff
@ -14,16 +14,37 @@ service Query {
|
||||
option (google.api.http).get = "/cosmos/nft/v1beta1/balance/{owner}/{class_id}";
|
||||
}
|
||||
|
||||
// BalancebyQueryString queries the number of NFTs of a given class owned by the owner, same as balanceOf in ERC721
|
||||
//
|
||||
// Since: nft v0.1.1
|
||||
rpc BalanceByQueryString(QueryBalanceByQueryStringRequest) returns (QueryBalanceByQueryStringResponse) {
|
||||
option (google.api.http).get = "/cosmos/nft/v1beta1/balance";
|
||||
}
|
||||
|
||||
// Owner queries the owner of the NFT based on its class and id, same as ownerOf in ERC721
|
||||
rpc Owner(QueryOwnerRequest) returns (QueryOwnerResponse) {
|
||||
option (google.api.http).get = "/cosmos/nft/v1beta1/owner/{class_id}/{id}";
|
||||
}
|
||||
|
||||
// OwnerByQueryString queries the owner of the NFT based on its class and id, same as ownerOf in ERC721
|
||||
//
|
||||
// Since: nft v0.1.1
|
||||
rpc OwnerByQueryString(QueryOwnerByQueryStringRequest) returns (QueryOwnerByQueryStringResponse) {
|
||||
option (google.api.http).get = "/cosmos/nft/v1beta1/owner";
|
||||
}
|
||||
|
||||
// Supply queries the number of NFTs from the given class, same as totalSupply of ERC721.
|
||||
rpc Supply(QuerySupplyRequest) returns (QuerySupplyResponse) {
|
||||
option (google.api.http).get = "/cosmos/nft/v1beta1/supply/{class_id}";
|
||||
}
|
||||
|
||||
// SupplyByQueryString queries the number of NFTs from the given class, same as totalSupply of ERC721.
|
||||
//
|
||||
// Since: nft v0.1.1
|
||||
rpc SupplyByQueryString(QuerySupplyByQueryStringRequest) returns (QuerySupplyByQueryStringResponse) {
|
||||
option (google.api.http).get = "/cosmos/nft/v1beta1/supply";
|
||||
}
|
||||
|
||||
// NFTs queries all NFTs of a given class or owner,choose at least one of the two, similar to tokenByIndex in
|
||||
// ERC721Enumerable
|
||||
rpc NFTs(QueryNFTsRequest) returns (QueryNFTsResponse) {
|
||||
@ -35,11 +56,25 @@ service Query {
|
||||
option (google.api.http).get = "/cosmos/nft/v1beta1/nfts/{class_id}/{id}";
|
||||
}
|
||||
|
||||
// NFTByQueryString queries an NFT based on its class and id.
|
||||
//
|
||||
// Since: nft v0.1.1
|
||||
rpc NFTByQueryString(QueryNFTByQueryStringRequest) returns (QueryNFTByQueryStringResponse) {
|
||||
option (google.api.http).get = "/cosmos/nft/v1beta1/nft";
|
||||
}
|
||||
|
||||
// Class queries an NFT class based on its id
|
||||
rpc Class(QueryClassRequest) returns (QueryClassResponse) {
|
||||
option (google.api.http).get = "/cosmos/nft/v1beta1/classes/{class_id}";
|
||||
}
|
||||
|
||||
// Class queries an NFT class based on its id
|
||||
//
|
||||
// Since: nft v0.1.1
|
||||
rpc ClassByQueryString(QueryClassByQueryStringRequest) returns (QueryClassByQueryStringResponse) {
|
||||
option (google.api.http).get = "/cosmos/nft/v1beta1/class";
|
||||
}
|
||||
|
||||
// Classes queries all NFT classes
|
||||
rpc Classes(QueryClassesRequest) returns (QueryClassesResponse) {
|
||||
option (google.api.http).get = "/cosmos/nft/v1beta1/classes";
|
||||
@ -55,12 +90,31 @@ message QueryBalanceRequest {
|
||||
string owner = 2;
|
||||
}
|
||||
|
||||
// QueryBalanceByQueryStringRequest is the request type for the Query/Balance RPC method
|
||||
//
|
||||
// Since: nft v0.1.1
|
||||
message QueryBalanceByQueryStringRequest {
|
||||
// class_id associated with the nft
|
||||
string class_id = 1;
|
||||
|
||||
// owner is the owner address of the nft
|
||||
string owner = 2;
|
||||
}
|
||||
|
||||
// QueryBalanceResponse is the response type for the Query/Balance RPC method
|
||||
message QueryBalanceResponse {
|
||||
// amount is the number of all NFTs of a given class owned by the owner
|
||||
uint64 amount = 1;
|
||||
}
|
||||
|
||||
// QueryBalanceByQueryStringResponse is the response type for the Query/Balance RPC method
|
||||
//
|
||||
// Since: nft v0.1.1
|
||||
message QueryBalanceByQueryStringResponse {
|
||||
// amount is the number of all NFTs of a given class owned by the owner
|
||||
uint64 amount = 1;
|
||||
}
|
||||
|
||||
// QueryOwnerRequest is the request type for the Query/Owner RPC method
|
||||
message QueryOwnerRequest {
|
||||
// class_id associated with the nft
|
||||
@ -70,24 +124,59 @@ message QueryOwnerRequest {
|
||||
string id = 2;
|
||||
}
|
||||
|
||||
// QueryOwnerByQueryStringRequest is the request type for the Query/Owner RPC method
|
||||
//
|
||||
// Since: nft v0.1.1
|
||||
message QueryOwnerByQueryStringRequest {
|
||||
// class_id associated with the nft
|
||||
string class_id = 1;
|
||||
|
||||
// id is a unique identifier of the NFT
|
||||
string id = 2;
|
||||
}
|
||||
|
||||
// QueryOwnerResponse is the response type for the Query/Owner RPC method
|
||||
message QueryOwnerResponse {
|
||||
// owner is the owner address of the nft
|
||||
string owner = 1;
|
||||
}
|
||||
|
||||
// QueryOwnerByQueryStringResponse is the response type for the Query/Owner RPC method
|
||||
//
|
||||
// Since: nft v0.1.1
|
||||
message QueryOwnerByQueryStringResponse {
|
||||
// owner is the owner address of the nft
|
||||
string owner = 1;
|
||||
}
|
||||
|
||||
// QuerySupplyRequest is the request type for the Query/Supply RPC method
|
||||
message QuerySupplyRequest {
|
||||
// class_id associated with the nft
|
||||
string class_id = 1;
|
||||
}
|
||||
|
||||
// QuerySupplyByQueryStringRequest is the request type for the Query/Supply RPC method
|
||||
//
|
||||
// Since: nft v0.1.1
|
||||
message QuerySupplyByQueryStringRequest {
|
||||
// class_id associated with the nft
|
||||
string class_id = 1;
|
||||
}
|
||||
|
||||
// QuerySupplyResponse is the response type for the Query/Supply RPC method
|
||||
message QuerySupplyResponse {
|
||||
// amount is the number of all NFTs from the given class
|
||||
uint64 amount = 1;
|
||||
}
|
||||
|
||||
// QuerySupplyByQueryStringResponse is the response type for the Query/Supply RPC method
|
||||
//
|
||||
// Since: nft v0.1.1
|
||||
message QuerySupplyByQueryStringResponse {
|
||||
// amount is the number of all NFTs from the given class
|
||||
uint64 amount = 1;
|
||||
}
|
||||
|
||||
// QueryNFTstRequest is the request type for the Query/NFTs RPC method
|
||||
message QueryNFTsRequest {
|
||||
// class_id associated with the nft
|
||||
@ -118,24 +207,59 @@ message QueryNFTRequest {
|
||||
string id = 2;
|
||||
}
|
||||
|
||||
// QueryNFTByQueryStringRequest is the request type for the Query/NFT RPC method
|
||||
//
|
||||
// Since: nft v0.1.1
|
||||
message QueryNFTByQueryStringRequest {
|
||||
// class_id associated with the nft
|
||||
string class_id = 1;
|
||||
|
||||
// id is a unique identifier of the NFT
|
||||
string id = 2;
|
||||
}
|
||||
|
||||
// QueryNFTResponse is the response type for the Query/NFT RPC method
|
||||
message QueryNFTResponse {
|
||||
// owner is the owner address of the nft
|
||||
cosmos.nft.v1beta1.NFT nft = 1;
|
||||
}
|
||||
|
||||
// QueryNFTByQueryStringResponse is the response type for the Query/NFT RPC method
|
||||
//
|
||||
// Since: nft v0.1.1
|
||||
message QueryNFTByQueryStringResponse {
|
||||
// owner is the owner address of the nft
|
||||
cosmos.nft.v1beta1.NFT nft = 1;
|
||||
}
|
||||
|
||||
// QueryClassRequest is the request type for the Query/Class RPC method
|
||||
message QueryClassRequest {
|
||||
// class_id associated with the nft
|
||||
string class_id = 1;
|
||||
}
|
||||
|
||||
// QueryClassByQueryStringRequest is the request type for the Query/Class RPC method
|
||||
//
|
||||
// Since: nft v0.1.1
|
||||
message QueryClassByQueryStringRequest {
|
||||
// class_id associated with the nft
|
||||
string class_id = 1;
|
||||
}
|
||||
|
||||
// QueryClassResponse is the response type for the Query/Class RPC method
|
||||
message QueryClassResponse {
|
||||
// class defines the class of the nft type.
|
||||
cosmos.nft.v1beta1.Class class = 1;
|
||||
}
|
||||
|
||||
// QueryClassByQueryStringResponse is the response type for the Query/Class RPC method
|
||||
//
|
||||
// Since: nft v0.1.1
|
||||
message QueryClassByQueryStringResponse {
|
||||
// class defines the class of the nft type.
|
||||
cosmos.nft.v1beta1.Class class = 1;
|
||||
}
|
||||
|
||||
// QueryClassesRequest is the request type for the Query/Classes RPC method
|
||||
message QueryClassesRequest {
|
||||
// pagination defines an optional pagination for the request.
|
||||
|
||||
@ -31,4 +31,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
### Features
|
||||
* [#18355](https://github.com/cosmos/cosmos-sdk/pull/18355) Addes new versions for `Balance`, `Owner`, `Supply`, `NFT`, `Class` queries that receives request via query string.
|
||||
|
||||
## [v0.1.0](https://github.com/cosmos/cosmos-sdk/releases/tag/x/nft/v0.1.0) - 2023-11-07
|
||||
|
||||
@ -34,6 +34,19 @@ func (k Keeper) Balance(goCtx context.Context, r *nft.QueryBalanceRequest) (*nft
|
||||
return &nft.QueryBalanceResponse{Amount: balance}, nil
|
||||
}
|
||||
|
||||
// BalanceByQueryString return the number of NFTs of a given class owned by the owner, same as balanceOf in ERC721
|
||||
// but receives request via query string.
|
||||
func (k Keeper) BalanceByQueryString(goCtx context.Context, r *nft.QueryBalanceByQueryStringRequest) (*nft.QueryBalanceByQueryStringResponse, error) {
|
||||
res, err := k.Balance(goCtx, &nft.QueryBalanceRequest{
|
||||
ClassId: r.ClassId,
|
||||
Owner: r.Owner,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &nft.QueryBalanceByQueryStringResponse{Amount: res.Amount}, nil
|
||||
}
|
||||
|
||||
// Owner return the owner of the NFT based on its class and id, same as ownerOf in ERC721
|
||||
func (k Keeper) Owner(goCtx context.Context, r *nft.QueryOwnerRequest) (*nft.QueryOwnerResponse, error) {
|
||||
if r == nil {
|
||||
@ -60,6 +73,19 @@ func (k Keeper) Owner(goCtx context.Context, r *nft.QueryOwnerRequest) (*nft.Que
|
||||
return &nft.QueryOwnerResponse{Owner: ownerstr}, nil
|
||||
}
|
||||
|
||||
// OwnerByQueryString return the owner of the NFT based on its class and id, same as ownerOf in ERC721
|
||||
// but receives request via query string.
|
||||
func (k Keeper) OwnerByQueryString(goCtx context.Context, r *nft.QueryOwnerByQueryStringRequest) (*nft.QueryOwnerByQueryStringResponse, error) {
|
||||
res, err := k.Owner(goCtx, &nft.QueryOwnerRequest{
|
||||
ClassId: r.ClassId,
|
||||
Id: r.Id,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &nft.QueryOwnerByQueryStringResponse{Owner: res.Owner}, nil
|
||||
}
|
||||
|
||||
// Supply return the number of NFTs from the given class, same as totalSupply of ERC721.
|
||||
func (k Keeper) Supply(goCtx context.Context, r *nft.QuerySupplyRequest) (*nft.QuerySupplyResponse, error) {
|
||||
if r == nil {
|
||||
@ -74,6 +100,18 @@ func (k Keeper) Supply(goCtx context.Context, r *nft.QuerySupplyRequest) (*nft.Q
|
||||
return &nft.QuerySupplyResponse{Amount: supply}, nil
|
||||
}
|
||||
|
||||
// SupplyByQueryString return the number of NFTs from the given class, same as totalSupply of ERC721.
|
||||
// but receives request via query string.
|
||||
func (k Keeper) SupplyByQueryString(goCtx context.Context, r *nft.QuerySupplyByQueryStringRequest) (*nft.QuerySupplyByQueryStringResponse, error) {
|
||||
res, err := k.Supply(goCtx, &nft.QuerySupplyRequest{
|
||||
ClassId: r.ClassId,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &nft.QuerySupplyByQueryStringResponse{Amount: res.Amount}, nil
|
||||
}
|
||||
|
||||
// NFTs queries all NFTs of a given class or owner (at least one must be provided), similar to tokenByIndex in ERC721Enumerable
|
||||
func (k Keeper) NFTs(goCtx context.Context, r *nft.QueryNFTsRequest) (*nft.QueryNFTsResponse, error) {
|
||||
if r == nil {
|
||||
@ -157,6 +195,19 @@ func (k Keeper) NFT(goCtx context.Context, r *nft.QueryNFTRequest) (*nft.QueryNF
|
||||
return &nft.QueryNFTResponse{Nft: &n}, nil
|
||||
}
|
||||
|
||||
// NFTByQueryString return an NFT based on its class and id.
|
||||
// but receives request via query string.
|
||||
func (k Keeper) NFTByQueryString(goCtx context.Context, r *nft.QueryNFTByQueryStringRequest) (*nft.QueryNFTByQueryStringResponse, error) {
|
||||
res, err := k.NFT(goCtx, &nft.QueryNFTRequest{
|
||||
ClassId: r.ClassId,
|
||||
Id: r.Id,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &nft.QueryNFTByQueryStringResponse{Nft: res.Nft}, nil
|
||||
}
|
||||
|
||||
// Class return an NFT class based on its id
|
||||
func (k Keeper) Class(goCtx context.Context, r *nft.QueryClassRequest) (*nft.QueryClassResponse, error) {
|
||||
if r == nil {
|
||||
@ -175,6 +226,18 @@ func (k Keeper) Class(goCtx context.Context, r *nft.QueryClassRequest) (*nft.Que
|
||||
return &nft.QueryClassResponse{Class: &class}, nil
|
||||
}
|
||||
|
||||
// ClassByQueryString return an NFT class based on its id
|
||||
// but receives request via query string.
|
||||
func (k Keeper) ClassByQueryString(goCtx context.Context, r *nft.QueryClassByQueryStringRequest) (*nft.QueryClassByQueryStringResponse, error) {
|
||||
res, err := k.Class(goCtx, &nft.QueryClassRequest{
|
||||
ClassId: r.ClassId,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &nft.QueryClassByQueryStringResponse{Class: res.Class}, nil
|
||||
}
|
||||
|
||||
// Classes return all NFT classes
|
||||
func (k Keeper) Classes(goCtx context.Context, r *nft.QueryClassesRequest) (*nft.QueryClassesResponse, error) {
|
||||
if r == nil {
|
||||
|
||||
@ -80,6 +80,71 @@ func (s *TestSuite) TestBalance() {
|
||||
}
|
||||
}
|
||||
|
||||
func (s *TestSuite) TestBalanceByQueryString() {
|
||||
s.accountKeeper.EXPECT().AddressCodec().Return(address.NewBech32Codec("cosmos")).AnyTimes()
|
||||
var req *nft.QueryBalanceByQueryStringRequest
|
||||
testCases := []struct {
|
||||
msg string
|
||||
malleate func(index int, require *require.Assertions)
|
||||
expError string
|
||||
balance uint64
|
||||
postTest func(index int, require *require.Assertions, res *nft.QueryBalanceByQueryStringResponse, expBalance uint64)
|
||||
}{
|
||||
{
|
||||
"fail empty ClassId",
|
||||
func(index int, require *require.Assertions) {
|
||||
req = &nft.QueryBalanceByQueryStringRequest{}
|
||||
},
|
||||
nft.ErrEmptyClassID.Error(),
|
||||
0,
|
||||
func(index int, require *require.Assertions, res *nft.QueryBalanceByQueryStringResponse, expBalance uint64) {
|
||||
},
|
||||
},
|
||||
{
|
||||
"fail invalid Owner addr",
|
||||
func(index int, require *require.Assertions) {
|
||||
req = &nft.QueryBalanceByQueryStringRequest{
|
||||
ClassId: testClassID,
|
||||
Owner: "owner",
|
||||
}
|
||||
},
|
||||
"decoding bech32 failed",
|
||||
0,
|
||||
func(index int, require *require.Assertions, res *nft.QueryBalanceByQueryStringResponse, expBalance uint64) {
|
||||
},
|
||||
},
|
||||
{
|
||||
"Success",
|
||||
func(index int, require *require.Assertions) {
|
||||
s.TestMint()
|
||||
req = &nft.QueryBalanceByQueryStringRequest{
|
||||
ClassId: testClassID,
|
||||
Owner: s.encodedAddrs[0],
|
||||
}
|
||||
},
|
||||
"",
|
||||
2,
|
||||
func(index int, require *require.Assertions, res *nft.QueryBalanceByQueryStringResponse, expBalance uint64) {
|
||||
require.Equal(res.Amount, expBalance, "the error occurred on:%d", index)
|
||||
},
|
||||
},
|
||||
}
|
||||
for index, tc := range testCases {
|
||||
s.Run(fmt.Sprintf("Case %s", tc.msg), func() {
|
||||
require := s.Require()
|
||||
tc.malleate(index, require)
|
||||
result, err := s.queryClient.BalanceByQueryString(gocontext.Background(), req)
|
||||
if tc.expError == "" {
|
||||
require.NoError(err)
|
||||
} else {
|
||||
require.Error(err)
|
||||
require.Contains(err.Error(), tc.expError)
|
||||
}
|
||||
tc.postTest(index, require, result, tc.balance)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func (s *TestSuite) TestOwner() {
|
||||
var (
|
||||
req *nft.QueryOwnerRequest
|
||||
@ -169,6 +234,95 @@ func (s *TestSuite) TestOwner() {
|
||||
}
|
||||
}
|
||||
|
||||
func (s *TestSuite) TestOwnerByQueryString() {
|
||||
var (
|
||||
req *nft.QueryOwnerByQueryStringRequest
|
||||
owner string
|
||||
)
|
||||
testCases := []struct {
|
||||
msg string
|
||||
malleate func(index int, require *require.Assertions)
|
||||
expError string
|
||||
postTest func(index int, require *require.Assertions, res *nft.QueryOwnerByQueryStringResponse)
|
||||
}{
|
||||
{
|
||||
"fail empty ClassId",
|
||||
func(index int, require *require.Assertions) {
|
||||
req = &nft.QueryOwnerByQueryStringRequest{
|
||||
Id: testID,
|
||||
}
|
||||
},
|
||||
nft.ErrEmptyClassID.Error(),
|
||||
func(index int, require *require.Assertions, res *nft.QueryOwnerByQueryStringResponse) {},
|
||||
},
|
||||
{
|
||||
"fail empty nft id",
|
||||
func(index int, require *require.Assertions) {
|
||||
req = &nft.QueryOwnerByQueryStringRequest{
|
||||
ClassId: testClassID,
|
||||
}
|
||||
},
|
||||
nft.ErrEmptyNFTID.Error(),
|
||||
func(index int, require *require.Assertions, res *nft.QueryOwnerByQueryStringResponse) {},
|
||||
},
|
||||
{
|
||||
"success but nft id not exist",
|
||||
func(index int, require *require.Assertions) {
|
||||
req = &nft.QueryOwnerByQueryStringRequest{
|
||||
ClassId: testClassID,
|
||||
Id: "kitty2",
|
||||
}
|
||||
},
|
||||
"",
|
||||
func(index int, require *require.Assertions, res *nft.QueryOwnerByQueryStringResponse) {
|
||||
require.Equal(res.Owner, owner, "the error occurred on:%d", index)
|
||||
},
|
||||
},
|
||||
{
|
||||
"success but class id not exist",
|
||||
func(index int, require *require.Assertions) {
|
||||
req = &nft.QueryOwnerByQueryStringRequest{
|
||||
ClassId: "kitty1",
|
||||
Id: testID,
|
||||
}
|
||||
},
|
||||
"",
|
||||
func(index int, require *require.Assertions, res *nft.QueryOwnerByQueryStringResponse) {
|
||||
require.Equal(res.Owner, owner, "the error occurred on:%d", index)
|
||||
},
|
||||
},
|
||||
{
|
||||
"Success",
|
||||
func(index int, require *require.Assertions) {
|
||||
s.TestMint()
|
||||
req = &nft.QueryOwnerByQueryStringRequest{
|
||||
ClassId: testClassID,
|
||||
Id: testID,
|
||||
}
|
||||
owner = s.encodedAddrs[0]
|
||||
},
|
||||
"",
|
||||
func(index int, require *require.Assertions, res *nft.QueryOwnerByQueryStringResponse) {
|
||||
require.Equal(res.Owner, owner, "the error occurred on:%d", index)
|
||||
},
|
||||
},
|
||||
}
|
||||
for index, tc := range testCases {
|
||||
s.Run(fmt.Sprintf("Case %s", tc.msg), func() {
|
||||
require := s.Require()
|
||||
tc.malleate(index, require)
|
||||
result, err := s.queryClient.OwnerByQueryString(gocontext.Background(), req)
|
||||
if tc.expError == "" {
|
||||
require.NoError(err)
|
||||
} else {
|
||||
require.Error(err)
|
||||
require.Contains(err.Error(), tc.expError)
|
||||
}
|
||||
tc.postTest(index, require, result)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func (s *TestSuite) TestSupply() {
|
||||
var req *nft.QuerySupplyRequest
|
||||
testCases := []struct {
|
||||
@ -252,6 +406,90 @@ func (s *TestSuite) TestSupply() {
|
||||
}
|
||||
}
|
||||
|
||||
func (s *TestSuite) TestSupplyByQueryString() {
|
||||
var req *nft.QuerySupplyByQueryStringRequest
|
||||
testCases := []struct {
|
||||
msg string
|
||||
malleate func(index int, require *require.Assertions)
|
||||
expError string
|
||||
supply uint64
|
||||
postTest func(index int, require *require.Assertions, res *nft.QuerySupplyByQueryStringResponse, supply uint64)
|
||||
}{
|
||||
{
|
||||
"fail empty ClassId",
|
||||
func(index int, require *require.Assertions) {
|
||||
req = &nft.QuerySupplyByQueryStringRequest{}
|
||||
},
|
||||
nft.ErrEmptyClassID.Error(),
|
||||
0,
|
||||
func(index int, require *require.Assertions, res *nft.QuerySupplyByQueryStringResponse, supply uint64) {
|
||||
},
|
||||
},
|
||||
{
|
||||
"success but class id not exist",
|
||||
func(index int, require *require.Assertions) {
|
||||
req = &nft.QuerySupplyByQueryStringRequest{
|
||||
ClassId: "kitty1",
|
||||
}
|
||||
},
|
||||
"",
|
||||
0,
|
||||
func(index int, require *require.Assertions, res *nft.QuerySupplyByQueryStringResponse, supply uint64) {
|
||||
require.Equal(res.Amount, supply, "the error occurred on:%d", index)
|
||||
},
|
||||
},
|
||||
{
|
||||
"success but supply equal zero",
|
||||
func(index int, require *require.Assertions) {
|
||||
req = &nft.QuerySupplyByQueryStringRequest{
|
||||
ClassId: testClassID,
|
||||
}
|
||||
s.TestSaveClass()
|
||||
},
|
||||
"",
|
||||
0,
|
||||
func(index int, require *require.Assertions, res *nft.QuerySupplyByQueryStringResponse, supply uint64) {
|
||||
require.Equal(res.Amount, supply, "the error occurred on:%d", index)
|
||||
},
|
||||
},
|
||||
{
|
||||
"Success",
|
||||
func(index int, require *require.Assertions) {
|
||||
n := nft.NFT{
|
||||
ClassId: testClassID,
|
||||
Id: testID,
|
||||
Uri: testURI,
|
||||
}
|
||||
err := s.nftKeeper.Mint(s.ctx, n, s.addrs[0])
|
||||
require.NoError(err, "the error occurred on:%d", index)
|
||||
|
||||
req = &nft.QuerySupplyByQueryStringRequest{
|
||||
ClassId: testClassID,
|
||||
}
|
||||
},
|
||||
"",
|
||||
1,
|
||||
func(index int, require *require.Assertions, res *nft.QuerySupplyByQueryStringResponse, supply uint64) {
|
||||
require.Equal(res.Amount, supply, "the error occurred on:%d", index)
|
||||
},
|
||||
},
|
||||
}
|
||||
for index, tc := range testCases {
|
||||
s.Run(fmt.Sprintf("Case %s", tc.msg), func() {
|
||||
require := s.Require()
|
||||
tc.malleate(index, require)
|
||||
result, err := s.queryClient.SupplyByQueryString(gocontext.Background(), req)
|
||||
if tc.expError == "" {
|
||||
require.NoError(err)
|
||||
} else {
|
||||
require.Error(err)
|
||||
require.Contains(err.Error(), tc.expError)
|
||||
}
|
||||
tc.postTest(index, require, result, tc.supply)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func (s *TestSuite) TestNFTs() {
|
||||
var (
|
||||
req *nft.QueryNFTsRequest
|
||||
@ -467,6 +705,93 @@ func (s *TestSuite) TestNFT() {
|
||||
}
|
||||
}
|
||||
|
||||
func (s *TestSuite) TestNFTByQueryString() {
|
||||
var (
|
||||
req *nft.QueryNFTByQueryStringRequest
|
||||
expNFT nft.NFT
|
||||
)
|
||||
testCases := []struct {
|
||||
msg string
|
||||
malleate func(index int, require *require.Assertions)
|
||||
expError string
|
||||
postTest func(index int, require *require.Assertions, res *nft.QueryNFTByQueryStringResponse)
|
||||
}{
|
||||
{
|
||||
"fail empty ClassId",
|
||||
func(index int, require *require.Assertions) {
|
||||
req = &nft.QueryNFTByQueryStringRequest{}
|
||||
},
|
||||
nft.ErrEmptyClassID.Error(),
|
||||
func(index int, require *require.Assertions, res *nft.QueryNFTByQueryStringResponse) {},
|
||||
},
|
||||
{
|
||||
"fail empty nft id",
|
||||
func(index int, require *require.Assertions) {
|
||||
req = &nft.QueryNFTByQueryStringRequest{
|
||||
ClassId: testClassID,
|
||||
}
|
||||
},
|
||||
nft.ErrEmptyNFTID.Error(),
|
||||
func(index int, require *require.Assertions, res *nft.QueryNFTByQueryStringResponse) {},
|
||||
},
|
||||
{
|
||||
"fail ClassId not exist",
|
||||
func(index int, require *require.Assertions) {
|
||||
req = &nft.QueryNFTByQueryStringRequest{
|
||||
ClassId: "kitty1",
|
||||
Id: testID,
|
||||
}
|
||||
s.TestMint()
|
||||
},
|
||||
"not found nft",
|
||||
func(index int, require *require.Assertions, res *nft.QueryNFTByQueryStringResponse) {},
|
||||
},
|
||||
{
|
||||
"fail nft id not exist",
|
||||
func(index int, require *require.Assertions) {
|
||||
req = &nft.QueryNFTByQueryStringRequest{
|
||||
ClassId: testClassID,
|
||||
Id: "kitty2",
|
||||
}
|
||||
},
|
||||
"not found nft",
|
||||
func(index int, require *require.Assertions, res *nft.QueryNFTByQueryStringResponse) {},
|
||||
},
|
||||
{
|
||||
"success",
|
||||
func(index int, require *require.Assertions) {
|
||||
req = &nft.QueryNFTByQueryStringRequest{
|
||||
ClassId: testClassID,
|
||||
Id: testID,
|
||||
}
|
||||
expNFT = nft.NFT{
|
||||
ClassId: testClassID,
|
||||
Id: testID,
|
||||
Uri: testURI,
|
||||
}
|
||||
},
|
||||
"",
|
||||
func(index int, require *require.Assertions, res *nft.QueryNFTByQueryStringResponse) {
|
||||
require.Equal(*res.Nft, expNFT, "the error occurred on:%d", index)
|
||||
},
|
||||
},
|
||||
}
|
||||
for index, tc := range testCases {
|
||||
s.Run(fmt.Sprintf("Case %s", tc.msg), func() {
|
||||
require := s.Require()
|
||||
tc.malleate(index, require)
|
||||
result, err := s.queryClient.NFTByQueryString(gocontext.Background(), req)
|
||||
if tc.expError == "" {
|
||||
require.NoError(err)
|
||||
} else {
|
||||
require.Error(err)
|
||||
require.Contains(err.Error(), tc.expError)
|
||||
}
|
||||
tc.postTest(index, require, result)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func (s *TestSuite) TestClass() {
|
||||
var (
|
||||
req *nft.QueryClassRequest
|
||||
@ -534,6 +859,73 @@ func (s *TestSuite) TestClass() {
|
||||
}
|
||||
}
|
||||
|
||||
func (s *TestSuite) TestClassByQueryString() {
|
||||
var (
|
||||
req *nft.QueryClassByQueryStringRequest
|
||||
class nft.Class
|
||||
)
|
||||
testCases := []struct {
|
||||
msg string
|
||||
malleate func(index int, require *require.Assertions)
|
||||
expError string
|
||||
postTest func(index int, require *require.Assertions, res *nft.QueryClassByQueryStringResponse)
|
||||
}{
|
||||
{
|
||||
"fail empty ClassId",
|
||||
func(index int, require *require.Assertions) {
|
||||
req = &nft.QueryClassByQueryStringRequest{}
|
||||
},
|
||||
nft.ErrEmptyClassID.Error(),
|
||||
func(index int, require *require.Assertions, res *nft.QueryClassByQueryStringResponse) {},
|
||||
},
|
||||
{
|
||||
"fail ClassId not exist",
|
||||
func(index int, require *require.Assertions) {
|
||||
req = &nft.QueryClassByQueryStringRequest{
|
||||
ClassId: "kitty1",
|
||||
}
|
||||
s.TestSaveClass()
|
||||
},
|
||||
"not found class",
|
||||
func(index int, require *require.Assertions, res *nft.QueryClassByQueryStringResponse) {},
|
||||
},
|
||||
{
|
||||
"success",
|
||||
func(index int, require *require.Assertions) {
|
||||
class = nft.Class{
|
||||
Id: testClassID,
|
||||
Name: testClassName,
|
||||
Symbol: testClassSymbol,
|
||||
Description: testClassDescription,
|
||||
Uri: testClassURI,
|
||||
UriHash: testClassURIHash,
|
||||
}
|
||||
req = &nft.QueryClassByQueryStringRequest{
|
||||
ClassId: testClassID,
|
||||
}
|
||||
},
|
||||
"",
|
||||
func(index int, require *require.Assertions, res *nft.QueryClassByQueryStringResponse) {
|
||||
require.Equal(*res.Class, class, "the error occurred on:%d", index)
|
||||
},
|
||||
},
|
||||
}
|
||||
for index, tc := range testCases {
|
||||
s.Run(fmt.Sprintf("Case %s", tc.msg), func() {
|
||||
require := s.Require()
|
||||
tc.malleate(index, require)
|
||||
result, err := s.queryClient.ClassByQueryString(gocontext.Background(), req)
|
||||
if tc.expError == "" {
|
||||
require.NoError(err)
|
||||
} else {
|
||||
require.Error(err)
|
||||
require.Contains(err.Error(), tc.expError)
|
||||
}
|
||||
tc.postTest(index, require, result)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func (s *TestSuite) TestClasses() {
|
||||
var (
|
||||
req *nft.QueryClassesRequest
|
||||
|
||||
2184
x/nft/query.pb.go
2184
x/nft/query.pb.go
File diff suppressed because it is too large
Load Diff
@ -109,6 +109,42 @@ func local_request_Query_Balance_0(ctx context.Context, marshaler runtime.Marsha
|
||||
|
||||
}
|
||||
|
||||
var (
|
||||
filter_Query_BalanceByQueryString_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}
|
||||
)
|
||||
|
||||
func request_Query_BalanceByQueryString_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq QueryBalanceByQueryStringRequest
|
||||
var metadata runtime.ServerMetadata
|
||||
|
||||
if err := req.ParseForm(); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_BalanceByQueryString_0); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
|
||||
msg, err := client.BalanceByQueryString(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
func local_request_Query_BalanceByQueryString_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq QueryBalanceByQueryStringRequest
|
||||
var metadata runtime.ServerMetadata
|
||||
|
||||
if err := req.ParseForm(); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_BalanceByQueryString_0); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
|
||||
msg, err := server.BalanceByQueryString(ctx, &protoReq)
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
func request_Query_Owner_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq QueryOwnerRequest
|
||||
var metadata runtime.ServerMetadata
|
||||
@ -185,6 +221,42 @@ func local_request_Query_Owner_0(ctx context.Context, marshaler runtime.Marshale
|
||||
|
||||
}
|
||||
|
||||
var (
|
||||
filter_Query_OwnerByQueryString_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}
|
||||
)
|
||||
|
||||
func request_Query_OwnerByQueryString_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq QueryOwnerByQueryStringRequest
|
||||
var metadata runtime.ServerMetadata
|
||||
|
||||
if err := req.ParseForm(); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_OwnerByQueryString_0); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
|
||||
msg, err := client.OwnerByQueryString(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
func local_request_Query_OwnerByQueryString_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq QueryOwnerByQueryStringRequest
|
||||
var metadata runtime.ServerMetadata
|
||||
|
||||
if err := req.ParseForm(); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_OwnerByQueryString_0); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
|
||||
msg, err := server.OwnerByQueryString(ctx, &protoReq)
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
func request_Query_Supply_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq QuerySupplyRequest
|
||||
var metadata runtime.ServerMetadata
|
||||
@ -239,6 +311,42 @@ func local_request_Query_Supply_0(ctx context.Context, marshaler runtime.Marshal
|
||||
|
||||
}
|
||||
|
||||
var (
|
||||
filter_Query_SupplyByQueryString_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}
|
||||
)
|
||||
|
||||
func request_Query_SupplyByQueryString_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq QuerySupplyByQueryStringRequest
|
||||
var metadata runtime.ServerMetadata
|
||||
|
||||
if err := req.ParseForm(); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_SupplyByQueryString_0); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
|
||||
msg, err := client.SupplyByQueryString(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
func local_request_Query_SupplyByQueryString_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq QuerySupplyByQueryStringRequest
|
||||
var metadata runtime.ServerMetadata
|
||||
|
||||
if err := req.ParseForm(); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_SupplyByQueryString_0); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
|
||||
msg, err := server.SupplyByQueryString(ctx, &protoReq)
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
var (
|
||||
filter_Query_NFTs_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}
|
||||
)
|
||||
@ -351,6 +459,42 @@ func local_request_Query_NFT_0(ctx context.Context, marshaler runtime.Marshaler,
|
||||
|
||||
}
|
||||
|
||||
var (
|
||||
filter_Query_NFTByQueryString_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}
|
||||
)
|
||||
|
||||
func request_Query_NFTByQueryString_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq QueryNFTByQueryStringRequest
|
||||
var metadata runtime.ServerMetadata
|
||||
|
||||
if err := req.ParseForm(); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_NFTByQueryString_0); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
|
||||
msg, err := client.NFTByQueryString(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
func local_request_Query_NFTByQueryString_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq QueryNFTByQueryStringRequest
|
||||
var metadata runtime.ServerMetadata
|
||||
|
||||
if err := req.ParseForm(); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_NFTByQueryString_0); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
|
||||
msg, err := server.NFTByQueryString(ctx, &protoReq)
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
func request_Query_Class_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq QueryClassRequest
|
||||
var metadata runtime.ServerMetadata
|
||||
@ -405,6 +549,42 @@ func local_request_Query_Class_0(ctx context.Context, marshaler runtime.Marshale
|
||||
|
||||
}
|
||||
|
||||
var (
|
||||
filter_Query_ClassByQueryString_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}
|
||||
)
|
||||
|
||||
func request_Query_ClassByQueryString_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq QueryClassByQueryStringRequest
|
||||
var metadata runtime.ServerMetadata
|
||||
|
||||
if err := req.ParseForm(); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_ClassByQueryString_0); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
|
||||
msg, err := client.ClassByQueryString(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
func local_request_Query_ClassByQueryString_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq QueryClassByQueryStringRequest
|
||||
var metadata runtime.ServerMetadata
|
||||
|
||||
if err := req.ParseForm(); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_ClassByQueryString_0); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
|
||||
msg, err := server.ClassByQueryString(ctx, &protoReq)
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
var (
|
||||
filter_Query_Classes_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}
|
||||
)
|
||||
@ -470,6 +650,29 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("GET", pattern_Query_BalanceByQueryString_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_BalanceByQueryString_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_BalanceByQueryString_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("GET", pattern_Query_Owner_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
@ -493,6 +696,29 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("GET", pattern_Query_OwnerByQueryString_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_OwnerByQueryString_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_OwnerByQueryString_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("GET", pattern_Query_Supply_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
@ -516,6 +742,29 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("GET", pattern_Query_SupplyByQueryString_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_SupplyByQueryString_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_SupplyByQueryString_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("GET", pattern_Query_NFTs_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
@ -562,6 +811,29 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("GET", pattern_Query_NFTByQueryString_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_NFTByQueryString_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_NFTByQueryString_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("GET", pattern_Query_Class_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
@ -585,6 +857,29 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("GET", pattern_Query_ClassByQueryString_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_ClassByQueryString_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_ClassByQueryString_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("GET", pattern_Query_Classes_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
@ -669,6 +964,26 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("GET", pattern_Query_BalanceByQueryString_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_BalanceByQueryString_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_BalanceByQueryString_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("GET", pattern_Query_Owner_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
@ -689,6 +1004,26 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("GET", pattern_Query_OwnerByQueryString_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_OwnerByQueryString_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_OwnerByQueryString_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("GET", pattern_Query_Supply_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
@ -709,6 +1044,26 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("GET", pattern_Query_SupplyByQueryString_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_SupplyByQueryString_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_SupplyByQueryString_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("GET", pattern_Query_NFTs_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
@ -749,6 +1104,26 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("GET", pattern_Query_NFTByQueryString_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_NFTByQueryString_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_NFTByQueryString_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("GET", pattern_Query_Class_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
@ -769,6 +1144,26 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("GET", pattern_Query_ClassByQueryString_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_ClassByQueryString_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_ClassByQueryString_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("GET", pattern_Query_Classes_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
@ -795,31 +1190,51 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie
|
||||
var (
|
||||
pattern_Query_Balance_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4, 1, 0, 4, 1, 5, 5}, []string{"cosmos", "nft", "v1beta1", "balance", "owner", "class_id"}, "", runtime.AssumeColonVerbOpt(false)))
|
||||
|
||||
pattern_Query_BalanceByQueryString_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"cosmos", "nft", "v1beta1", "balance"}, "", runtime.AssumeColonVerbOpt(false)))
|
||||
|
||||
pattern_Query_Owner_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4, 1, 0, 4, 1, 5, 5}, []string{"cosmos", "nft", "v1beta1", "owner", "class_id", "id"}, "", runtime.AssumeColonVerbOpt(false)))
|
||||
|
||||
pattern_Query_OwnerByQueryString_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"cosmos", "nft", "v1beta1", "owner"}, "", runtime.AssumeColonVerbOpt(false)))
|
||||
|
||||
pattern_Query_Supply_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"cosmos", "nft", "v1beta1", "supply", "class_id"}, "", runtime.AssumeColonVerbOpt(false)))
|
||||
|
||||
pattern_Query_SupplyByQueryString_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"cosmos", "nft", "v1beta1", "supply"}, "", runtime.AssumeColonVerbOpt(false)))
|
||||
|
||||
pattern_Query_NFTs_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"cosmos", "nft", "v1beta1", "nfts"}, "", runtime.AssumeColonVerbOpt(false)))
|
||||
|
||||
pattern_Query_NFT_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4, 1, 0, 4, 1, 5, 5}, []string{"cosmos", "nft", "v1beta1", "nfts", "class_id", "id"}, "", runtime.AssumeColonVerbOpt(false)))
|
||||
|
||||
pattern_Query_NFTByQueryString_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 1}, []string{"cosmos", "nft", "v1beta1"}, "", runtime.AssumeColonVerbOpt(false)))
|
||||
|
||||
pattern_Query_Class_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"cosmos", "nft", "v1beta1", "classes", "class_id"}, "", runtime.AssumeColonVerbOpt(false)))
|
||||
|
||||
pattern_Query_ClassByQueryString_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"cosmos", "nft", "v1beta1", "class"}, "", runtime.AssumeColonVerbOpt(false)))
|
||||
|
||||
pattern_Query_Classes_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"cosmos", "nft", "v1beta1", "classes"}, "", runtime.AssumeColonVerbOpt(false)))
|
||||
)
|
||||
|
||||
var (
|
||||
forward_Query_Balance_0 = runtime.ForwardResponseMessage
|
||||
|
||||
forward_Query_BalanceByQueryString_0 = runtime.ForwardResponseMessage
|
||||
|
||||
forward_Query_Owner_0 = runtime.ForwardResponseMessage
|
||||
|
||||
forward_Query_OwnerByQueryString_0 = runtime.ForwardResponseMessage
|
||||
|
||||
forward_Query_Supply_0 = runtime.ForwardResponseMessage
|
||||
|
||||
forward_Query_SupplyByQueryString_0 = runtime.ForwardResponseMessage
|
||||
|
||||
forward_Query_NFTs_0 = runtime.ForwardResponseMessage
|
||||
|
||||
forward_Query_NFT_0 = runtime.ForwardResponseMessage
|
||||
|
||||
forward_Query_NFTByQueryString_0 = runtime.ForwardResponseMessage
|
||||
|
||||
forward_Query_Class_0 = runtime.ForwardResponseMessage
|
||||
|
||||
forward_Query_ClassByQueryString_0 = runtime.ForwardResponseMessage
|
||||
|
||||
forward_Query_Classes_0 = runtime.ForwardResponseMessage
|
||||
)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user