diff --git a/CHANGELOG.md b/CHANGELOG.md index bef52a021cc..fbd1030d480 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -37,7 +37,12 @@ Ref: https://keepachangelog.com/en/1.0.0/ ## [Unreleased] +### Features + +* [\#9533](https://github.com/cosmos/cosmos-sdk/pull/9533) Added a new gRPC method, `DenomOwners`, in `x/bank` to query for all account holders of a specific denomination. + ### API Breaking Changes + * (client/tx) [\#9421](https://github.com/cosmos/cosmos-sdk/pull/9421/) `BuildUnsignedTx`, `BuildSimTx`, `PrintUnsignedStdTx` functions are moved to the Tx Factory as methods. diff --git a/docs/core/proto-docs.md b/docs/core/proto-docs.md index 6b2ddbe1e46..87e6a2e623b 100644 --- a/docs/core/proto-docs.md +++ b/docs/core/proto-docs.md @@ -89,12 +89,15 @@ - [GenesisState](#cosmos.bank.v1beta1.GenesisState) - [cosmos/bank/v1beta1/query.proto](#cosmos/bank/v1beta1/query.proto) + - [DenomOwner](#cosmos.bank.v1beta1.DenomOwner) - [QueryAllBalancesRequest](#cosmos.bank.v1beta1.QueryAllBalancesRequest) - [QueryAllBalancesResponse](#cosmos.bank.v1beta1.QueryAllBalancesResponse) - [QueryBalanceRequest](#cosmos.bank.v1beta1.QueryBalanceRequest) - [QueryBalanceResponse](#cosmos.bank.v1beta1.QueryBalanceResponse) - [QueryDenomMetadataRequest](#cosmos.bank.v1beta1.QueryDenomMetadataRequest) - [QueryDenomMetadataResponse](#cosmos.bank.v1beta1.QueryDenomMetadataResponse) + - [QueryDenomOwnersRequest](#cosmos.bank.v1beta1.QueryDenomOwnersRequest) + - [QueryDenomOwnersResponse](#cosmos.bank.v1beta1.QueryDenomOwnersResponse) - [QueryDenomsMetadataRequest](#cosmos.bank.v1beta1.QueryDenomsMetadataRequest) - [QueryDenomsMetadataResponse](#cosmos.bank.v1beta1.QueryDenomsMetadataResponse) - [QueryParamsRequest](#cosmos.bank.v1beta1.QueryParamsRequest) @@ -1703,6 +1706,19 @@ GenesisState defines the bank module's genesis state. + + +### DenomOwner + +DenomOwner defines structure representing an account that owns or holds a +particular denominated token. It contains the account address and account +balance of the denominated token. + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `address` | [string](#string) | | address defines the address that owns a particular denomination. | +| `balance` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | balance is the balance of the denominated coin for an account. | + ### QueryAllBalancesRequest @@ -1798,6 +1814,40 @@ method. + + +### QueryDenomOwnersRequest +QueryDenomOwnersRequest defines the request type for the DenomOwners RPC query, +which queries for a paginated set of all account holders of a particular +denomination. + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `denom` | [string](#string) | | denom defines the coin denomination to query all account holders for. | +| `pagination` | [cosmos.base.query.v1beta1.PageRequest](#cosmos.base.query.v1beta1.PageRequest) | | pagination defines an optional pagination for the request. | + + + + + + + + +### QueryDenomOwnersResponse +QueryDenomOwnersResponse defines the RPC response of a DenomOwners RPC query. + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `denom_owners` | [DenomOwner](#cosmos.bank.v1beta1.DenomOwner) | repeated | | +| `pagination` | [cosmos.base.query.v1beta1.PageResponse](#cosmos.base.query.v1beta1.PageResponse) | | pagination defines the pagination in the response. | + + + + + + ### QueryDenomsMetadataRequest @@ -1938,6 +1988,7 @@ Query defines the gRPC querier service. | `Params` | [QueryParamsRequest](#cosmos.bank.v1beta1.QueryParamsRequest) | [QueryParamsResponse](#cosmos.bank.v1beta1.QueryParamsResponse) | Params queries the parameters of x/bank module. | GET|/cosmos/bank/v1beta1/params| | `DenomMetadata` | [QueryDenomMetadataRequest](#cosmos.bank.v1beta1.QueryDenomMetadataRequest) | [QueryDenomMetadataResponse](#cosmos.bank.v1beta1.QueryDenomMetadataResponse) | DenomsMetadata queries the client metadata of a given coin denomination. | GET|/cosmos/bank/v1beta1/denoms_metadata/{denom}| | `DenomsMetadata` | [QueryDenomsMetadataRequest](#cosmos.bank.v1beta1.QueryDenomsMetadataRequest) | [QueryDenomsMetadataResponse](#cosmos.bank.v1beta1.QueryDenomsMetadataResponse) | DenomsMetadata queries the client metadata for all registered coin denominations. | GET|/cosmos/bank/v1beta1/denoms_metadata| +| `DenomOwners` | [QueryDenomOwnersRequest](#cosmos.bank.v1beta1.QueryDenomOwnersRequest) | [QueryDenomOwnersResponse](#cosmos.bank.v1beta1.QueryDenomOwnersResponse) | DenomOwners queries for all account addresses that own a particular token denomination. | GET|/cosmos/bank/v1beta1/denom_owners/{denom}| @@ -8259,4 +8310,3 @@ still be used for delegating and for governance votes even while locked. | bool | | bool | boolean | boolean | bool | bool | boolean | TrueClass/FalseClass | | string | A string must always contain UTF-8 encoded or 7-bit ASCII text. | string | String | str/unicode | string | string | string | String (UTF-8) | | bytes | May contain any arbitrary sequence of bytes. | string | ByteString | str | []byte | ByteString | string | String (ASCII-8BIT) | - diff --git a/proto/cosmos/bank/v1beta1/query.proto b/proto/cosmos/bank/v1beta1/query.proto index e3a464f8baa..9ffa9d86fd6 100644 --- a/proto/cosmos/bank/v1beta1/query.proto +++ b/proto/cosmos/bank/v1beta1/query.proto @@ -41,10 +41,17 @@ service Query { option (google.api.http).get = "/cosmos/bank/v1beta1/denoms_metadata/{denom}"; } - // DenomsMetadata queries the client metadata for all registered coin denominations. + // DenomsMetadata queries the client metadata for all registered coin + // denominations. rpc DenomsMetadata(QueryDenomsMetadataRequest) returns (QueryDenomsMetadataResponse) { option (google.api.http).get = "/cosmos/bank/v1beta1/denoms_metadata"; } + + // DenomOwners queries for all account addresses that own a particular token + // denomination. + rpc DenomOwners(QueryDenomOwnersRequest) returns (QueryDenomOwnersResponse) { + option (google.api.http).get = "/cosmos/bank/v1beta1/denom_owners/{denom}"; + } } // QueryBalanceRequest is the request type for the Query/Balance RPC method. @@ -157,3 +164,33 @@ message QueryDenomMetadataResponse { // metadata describes and provides all the client information for the requested token. Metadata metadata = 1 [(gogoproto.nullable) = false]; } + +// QueryDenomOwnersRequest defines the request type for the DenomOwners RPC query, +// which queries for a paginated set of all account holders of a particular +// denomination. +message QueryDenomOwnersRequest { + // denom defines the coin denomination to query all account holders for. + string denom = 1; + + // pagination defines an optional pagination for the request. + cosmos.base.query.v1beta1.PageRequest pagination = 2; +} + +// DenomOwner defines structure representing an account that owns or holds a +// particular denominated token. It contains the account address and account +// balance of the denominated token. +message DenomOwner { + // address defines the address that owns a particular denomination. + string address = 1; + + // balance is the balance of the denominated coin for an account. + cosmos.base.v1beta1.Coin balance = 2 [(gogoproto.nullable) = false]; +} + +// QueryDenomOwnersResponse defines the RPC response of a DenomOwners RPC query. +message QueryDenomOwnersResponse { + repeated DenomOwner denom_owners = 1; + + // pagination defines the pagination in the response. + cosmos.base.query.v1beta1.PageResponse pagination = 2; +} diff --git a/x/bank/keeper/grpc_query.go b/x/bank/keeper/grpc_query.go index 02655aa2f59..53c192954f6 100644 --- a/x/bank/keeper/grpc_query.go +++ b/x/bank/keeper/grpc_query.go @@ -164,3 +164,61 @@ func (k BaseKeeper) DenomMetadata(c context.Context, req *types.QueryDenomMetada Metadata: metadata, }, nil } + +func (k BaseKeeper) DenomOwners( + goCtx context.Context, + req *types.QueryDenomOwnersRequest, +) (*types.QueryDenomOwnersResponse, error) { + + if req == nil { + return nil, status.Errorf(codes.InvalidArgument, "empty request") + } + + if req.Denom == "" { + return nil, status.Error(codes.InvalidArgument, "empty denom") + } + + ctx := sdk.UnwrapSDKContext(goCtx) + + store := ctx.KVStore(k.storeKey) + balancesStore := prefix.NewStore(store, types.BalancesPrefix) + + var denomOwners []*types.DenomOwner + pageRes, err := query.FilteredPaginate( + balancesStore, + req.Pagination, + func(key []byte, value []byte, accumulate bool) (bool, error) { + var balance sdk.Coin + if err := k.cdc.Unmarshal(value, &balance); err != nil { + return false, err + } + + if req.Denom != balance.Denom { + return false, nil + } + + if accumulate { + address, err := types.AddressFromBalancesStore(key) + if err != nil { + return false, err + } + + denomOwners = append( + denomOwners, + &types.DenomOwner{ + Address: address.String(), + Balance: balance, + }, + ) + } + + return true, nil + }, + ) + + if err != nil { + return nil, status.Error(codes.Internal, err.Error()) + } + + return &types.QueryDenomOwnersResponse{DenomOwners: denomOwners, Pagination: pageRes}, nil +} diff --git a/x/bank/keeper/grpc_query_test.go b/x/bank/keeper/grpc_query_test.go index 181506a6d7f..4593d8585b4 100644 --- a/x/bank/keeper/grpc_query_test.go +++ b/x/bank/keeper/grpc_query_test.go @@ -5,13 +5,12 @@ import ( "fmt" "github.com/cosmos/cosmos-sdk/simapp" - - minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" - "github.com/cosmos/cosmos-sdk/testutil/testdata" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/query" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" "github.com/cosmos/cosmos-sdk/x/bank/types" + minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" ) func (suite *IntegrationTestSuite) TestQueryBalance() { @@ -305,3 +304,92 @@ func (suite *IntegrationTestSuite) QueryDenomMetadataRequest() { }) } } + +func (suite *IntegrationTestSuite) TestGRPCDenomOwners() { + ctx := suite.ctx + + authKeeper, keeper := suite.initKeepersWithmAccPerms(make(map[string]bool)) + suite.Require().NoError(keeper.MintCoins(ctx, minttypes.ModuleName, initCoins)) + + for i := 0; i < 10; i++ { + acc := authKeeper.NewAccountWithAddress(ctx, authtypes.NewModuleAddress(fmt.Sprintf("account-%d", i))) + authKeeper.SetAccount(ctx, acc) + + bal := sdk.NewCoins(sdk.NewCoin( + sdk.DefaultBondDenom, + sdk.TokensFromConsensusPower(initialPower/10, sdk.DefaultPowerReduction), + )) + suite.Require().NoError(keeper.SendCoinsFromModuleToAccount(ctx, minttypes.ModuleName, acc.GetAddress(), bal)) + } + + testCases := map[string]struct { + req *types.QueryDenomOwnersRequest + expPass bool + numAddrs int + hasNext bool + total uint64 + }{ + "empty request": { + req: &types.QueryDenomOwnersRequest{}, + expPass: false, + }, + "invalid denom": { + req: &types.QueryDenomOwnersRequest{ + Denom: "foo", + }, + expPass: true, + numAddrs: 0, + hasNext: false, + total: 0, + }, + "valid request - page 1": { + req: &types.QueryDenomOwnersRequest{ + Denom: sdk.DefaultBondDenom, + Pagination: &query.PageRequest{ + Limit: 6, + CountTotal: true, + }, + }, + expPass: true, + numAddrs: 6, + hasNext: true, + total: 10, + }, + "valid request - page 2": { + req: &types.QueryDenomOwnersRequest{ + Denom: sdk.DefaultBondDenom, + Pagination: &query.PageRequest{ + Offset: 6, + Limit: 10, + CountTotal: true, + }, + }, + expPass: true, + numAddrs: 4, + hasNext: false, + total: 10, + }, + } + + for name, tc := range testCases { + suite.Run(name, func() { + resp, err := suite.queryClient.DenomOwners(gocontext.Background(), tc.req) + if tc.expPass { + suite.NoError(err) + suite.NotNil(resp) + suite.Len(resp.DenomOwners, tc.numAddrs) + suite.Equal(tc.total, resp.Pagination.Total) + + if tc.hasNext { + suite.NotNil(resp.Pagination.NextKey) + } else { + suite.Nil(resp.Pagination.NextKey) + } + } else { + suite.Require().Error(err) + } + }) + } + + suite.Require().True(true) +} diff --git a/x/bank/types/query.pb.go b/x/bank/types/query.pb.go index 5ad95812ba8..3b4fd465475 100644 --- a/x/bank/types/query.pb.go +++ b/x/bank/types/query.pb.go @@ -681,6 +681,174 @@ func (m *QueryDenomMetadataResponse) GetMetadata() Metadata { return Metadata{} } +// QueryDenomOwnersRequest defines the request type for the DenomOwners RPC query, +// which queries for a paginated set of all account holders of a particular +// denomination. +type QueryDenomOwnersRequest struct { + // denom defines the coin denomination to query all account holders for. + Denom string `protobuf:"bytes,1,opt,name=denom,proto3" json:"denom,omitempty"` + // pagination defines an optional pagination for the request. + Pagination *query.PageRequest `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryDenomOwnersRequest) Reset() { *m = QueryDenomOwnersRequest{} } +func (m *QueryDenomOwnersRequest) String() string { return proto.CompactTextString(m) } +func (*QueryDenomOwnersRequest) ProtoMessage() {} +func (*QueryDenomOwnersRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_9c6fc1939682df13, []int{14} +} +func (m *QueryDenomOwnersRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryDenomOwnersRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryDenomOwnersRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryDenomOwnersRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryDenomOwnersRequest.Merge(m, src) +} +func (m *QueryDenomOwnersRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryDenomOwnersRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryDenomOwnersRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryDenomOwnersRequest proto.InternalMessageInfo + +func (m *QueryDenomOwnersRequest) GetDenom() string { + if m != nil { + return m.Denom + } + return "" +} + +func (m *QueryDenomOwnersRequest) GetPagination() *query.PageRequest { + if m != nil { + return m.Pagination + } + return nil +} + +// DenomOwner defines structure representing an account that owns or holds a +// particular denominated token. It contains the account address and account +// balance of the denominated token. +type DenomOwner struct { + // address defines the address that owns a particular denomination. + Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` + // balance is the balance of the denominated coin for an account. + Balance types.Coin `protobuf:"bytes,2,opt,name=balance,proto3" json:"balance"` +} + +func (m *DenomOwner) Reset() { *m = DenomOwner{} } +func (m *DenomOwner) String() string { return proto.CompactTextString(m) } +func (*DenomOwner) ProtoMessage() {} +func (*DenomOwner) Descriptor() ([]byte, []int) { + return fileDescriptor_9c6fc1939682df13, []int{15} +} +func (m *DenomOwner) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *DenomOwner) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_DenomOwner.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *DenomOwner) XXX_Merge(src proto.Message) { + xxx_messageInfo_DenomOwner.Merge(m, src) +} +func (m *DenomOwner) XXX_Size() int { + return m.Size() +} +func (m *DenomOwner) XXX_DiscardUnknown() { + xxx_messageInfo_DenomOwner.DiscardUnknown(m) +} + +var xxx_messageInfo_DenomOwner proto.InternalMessageInfo + +func (m *DenomOwner) GetAddress() string { + if m != nil { + return m.Address + } + return "" +} + +func (m *DenomOwner) GetBalance() types.Coin { + if m != nil { + return m.Balance + } + return types.Coin{} +} + +// QueryDenomOwnersResponse defines the RPC response of a DenomOwners RPC query. +type QueryDenomOwnersResponse struct { + DenomOwners []*DenomOwner `protobuf:"bytes,1,rep,name=denom_owners,json=denomOwners,proto3" json:"denom_owners,omitempty"` + // pagination defines the pagination in the response. + Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryDenomOwnersResponse) Reset() { *m = QueryDenomOwnersResponse{} } +func (m *QueryDenomOwnersResponse) String() string { return proto.CompactTextString(m) } +func (*QueryDenomOwnersResponse) ProtoMessage() {} +func (*QueryDenomOwnersResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_9c6fc1939682df13, []int{16} +} +func (m *QueryDenomOwnersResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryDenomOwnersResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryDenomOwnersResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryDenomOwnersResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryDenomOwnersResponse.Merge(m, src) +} +func (m *QueryDenomOwnersResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryDenomOwnersResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryDenomOwnersResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryDenomOwnersResponse proto.InternalMessageInfo + +func (m *QueryDenomOwnersResponse) GetDenomOwners() []*DenomOwner { + if m != nil { + return m.DenomOwners + } + return nil +} + +func (m *QueryDenomOwnersResponse) GetPagination() *query.PageResponse { + if m != nil { + return m.Pagination + } + return nil +} + func init() { proto.RegisterType((*QueryBalanceRequest)(nil), "cosmos.bank.v1beta1.QueryBalanceRequest") proto.RegisterType((*QueryBalanceResponse)(nil), "cosmos.bank.v1beta1.QueryBalanceResponse") @@ -696,64 +864,73 @@ func init() { proto.RegisterType((*QueryDenomsMetadataResponse)(nil), "cosmos.bank.v1beta1.QueryDenomsMetadataResponse") proto.RegisterType((*QueryDenomMetadataRequest)(nil), "cosmos.bank.v1beta1.QueryDenomMetadataRequest") proto.RegisterType((*QueryDenomMetadataResponse)(nil), "cosmos.bank.v1beta1.QueryDenomMetadataResponse") + proto.RegisterType((*QueryDenomOwnersRequest)(nil), "cosmos.bank.v1beta1.QueryDenomOwnersRequest") + proto.RegisterType((*DenomOwner)(nil), "cosmos.bank.v1beta1.DenomOwner") + proto.RegisterType((*QueryDenomOwnersResponse)(nil), "cosmos.bank.v1beta1.QueryDenomOwnersResponse") } func init() { proto.RegisterFile("cosmos/bank/v1beta1/query.proto", fileDescriptor_9c6fc1939682df13) } var fileDescriptor_9c6fc1939682df13 = []byte{ - // 825 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x56, 0x4d, 0x6f, 0xd3, 0x58, - 0x14, 0xcd, 0xeb, 0x4c, 0xd3, 0xf4, 0x46, 0x33, 0x8b, 0xd7, 0x8c, 0x26, 0x75, 0xa7, 0xc9, 0xc8, - 0x9d, 0x69, 0xd3, 0x92, 0xda, 0x4d, 0x8b, 0x54, 0xc1, 0x06, 0x35, 0x45, 0x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dc, 0x3c, 0x3c, 0xce, 0xa0, 0xa3, 0xe3, 0x0c, 0xfa, 0x76, 0x9c, 0x41, - 0x2f, 0x4e, 0x32, 0xb1, 0xa3, 0x93, 0x4c, 0xec, 0xf3, 0x49, 0x26, 0x76, 0x7b, 0x71, 0xe0, 0x57, - 0xf5, 0xa1, 0x68, 0xcb, 0x3f, 0xae, 0x95, 0x38, 0xff, 0xe7, 0xb8, 0xf6, 0x33, 0x00, 0x00, 0xff, - 0xff, 0xa0, 0xfe, 0xe2, 0x92, 0x11, 0x0b, 0x00, 0x00, + // 917 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x57, 0x4f, 0x4f, 0x3b, 0x45, + 0x18, 0xee, 0xa0, 0x94, 0xf2, 0x56, 0x3d, 0x0c, 0x35, 0x96, 0x45, 0x5a, 0xb3, 0x28, 0xb4, 0x50, + 0x76, 0x29, 0x98, 0x10, 0xbc, 0x18, 0x8a, 0xd1, 0x83, 0x31, 0xd4, 0xea, 0xc9, 0xc4, 0x90, 0x69, + 0xbb, 0xae, 0x0d, 0xed, 0xce, 0xd2, 0xd9, 0x8a, 0x84, 0x90, 0x18, 0x13, 0x13, 0x4f, 0x6a, 0xe2, + 0xc1, 0x83, 0x31, 0xc1, 0x8b, 0x46, 0x3f, 0x09, 0x07, 0x0f, 0x44, 0x2f, 0x9e, 0xd4, 0x80, 0x07, + 0x3f, 0x86, 0xe9, 0xfc, 0xd9, 0xee, 0xb6, 0xdb, 0xed, 0x1e, 0xfa, 0x3b, 0xd1, 0x9d, 0x7d, 0xff, + 0x3c, 0xcf, 0x33, 0x33, 0xef, 0xb3, 0x40, 0xb1, 0x45, 0x59, 0x8f, 0x32, 0xb3, 0x49, 0x9c, 0x73, + 0xf3, 0x93, 0x6a, 0xd3, 0xf2, 0x48, 0xd5, 0xbc, 0x18, 0x58, 0xfd, 0x2b, 0xc3, 0xed, 0x53, 0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, 0xcb, 0xd3, 0xa1, 0xc9, 0x49, 0xaa, 0x34, 0xac, 0x9d, + 0xdc, 0x3d, 0x14, 0xd0, 0xfd, 0x43, 0x01, 0xfd, 0xf3, 0x50, 0x40, 0xdf, 0x3c, 0x16, 0x52, 0xf7, + 0x8f, 0x85, 0xd4, 0x9f, 0x8f, 0x85, 0xd4, 0x07, 0xe5, 0xd8, 0x6f, 0xaf, 0x4f, 0x45, 0x6d, 0xfe, + 0x09, 0xd6, 0x4c, 0xf3, 0xff, 0x2f, 0x0e, 0xfe, 0x0f, 0x00, 0x00, 0xff, 0xff, 0x75, 0x2d, 0x5e, + 0xd9, 0x37, 0x0d, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -780,8 +957,12 @@ type QueryClient interface { Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) // DenomsMetadata queries the client metadata of a given coin denomination. DenomMetadata(ctx context.Context, in *QueryDenomMetadataRequest, opts ...grpc.CallOption) (*QueryDenomMetadataResponse, error) - // DenomsMetadata queries the client metadata for all registered coin denominations. + // DenomsMetadata queries the client metadata for all registered coin + // denominations. DenomsMetadata(ctx context.Context, in *QueryDenomsMetadataRequest, opts ...grpc.CallOption) (*QueryDenomsMetadataResponse, error) + // DenomOwners queries for all account addresses that own a particular token + // denomination. + DenomOwners(ctx context.Context, in *QueryDenomOwnersRequest, opts ...grpc.CallOption) (*QueryDenomOwnersResponse, error) } type queryClient struct { @@ -855,6 +1036,15 @@ func (c *queryClient) DenomsMetadata(ctx context.Context, in *QueryDenomsMetadat return out, nil } +func (c *queryClient) DenomOwners(ctx context.Context, in *QueryDenomOwnersRequest, opts ...grpc.CallOption) (*QueryDenomOwnersResponse, error) { + out := new(QueryDenomOwnersResponse) + err := c.cc.Invoke(ctx, "/cosmos.bank.v1beta1.Query/DenomOwners", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // QueryServer is the server API for Query service. type QueryServer interface { // Balance queries the balance of a single coin for a single account. @@ -869,8 +1059,12 @@ type QueryServer interface { Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) // DenomsMetadata queries the client metadata of a given coin denomination. DenomMetadata(context.Context, *QueryDenomMetadataRequest) (*QueryDenomMetadataResponse, error) - // DenomsMetadata queries the client metadata for all registered coin denominations. + // DenomsMetadata queries the client metadata for all registered coin + // denominations. DenomsMetadata(context.Context, *QueryDenomsMetadataRequest) (*QueryDenomsMetadataResponse, error) + // DenomOwners queries for all account addresses that own a particular token + // denomination. + DenomOwners(context.Context, *QueryDenomOwnersRequest) (*QueryDenomOwnersResponse, error) } // UnimplementedQueryServer can be embedded to have forward compatible implementations. @@ -898,6 +1092,9 @@ func (*UnimplementedQueryServer) DenomMetadata(ctx context.Context, req *QueryDe func (*UnimplementedQueryServer) DenomsMetadata(ctx context.Context, req *QueryDenomsMetadataRequest) (*QueryDenomsMetadataResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method DenomsMetadata not implemented") } +func (*UnimplementedQueryServer) DenomOwners(ctx context.Context, req *QueryDenomOwnersRequest) (*QueryDenomOwnersResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method DenomOwners not implemented") +} func RegisterQueryServer(s grpc1.Server, srv QueryServer) { s.RegisterService(&_Query_serviceDesc, srv) @@ -1029,6 +1226,24 @@ func _Query_DenomsMetadata_Handler(srv interface{}, ctx context.Context, dec fun return interceptor(ctx, in, info, handler) } +func _Query_DenomOwners_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryDenomOwnersRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).DenomOwners(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cosmos.bank.v1beta1.Query/DenomOwners", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).DenomOwners(ctx, req.(*QueryDenomOwnersRequest)) + } + return interceptor(ctx, in, info, handler) +} + var _Query_serviceDesc = grpc.ServiceDesc{ ServiceName: "cosmos.bank.v1beta1.Query", HandlerType: (*QueryServer)(nil), @@ -1061,6 +1276,10 @@ var _Query_serviceDesc = grpc.ServiceDesc{ MethodName: "DenomsMetadata", Handler: _Query_DenomsMetadata_Handler, }, + { + MethodName: "DenomOwners", + Handler: _Query_DenomOwners_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "cosmos/bank/v1beta1/query.proto", @@ -1579,6 +1798,137 @@ func (m *QueryDenomMetadataResponse) MarshalToSizedBuffer(dAtA []byte) (int, err return len(dAtA) - i, nil } +func (m *QueryDenomOwnersRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryDenomOwnersRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryDenomOwnersRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = 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.Denom) > 0 { + i -= len(m.Denom) + copy(dAtA[i:], m.Denom) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Denom))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *DenomOwner) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *DenomOwner) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *DenomOwner) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Balance.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + if len(m.Address) > 0 { + i -= len(m.Address) + copy(dAtA[i:], m.Address) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Address))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryDenomOwnersResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryDenomOwnersResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryDenomOwnersResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = 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.DenomOwners) > 0 { + for iNdEx := len(m.DenomOwners) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.DenomOwners[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { offset -= sovQuery(v) base := offset @@ -1788,20 +2138,71 @@ func (m *QueryDenomMetadataResponse) Size() (n int) { return n } -func sovQuery(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozQuery(x uint64) (n int) { - return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *QueryBalanceRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { +func (m *QueryDenomOwnersRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Denom) + 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 +} + +func (m *DenomOwner) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Address) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + l = m.Balance.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func (m *QueryDenomOwnersResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.DenomOwners) > 0 { + for _, e := range m.DenomOwners { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func sovQuery(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozQuery(x uint64) (n int) { + return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *QueryBalanceRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { return ErrIntOverflowQuery } if iNdEx >= l { @@ -3107,6 +3508,359 @@ func (m *QueryDenomMetadataResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *QueryDenomOwnersRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryDenomOwnersRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryDenomOwnersRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Denom", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Denom = 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:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *DenomOwner) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: DenomOwner: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DenomOwner: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Address = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Balance", 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 err := m.Balance.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryDenomOwnersResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryDenomOwnersResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryDenomOwnersResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DenomOwners", 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 + } + m.DenomOwners = append(m.DenomOwners, &DenomOwner{}) + if err := m.DenomOwners[len(m.DenomOwners)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + 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:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipQuery(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/bank/types/query.pb.gw.go b/x/bank/types/query.pb.gw.go index 8b8ed9a5260..60ebdb97566 100644 --- a/x/bank/types/query.pb.gw.go +++ b/x/bank/types/query.pb.gw.go @@ -377,6 +377,78 @@ func local_request_Query_DenomsMetadata_0(ctx context.Context, marshaler runtime } +var ( + filter_Query_DenomOwners_0 = &utilities.DoubleArray{Encoding: map[string]int{"denom": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} +) + +func request_Query_DenomOwners_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryDenomOwnersRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["denom"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "denom") + } + + protoReq.Denom, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "denom", 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_DenomOwners_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.DenomOwners(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_DenomOwners_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryDenomOwnersRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["denom"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "denom") + } + + protoReq.Denom, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "denom", 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_DenomOwners_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.DenomOwners(ctx, &protoReq) + return msg, metadata, err + +} + // RegisterQueryHandlerServer registers the http handlers for service Query to "mux". // UnaryRPC :call QueryServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. @@ -523,6 +595,26 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv }) + mux.Handle("GET", pattern_Query_DenomOwners_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.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_DenomOwners_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_DenomOwners_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -704,6 +796,26 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie }) + mux.Handle("GET", pattern_Query_DenomOwners_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_DenomOwners_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_DenomOwners_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -721,6 +833,8 @@ var ( pattern_Query_DenomMetadata_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"cosmos", "bank", "v1beta1", "denoms_metadata", "denom"}, "", runtime.AssumeColonVerbOpt(false))) pattern_Query_DenomsMetadata_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"cosmos", "bank", "v1beta1", "denoms_metadata"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_DenomOwners_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"cosmos", "bank", "v1beta1", "denom_owners", "denom"}, "", runtime.AssumeColonVerbOpt(false))) ) var ( @@ -737,4 +851,6 @@ var ( forward_Query_DenomMetadata_0 = runtime.ForwardResponseMessage forward_Query_DenomsMetadata_0 = runtime.ForwardResponseMessage + + forward_Query_DenomOwners_0 = runtime.ForwardResponseMessage )