diff --git a/proto/tokenfactory/query.proto b/proto/tokenfactory/query.proto index 170a95f312..566571bb86 100644 --- a/proto/tokenfactory/query.proto +++ b/proto/tokenfactory/query.proto @@ -2,6 +2,7 @@ syntax = "proto3"; package seiprotocol.seichain.tokenfactory; import "cosmos/bank/v1beta1/bank.proto"; +import "cosmos/base/query/v1beta1/pagination.proto"; import "gogoproto/gogo.proto"; import "google/api/annotations.proto"; import "tokenfactory/authority_metadata.proto"; @@ -69,12 +70,14 @@ message QueryDenomAuthorityMetadataResponse { // DenomsFromCreator gRPC query. message QueryDenomsFromCreatorRequest { string creator = 1 [(gogoproto.moretags) = "yaml:\"creator\""]; + cosmos.base.query.v1beta1.PageRequest pagination = 2; } -// QueryDenomsFromCreatorRequest defines the response structure for the +// QueryDenomsFromCreatorResponse defines the response structure for the // DenomsFromCreator gRPC query. message QueryDenomsFromCreatorResponse { repeated string denoms = 1 [(gogoproto.moretags) = "yaml:\"denoms\""]; + cosmos.base.query.v1beta1.PageResponse pagination = 2; } // QueryDenomMetadataRequest is the request type for the DenomMetadata gRPC method. diff --git a/wasmbinding/test/query_test.go b/wasmbinding/test/query_test.go index e85f8d6352..769544a760 100644 --- a/wasmbinding/test/query_test.go +++ b/wasmbinding/test/query_test.go @@ -249,7 +249,7 @@ func TestWasmGetDenomsFromCreator(t *testing.T) { var parsedRes tokenfactorytypes.QueryDenomsFromCreatorResponse err = json.Unmarshal(res, &parsedRes) require.NoError(t, err) - require.Equal(t, tokenfactorytypes.QueryDenomsFromCreatorResponse{Denoms: nil}, parsedRes) + require.Empty(t, parsedRes.Denoms) // Add first denom testWrapper.App.TokenFactoryKeeper.CreateDenom(testWrapper.Ctx, app.TestUser, "test1") @@ -260,7 +260,7 @@ func TestWasmGetDenomsFromCreator(t *testing.T) { var parsedRes2 tokenfactorytypes.QueryDenomsFromCreatorResponse err = json.Unmarshal(res, &parsedRes2) require.NoError(t, err) - require.Equal(t, tokenfactorytypes.QueryDenomsFromCreatorResponse{Denoms: []string{denom1}}, parsedRes2) + require.Equal(t, []string{denom1}, parsedRes2.Denoms) // Add second denom testWrapper.App.TokenFactoryKeeper.CreateDenom(testWrapper.Ctx, app.TestUser, "test2") @@ -271,7 +271,7 @@ func TestWasmGetDenomsFromCreator(t *testing.T) { var parsedRes3 tokenfactorytypes.QueryDenomsFromCreatorResponse err = json.Unmarshal(res, &parsedRes3) require.NoError(t, err) - require.Equal(t, tokenfactorytypes.QueryDenomsFromCreatorResponse{Denoms: []string{denom1, denom2}}, parsedRes3) + require.Equal(t, []string{denom1, denom2}, parsedRes3.Denoms) } diff --git a/x/tokenfactory/client/cli/query.go b/x/tokenfactory/client/cli/query.go index f93634d2c7..85f41d4300 100644 --- a/x/tokenfactory/client/cli/query.go +++ b/x/tokenfactory/client/cli/query.go @@ -105,8 +105,14 @@ func GetCmdDenomsFromCreator() *cobra.Command { return err } + pageReq, err := client.ReadPageRequest(cmd.Flags()) + if err != nil { + return err + } + res, err := queryClient.DenomsFromCreator(cmd.Context(), &types.QueryDenomsFromCreatorRequest{ - Creator: args[0], + Creator: args[0], + Pagination: pageReq, }) if err != nil { return err @@ -117,6 +123,7 @@ func GetCmdDenomsFromCreator() *cobra.Command { } flags.AddQueryFlagsToCmd(cmd) + flags.AddPaginationFlagsToCmd(cmd, "denoms-from-creator") return cmd } diff --git a/x/tokenfactory/keeper/creators.go b/x/tokenfactory/keeper/creators.go index f5d3d99701..d55e4aa1ed 100644 --- a/x/tokenfactory/keeper/creators.go +++ b/x/tokenfactory/keeper/creators.go @@ -2,6 +2,7 @@ package keeper import ( sdk "github.com/sei-protocol/sei-chain/sei-cosmos/types" + "github.com/sei-protocol/sei-chain/sei-cosmos/types/query" ) func (k Keeper) addDenomFromCreator(ctx sdk.Context, creator, denom string) { @@ -9,17 +10,17 @@ func (k Keeper) addDenomFromCreator(ctx sdk.Context, creator, denom string) { store.Set([]byte(denom), []byte(denom)) } -func (k Keeper) getDenomsFromCreator(ctx sdk.Context, creator string) []string { +func (k Keeper) getDenomsFromCreator(ctx sdk.Context, creator string, pagination *query.PageRequest) ([]string, *query.PageResponse, error) { store := k.GetCreatorPrefixStore(ctx, creator) - - iterator := store.Iterator(nil, nil) - defer func() { _ = iterator.Close() }() - - denoms := []string{} - for ; iterator.Valid(); iterator.Next() { - denoms = append(denoms, string(iterator.Key())) + var denoms []string + pageRes, err := query.Paginate(store, pagination, func(key []byte, _ []byte) error { + denoms = append(denoms, string(key)) + return nil + }) + if err != nil { + return nil, nil, err } - return denoms + return denoms, pageRes, nil } func (k Keeper) GetAllDenomsIterator(ctx sdk.Context) sdk.Iterator { diff --git a/x/tokenfactory/keeper/grpc_query.go b/x/tokenfactory/keeper/grpc_query.go index b2cc282949..da7daf80e6 100644 --- a/x/tokenfactory/keeper/grpc_query.go +++ b/x/tokenfactory/keeper/grpc_query.go @@ -32,8 +32,11 @@ func (k Keeper) DenomAuthorityMetadata(ctx context.Context, req *types.QueryDeno func (k Keeper) DenomsFromCreator(ctx context.Context, req *types.QueryDenomsFromCreatorRequest) (*types.QueryDenomsFromCreatorResponse, error) { sdkCtx := sdk.UnwrapSDKContext(ctx) - denoms := k.getDenomsFromCreator(sdkCtx, req.GetCreator()) - return &types.QueryDenomsFromCreatorResponse{Denoms: denoms}, nil + denoms, pageRes, err := k.getDenomsFromCreator(sdkCtx, req.GetCreator(), req.GetPagination()) + if err != nil { + return nil, err + } + return &types.QueryDenomsFromCreatorResponse{Denoms: denoms, Pagination: pageRes}, nil } // DenomMetadata implements Query/DenomMetadata gRPC method. diff --git a/x/tokenfactory/keeper/grpc_query_test.go b/x/tokenfactory/keeper/grpc_query_test.go index 46371a66e0..01cae67859 100644 --- a/x/tokenfactory/keeper/grpc_query_test.go +++ b/x/tokenfactory/keeper/grpc_query_test.go @@ -3,12 +3,14 @@ package keeper_test import ( "context" "fmt" + "reflect" + "testing" + sdk "github.com/sei-protocol/sei-chain/sei-cosmos/types" + "github.com/sei-protocol/sei-chain/sei-cosmos/types/query" banktypes "github.com/sei-protocol/sei-chain/sei-cosmos/x/bank/types" "github.com/sei-protocol/sei-chain/x/tokenfactory/keeper" "github.com/sei-protocol/sei-chain/x/tokenfactory/types" - "reflect" - "testing" ) func (suite *KeeperTestSuite) TestDenomMetadataRequest() { @@ -158,6 +160,68 @@ func (suite *KeeperTestSuite) TestDenomAllowListRequest() { } } +func (suite *KeeperTestSuite) TestDenomsFromCreatorPagination() { + creator := suite.TestAccs[0].String() + ctx := sdk.WrapSDKContext(suite.Ctx) + + denomSubdirs := []string{"aaa", "bbb", "ccc", "ddd", "eee"} + for _, sub := range denomSubdirs { + _, err := suite.msgServer.CreateDenom(ctx, types.NewMsgCreateDenom(creator, sub)) + suite.Require().NoError(err) + } + + suite.Run("no pagination returns all denoms", func() { + res, err := suite.queryClient.DenomsFromCreator(ctx, &types.QueryDenomsFromCreatorRequest{Creator: creator}) + suite.Require().NoError(err) + suite.Require().Len(res.Denoms, len(denomSubdirs)) + suite.Require().NotNil(res.Pagination) + }) + + suite.Run("limit 2 returns first page with next key", func() { + res, err := suite.queryClient.DenomsFromCreator(ctx, &types.QueryDenomsFromCreatorRequest{ + Creator: creator, + Pagination: &query.PageRequest{Limit: 2}, + }) + suite.Require().NoError(err) + suite.Require().Len(res.Denoms, 2) + suite.Require().NotNil(res.Pagination) + suite.Require().NotNil(res.Pagination.NextKey) + }) + + suite.Run("key-based second page returns remaining denoms", func() { + first, err := suite.queryClient.DenomsFromCreator(ctx, &types.QueryDenomsFromCreatorRequest{ + Creator: creator, + Pagination: &query.PageRequest{Limit: 2}, + }) + suite.Require().NoError(err) + + second, err := suite.queryClient.DenomsFromCreator(ctx, &types.QueryDenomsFromCreatorRequest{ + Creator: creator, + Pagination: &query.PageRequest{Key: first.Pagination.NextKey, Limit: 2}, + }) + suite.Require().NoError(err) + suite.Require().NotEmpty(second.Denoms) + // pages must not overlap + for _, d := range second.Denoms { + suite.Require().NotContains(first.Denoms, d) + } + }) + + suite.Run("offset-based pagination", func() { + all, err := suite.queryClient.DenomsFromCreator(ctx, &types.QueryDenomsFromCreatorRequest{Creator: creator}) + suite.Require().NoError(err) + + const offset = 2 + res, err := suite.queryClient.DenomsFromCreator(ctx, &types.QueryDenomsFromCreatorRequest{ + Creator: creator, + Pagination: &query.PageRequest{Offset: offset, Limit: 2}, + }) + suite.Require().NoError(err) + suite.Require().NotEmpty(res.Denoms) + suite.Require().Equal(all.Denoms[offset:offset+len(res.Denoms)], res.Denoms) + }) +} + func TestKeeper_DenomAllowList(t *testing.T) { type args struct { req *types.QueryDenomAllowListRequest diff --git a/x/tokenfactory/types/query.pb.go b/x/tokenfactory/types/query.pb.go index 169be20217..9f6a7c72b7 100644 --- a/x/tokenfactory/types/query.pb.go +++ b/x/tokenfactory/types/query.pb.go @@ -9,6 +9,7 @@ import ( _ "github.com/gogo/protobuf/gogoproto" grpc1 "github.com/gogo/protobuf/grpc" proto "github.com/gogo/protobuf/proto" + query "github.com/sei-protocol/sei-chain/sei-cosmos/types/query" types "github.com/sei-protocol/sei-chain/sei-cosmos/x/bank/types" _ "google.golang.org/genproto/googleapis/api/annotations" grpc "google.golang.org/grpc" @@ -208,7 +209,8 @@ func (m *QueryDenomAuthorityMetadataResponse) GetAuthorityMetadata() DenomAuthor // QueryDenomsFromCreatorRequest defines the request structure for the // DenomsFromCreator gRPC query. type QueryDenomsFromCreatorRequest struct { - Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty" yaml:"creator"` + Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty" yaml:"creator"` + Pagination *query.PageRequest `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` } func (m *QueryDenomsFromCreatorRequest) Reset() { *m = QueryDenomsFromCreatorRequest{} } @@ -251,10 +253,18 @@ func (m *QueryDenomsFromCreatorRequest) GetCreator() string { return "" } -// QueryDenomsFromCreatorRequest defines the response structure for the +func (m *QueryDenomsFromCreatorRequest) GetPagination() *query.PageRequest { + if m != nil { + return m.Pagination + } + return nil +} + +// QueryDenomsFromCreatorResponse defines the response structure for the // DenomsFromCreator gRPC query. type QueryDenomsFromCreatorResponse struct { - Denoms []string `protobuf:"bytes,1,rep,name=denoms,proto3" json:"denoms,omitempty" yaml:"denoms"` + Denoms []string `protobuf:"bytes,1,rep,name=denoms,proto3" json:"denoms,omitempty" yaml:"denoms"` + Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` } func (m *QueryDenomsFromCreatorResponse) Reset() { *m = QueryDenomsFromCreatorResponse{} } @@ -297,6 +307,13 @@ func (m *QueryDenomsFromCreatorResponse) GetDenoms() []string { return nil } +func (m *QueryDenomsFromCreatorResponse) GetPagination() *query.PageResponse { + if m != nil { + return m.Pagination + } + return nil +} + // QueryDenomMetadataRequest is the request type for the DenomMetadata gRPC method. type QueryDenomMetadataRequest struct { // denom is the coin denom to query the metadata for. @@ -499,52 +516,56 @@ func init() { func init() { proto.RegisterFile("tokenfactory/query.proto", fileDescriptor_78516c77a1ba9513) } var fileDescriptor_78516c77a1ba9513 = []byte{ - // 718 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x94, 0x4f, 0x4f, 0x13, 0x4f, - 0x18, 0xc7, 0x3b, 0xbf, 0x9f, 0x54, 0x18, 0x85, 0xc8, 0x48, 0x0c, 0xac, 0xb2, 0x95, 0x31, 0x1a, - 0x30, 0xb0, 0x1b, 0x4a, 0xc0, 0xf8, 0x07, 0xb5, 0x45, 0x20, 0x46, 0x48, 0xb0, 0x47, 0x13, 0x6d, - 0xa6, 0x65, 0x28, 0x1b, 0xba, 0x3b, 0x65, 0x67, 0xaa, 0x36, 0x84, 0x8b, 0x57, 0x2f, 0x26, 0xbe, - 0x0c, 0x4f, 0xc6, 0x37, 0x81, 0x17, 0x43, 0xe2, 0xc5, 0x53, 0x63, 0xa8, 0xaf, 0xa0, 0x07, 0xcf, - 0xa6, 0x33, 0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 0xe1, 0x11, 0x46, 0xbd, 0x35, 0xbd, 0xf5, 0xb9, 0x30, 0x1e, - 0x9e, 0xb6, 0x5c, 0xc3, 0x2d, 0x4a, 0xb8, 0x3b, 0x68, 0xbe, 0x87, 0x43, 0x3b, 0x7e, 0x6a, 0xd2, - 0x1b, 0x07, 0x47, 0x26, 0x38, 0x3c, 0x32, 0xc1, 0xcf, 0x23, 0x13, 0x7c, 0xa8, 0x99, 0xb1, 0xc3, - 0x9a, 0x19, 0xfb, 0x51, 0x33, 0x63, 0x2f, 0x16, 0x0a, 0x8e, 0xd8, 0x2e, 0xe7, 0xac, 0x3c, 0x73, - 0xdb, 0xa4, 0x67, 0x94, 0xf6, 0xdb, 0xb0, 0xba, 0xa8, 0x94, 0x28, 0xcf, 0xc5, 0x65, 0xe2, 0xdc, - 0x9f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x89, 0xc7, 0x75, 0xf5, 0xa1, 0x08, 0x00, 0x00, + // 772 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x54, 0x4f, 0x4f, 0x13, 0x4f, + 0x18, 0xee, 0xf0, 0xfb, 0x51, 0x61, 0x14, 0x22, 0x23, 0x31, 0x50, 0x65, 0x2b, 0x63, 0x44, 0x20, + 0xb0, 0x1b, 0x4a, 0xc0, 0xf8, 0x07, 0xb5, 0x45, 0x20, 0x26, 0x90, 0x60, 0x8f, 0x26, 0xda, 0x4c, + 0xcb, 0x50, 0x36, 0x74, 0x77, 0xca, 0xce, 0x54, 0x6d, 0x08, 0x17, 0xaf, 0x5e, 0x4c, 0xd4, 0x4f, + 0xe1, 0xc9, 0xf8, 0x25, 0xf0, 0x62, 0x48, 0xbc, 0x78, 0x6a, 0x0c, 0xf5, 0x13, 0xf4, 0xe0, 0xd9, + 0x74, 0x66, 0xfa, 0x67, 0xdb, 0x15, 0x5a, 0x38, 0x75, 0xfa, 0xce, 0xfb,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+ 0xae, 0xee, 0xa5, 0x0c, 0xe0, 0x50, 0xdb, 0xe0, 0x40, 0x8f, 0xbb, 0x52, 0x14, 0x30, 0x0b, 0x23, + 0xf1, 0x73, 0x30, 0x68, 0x5f, 0x4f, 0xa5, 0xaf, 0x65, 0x14, 0xef, 0xdc, 0x57, 0x6a, 0xdb, 0x63, + 0x4e, 0x4a, 0x4f, 0x58, 0x6b, 0x5f, 0x2f, 0x0e, 0xd0, 0x77, 0x00, 0x07, 0xfd, 0x4f, 0x18, 0x75, + 0x77, 0xe9, 0xad, 0xe3, 0x22, 0xf2, 0xf0, 0xac, 0x70, 0x6d, 0x6e, 0x49, 0x9a, 0xbb, 0x83, 0x16, + 0xba, 0xf8, 0x68, 0x8d, 0x51, 0x93, 0xd8, 0x3c, 0x3c, 0x36, 0xc0, 0xd1, 0xb1, 0x01, 0x7e, 0x1d, + 0x1b, 0xe0, 0x7d, 0xd9, 0x08, 0x1d, 0x95, 0x8d, 0xd0, 0xcf, 0xb2, 0x11, 0x7a, 0xbe, 0x98, 0xb5, + 0xc5, 0x4e, 0x21, 0x6d, 0x66, 0x98, 0xd3, 0x46, 0x3d, 0xab, 0xb8, 0xdf, 0xf8, 0xd9, 0x45, 0x31, + 0x4f, 0x79, 0x3a, 0x2c, 0x1b, 0xe7, 0xff, 0x06, 0x00, 0x00, 0xff, 0xff, 0x34, 0x90, 0x0e, 0xae, + 0x60, 0x09, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -566,7 +587,8 @@ type QueryClient interface { // DenomAuthorityMetadata for a particular denom. DenomAuthorityMetadata(ctx context.Context, in *QueryDenomAuthorityMetadataRequest, opts ...grpc.CallOption) (*QueryDenomAuthorityMetadataResponse, error) // DenomsMetadata defines a gRPC query method for fetching - // DenomMetadata for a particular denom. + // + // DenomMetadata for a particular denom. DenomMetadata(ctx context.Context, in *QueryDenomMetadataRequest, opts ...grpc.CallOption) (*QueryDenomMetadataResponse, error) // DenomsFromCreator defines a gRPC query method for fetching all // denominations created by a specific admin/creator. @@ -637,7 +659,8 @@ type QueryServer interface { // DenomAuthorityMetadata for a particular denom. DenomAuthorityMetadata(context.Context, *QueryDenomAuthorityMetadataRequest) (*QueryDenomAuthorityMetadataResponse, error) // DenomsMetadata defines a gRPC query method for fetching - // DenomMetadata for a particular denom. + // + // DenomMetadata for a particular denom. DenomMetadata(context.Context, *QueryDenomMetadataRequest) (*QueryDenomMetadataResponse, error) // DenomsFromCreator defines a gRPC query method for fetching all // denominations created by a specific admin/creator. @@ -928,6 +951,18 @@ func (m *QueryDenomsFromCreatorRequest) MarshalToSizedBuffer(dAtA []byte) (int, _ = i var l int _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } if len(m.Creator) > 0 { i -= len(m.Creator) copy(dAtA[i:], m.Creator) @@ -958,6 +993,18 @@ func (m *QueryDenomsFromCreatorResponse) MarshalToSizedBuffer(dAtA []byte) (int, _ = i var l int _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } if len(m.Denoms) > 0 { for iNdEx := len(m.Denoms) - 1; iNdEx >= 0; iNdEx-- { i -= len(m.Denoms[iNdEx]) @@ -1161,6 +1208,10 @@ func (m *QueryDenomsFromCreatorRequest) Size() (n int) { if l > 0 { n += 1 + l + sovQuery(uint64(l)) } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } return n } @@ -1176,6 +1227,10 @@ func (m *QueryDenomsFromCreatorResponse) Size() (n int) { n += 1 + l + sovQuery(uint64(l)) } } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } return n } @@ -1592,6 +1647,42 @@ func (m *QueryDenomsFromCreatorRequest) Unmarshal(dAtA []byte) error { } m.Creator = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", 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.Pagination == nil { + m.Pagination = &query.PageRequest{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) @@ -1674,6 +1765,42 @@ func (m *QueryDenomsFromCreatorResponse) Unmarshal(dAtA []byte) error { } m.Denoms = append(m.Denoms, string(dAtA[iNdEx:postIndex])) iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", 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.Pagination == nil { + m.Pagination = &query.PageResponse{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) diff --git a/x/tokenfactory/types/query.pb.gw.go b/x/tokenfactory/types/query.pb.gw.go index ad96b46ac8..424ea3ee04 100644 --- a/x/tokenfactory/types/query.pb.gw.go +++ b/x/tokenfactory/types/query.pb.gw.go @@ -141,6 +141,10 @@ func local_request_Query_DenomMetadata_0(ctx context.Context, marshaler runtime. } +var ( + filter_Query_DenomsFromCreator_0 = &utilities.DoubleArray{Encoding: map[string]int{"creator": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} +) + func request_Query_DenomsFromCreator_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq QueryDenomsFromCreatorRequest var metadata runtime.ServerMetadata @@ -163,6 +167,13 @@ func request_Query_DenomsFromCreator_0(ctx context.Context, marshaler runtime.Ma return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "creator", err) } + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_DenomsFromCreator_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + msg, err := client.DenomsFromCreator(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err @@ -190,6 +201,13 @@ func local_request_Query_DenomsFromCreator_0(ctx context.Context, marshaler runt return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "creator", err) } + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_DenomsFromCreator_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + msg, err := server.DenomsFromCreator(ctx, &protoReq) return msg, metadata, err