diff --git a/buf.yaml b/buf.yaml index ba91745ba7d5..56fb6cba7592 100644 --- a/buf.yaml +++ b/buf.yaml @@ -12,6 +12,7 @@ lint: - UNARY_RPC - COMMENT_FIELD - PACKAGE_DIRECTORY_MATCH + - SERVICE_SUFFIX ignore: - third_party - codec/testdata diff --git a/x/bank/alias.go b/x/bank/alias.go index 769fdf985faf..2f488253397c 100644 --- a/x/bank/alias.go +++ b/x/bank/alias.go @@ -28,7 +28,6 @@ var ( NewBaseKeeper = keeper.NewBaseKeeper NewBaseSendKeeper = keeper.NewBaseSendKeeper NewBaseViewKeeper = keeper.NewBaseViewKeeper - NewQuerier = keeper.NewQuerier RegisterCodec = types.RegisterCodec ErrNoInputs = types.ErrNoInputs ErrNoOutputs = types.ErrNoOutputs @@ -44,8 +43,8 @@ var ( NewOutput = types.NewOutput ValidateInputsOutputs = types.ValidateInputsOutputs ParamKeyTable = types.ParamKeyTable - NewQueryBalanceParams = types.NewQueryBalanceParams - NewQueryAllBalancesParams = types.NewQueryAllBalancesParams + NewQueryBalanceRequest = types.NewQueryBalanceRequest + NewQueryAllBalancesRequest = types.NewQueryAllBalancesRequest ModuleCdc = types.ModuleCdc ParamStoreKeySendEnabled = types.ParamStoreKeySendEnabled BalancesPrefix = types.BalancesPrefix @@ -67,8 +66,8 @@ type ( MsgMultiSend = types.MsgMultiSend Input = types.Input Output = types.Output - QueryBalanceParams = types.QueryBalanceParams - QueryAllBalancesParams = types.QueryAllBalancesParams + QueryBalanceRequest = types.QueryBalanceRequest + QueryAllBalancesRequest = types.QueryAllBalancesRequest GenesisBalancesIterator = types.GenesisBalancesIterator Keeper = keeper.Keeper GenesisState = types.GenesisState diff --git a/x/bank/client/cli/query.go b/x/bank/client/cli/query.go index 03378be26544..533db577d9c6 100644 --- a/x/bank/client/cli/query.go +++ b/x/bank/client/cli/query.go @@ -72,10 +72,10 @@ func GetBalancesCmd(cdc *codec.Codec) *cobra.Command { denom := viper.GetString(flagDenom) if denom == "" { - params = types.NewQueryAllBalancesParams(addr) + params = types.NewQueryAllBalancesRequest(addr) route = fmt.Sprintf("custom/%s/%s", types.QuerierRoute, types.QueryAllBalances) } else { - params = types.NewQueryBalanceParams(addr, denom) + params = types.NewQueryBalanceRequest(addr, denom) route = fmt.Sprintf("custom/%s/%s", types.QuerierRoute, types.QueryBalance) } diff --git a/x/bank/client/rest/query.go b/x/bank/client/rest/query.go index 55ddb6338fd0..524ed077aaf0 100644 --- a/x/bank/client/rest/query.go +++ b/x/bank/client/rest/query.go @@ -49,10 +49,10 @@ func QueryBalancesRequestHandlerFn(clientCtx client.Context) http.HandlerFunc { denom := r.FormValue("denom") if denom == "" { - params = types.NewQueryAllBalancesParams(addr) + params = types.NewQueryAllBalancesRequest(addr) route = fmt.Sprintf("custom/%s/%s", types.QuerierRoute, types.QueryAllBalances) } else { - params = types.NewQueryBalanceParams(addr, denom) + params = types.NewQueryBalanceRequest(addr, denom) route = fmt.Sprintf("custom/%s/%s", types.QuerierRoute, types.QueryBalance) } diff --git a/x/bank/keeper/grpc_query.go b/x/bank/keeper/grpc_query.go new file mode 100644 index 000000000000..9f78cb41ee27 --- /dev/null +++ b/x/bank/keeper/grpc_query.go @@ -0,0 +1,73 @@ +package keeper + +import ( + "context" + + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/x/bank/types" +) + +var _ types.QueryServer = BaseKeeper{} + +// Balance implements the Query/Balance gRPC method +func (q BaseKeeper) Balance(c context.Context, req *types.QueryBalanceRequest) (*types.QueryBalanceResponse, error) { + if req == nil { + return nil, status.Errorf(codes.InvalidArgument, "empty request") + } + + if len(req.Address) == 0 { + return nil, status.Errorf(codes.InvalidArgument, "invalid address") + } + + if req.Denom == "" { + return nil, status.Errorf(codes.InvalidArgument, "invalid denom") + } + + ctx := sdk.UnwrapSDKContext(c) + balance := q.GetBalance(ctx, req.Address, req.Denom) + + return &types.QueryBalanceResponse{Balance: &balance}, nil +} + +// AllBalances implements the Query/AllBalances gRPC method +func (q BaseKeeper) AllBalances(c context.Context, req *types.QueryAllBalancesRequest) (*types.QueryAllBalancesResponse, error) { + if req == nil { + return nil, status.Errorf(codes.InvalidArgument, "empty request") + } + + if len(req.Address) == 0 { + return nil, status.Errorf(codes.InvalidArgument, "invalid address") + } + + ctx := sdk.UnwrapSDKContext(c) + balances := q.GetAllBalances(ctx, req.Address) + + return &types.QueryAllBalancesResponse{Balances: balances}, nil +} + +// TotalSupply implements the Query/TotalSupply gRPC method +func (q BaseKeeper) TotalSupply(c context.Context, _ *types.QueryTotalSupplyRequest) (*types.QueryTotalSupplyResponse, error) { + ctx := sdk.UnwrapSDKContext(c) + totalSupply := q.GetSupply(ctx).GetTotal() + + return &types.QueryTotalSupplyResponse{Supply: totalSupply}, nil +} + +// SupplyOf implements the Query/SupplyOf gRPC method +func (q BaseKeeper) SupplyOf(c context.Context, req *types.QuerySupplyOfRequest) (*types.QuerySupplyOfResponse, error) { + if req == nil { + return nil, status.Errorf(codes.InvalidArgument, "empty request") + } + + if req.Denom == "" { + return nil, status.Errorf(codes.InvalidArgument, "invalid denom") + } + + ctx := sdk.UnwrapSDKContext(c) + supply := q.GetSupply(ctx).GetTotal().AmountOf(req.Denom) + + return &types.QuerySupplyOfResponse{Amount: supply}, nil +} diff --git a/x/bank/keeper/grpc_query_test.go b/x/bank/keeper/grpc_query_test.go new file mode 100644 index 000000000000..fe85170abd5e --- /dev/null +++ b/x/bank/keeper/grpc_query_test.go @@ -0,0 +1,110 @@ +package keeper_test + +import ( + gocontext "context" + + "github.com/cosmos/cosmos-sdk/baseapp" + sdk "github.com/cosmos/cosmos-sdk/types" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + "github.com/cosmos/cosmos-sdk/x/bank" + "github.com/cosmos/cosmos-sdk/x/bank/types" +) + +func (suite *IntegrationTestSuite) TestQueryBalance() { + app, ctx := suite.app, suite.ctx + _, _, addr := authtypes.KeyTestPubAddr() + + queryHelper := baseapp.NewQueryServerTestHelper(ctx) + types.RegisterQueryServer(queryHelper, app.BankKeeper) + queryClient := types.NewQueryClient(queryHelper) + + _, err := queryClient.Balance(gocontext.Background(), &types.QueryBalanceRequest{}) + suite.Require().Error(err) + + _, err = queryClient.Balance(gocontext.Background(), &types.QueryBalanceRequest{Address: addr}) + suite.Require().Error(err) + + req := types.NewQueryBalanceRequest(addr, fooDenom) + res, err := queryClient.Balance(gocontext.Background(), req) + suite.Require().NoError(err) + suite.Require().NotNil(res) + suite.True(res.Balance.IsZero()) + + origCoins := sdk.NewCoins(newFooCoin(50), newBarCoin(30)) + acc := app.AccountKeeper.NewAccountWithAddress(ctx, addr) + + app.AccountKeeper.SetAccount(ctx, acc) + suite.Require().NoError(app.BankKeeper.SetBalances(ctx, acc.GetAddress(), origCoins)) + + res, err = queryClient.Balance(gocontext.Background(), req) + suite.Require().NoError(err) + suite.Require().NotNil(res) + suite.True(res.Balance.IsEqual(newFooCoin(50))) +} + +func (suite *IntegrationTestSuite) TestQueryAllBalances() { + app, ctx := suite.app, suite.ctx + _, _, addr := authtypes.KeyTestPubAddr() + + queryHelper := baseapp.NewQueryServerTestHelper(ctx) + types.RegisterQueryServer(queryHelper, app.BankKeeper) + queryClient := types.NewQueryClient(queryHelper) + + _, err := queryClient.AllBalances(gocontext.Background(), &types.QueryAllBalancesRequest{}) + suite.Require().Error(err) + + req := types.NewQueryAllBalancesRequest(addr) + res, err := queryClient.AllBalances(gocontext.Background(), req) + suite.Require().NoError(err) + suite.Require().NotNil(res) + suite.True(res.Balances.IsZero()) + + origCoins := sdk.NewCoins(newFooCoin(50), newBarCoin(30)) + acc := app.AccountKeeper.NewAccountWithAddress(ctx, addr) + + app.AccountKeeper.SetAccount(ctx, acc) + suite.Require().NoError(app.BankKeeper.SetBalances(ctx, acc.GetAddress(), origCoins)) + + res, err = queryClient.AllBalances(gocontext.Background(), req) + suite.Require().NoError(err) + suite.Require().NotNil(res) + suite.True(res.Balances.IsEqual(origCoins)) +} + +func (suite *IntegrationTestSuite) TestQueryTotalSupply() { + app, ctx := suite.app, suite.ctx + expectedTotalSupply := bank.NewSupply(sdk.NewCoins(sdk.NewInt64Coin("test", 400000000))) + app.BankKeeper.SetSupply(ctx, expectedTotalSupply) + + queryHelper := baseapp.NewQueryServerTestHelper(ctx) + types.RegisterQueryServer(queryHelper, app.BankKeeper) + queryClient := types.NewQueryClient(queryHelper) + + res, err := queryClient.TotalSupply(gocontext.Background(), &types.QueryTotalSupplyRequest{}) + suite.Require().NoError(err) + suite.Require().NotNil(res) + + suite.Require().Equal(expectedTotalSupply.Total, res.Supply) +} + +func (suite *IntegrationTestSuite) TestQueryTotalSupplyOf() { + app, ctx := suite.app, suite.ctx + + test1Supply := sdk.NewInt64Coin("test1", 4000000) + test2Supply := sdk.NewInt64Coin("test2", 700000000) + expectedTotalSupply := bank.NewSupply(sdk.NewCoins(test1Supply, test2Supply)) + app.BankKeeper.SetSupply(ctx, expectedTotalSupply) + + queryHelper := baseapp.NewQueryServerTestHelper(ctx) + types.RegisterQueryServer(queryHelper, app.BankKeeper) + queryClient := types.NewQueryClient(queryHelper) + + _, err := queryClient.SupplyOf(gocontext.Background(), &types.QuerySupplyOfRequest{}) + suite.Require().Error(err) + + res, err := queryClient.SupplyOf(gocontext.Background(), &types.QuerySupplyOfRequest{Denom: test1Supply.Denom}) + suite.Require().NoError(err) + suite.Require().NotNil(res) + + suite.Require().Equal(test1Supply.Amount, res.Amount) +} diff --git a/x/bank/keeper/keeper.go b/x/bank/keeper/keeper.go index d50655566959..6c0fa582c038 100644 --- a/x/bank/keeper/keeper.go +++ b/x/bank/keeper/keeper.go @@ -41,6 +41,8 @@ type Keeper interface { UnmarshalSupply(bz []byte) (exported.SupplyI, error) MarshalSupplyJSON(supply exported.SupplyI) ([]byte, error) UnmarshalSupplyJSON(bz []byte) (exported.SupplyI, error) + + types.QueryServer } // BaseKeeper manages transfers between accounts. It implements the Keeper interface. diff --git a/x/bank/keeper/querier.go b/x/bank/keeper/querier.go index 24ef415fdc55..c73db3935675 100644 --- a/x/bank/keeper/querier.go +++ b/x/bank/keeper/querier.go @@ -33,7 +33,7 @@ func NewQuerier(k Keeper) sdk.Querier { } func queryBalance(ctx sdk.Context, req abci.RequestQuery, k Keeper) ([]byte, error) { - var params types.QueryBalanceParams + var params types.QueryBalanceRequest if err := types.ModuleCdc.UnmarshalJSON(req.Data, ¶ms); err != nil { return nil, sdkerrors.Wrap(sdkerrors.ErrJSONUnmarshal, err.Error()) @@ -50,7 +50,7 @@ func queryBalance(ctx sdk.Context, req abci.RequestQuery, k Keeper) ([]byte, err } func queryAllBalance(ctx sdk.Context, req abci.RequestQuery, k Keeper) ([]byte, error) { - var params types.QueryAllBalancesParams + var params types.QueryAllBalancesRequest if err := types.ModuleCdc.UnmarshalJSON(req.Data, ¶ms); err != nil { return nil, sdkerrors.Wrap(sdkerrors.ErrJSONUnmarshal, err.Error()) diff --git a/x/bank/keeper/querier_test.go b/x/bank/keeper/querier_test.go index be68730460b9..74e909a680c2 100644 --- a/x/bank/keeper/querier_test.go +++ b/x/bank/keeper/querier_test.go @@ -26,7 +26,7 @@ func (suite *IntegrationTestSuite) TestQuerier_QueryBalance() { suite.Require().NotNil(err) suite.Require().Nil(res) - req.Data = app.Codec().MustMarshalJSON(types.NewQueryBalanceParams(addr, fooDenom)) + req.Data = app.Codec().MustMarshalJSON(types.NewQueryBalanceRequest(addr, fooDenom)) res, err = querier(ctx, []string{types.QueryBalance}, req) suite.Require().NoError(err) suite.Require().NotNil(res) @@ -62,7 +62,7 @@ func (suite *IntegrationTestSuite) TestQuerier_QueryAllBalances() { suite.Require().NotNil(err) suite.Require().Nil(res) - req.Data = app.Codec().MustMarshalJSON(types.NewQueryAllBalancesParams(addr)) + req.Data = app.Codec().MustMarshalJSON(types.NewQueryAllBalancesRequest(addr)) res, err = querier(ctx, []string{types.QueryAllBalances}, req) suite.Require().NoError(err) suite.Require().NotNil(res) diff --git a/x/bank/types/querier.go b/x/bank/types/querier.go index 4767c65aa89a..5599f64afc2e 100644 --- a/x/bank/types/querier.go +++ b/x/bank/types/querier.go @@ -12,25 +12,14 @@ const ( QuerySupplyOf = "supply_of" ) -// QueryBalanceParams defines the params for querying an account balance. -type QueryBalanceParams struct { - Address sdk.AccAddress - Denom string +// NewQueryBalanceRequest creates a new instance of QueryBalanceRequest. +func NewQueryBalanceRequest(addr sdk.AccAddress, denom string) *QueryBalanceRequest { + return &QueryBalanceRequest{Address: addr, Denom: denom} } -// NewQueryBalanceParams creates a new instance of QueryBalanceParams. -func NewQueryBalanceParams(addr sdk.AccAddress, denom string) QueryBalanceParams { - return QueryBalanceParams{Address: addr, Denom: denom} -} - -// QueryAllBalancesParams defines the params for querying all account balances -type QueryAllBalancesParams struct { - Address sdk.AccAddress -} - -// NewQueryAllBalancesParams creates a new instance of QueryAllBalancesParams. -func NewQueryAllBalancesParams(addr sdk.AccAddress) QueryAllBalancesParams { - return QueryAllBalancesParams{Address: addr} +// NewQueryAllBalancesRequest creates a new instance of QueryAllBalancesRequest. +func NewQueryAllBalancesRequest(addr sdk.AccAddress) *QueryAllBalancesRequest { + return &QueryAllBalancesRequest{Address: addr} } // QueryTotalSupply defines the params for the following queries: diff --git a/x/bank/types/query.pb.go b/x/bank/types/query.pb.go new file mode 100644 index 000000000000..b9223cf7e00f --- /dev/null +++ b/x/bank/types/query.pb.go @@ -0,0 +1,1799 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: x/bank/types/query.proto + +package types + +import ( + context "context" + fmt "fmt" + github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" + types "github.com/cosmos/cosmos-sdk/types" + _ "github.com/gogo/protobuf/gogoproto" + grpc1 "github.com/gogo/protobuf/grpc" + proto "github.com/gogo/protobuf/proto" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// QueryBalanceRequest is the request type for the Query.Balance RPC method +type QueryBalanceRequest struct { + // address is the address to query balances for + Address github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,1,opt,name=address,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"address,omitempty"` + // denom is the coin denom to query balances for + Denom string `protobuf:"bytes,2,opt,name=denom,proto3" json:"denom,omitempty"` +} + +func (m *QueryBalanceRequest) Reset() { *m = QueryBalanceRequest{} } +func (m *QueryBalanceRequest) String() string { return proto.CompactTextString(m) } +func (*QueryBalanceRequest) ProtoMessage() {} +func (*QueryBalanceRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_b761440f9b86d1e8, []int{0} +} +func (m *QueryBalanceRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryBalanceRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryBalanceRequest.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 *QueryBalanceRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryBalanceRequest.Merge(m, src) +} +func (m *QueryBalanceRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryBalanceRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryBalanceRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryBalanceRequest proto.InternalMessageInfo + +func (m *QueryBalanceRequest) GetAddress() github_com_cosmos_cosmos_sdk_types.AccAddress { + if m != nil { + return m.Address + } + return nil +} + +func (m *QueryBalanceRequest) GetDenom() string { + if m != nil { + return m.Denom + } + return "" +} + +// QueryBalanceResponse is the response type for the Query.Balance RPC method +type QueryBalanceResponse struct { + // balance is the balance of the coin + Balance *types.Coin `protobuf:"bytes,1,opt,name=balance,proto3" json:"balance,omitempty"` +} + +func (m *QueryBalanceResponse) Reset() { *m = QueryBalanceResponse{} } +func (m *QueryBalanceResponse) String() string { return proto.CompactTextString(m) } +func (*QueryBalanceResponse) ProtoMessage() {} +func (*QueryBalanceResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_b761440f9b86d1e8, []int{1} +} +func (m *QueryBalanceResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryBalanceResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryBalanceResponse.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 *QueryBalanceResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryBalanceResponse.Merge(m, src) +} +func (m *QueryBalanceResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryBalanceResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryBalanceResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryBalanceResponse proto.InternalMessageInfo + +func (m *QueryBalanceResponse) GetBalance() *types.Coin { + if m != nil { + return m.Balance + } + return nil +} + +// QueryBalanceRequest is the request type for the Query.AllBalances RPC method +type QueryAllBalancesRequest struct { + // address is the address to query balances for + Address github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,1,opt,name=address,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"address,omitempty"` +} + +func (m *QueryAllBalancesRequest) Reset() { *m = QueryAllBalancesRequest{} } +func (m *QueryAllBalancesRequest) String() string { return proto.CompactTextString(m) } +func (*QueryAllBalancesRequest) ProtoMessage() {} +func (*QueryAllBalancesRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_b761440f9b86d1e8, []int{2} +} +func (m *QueryAllBalancesRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryAllBalancesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryAllBalancesRequest.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 *QueryAllBalancesRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryAllBalancesRequest.Merge(m, src) +} +func (m *QueryAllBalancesRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryAllBalancesRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryAllBalancesRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryAllBalancesRequest proto.InternalMessageInfo + +func (m *QueryAllBalancesRequest) GetAddress() github_com_cosmos_cosmos_sdk_types.AccAddress { + if m != nil { + return m.Address + } + return nil +} + +// QueryAllBalancesResponse is the response type for the Query.AllBalances RPC method +type QueryAllBalancesResponse struct { + // balances is the balances of the coins + Balances github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,1,rep,name=balances,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"balances"` +} + +func (m *QueryAllBalancesResponse) Reset() { *m = QueryAllBalancesResponse{} } +func (m *QueryAllBalancesResponse) String() string { return proto.CompactTextString(m) } +func (*QueryAllBalancesResponse) ProtoMessage() {} +func (*QueryAllBalancesResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_b761440f9b86d1e8, []int{3} +} +func (m *QueryAllBalancesResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryAllBalancesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryAllBalancesResponse.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 *QueryAllBalancesResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryAllBalancesResponse.Merge(m, src) +} +func (m *QueryAllBalancesResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryAllBalancesResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryAllBalancesResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryAllBalancesResponse proto.InternalMessageInfo + +func (m *QueryAllBalancesResponse) GetBalances() github_com_cosmos_cosmos_sdk_types.Coins { + if m != nil { + return m.Balances + } + return nil +} + +// QueryTotalSupplyRequest is the request type for the Query.TotalSupply RPC method +type QueryTotalSupplyRequest struct { +} + +func (m *QueryTotalSupplyRequest) Reset() { *m = QueryTotalSupplyRequest{} } +func (m *QueryTotalSupplyRequest) String() string { return proto.CompactTextString(m) } +func (*QueryTotalSupplyRequest) ProtoMessage() {} +func (*QueryTotalSupplyRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_b761440f9b86d1e8, []int{4} +} +func (m *QueryTotalSupplyRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryTotalSupplyRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryTotalSupplyRequest.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 *QueryTotalSupplyRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryTotalSupplyRequest.Merge(m, src) +} +func (m *QueryTotalSupplyRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryTotalSupplyRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryTotalSupplyRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryTotalSupplyRequest proto.InternalMessageInfo + +// QueryTotalSupplyResponse is the response type for the Query.TotalSupply RPC method +type QueryTotalSupplyResponse struct { + // supply is the supply of the coins + Supply github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,1,rep,name=supply,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"supply"` +} + +func (m *QueryTotalSupplyResponse) Reset() { *m = QueryTotalSupplyResponse{} } +func (m *QueryTotalSupplyResponse) String() string { return proto.CompactTextString(m) } +func (*QueryTotalSupplyResponse) ProtoMessage() {} +func (*QueryTotalSupplyResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_b761440f9b86d1e8, []int{5} +} +func (m *QueryTotalSupplyResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryTotalSupplyResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryTotalSupplyResponse.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 *QueryTotalSupplyResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryTotalSupplyResponse.Merge(m, src) +} +func (m *QueryTotalSupplyResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryTotalSupplyResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryTotalSupplyResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryTotalSupplyResponse proto.InternalMessageInfo + +func (m *QueryTotalSupplyResponse) GetSupply() github_com_cosmos_cosmos_sdk_types.Coins { + if m != nil { + return m.Supply + } + return nil +} + +// QuerySupplyOfRequest is the request type for the Query.SupplyOf RPC method +type QuerySupplyOfRequest struct { + Denom string `protobuf:"bytes,1,opt,name=denom,proto3" json:"denom,omitempty"` +} + +func (m *QuerySupplyOfRequest) Reset() { *m = QuerySupplyOfRequest{} } +func (m *QuerySupplyOfRequest) String() string { return proto.CompactTextString(m) } +func (*QuerySupplyOfRequest) ProtoMessage() {} +func (*QuerySupplyOfRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_b761440f9b86d1e8, []int{6} +} +func (m *QuerySupplyOfRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QuerySupplyOfRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QuerySupplyOfRequest.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 *QuerySupplyOfRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QuerySupplyOfRequest.Merge(m, src) +} +func (m *QuerySupplyOfRequest) XXX_Size() int { + return m.Size() +} +func (m *QuerySupplyOfRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QuerySupplyOfRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QuerySupplyOfRequest proto.InternalMessageInfo + +func (m *QuerySupplyOfRequest) GetDenom() string { + if m != nil { + return m.Denom + } + return "" +} + +// QuerySupplyOfResponse is the response type for the Query.SupplyOf RPC method +type QuerySupplyOfResponse struct { + // amount is the supply of the coin + Amount github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,1,opt,name=amount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"amount"` +} + +func (m *QuerySupplyOfResponse) Reset() { *m = QuerySupplyOfResponse{} } +func (m *QuerySupplyOfResponse) String() string { return proto.CompactTextString(m) } +func (*QuerySupplyOfResponse) ProtoMessage() {} +func (*QuerySupplyOfResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_b761440f9b86d1e8, []int{7} +} +func (m *QuerySupplyOfResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QuerySupplyOfResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QuerySupplyOfResponse.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 *QuerySupplyOfResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QuerySupplyOfResponse.Merge(m, src) +} +func (m *QuerySupplyOfResponse) XXX_Size() int { + return m.Size() +} +func (m *QuerySupplyOfResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QuerySupplyOfResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QuerySupplyOfResponse proto.InternalMessageInfo + +func init() { + proto.RegisterType((*QueryBalanceRequest)(nil), "cosmos_sdk.x.bank.v1.QueryBalanceRequest") + proto.RegisterType((*QueryBalanceResponse)(nil), "cosmos_sdk.x.bank.v1.QueryBalanceResponse") + proto.RegisterType((*QueryAllBalancesRequest)(nil), "cosmos_sdk.x.bank.v1.QueryAllBalancesRequest") + proto.RegisterType((*QueryAllBalancesResponse)(nil), "cosmos_sdk.x.bank.v1.QueryAllBalancesResponse") + proto.RegisterType((*QueryTotalSupplyRequest)(nil), "cosmos_sdk.x.bank.v1.QueryTotalSupplyRequest") + proto.RegisterType((*QueryTotalSupplyResponse)(nil), "cosmos_sdk.x.bank.v1.QueryTotalSupplyResponse") + proto.RegisterType((*QuerySupplyOfRequest)(nil), "cosmos_sdk.x.bank.v1.QuerySupplyOfRequest") + proto.RegisterType((*QuerySupplyOfResponse)(nil), "cosmos_sdk.x.bank.v1.QuerySupplyOfResponse") +} + +func init() { proto.RegisterFile("x/bank/types/query.proto", fileDescriptor_b761440f9b86d1e8) } + +var fileDescriptor_b761440f9b86d1e8 = []byte{ + // 493 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x54, 0xcb, 0x6e, 0xd3, 0x40, + 0x14, 0xb5, 0xa9, 0x9a, 0x94, 0x5b, 0x36, 0x4c, 0x83, 0x08, 0x5e, 0x38, 0xd5, 0x2c, 0xaa, 0x14, + 0xc8, 0x98, 0x94, 0x2f, 0x88, 0x2b, 0x90, 0x10, 0x0b, 0x84, 0x61, 0x85, 0x84, 0x22, 0x3f, 0xa6, + 0x69, 0x54, 0xc7, 0xe3, 0x7a, 0xc6, 0x55, 0xbc, 0xe0, 0x1f, 0xf8, 0x0e, 0x96, 0x7c, 0x45, 0x97, + 0x5d, 0x22, 0x16, 0x01, 0x25, 0x7f, 0xc1, 0x0a, 0xd9, 0x33, 0x2e, 0x6e, 0x13, 0x2c, 0x2f, 0x60, + 0xe3, 0xc7, 0xf8, 0xdc, 0x73, 0xce, 0x9d, 0x73, 0x3d, 0xd0, 0x9d, 0x5b, 0x9e, 0x1b, 0x9d, 0x59, + 0x22, 0x8b, 0x29, 0xb7, 0xce, 0x53, 0x9a, 0x64, 0x24, 0x4e, 0x98, 0x60, 0xa8, 0xe3, 0x33, 0x3e, + 0x63, 0x7c, 0xcc, 0x83, 0x33, 0x32, 0x27, 0x39, 0x88, 0x5c, 0x0c, 0x8d, 0x03, 0x71, 0x3a, 0x4d, + 0x82, 0x71, 0xec, 0x26, 0x22, 0xb3, 0x0a, 0xa0, 0x35, 0x61, 0x13, 0xf6, 0xe7, 0x49, 0x56, 0x1b, + 0xf7, 0x25, 0x61, 0x71, 0x95, 0x4b, 0x78, 0x0e, 0x7b, 0x6f, 0x73, 0x7e, 0xdb, 0x0d, 0xdd, 0xc8, + 0xa7, 0x0e, 0x3d, 0x4f, 0x29, 0x17, 0xe8, 0x35, 0xb4, 0xdd, 0x20, 0x48, 0x28, 0xe7, 0x5d, 0x7d, + 0x5f, 0xef, 0xdf, 0xb3, 0x87, 0xbf, 0x16, 0xbd, 0xc1, 0x64, 0x2a, 0x4e, 0x53, 0x8f, 0xf8, 0x6c, + 0x66, 0x49, 0x1f, 0xea, 0x36, 0xe0, 0x81, 0x32, 0x4b, 0x46, 0xbe, 0x3f, 0x92, 0x85, 0x4e, 0xc9, + 0x80, 0x3a, 0xb0, 0x1d, 0xd0, 0x88, 0xcd, 0xba, 0x77, 0xf6, 0xf5, 0xfe, 0x5d, 0x47, 0xbe, 0xe0, + 0x17, 0xd0, 0xb9, 0xa9, 0xcc, 0x63, 0x16, 0x71, 0x8a, 0x06, 0xd0, 0xf6, 0xe4, 0x52, 0x21, 0xbd, + 0x7b, 0xb4, 0x47, 0x2a, 0x4d, 0x5f, 0x0c, 0xc9, 0x31, 0x9b, 0x46, 0x4e, 0x89, 0xc1, 0x27, 0xf0, + 0xb0, 0xa0, 0x19, 0x85, 0xa1, 0x62, 0xe2, 0xff, 0xa3, 0x09, 0xfc, 0x09, 0xba, 0xeb, 0x3a, 0xca, + 0xb2, 0x0b, 0x3b, 0xca, 0x4e, 0xae, 0xb4, 0xf5, 0x17, 0xcf, 0xf6, 0xb3, 0xcb, 0x45, 0x4f, 0xfb, + 0xf2, 0xa3, 0xd7, 0x6f, 0x60, 0x21, 0x2f, 0xe0, 0xce, 0x35, 0x2d, 0x7e, 0xa4, 0xda, 0x7c, 0xcf, + 0x84, 0x1b, 0xbe, 0x4b, 0xe3, 0x38, 0xcc, 0x54, 0x9b, 0x38, 0x53, 0xce, 0x6e, 0x7c, 0x52, 0xce, + 0x3e, 0x42, 0x8b, 0x17, 0x2b, 0xff, 0xd6, 0x97, 0x22, 0xc5, 0x4f, 0x55, 0x86, 0x52, 0xf5, 0xcd, + 0x49, 0xb9, 0xf3, 0xd7, 0x89, 0xeb, 0xd5, 0xc4, 0xc7, 0xf0, 0xe0, 0x16, 0x5a, 0xb9, 0x7c, 0x09, + 0x2d, 0x77, 0xc6, 0xd2, 0x48, 0x48, 0xbc, 0x4d, 0x72, 0x43, 0xdf, 0x17, 0xbd, 0x83, 0x06, 0x86, + 0x5e, 0x45, 0xc2, 0x51, 0xd5, 0x47, 0x5f, 0xb7, 0x60, 0xbb, 0x50, 0x40, 0x1e, 0xb4, 0x55, 0x4a, + 0xe8, 0x90, 0x6c, 0xfa, 0x67, 0xc8, 0x86, 0xa9, 0x37, 0x1e, 0x37, 0x81, 0x4a, 0xcf, 0x58, 0x43, + 0x11, 0xec, 0x56, 0x86, 0x01, 0x0d, 0x6a, 0x8a, 0xd7, 0x87, 0xd3, 0x20, 0x4d, 0xe1, 0x55, 0xbd, + 0x4a, 0xc4, 0xb5, 0x7a, 0xeb, 0x53, 0x52, 0xab, 0xb7, 0x61, 0x72, 0xb0, 0x86, 0x28, 0xec, 0x94, + 0x49, 0xa1, 0xba, 0x9d, 0xb9, 0x15, 0xbe, 0xf1, 0xa4, 0x11, 0xb6, 0x94, 0xb1, 0x8f, 0x2f, 0x97, + 0xa6, 0x7e, 0xb5, 0x34, 0xf5, 0x9f, 0x4b, 0x53, 0xff, 0xbc, 0x32, 0xb5, 0xab, 0x95, 0xa9, 0x7d, + 0x5b, 0x99, 0xda, 0x87, 0xc3, 0xda, 0xf8, 0xab, 0x67, 0xa4, 0xd7, 0x2a, 0x4e, 0xb3, 0xe7, 0xbf, + 0x03, 0x00, 0x00, 0xff, 0xff, 0xd2, 0x7b, 0xe0, 0xb4, 0x3a, 0x05, 0x00, 0x00, +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// QueryClient is the client API for Query service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type QueryClient interface { + // Balance queries the balance of a single coin for a single account + Balance(ctx context.Context, in *QueryBalanceRequest, opts ...grpc.CallOption) (*QueryBalanceResponse, error) + // AllBalances queries the balance of all coins for a single account + AllBalances(ctx context.Context, in *QueryAllBalancesRequest, opts ...grpc.CallOption) (*QueryAllBalancesResponse, error) + // TotalSupply queries the total supply of all coins + TotalSupply(ctx context.Context, in *QueryTotalSupplyRequest, opts ...grpc.CallOption) (*QueryTotalSupplyResponse, error) + // SupplyOf queries the supply of a single coin + SupplyOf(ctx context.Context, in *QuerySupplyOfRequest, opts ...grpc.CallOption) (*QuerySupplyOfResponse, error) +} + +type queryClient struct { + cc grpc1.ClientConn +} + +func NewQueryClient(cc grpc1.ClientConn) QueryClient { + return &queryClient{cc} +} + +func (c *queryClient) Balance(ctx context.Context, in *QueryBalanceRequest, opts ...grpc.CallOption) (*QueryBalanceResponse, error) { + out := new(QueryBalanceResponse) + err := c.cc.Invoke(ctx, "/cosmos_sdk.x.bank.v1.Query/Balance", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) AllBalances(ctx context.Context, in *QueryAllBalancesRequest, opts ...grpc.CallOption) (*QueryAllBalancesResponse, error) { + out := new(QueryAllBalancesResponse) + err := c.cc.Invoke(ctx, "/cosmos_sdk.x.bank.v1.Query/AllBalances", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) TotalSupply(ctx context.Context, in *QueryTotalSupplyRequest, opts ...grpc.CallOption) (*QueryTotalSupplyResponse, error) { + out := new(QueryTotalSupplyResponse) + err := c.cc.Invoke(ctx, "/cosmos_sdk.x.bank.v1.Query/TotalSupply", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) SupplyOf(ctx context.Context, in *QuerySupplyOfRequest, opts ...grpc.CallOption) (*QuerySupplyOfResponse, error) { + out := new(QuerySupplyOfResponse) + err := c.cc.Invoke(ctx, "/cosmos_sdk.x.bank.v1.Query/SupplyOf", 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 + Balance(context.Context, *QueryBalanceRequest) (*QueryBalanceResponse, error) + // AllBalances queries the balance of all coins for a single account + AllBalances(context.Context, *QueryAllBalancesRequest) (*QueryAllBalancesResponse, error) + // TotalSupply queries the total supply of all coins + TotalSupply(context.Context, *QueryTotalSupplyRequest) (*QueryTotalSupplyResponse, error) + // SupplyOf queries the supply of a single coin + SupplyOf(context.Context, *QuerySupplyOfRequest) (*QuerySupplyOfResponse, error) +} + +// UnimplementedQueryServer can be embedded to have forward compatible implementations. +type UnimplementedQueryServer struct { +} + +func (*UnimplementedQueryServer) Balance(ctx context.Context, req *QueryBalanceRequest) (*QueryBalanceResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Balance not implemented") +} +func (*UnimplementedQueryServer) AllBalances(ctx context.Context, req *QueryAllBalancesRequest) (*QueryAllBalancesResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method AllBalances not implemented") +} +func (*UnimplementedQueryServer) TotalSupply(ctx context.Context, req *QueryTotalSupplyRequest) (*QueryTotalSupplyResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method TotalSupply not implemented") +} +func (*UnimplementedQueryServer) SupplyOf(ctx context.Context, req *QuerySupplyOfRequest) (*QuerySupplyOfResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method SupplyOf not implemented") +} + +func RegisterQueryServer(s grpc1.Server, srv QueryServer) { + s.RegisterService(&_Query_serviceDesc, srv) +} + +func _Query_Balance_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryBalanceRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Balance(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cosmos_sdk.x.bank.v1.Query/Balance", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Balance(ctx, req.(*QueryBalanceRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_AllBalances_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryAllBalancesRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).AllBalances(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cosmos_sdk.x.bank.v1.Query/AllBalances", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).AllBalances(ctx, req.(*QueryAllBalancesRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_TotalSupply_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryTotalSupplyRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).TotalSupply(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cosmos_sdk.x.bank.v1.Query/TotalSupply", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).TotalSupply(ctx, req.(*QueryTotalSupplyRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_SupplyOf_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QuerySupplyOfRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).SupplyOf(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cosmos_sdk.x.bank.v1.Query/SupplyOf", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).SupplyOf(ctx, req.(*QuerySupplyOfRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _Query_serviceDesc = grpc.ServiceDesc{ + ServiceName: "cosmos_sdk.x.bank.v1.Query", + HandlerType: (*QueryServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Balance", + Handler: _Query_Balance_Handler, + }, + { + MethodName: "AllBalances", + Handler: _Query_AllBalances_Handler, + }, + { + MethodName: "TotalSupply", + Handler: _Query_TotalSupply_Handler, + }, + { + MethodName: "SupplyOf", + Handler: _Query_SupplyOf_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "x/bank/types/query.proto", +} + +func (m *QueryBalanceRequest) 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 *QueryBalanceRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryBalanceRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + 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] = 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 *QueryBalanceResponse) 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 *QueryBalanceResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryBalanceResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Balance != nil { + { + size, err := m.Balance.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 *QueryAllBalancesRequest) 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 *QueryAllBalancesRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryAllBalancesRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + 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 *QueryAllBalancesResponse) 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 *QueryAllBalancesResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryAllBalancesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Balances) > 0 { + for iNdEx := len(m.Balances) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Balances[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 *QueryTotalSupplyRequest) 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 *QueryTotalSupplyRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryTotalSupplyRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *QueryTotalSupplyResponse) 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 *QueryTotalSupplyResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryTotalSupplyResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Supply) > 0 { + for iNdEx := len(m.Supply) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Supply[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 *QuerySupplyOfRequest) 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 *QuerySupplyOfRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QuerySupplyOfRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + 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 *QuerySupplyOfResponse) 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 *QuerySupplyOfResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QuerySupplyOfResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size := m.Amount.Size() + i -= size + if _, err := m.Amount.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + 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 + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *QueryBalanceRequest) 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 = len(m.Denom) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryBalanceResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Balance != nil { + l = m.Balance.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryAllBalancesRequest) 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)) + } + return n +} + +func (m *QueryAllBalancesResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Balances) > 0 { + for _, e := range m.Balances { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + return n +} + +func (m *QueryTotalSupplyRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *QueryTotalSupplyResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Supply) > 0 { + for _, e := range m.Supply { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + return n +} + +func (m *QuerySupplyOfRequest) 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)) + } + return n +} + +func (m *QuerySupplyOfResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Amount.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 { + 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: QueryBalanceRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryBalanceRequest: 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 byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Address = append(m.Address[:0], dAtA[iNdEx:postIndex]...) + if m.Address == nil { + m.Address = []byte{} + } + iNdEx = postIndex + case 2: + 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 + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryBalanceResponse) 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: QueryBalanceResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryBalanceResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + 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 m.Balance == nil { + m.Balance = &types.Coin{} + } + 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 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryAllBalancesRequest) 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: QueryAllBalancesRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryAllBalancesRequest: 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 byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Address = append(m.Address[:0], dAtA[iNdEx:postIndex]...) + if m.Address == nil { + m.Address = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryAllBalancesResponse) 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: QueryAllBalancesResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryAllBalancesResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Balances", 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.Balances = append(m.Balances, types.Coin{}) + if err := m.Balances[len(m.Balances)-1].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 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryTotalSupplyRequest) 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: QueryTotalSupplyRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryTotalSupplyRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryTotalSupplyResponse) 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: QueryTotalSupplyResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryTotalSupplyResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Supply", 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.Supply = append(m.Supply, types.Coin{}) + if err := m.Supply[len(m.Supply)-1].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 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QuerySupplyOfRequest) 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: QuerySupplyOfRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QuerySupplyOfRequest: 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 + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QuerySupplyOfResponse) 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: QuerySupplyOfResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QuerySupplyOfResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Amount", 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 + } + if err := m.Amount.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 { + return ErrInvalidLengthQuery + } + if (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 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowQuery + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowQuery + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowQuery + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthQuery + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupQuery + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthQuery + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthQuery = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowQuery = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupQuery = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/bank/types/query.proto b/x/bank/types/query.proto new file mode 100644 index 000000000000..9c23127f5ce9 --- /dev/null +++ b/x/bank/types/query.proto @@ -0,0 +1,70 @@ +syntax = "proto3"; +package cosmos_sdk.x.bank.v1; + +import "third_party/proto/gogoproto/gogo.proto"; +import "types/types.proto"; + +option go_package = "github.com/cosmos/cosmos-sdk/x/bank/types"; + +// Query provides defines the gRPC querier service +service Query { + // Balance queries the balance of a single coin for a single account + rpc Balance (QueryBalanceRequest) returns (QueryBalanceResponse) { } + + // AllBalances queries the balance of all coins for a single account + rpc AllBalances (QueryAllBalancesRequest) returns (QueryAllBalancesResponse) { } + + // TotalSupply queries the total supply of all coins + rpc TotalSupply (QueryTotalSupplyRequest) returns (QueryTotalSupplyResponse) { } + + // SupplyOf queries the supply of a single coin + rpc SupplyOf (QuerySupplyOfRequest) returns (QuerySupplyOfResponse) { } +} + +// QueryBalanceRequest is the request type for the Query/Balance RPC method +message QueryBalanceRequest { + // address is the address to query balances for + bytes address = 1 [(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress"]; + + // denom is the coin denom to query balances for + string denom = 2; +} + +// QueryBalanceResponse is the response type for the Query/Balance RPC method +message QueryBalanceResponse { + + // balance is the balance of the coin + cosmos_sdk.v1.Coin balance = 1; +} + +// QueryBalanceRequest is the request type for the Query/AllBalances RPC method +message QueryAllBalancesRequest { + // address is the address to query balances for + bytes address = 1 [(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress"]; +} + +// QueryAllBalancesResponse is the response type for the Query/AllBalances RPC method +message QueryAllBalancesResponse { + // balances is the balances of the coins + repeated cosmos_sdk.v1.Coin balances = 1 [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"]; +} + +// QueryTotalSupplyRequest is the request type for the Query/TotalSupply RPC method +message QueryTotalSupplyRequest { } + +// QueryTotalSupplyResponse is the response type for the Query/TotalSupply RPC method +message QueryTotalSupplyResponse { + // supply is the supply of the coins + repeated cosmos_sdk.v1.Coin supply = 1 [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"]; +} + +// QuerySupplyOfRequest is the request type for the Query/SupplyOf RPC method +message QuerySupplyOfRequest { + string denom = 1; +} + +// QuerySupplyOfResponse is the response type for the Query/SupplyOf RPC method +message QuerySupplyOfResponse { + // amount is the supply of the coin + string amount = 1 [(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", (gogoproto.nullable) = false]; +}