From 2f29bc871ea30f25f9341b982378c3e13bf9923e Mon Sep 17 00:00:00 2001 From: Sai Kumar Date: Wed, 24 Apr 2024 18:46:22 +0530 Subject: [PATCH] added token-balances api and cli query --- app/app.go | 2 +- proto/umee/ugov/v1/query.proto | 37 ++ x/ugov/client/cli/query.go | 31 ++ x/ugov/keeper/keeper.go | 23 +- x/ugov/keeper/query_server.go | 28 ++ x/ugov/query.pb.go | 851 +++++++++++++++++++++++++++++++-- x/ugov/query.pb.gw.go | 83 ++++ 7 files changed, 993 insertions(+), 62 deletions(-) diff --git a/app/app.go b/app/app.go index a831cb20a2..ea2643617a 100644 --- a/app/app.go +++ b/app/app.go @@ -465,7 +465,7 @@ func New( app.NFTKeeper = nftkeeper.NewKeeper(keys[nftkeeper.StoreKey], appCodec, app.AccountKeeper, app.BankKeeper) - app.UGovKeeperB = ugovkeeper.NewBuilder(appCodec, keys[ugov.ModuleName]) + app.UGovKeeperB = ugovkeeper.NewBuilder(appCodec, keys[ugov.ModuleName], app.BankKeeper) app.OracleKeeper = oraclekeeper.NewKeeper( appCodec, diff --git a/proto/umee/ugov/v1/query.proto b/proto/umee/ugov/v1/query.proto index 6470524160..4a2747688a 100644 --- a/proto/umee/ugov/v1/query.proto +++ b/proto/umee/ugov/v1/query.proto @@ -6,6 +6,8 @@ import "cosmos_proto/cosmos.proto"; import "gogoproto/gogo.proto"; import "google/api/annotations.proto"; import "google/protobuf/timestamp.proto"; +import "cosmos/base/query/v1beta1/pagination.proto"; +import "amino/amino.proto"; import "umee/ugov/v1/ugov.proto"; @@ -34,6 +36,41 @@ service Query { rpc InflationCycleEnd(QueryInflationCycleEnd) returns (QueryInflationCycleEndResponse) { option (google.api.http).get = "/umee/ugov/v1/inflation_cycle_end"; } + + // Token Balances queries for all account addresses that own a particular token + // denomination. + rpc TokenBalances(QueryTokenBalances) returns (QueryTokenBalancesResponse){ + option (google.api.http).get = "/umee/ugov/v1/token_balances"; + } +} + +// which queries for a paginated set of all account holders of a particular +// denomination. +message QueryTokenBalances{ + // denom defines the coin denomination to query all account holders for. + string denom = 1; + int64 height = 2; + // pagination defines an optional pagination for the request. + cosmos.base.query.v1beta1.PageRequest pagination = 3; +} + +// QueryDenomOwnersResponse defines the RPC response of a TokenBalances RPC query. +message QueryTokenBalancesResponse { + repeated DenomOwner denom_owners = 1; + // pagination defines the pagination in the response. + cosmos.base.query.v1beta1.PageResponse 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 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + + // balance is the balance of the denominated coin for an account. + cosmos.base.v1beta1.Coin balance = 2 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; } // QueryMinGasPrice is a request type. diff --git a/x/ugov/client/cli/query.go b/x/ugov/client/cli/query.go index 43dec209b6..37c4e865c3 100644 --- a/x/ugov/client/cli/query.go +++ b/x/ugov/client/cli/query.go @@ -25,6 +25,7 @@ func GetQueryCmd() *cobra.Command { QueryInflationParams(), QueryInflationCyleEnd(), QueryEmergencyGroup(), + QueryTokenBalances(), ) return cmd @@ -121,3 +122,33 @@ func QueryInflationCyleEnd() *cobra.Command { return cmd } + +// QueryTokenBalances creates the Query/TokenBalances CLI. +func QueryTokenBalances() *cobra.Command { + cmd := &cobra.Command{ + Use: "token-balances [denom]", + Args: cobra.ExactArgs(1), + Short: "Queries for all account addresses that own a particular token denomination.", + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + pageReq, err := client.ReadPageRequest(cmd.Flags()) + if err != nil { + return err + } + queryClient := ugov.NewQueryClient(clientCtx) + resp, err := queryClient.TokenBalances(cmd.Context(), &ugov.QueryTokenBalances{ + Denom: args[0], + Pagination: pageReq, + }) + return cli.PrintOrErr(resp, err, clientCtx) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + flags.AddPaginationFlagsToCmd(cmd, "token-balances") + + return cmd +} diff --git a/x/ugov/keeper/keeper.go b/x/ugov/keeper/keeper.go index af69ab95dd..8ff100fe50 100644 --- a/x/ugov/keeper/keeper.go +++ b/x/ugov/keeper/keeper.go @@ -4,6 +4,7 @@ import ( "github.com/cosmos/cosmos-sdk/codec" storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/x/bank/keeper" "github.com/umee-network/umee/v6/x/ugov" ) @@ -11,23 +12,26 @@ var _ ugov.Keeper = Keeper{} // Builder constructs Keeper by perparing all related dependencies (notably the store). type Builder struct { - storeKey storetypes.StoreKey - Cdc codec.BinaryCodec + storeKey storetypes.StoreKey + Cdc codec.BinaryCodec + BankKeeper keeper.BaseKeeper } func NewBuilder( - cdc codec.BinaryCodec, key storetypes.StoreKey, + cdc codec.BinaryCodec, key storetypes.StoreKey, bk keeper.BaseKeeper, ) Builder { return Builder{ - Cdc: cdc, - storeKey: key, + Cdc: cdc, + storeKey: key, + BankKeeper: bk, } } func (kb Builder) Keeper(ctx *sdk.Context) ugov.Keeper { return Keeper{ - store: ctx.KVStore(kb.storeKey), - cdc: kb.Cdc, + store: ctx.KVStore(kb.storeKey), + cdc: kb.Cdc, + BankKeeper: kb.BankKeeper, } } @@ -38,6 +42,7 @@ func (kb Builder) EmergencyGroup(ctx *sdk.Context) ugov.WithEmergencyGroup { ret // Keeper provides a light interface for module data access and transformation type Keeper struct { - store sdk.KVStore - cdc codec.BinaryCodec + store sdk.KVStore + cdc codec.BinaryCodec + BankKeeper keeper.BaseKeeper } diff --git a/x/ugov/keeper/query_server.go b/x/ugov/keeper/query_server.go index 1f66927bff..844f91b9a7 100644 --- a/x/ugov/keeper/query_server.go +++ b/x/ugov/keeper/query_server.go @@ -4,6 +4,8 @@ import ( context "context" sdk "github.com/cosmos/cosmos-sdk/types" + banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" + "github.com/umee-network/umee/v6/x/ugov" ) @@ -49,3 +51,29 @@ func (q Querier) InflationCycleEnd(ctx context.Context, _ *ugov.QueryInflationCy cycleEndTime := q.Keeper(&sdkCtx).InflationCycleEnd() return &ugov.QueryInflationCycleEndResponse{End: &cycleEndTime}, nil } + +// TokenBalances implements ugov.QueryServer. +func (q Querier) TokenBalances(ctx context.Context, req *ugov.QueryTokenBalances) (*ugov.QueryTokenBalancesResponse, + error) { + sdkCtx := sdk.UnwrapSDKContext(ctx) + if req.Height != 0 { + sdkCtx = sdkCtx.WithBlockHeight(req.Height) + } + resp, err := q.BankKeeper.DenomOwners(sdk.WrapSDKContext(sdkCtx), &banktypes.QueryDenomOwnersRequest{ + Denom: req.Denom, + Pagination: req.Pagination, + }) + if err != nil { + return nil, err + } + + denomsOwners := make([]*ugov.DenomOwner, 0) + for _, v := range resp.DenomOwners { + denomsOwners = append(denomsOwners, &ugov.DenomOwner{ + Address: v.Address, + Balance: v.Balance, + }) + } + + return &ugov.QueryTokenBalancesResponse{Pagination: resp.Pagination, DenomOwners: denomsOwners}, nil +} diff --git a/x/ugov/query.pb.go b/x/ugov/query.pb.go index df7406236a..f250a343f5 100644 --- a/x/ugov/query.pb.go +++ b/x/ugov/query.pb.go @@ -8,6 +8,8 @@ import ( fmt "fmt" _ "github.com/cosmos/cosmos-proto" types "github.com/cosmos/cosmos-sdk/types" + query "github.com/cosmos/cosmos-sdk/types/query" + _ "github.com/cosmos/cosmos-sdk/types/tx/amino" _ "github.com/cosmos/gogoproto/gogoproto" grpc1 "github.com/cosmos/gogoproto/grpc" proto "github.com/cosmos/gogoproto/proto" @@ -35,6 +37,132 @@ var _ = time.Kitchen // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package +// which queries for a paginated set of all account holders of a particular +// denomination. +type QueryTokenBalances struct { + // denom defines the coin denomination to query all account holders for. + Denom string `protobuf:"bytes,1,opt,name=denom,proto3" json:"denom,omitempty"` + Height int64 `protobuf:"varint,2,opt,name=height,proto3" json:"height,omitempty"` + // pagination defines an optional pagination for the request. + Pagination *query.PageRequest `protobuf:"bytes,3,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryTokenBalances) Reset() { *m = QueryTokenBalances{} } +func (m *QueryTokenBalances) String() string { return proto.CompactTextString(m) } +func (*QueryTokenBalances) ProtoMessage() {} +func (*QueryTokenBalances) Descriptor() ([]byte, []int) { + return fileDescriptor_25fa04679024a47d, []int{0} +} +func (m *QueryTokenBalances) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryTokenBalances) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryTokenBalances.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 *QueryTokenBalances) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryTokenBalances.Merge(m, src) +} +func (m *QueryTokenBalances) XXX_Size() int { + return m.Size() +} +func (m *QueryTokenBalances) XXX_DiscardUnknown() { + xxx_messageInfo_QueryTokenBalances.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryTokenBalances proto.InternalMessageInfo + +// QueryDenomOwnersResponse defines the RPC response of a TokenBalances RPC query. +type QueryTokenBalancesResponse 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 *QueryTokenBalancesResponse) Reset() { *m = QueryTokenBalancesResponse{} } +func (m *QueryTokenBalancesResponse) String() string { return proto.CompactTextString(m) } +func (*QueryTokenBalancesResponse) ProtoMessage() {} +func (*QueryTokenBalancesResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_25fa04679024a47d, []int{1} +} +func (m *QueryTokenBalancesResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryTokenBalancesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryTokenBalancesResponse.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 *QueryTokenBalancesResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryTokenBalancesResponse.Merge(m, src) +} +func (m *QueryTokenBalancesResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryTokenBalancesResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryTokenBalancesResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryTokenBalancesResponse proto.InternalMessageInfo + +// 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_25fa04679024a47d, []int{2} +} +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 + // QueryMinGasPrice is a request type. type QueryMinGasPrice struct { } @@ -43,7 +171,7 @@ func (m *QueryMinGasPrice) Reset() { *m = QueryMinGasPrice{} } func (m *QueryMinGasPrice) String() string { return proto.CompactTextString(m) } func (*QueryMinGasPrice) ProtoMessage() {} func (*QueryMinGasPrice) Descriptor() ([]byte, []int) { - return fileDescriptor_25fa04679024a47d, []int{0} + return fileDescriptor_25fa04679024a47d, []int{3} } func (m *QueryMinGasPrice) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -81,7 +209,7 @@ func (m *QueryMinGasPriceResponse) Reset() { *m = QueryMinGasPriceRespon func (m *QueryMinGasPriceResponse) String() string { return proto.CompactTextString(m) } func (*QueryMinGasPriceResponse) ProtoMessage() {} func (*QueryMinGasPriceResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_25fa04679024a47d, []int{1} + return fileDescriptor_25fa04679024a47d, []int{4} } func (m *QueryMinGasPriceResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -118,7 +246,7 @@ func (m *QueryEmergencyGroup) Reset() { *m = QueryEmergencyGroup{} } func (m *QueryEmergencyGroup) String() string { return proto.CompactTextString(m) } func (*QueryEmergencyGroup) ProtoMessage() {} func (*QueryEmergencyGroup) Descriptor() ([]byte, []int) { - return fileDescriptor_25fa04679024a47d, []int{2} + return fileDescriptor_25fa04679024a47d, []int{5} } func (m *QueryEmergencyGroup) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -156,7 +284,7 @@ func (m *QueryEmergencyGroupResponse) Reset() { *m = QueryEmergencyGroup func (m *QueryEmergencyGroupResponse) String() string { return proto.CompactTextString(m) } func (*QueryEmergencyGroupResponse) ProtoMessage() {} func (*QueryEmergencyGroupResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_25fa04679024a47d, []int{3} + return fileDescriptor_25fa04679024a47d, []int{6} } func (m *QueryEmergencyGroupResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -193,7 +321,7 @@ func (m *QueryInflationParams) Reset() { *m = QueryInflationParams{} } func (m *QueryInflationParams) String() string { return proto.CompactTextString(m) } func (*QueryInflationParams) ProtoMessage() {} func (*QueryInflationParams) Descriptor() ([]byte, []int) { - return fileDescriptor_25fa04679024a47d, []int{4} + return fileDescriptor_25fa04679024a47d, []int{7} } func (m *QueryInflationParams) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -231,7 +359,7 @@ func (m *QueryInflationParamsResponse) Reset() { *m = QueryInflationPara func (m *QueryInflationParamsResponse) String() string { return proto.CompactTextString(m) } func (*QueryInflationParamsResponse) ProtoMessage() {} func (*QueryInflationParamsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_25fa04679024a47d, []int{5} + return fileDescriptor_25fa04679024a47d, []int{8} } func (m *QueryInflationParamsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -268,7 +396,7 @@ func (m *QueryInflationCycleEnd) Reset() { *m = QueryInflationCycleEnd{} func (m *QueryInflationCycleEnd) String() string { return proto.CompactTextString(m) } func (*QueryInflationCycleEnd) ProtoMessage() {} func (*QueryInflationCycleEnd) Descriptor() ([]byte, []int) { - return fileDescriptor_25fa04679024a47d, []int{6} + return fileDescriptor_25fa04679024a47d, []int{9} } func (m *QueryInflationCycleEnd) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -306,7 +434,7 @@ func (m *QueryInflationCycleEndResponse) Reset() { *m = QueryInflationCy func (m *QueryInflationCycleEndResponse) String() string { return proto.CompactTextString(m) } func (*QueryInflationCycleEndResponse) ProtoMessage() {} func (*QueryInflationCycleEndResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_25fa04679024a47d, []int{7} + return fileDescriptor_25fa04679024a47d, []int{10} } func (m *QueryInflationCycleEndResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -336,6 +464,9 @@ func (m *QueryInflationCycleEndResponse) XXX_DiscardUnknown() { var xxx_messageInfo_QueryInflationCycleEndResponse proto.InternalMessageInfo func init() { + proto.RegisterType((*QueryTokenBalances)(nil), "umee.ugov.v1.QueryTokenBalances") + proto.RegisterType((*QueryTokenBalancesResponse)(nil), "umee.ugov.v1.QueryTokenBalancesResponse") + proto.RegisterType((*DenomOwner)(nil), "umee.ugov.v1.DenomOwner") proto.RegisterType((*QueryMinGasPrice)(nil), "umee.ugov.v1.QueryMinGasPrice") proto.RegisterType((*QueryMinGasPriceResponse)(nil), "umee.ugov.v1.QueryMinGasPriceResponse") proto.RegisterType((*QueryEmergencyGroup)(nil), "umee.ugov.v1.QueryEmergencyGroup") @@ -349,45 +480,59 @@ func init() { func init() { proto.RegisterFile("umee/ugov/v1/query.proto", fileDescriptor_25fa04679024a47d) } var fileDescriptor_25fa04679024a47d = []byte{ - // 598 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x52, 0x4d, 0x6f, 0xd3, 0x40, - 0x10, 0x8d, 0xa1, 0x54, 0xb0, 0x85, 0x16, 0x96, 0x52, 0x82, 0x9b, 0x6c, 0x5a, 0x17, 0x22, 0x8a, - 0xe8, 0xae, 0x52, 0xa4, 0x5e, 0x38, 0x35, 0x6d, 0xa9, 0x38, 0x20, 0x95, 0xc0, 0x01, 0xc1, 0x21, - 0xd8, 0xce, 0xd6, 0xac, 0x88, 0x77, 0x8d, 0x3f, 0x02, 0xe1, 0x88, 0xc4, 0x81, 0x5b, 0x05, 0x7f, - 0x83, 0x23, 0x3f, 0x22, 0xc7, 0x0a, 0x2e, 0x9c, 0x0a, 0x24, 0xfc, 0x10, 0xe4, 0xf5, 0xda, 0x8a, - 0x4d, 0x68, 0xb9, 0x79, 0xe7, 0xbd, 0x99, 0xf7, 0xc6, 0x6f, 0x40, 0x39, 0x72, 0x29, 0x25, 0x91, - 0x23, 0x7a, 0xa4, 0xd7, 0x20, 0xaf, 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2, 0x70, 0x26, 0xf0, 0x83, 0x06, 0xe6, 0x0a, 0x19, 0x41, 0x63, 0x82, 0x4a, 0x81, 0xa3, 0xdf, - 0x3a, 0x99, 0x93, 0x59, 0xa9, 0x4b, 0x2b, 0x4b, 0x10, 0xe5, 0xad, 0xb0, 0x94, 0xde, 0x4e, 0xae, - 0x01, 0x7e, 0xd4, 0xc0, 0xa5, 0xbf, 0xf2, 0x86, 0xd7, 0x8f, 0x53, 0x4a, 0x59, 0xfa, 0xed, 0xff, - 0x61, 0x65, 0x8e, 0x56, 0xa5, 0xa3, 0x15, 0xb8, 0xfc, 0x2f, 0x47, 0x76, 0xdc, 0xd1, 0xa6, 0xbc, - 0xd3, 0xdc, 0x1e, 0xfc, 0x42, 0xa5, 0xc1, 0x10, 0x69, 0x87, 0x43, 0xa4, 0xfd, 0x1c, 0x22, 0xed, - 0x60, 0x84, 0x4a, 0x87, 0x23, 0x54, 0xfa, 0x3e, 0x42, 0xa5, 0xa7, 0x75, 0x87, 0x85, 0x2f, 0x22, - 0x0b, 0xdb, 0xc2, 0x95, 0xa3, 0xd6, 0x38, 0x0d, 0x5f, 0x0b, 0xff, 0x65, 0x32, 0xb7, 0xb7, 0x41, - 0xde, 0xc8, 0xe1, 0xd6, 0xb4, 0xbc, 0xcb, 0x3b, 0x7f, 0x02, 0x00, 0x00, 0xff, 0xff, 0x7c, 0x94, - 0xa4, 0x3e, 0x28, 0x05, 0x00, 0x00, + // 827 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x94, 0x4f, 0x4f, 0x3b, 0x45, + 0x18, 0xc7, 0x3b, 0x54, 0x40, 0xa6, 0xfc, 0x91, 0xb1, 0xe2, 0xb2, 0x94, 0x6d, 0x59, 0xb0, 0x16, + 0x22, 0xbb, 0x69, 0x4d, 0xb8, 0x98, 0x98, 0x50, 0xfe, 0xc5, 0x83, 0x11, 0x57, 0x0e, 0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xfe, 0x13, 0x80, 0xe8, 0xd3, 0xa8, 0xdd, 0x09, 0x3b, 0x27, 0xb4, + 0x8e, 0xdb, 0x98, 0xda, 0x24, 0x40, 0x79, 0x38, 0xd9, 0x22, 0x94, 0x79, 0x0a, 0x28, 0x81, 0xca, + 0x8c, 0x15, 0x2f, 0xd0, 0x12, 0x9c, 0x3a, 0x23, 0xae, 0x73, 0x16, 0x2a, 0x13, 0x25, 0x50, 0xc9, + 0x5a, 0x62, 0x85, 0x0e, 0x21, 0x7c, 0x84, 0x50, 0xb2, 0x25, 0x50, 0xc9, 0xd5, 0xca, 0x86, 0x38, + 0x94, 0x88, 0xd8, 0x88, 0x0f, 0x5a, 0x10, 0x1b, 0xc7, 0xd8, 0x21, 0x16, 0xb9, 0xe8, 0x92, 0x20, + 0xb4, 0x06, 0x2a, 0xf5, 0x5f, 0x01, 0x54, 0x9f, 0xc2, 0x58, 0x24, 0xe8, 0x30, 0x1a, 0x10, 0xf4, + 0x01, 0x9c, 0xe5, 0x1c, 0x0d, 0x76, 0x49, 0x89, 0x1f, 0x28, 0xa0, 0x94, 0xad, 0xe4, 0x6a, 0x8a, + 0x31, 0x38, 0x38, 0x63, 0x3f, 0x52, 0x7c, 0x12, 0x09, 0xac, 0x5c, 0x2b, 0xfd, 0x1f, 0xa0, 0x23, + 0x89, 0x71, 0x82, 0x33, 0xbe, 0x3b, 0x96, 0x31, 0x76, 0x96, 0x20, 0xbf, 0x05, 0x10, 0x3e, 0x9a, + 0xa0, 0x1a, 0x9c, 0xc6, 0xad, 0x96, 0x4f, 0x82, 0x20, 0x3e, 0xab, 0xba, 0xf2, 0xc7, 0xef, 0xdb, + 0x79, 0xd1, 0x77, 0x37, 0xce, 0x7c, 0x16, 0xfa, 0x2e, 0x75, 0xac, 0x44, 0x88, 0x3e, 0x84, 0xd3, + 0xcd, 0x78, 0x73, 0x02, 0x64, 0x59, 0x02, 0x49, 0x10, 0xf6, 0x98, 0x4b, 0xeb, 0x33, 0xfd, 0x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, 0x68, 0x99, 0x2f, 0xca, + 0x8e, 0x1b, 0x9e, 0x75, 0x9b, 0x86, 0xcd, 0x3c, 0xde, 0x65, 0x9b, 0x92, 0xf0, 0x92, 0xf9, 0xe7, + 0x71, 0xcb, 0xde, 0x8e, 0xf9, 0x35, 0xef, 0xdb, 0x9c, 0xe2, 0x6f, 0xe3, 0xfd, 0x17, 0x01, 0x00, + 0x00, 0xff, 0xff, 0x6b, 0xb0, 0x89, 0x9c, 0xa0, 0x07, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -410,6 +555,9 @@ type QueryClient interface { InflationParams(ctx context.Context, in *QueryInflationParams, opts ...grpc.CallOption) (*QueryInflationParamsResponse, error) // InflationCycleEnd returns inflation cycle end time InflationCycleEnd(ctx context.Context, in *QueryInflationCycleEnd, opts ...grpc.CallOption) (*QueryInflationCycleEndResponse, error) + // Token Balances queries for all account addresses that own a particular token + // denomination. + TokenBalances(ctx context.Context, in *QueryTokenBalances, opts ...grpc.CallOption) (*QueryTokenBalancesResponse, error) } type queryClient struct { @@ -456,6 +604,15 @@ func (c *queryClient) InflationCycleEnd(ctx context.Context, in *QueryInflationC return out, nil } +func (c *queryClient) TokenBalances(ctx context.Context, in *QueryTokenBalances, opts ...grpc.CallOption) (*QueryTokenBalancesResponse, error) { + out := new(QueryTokenBalancesResponse) + err := c.cc.Invoke(ctx, "/umee.ugov.v1.Query/TokenBalances", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // QueryServer is the server API for Query service. type QueryServer interface { // MinGasPrice returns minimum transaction fees. @@ -466,6 +623,9 @@ type QueryServer interface { InflationParams(context.Context, *QueryInflationParams) (*QueryInflationParamsResponse, error) // InflationCycleEnd returns inflation cycle end time InflationCycleEnd(context.Context, *QueryInflationCycleEnd) (*QueryInflationCycleEndResponse, error) + // Token Balances queries for all account addresses that own a particular token + // denomination. + TokenBalances(context.Context, *QueryTokenBalances) (*QueryTokenBalancesResponse, error) } // UnimplementedQueryServer can be embedded to have forward compatible implementations. @@ -484,6 +644,9 @@ func (*UnimplementedQueryServer) InflationParams(ctx context.Context, req *Query func (*UnimplementedQueryServer) InflationCycleEnd(ctx context.Context, req *QueryInflationCycleEnd) (*QueryInflationCycleEndResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method InflationCycleEnd not implemented") } +func (*UnimplementedQueryServer) TokenBalances(ctx context.Context, req *QueryTokenBalances) (*QueryTokenBalancesResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method TokenBalances not implemented") +} func RegisterQueryServer(s grpc1.Server, srv QueryServer) { s.RegisterService(&_Query_serviceDesc, srv) @@ -561,6 +724,24 @@ func _Query_InflationCycleEnd_Handler(srv interface{}, ctx context.Context, dec return interceptor(ctx, in, info, handler) } +func _Query_TokenBalances_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryTokenBalances) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).TokenBalances(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/umee.ugov.v1.Query/TokenBalances", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).TokenBalances(ctx, req.(*QueryTokenBalances)) + } + return interceptor(ctx, in, info, handler) +} + var _Query_serviceDesc = grpc.ServiceDesc{ ServiceName: "umee.ugov.v1.Query", HandlerType: (*QueryServer)(nil), @@ -581,11 +762,151 @@ var _Query_serviceDesc = grpc.ServiceDesc{ MethodName: "InflationCycleEnd", Handler: _Query_InflationCycleEnd_Handler, }, + { + MethodName: "TokenBalances", + Handler: _Query_TokenBalances_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "umee/ugov/v1/query.proto", } +func (m *QueryTokenBalances) 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 *QueryTokenBalances) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryTokenBalances) 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] = 0x1a + } + if m.Height != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.Height)) + i-- + dAtA[i] = 0x10 + } + 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 *QueryTokenBalancesResponse) 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 *QueryTokenBalancesResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryTokenBalancesResponse) 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 (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 *QueryMinGasPrice) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -795,12 +1116,12 @@ func (m *QueryInflationCycleEndResponse) MarshalToSizedBuffer(dAtA []byte) (int, var l int _ = l if m.End != nil { - n3, err3 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(*m.End, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(*m.End):]) - if err3 != nil { - return 0, err3 + n6, err6 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(*m.End, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(*m.End):]) + if err6 != nil { + return 0, err6 } - i -= n3 - i = encodeVarintQuery(dAtA, i, uint64(n3)) + i -= n6 + i = encodeVarintQuery(dAtA, i, uint64(n6)) i-- dAtA[i] = 0xa } @@ -818,6 +1139,60 @@ func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } +func (m *QueryTokenBalances) 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.Height != 0 { + n += 1 + sovQuery(uint64(m.Height)) + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryTokenBalancesResponse) 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 (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 *QueryMinGasPrice) Size() (n int) { if m == nil { return 0 @@ -908,6 +1283,378 @@ func sovQuery(x uint64) (n int) { func sozQuery(x uint64) (n int) { return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } +func (m *QueryTokenBalances) 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: QueryTokenBalances: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryTokenBalances: 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 != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Height", wireType) + } + m.Height = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Height |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + 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 *QueryTokenBalancesResponse) 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: QueryTokenBalancesResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryTokenBalancesResponse: 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 (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 *QueryMinGasPrice) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 diff --git a/x/ugov/query.pb.gw.go b/x/ugov/query.pb.gw.go index 9861335ca1..d3869ca4af 100644 --- a/x/ugov/query.pb.gw.go +++ b/x/ugov/query.pb.gw.go @@ -105,6 +105,42 @@ func local_request_Query_InflationCycleEnd_0(ctx context.Context, marshaler runt } +var ( + filter_Query_TokenBalances_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_Query_TokenBalances_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryTokenBalances + 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_TokenBalances_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.TokenBalances(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_TokenBalances_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryTokenBalances + 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_TokenBalances_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.TokenBalances(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. @@ -203,6 +239,29 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv }) + mux.Handle("GET", pattern_Query_TokenBalances_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_TokenBalances_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_TokenBalances_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -324,6 +383,26 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie }) + mux.Handle("GET", pattern_Query_TokenBalances_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_TokenBalances_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_TokenBalances_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -335,6 +414,8 @@ var ( pattern_Query_InflationParams_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"umee", "ugov", "v1", "inflation_params"}, "", runtime.AssumeColonVerbOpt(false))) pattern_Query_InflationCycleEnd_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"umee", "ugov", "v1", "inflation_cycle_end"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_TokenBalances_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"umee", "ugov", "v1", "token_balances"}, "", runtime.AssumeColonVerbOpt(false))) ) var ( @@ -345,4 +426,6 @@ var ( forward_Query_InflationParams_0 = runtime.ForwardResponseMessage forward_Query_InflationCycleEnd_0 = runtime.ForwardResponseMessage + + forward_Query_TokenBalances_0 = runtime.ForwardResponseMessage )