From 41da4554d39f92ffcef79e9cb48788a287a4dc02 Mon Sep 17 00:00:00 2001
From: MD Aleem <72057206+aleem1314@users.noreply.github.com>
Date: Thu, 23 Dec 2021 12:52:42 +0530
Subject: [PATCH] feat(x/group): add groups by member address query (#10822)
## Description
Closes: #10566
---
### Author Checklist
*All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.*
I have...
- [ ] included the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title
- [ ] added `!` to the type prefix if API or client breaking change
- [ ] targeted the correct branch (see [PR Targeting](https://github.com/cosmos/cosmos-sdk/blob/master/CONTRIBUTING.md#pr-targeting))
- [ ] provided a link to the relevant issue or specification
- [ ] followed the guidelines for [building modules](https://github.com/cosmos/cosmos-sdk/blob/master/docs/building-modules)
- [ ] included the necessary unit and integration [tests](https://github.com/cosmos/cosmos-sdk/blob/master/CONTRIBUTING.md#testing)
- [ ] added a changelog entry to `CHANGELOG.md`
- [ ] included comments for [documenting Go code](https://blog.golang.org/godoc)
- [ ] updated the relevant documentation or specification
- [ ] reviewed "Files changed" and left comments if necessary
- [ ] confirmed all CI checks have passed
### Reviewers Checklist
*All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.*
I have...
- [ ] confirmed the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title
- [ ] confirmed `!` in the type prefix if API or client breaking change
- [ ] confirmed all author checklist items have been addressed
- [ ] reviewed state machine logic
- [ ] reviewed API design and naming
- [ ] reviewed documentation is accurate
- [ ] reviewed tests and test coverage
- [ ] manually tested (if applicable)
---
docs/core/proto-docs.md | 35 ++
proto/cosmos/group/v1beta1/query.proto | 23 +
x/group/client/cli/query.go | 30 ++
x/group/client/testutil/query.go | 79 +++
x/group/go.mod | 4 +-
x/group/go.sum | 8 +-
x/group/keeper/grpc_query.go | 40 ++
x/group/keeper/grpc_query_test.go | 66 +++
x/group/query.pb.go | 660 ++++++++++++++++++++++---
x/group/query.pb.gw.go | 116 +++++
10 files changed, 984 insertions(+), 77 deletions(-)
create mode 100644 x/group/keeper/grpc_query_test.go
diff --git a/docs/core/proto-docs.md b/docs/core/proto-docs.md
index 20217b246..4670b3432 100644
--- a/docs/core/proto-docs.md
+++ b/docs/core/proto-docs.md
@@ -493,6 +493,8 @@
- [QueryGroupMembersResponse](#cosmos.group.v1beta1.QueryGroupMembersResponse)
- [QueryGroupsByAdminRequest](#cosmos.group.v1beta1.QueryGroupsByAdminRequest)
- [QueryGroupsByAdminResponse](#cosmos.group.v1beta1.QueryGroupsByAdminResponse)
+ - [QueryGroupsByMemberRequest](#cosmos.group.v1beta1.QueryGroupsByMemberRequest)
+ - [QueryGroupsByMemberResponse](#cosmos.group.v1beta1.QueryGroupsByMemberResponse)
- [QueryProposalRequest](#cosmos.group.v1beta1.QueryProposalRequest)
- [QueryProposalResponse](#cosmos.group.v1beta1.QueryProposalResponse)
- [QueryProposalsByGroupAccountRequest](#cosmos.group.v1beta1.QueryProposalsByGroupAccountRequest)
@@ -7314,6 +7316,38 @@ QueryGroupsByAdminResponse is the Query/GroupsByAdminResponse response type.
+
+
+### QueryGroupsByMemberRequest
+QueryGroupsByMemberRequest is the Query/GroupsByMember request type.
+
+
+| Field | Type | Label | Description |
+| ----- | ---- | ----- | ----------- |
+| `address` | [string](#string) | | address is the group member address. |
+| `pagination` | [cosmos.base.query.v1beta1.PageRequest](#cosmos.base.query.v1beta1.PageRequest) | | pagination defines an optional pagination for the request. |
+
+
+
+
+
+
+
+
+### QueryGroupsByMemberResponse
+QueryGroupsByMemberResponse is the Query/GroupsByMember response type.
+
+
+| Field | Type | Label | Description |
+| ----- | ---- | ----- | ----------- |
+| `groups` | [GroupInfo](#cosmos.group.v1beta1.GroupInfo) | repeated | groups are the groups info with the provided group member. |
+| `pagination` | [cosmos.base.query.v1beta1.PageResponse](#cosmos.base.query.v1beta1.PageResponse) | | pagination defines the pagination in the response. |
+
+
+
+
+
+
### QueryProposalRequest
@@ -7495,6 +7529,7 @@ Query is the cosmos.group.v1beta1 Query service.
| `VoteByProposalVoter` | [QueryVoteByProposalVoterRequest](#cosmos.group.v1beta1.QueryVoteByProposalVoterRequest) | [QueryVoteByProposalVoterResponse](#cosmos.group.v1beta1.QueryVoteByProposalVoterResponse) | VoteByProposalVoter queries a vote by proposal id and voter. | GET|/cosmos/group/v1beta1/vote_by_proposal_voter/{proposal_id}/{voter}|
| `VotesByProposal` | [QueryVotesByProposalRequest](#cosmos.group.v1beta1.QueryVotesByProposalRequest) | [QueryVotesByProposalResponse](#cosmos.group.v1beta1.QueryVotesByProposalResponse) | VotesByProposal queries a vote by proposal. | GET|/cosmos/group/v1beta1/votes_by_proposal/{proposal_id}|
| `VotesByVoter` | [QueryVotesByVoterRequest](#cosmos.group.v1beta1.QueryVotesByVoterRequest) | [QueryVotesByVoterResponse](#cosmos.group.v1beta1.QueryVotesByVoterResponse) | VotesByVoter queries a vote by voter. | GET|/cosmos/group/v1beta1/votes_by_voter/{voter}|
+| `GroupsByMember` | [QueryGroupsByMemberRequest](#cosmos.group.v1beta1.QueryGroupsByMemberRequest) | [QueryGroupsByMemberResponse](#cosmos.group.v1beta1.QueryGroupsByMemberResponse) | GroupsByMember queries groups by member address. | GET|/cosmos/group/v1beta1/groups_by_member/{address}|
diff --git a/proto/cosmos/group/v1beta1/query.proto b/proto/cosmos/group/v1beta1/query.proto
index d4c96912b..ed7270d90 100644
--- a/proto/cosmos/group/v1beta1/query.proto
+++ b/proto/cosmos/group/v1beta1/query.proto
@@ -66,6 +66,11 @@ service Query {
rpc VotesByVoter(QueryVotesByVoterRequest) returns (QueryVotesByVoterResponse) {
option (google.api.http).get = "/cosmos/group/v1beta1/votes_by_voter/{voter}";
};
+
+ // GroupsByMember queries groups by member address.
+ rpc GroupsByMember(QueryGroupsByMemberRequest) returns (QueryGroupsByMemberResponse) {
+ option (google.api.http).get = "/cosmos/group/v1beta1/groups_by_member/{address}";
+ };
}
// QueryGroupInfoRequest is the Query/GroupInfo request type.
@@ -265,3 +270,21 @@ message QueryVotesByVoterResponse {
// pagination defines the pagination in the response.
cosmos.base.query.v1beta1.PageResponse pagination = 2;
}
+
+// QueryGroupsByMemberRequest is the Query/GroupsByMember request type.
+message QueryGroupsByMemberRequest {
+ // address is the group member address.
+ string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
+
+ // pagination defines an optional pagination for the request.
+ cosmos.base.query.v1beta1.PageRequest pagination = 2;
+}
+
+// QueryGroupsByMemberResponse is the Query/GroupsByMember response type.
+message QueryGroupsByMemberResponse {
+ // groups are the groups info with the provided group member.
+ repeated GroupInfo groups = 1;
+
+ // pagination defines the pagination in the response.
+ cosmos.base.query.v1beta1.PageResponse pagination = 2;
+}
diff --git a/x/group/client/cli/query.go b/x/group/client/cli/query.go
index c80a93afd..94de8ebda 100644
--- a/x/group/client/cli/query.go
+++ b/x/group/client/cli/query.go
@@ -31,11 +31,41 @@ func QueryCmd(name string) *cobra.Command {
QueryVoteByProposalVoterCmd(),
QueryVotesByProposalCmd(),
QueryVotesByVoterCmd(),
+ QueryGroupsByMemberCmd(),
)
return queryCmd
}
+// QueryGroupsByMemberCmd creates a CLI command for Query/GroupsByMember.
+func QueryGroupsByMemberCmd() *cobra.Command {
+ cmd := &cobra.Command{
+ Use: "groups-by-member [address]",
+ Short: "Query for groups by member address with pagination flags",
+ Args: cobra.ExactArgs(1),
+ RunE: func(cmd *cobra.Command, args []string) error {
+ clientCtx, err := client.GetClientQueryContext(cmd)
+ if err != nil {
+ return err
+ }
+
+ queryClient := group.NewQueryClient(clientCtx)
+ res, err := queryClient.GroupsByMember(cmd.Context(), &group.QueryGroupsByMemberRequest{
+ Address: args[0],
+ })
+ if err != nil {
+ return err
+ }
+
+ return clientCtx.PrintProto(res)
+ },
+ }
+
+ flags.AddQueryFlagsToCmd(cmd)
+ flags.AddPaginationFlagsToCmd(cmd, "groups-by-members")
+ return cmd
+}
+
// QueryGroupInfoCmd creates a CLI command for Query/GroupInfo.
func QueryGroupInfoCmd() *cobra.Command {
cmd := &cobra.Command{
diff --git a/x/group/client/testutil/query.go b/x/group/client/testutil/query.go
index 8c1012cdb..f369ae407 100644
--- a/x/group/client/testutil/query.go
+++ b/x/group/client/testutil/query.go
@@ -4,7 +4,9 @@ import (
"fmt"
"strconv"
+ "github.com/cosmos/cosmos-sdk/crypto/keys/ed25519"
"github.com/cosmos/cosmos-sdk/testutil/cli"
+ sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/x/group"
client "github.com/cosmos/cosmos-sdk/x/group/client/cli"
@@ -69,6 +71,83 @@ func (s *IntegrationTestSuite) TestQueryGroupInfo() {
}
}
+func (s *IntegrationTestSuite) TestQueryGroupsByMembers() {
+ val := s.network.Validators[0]
+ clientCtx := val.ClientCtx
+ require := s.Require()
+
+ cmd := client.QueryGroupsByAdminCmd()
+ out, err := cli.ExecTestCLICmd(clientCtx, cmd, []string{val.Address.String(), fmt.Sprintf("--%s=json", tmcli.OutputFlag)})
+ require.NoError(err)
+
+ var groups group.QueryGroupsByAdminResponse
+ val.ClientCtx.Codec.MustUnmarshalJSON(out.Bytes(), &groups)
+ require.Len(groups.Groups, 1)
+
+ cmd = client.QueryGroupMembersCmd()
+ out, err = cli.ExecTestCLICmd(clientCtx, cmd, []string{fmt.Sprintf("%d", groups.Groups[0].GroupId), fmt.Sprintf("--%s=json", tmcli.OutputFlag)})
+ require.NoError(err)
+
+ var members group.QueryGroupMembersResponse
+ val.ClientCtx.Codec.MustUnmarshalJSON(out.Bytes(), &members)
+ require.Len(members.Members, 1)
+
+ testAddr := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address())
+
+ testCases := []struct {
+ name string
+ args []string
+ expectErr bool
+ expectErrMsg string
+ numItems int
+ expectGroups []*group.GroupInfo
+ }{
+ {
+ "invalid address",
+ []string{"abcd", fmt.Sprintf("--%s=json", tmcli.OutputFlag)},
+ true,
+ "invalid bech32 string",
+ 0,
+ []*group.GroupInfo{},
+ },
+ {
+ "not part of any group",
+ []string{testAddr.String(), fmt.Sprintf("--%s=json", tmcli.OutputFlag)},
+ false,
+ "",
+ 0,
+ []*group.GroupInfo{},
+ },
+ {
+ "expect one group",
+ []string{members.Members[0].Member.Address, fmt.Sprintf("--%s=json", tmcli.OutputFlag)},
+ false,
+ "",
+ 1,
+ groups.Groups,
+ },
+ }
+
+ for _, tc := range testCases {
+ tc := tc
+ s.Run(tc.name, func() {
+ cmd := client.QueryGroupsByMemberCmd()
+ out, err := cli.ExecTestCLICmd(clientCtx, cmd, tc.args)
+ if tc.expectErr {
+ require.Contains(out.String(), tc.expectErrMsg)
+ } else {
+ require.NoError(err, out.String())
+
+ var resp group.QueryGroupsByMemberResponse
+ val.ClientCtx.Codec.MustUnmarshalJSON(out.Bytes(), &resp)
+ require.Len(resp.Groups, tc.numItems)
+
+ require.Equal(tc.expectGroups, resp.Groups)
+ }
+ })
+ }
+}
+
func (s *IntegrationTestSuite) TestQueryGroupMembers() {
val := s.network.Validators[0]
clientCtx := val.ClientCtx
diff --git a/x/group/go.mod b/x/group/go.mod
index c745bb4e3..c01a5e6b8 100644
--- a/x/group/go.mod
+++ b/x/group/go.mod
@@ -110,7 +110,7 @@ require (
github.com/rcrowley/go-metrics v0.0.0-20200313005456-10cdbea86bc0 // indirect
github.com/regen-network/cosmos-proto v0.3.1 // indirect
github.com/rs/cors v1.8.0 // indirect
- github.com/rs/zerolog v1.26.0 // indirect
+ github.com/rs/zerolog v1.26.1 // indirect
github.com/sasha-s/go-deadlock v0.2.1-0.20190427202633-1595213edefa // indirect
github.com/spf13/afero v1.6.0 // indirect
github.com/spf13/cast v1.4.1 // indirect
@@ -127,7 +127,7 @@ require (
github.com/zondax/hid v0.9.0 // indirect
go.etcd.io/bbolt v1.3.6 // indirect
go.opencensus.io v0.23.0 // indirect
- golang.org/x/crypto v0.0.0-20210921155107-089bfa567519 // indirect
+ golang.org/x/crypto v0.0.0-20211215165025-cf75a172585e // indirect
golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2 // indirect
golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8 // indirect
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c // indirect
diff --git a/x/group/go.sum b/x/group/go.sum
index fedb3b468..2b1ab4910 100644
--- a/x/group/go.sum
+++ b/x/group/go.sum
@@ -631,7 +631,6 @@ github.com/hashicorp/consul/api v1.1.0/go.mod h1:VmuI/Lkw1nC05EYQWNKwWGbkg+FbDBt
github.com/hashicorp/consul/api v1.3.0/go.mod h1:MmDNSzIMUjNpY/mQ398R4bk2FnqQLoPndWW5VkKPlCE=
github.com/hashicorp/consul/api v1.10.1/go.mod h1:XjsvQN+RJGWI2TWy1/kqaE16HrR2J/FWgkYjdZQsX9M=
github.com/hashicorp/consul/api v1.11.0/go.mod h1:XjsvQN+RJGWI2TWy1/kqaE16HrR2J/FWgkYjdZQsX9M=
-github.com/hashicorp/consul/api v1.12.0/go.mod h1:6pVBMo0ebnYdt2S3H87XhekM/HHrUoTD2XXb/VrZVy0=
github.com/hashicorp/consul/sdk v0.1.1/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8=
github.com/hashicorp/consul/sdk v0.3.0/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8=
github.com/hashicorp/consul/sdk v0.8.0/go.mod h1:GBvyrGALthsZObzUGsfgHZQDXjg4lOjagTIwIR1vPms=
@@ -1120,8 +1119,9 @@ github.com/rs/xid v1.2.1/go.mod h1:+uKXf+4Djp6Md1KODXJxgGQPKngRmWyn10oCKFzNHOQ=
github.com/rs/xid v1.3.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg=
github.com/rs/xid v1.3.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg=
github.com/rs/zerolog v1.18.0/go.mod h1:9nvC1axdVrAHcu/s9taAVfBuIdTZLVQmKQyvrUjF5+I=
-github.com/rs/zerolog v1.26.0 h1:ORM4ibhEZeTeQlCojCK2kPz1ogAY4bGs4tD+SaAdGaE=
github.com/rs/zerolog v1.26.0/go.mod h1:yBiM87lvSqX8h0Ww4sdzNSkVYZ8dL2xjZJG1lAuGZEo=
+github.com/rs/zerolog v1.26.1 h1:/ihwxqH+4z8UxyI70wM1z9yCvkWcfz/a3mj48k/Zngc=
+github.com/rs/zerolog v1.26.1/go.mod h1:/wSSJWX7lVrsOwlbyTRSOJvqRlc+WjWlfes+CiJ+tmc=
github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g=
github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
@@ -1130,7 +1130,6 @@ github.com/ryanrolds/sqlclosecheck v0.3.0/go.mod h1:1gREqxyTGR3lVtpngyFo3hZAgk0K
github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts=
github.com/sagikazarmark/crypt v0.1.0/go.mod h1:B/mN0msZuINBtQ1zZLEQcegFJJf9vnYIR88KRMEuODE=
github.com/sagikazarmark/crypt v0.3.0/go.mod h1:uD/D+6UF4SrIR1uGEv7bBNkNqLGqUr43MRiaGWX1Nig=
-github.com/sagikazarmark/crypt v0.4.0/go.mod h1:ALv2SRj7GxYV4HO9elxH9nS6M9gW+xDNxqmyJ6RfDFM=
github.com/samuel/go-zookeeper v0.0.0-20190923202752-2cc03de413da/go.mod h1:gi+0XIa01GRL2eRQVjQkKGqKF3SF9vZR/HnPullcV2E=
github.com/sanposhiho/wastedassign/v2 v2.0.6/go.mod h1:KyZ0MWTwxxBmfwn33zh3k1dmsbF2ud9pAAGfoLfjhtI=
github.com/sasha-s/go-deadlock v0.2.1-0.20190427202633-1595213edefa h1:0U2s5loxrTy6/VgfVoLuVLFJcURKLH49ie0zSch7gh4=
@@ -1387,8 +1386,9 @@ golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e/go.mod h1:GvvjBRRGRdwPK5y
golang.org/x/crypto v0.0.0-20210817164053-32db794688a5/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.0.0-20210817164053-32db794688a5/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.0.0-20210915214749-c084706c2272/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
-golang.org/x/crypto v0.0.0-20210921155107-089bfa567519 h1:7I4JAnoQBe7ZtJcBaYHi5UtiO8tQHbUSXxL+pnGRANg=
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
+golang.org/x/crypto v0.0.0-20211215165025-cf75a172585e h1:1SzTfNOXwIS2oWiMF+6qu0OUDKb0dauo6MoDUQyu+yU=
+golang.org/x/crypto v0.0.0-20211215165025-cf75a172585e/go.mod h1:P+XmwS30IXTQdn5tA2iutPOUgjI07+tq3H3K9MVA1s8=
golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20180807140117-3d87b88a115f/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
diff --git a/x/group/keeper/grpc_query.go b/x/group/keeper/grpc_query.go
index e98058c91..f3228811b 100644
--- a/x/group/keeper/grpc_query.go
+++ b/x/group/keeper/grpc_query.go
@@ -2,6 +2,8 @@ package keeper
import (
"context"
+ "google.golang.org/grpc/codes"
+ "google.golang.org/grpc/status"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
@@ -251,6 +253,44 @@ func (q Keeper) VotesByVoter(goCtx context.Context, request *group.QueryVotesByV
}, nil
}
+func (q Keeper) GroupsByMember(goCtx context.Context, request *group.QueryGroupsByMemberRequest) (*group.QueryGroupsByMemberResponse, error) {
+ if request == nil {
+ return nil, status.Errorf(codes.InvalidArgument, "empty request")
+ }
+
+ ctx := sdk.UnwrapSDKContext(goCtx)
+ member, err := sdk.AccAddressFromBech32(request.Address)
+ if err != nil {
+ return nil, err
+ }
+
+ iter, err := q.groupMemberByMemberIndex.GetPaginated(ctx.KVStore(q.key), member.Bytes(), request.Pagination)
+ if err != nil {
+ return nil, err
+ }
+ defer iter.Close()
+
+ var members []*group.GroupMember
+ pageRes, err := orm.Paginate(iter, request.Pagination, &members)
+ if err != nil {
+ return nil, err
+ }
+
+ var groups []*group.GroupInfo
+ for _, gm := range members {
+ groupInfo, err := q.getGroupInfo(ctx, gm.GroupId)
+ if err != nil {
+ return nil, err
+ }
+ groups = append(groups, &groupInfo)
+ }
+
+ return &group.QueryGroupsByMemberResponse{
+ Groups: groups,
+ Pagination: pageRes,
+ }, nil
+}
+
func (q Keeper) getVote(ctx sdk.Context, proposalID uint64, voter sdk.AccAddress) (group.Vote, error) {
var v group.Vote
return v, q.voteTable.GetOne(ctx.KVStore(q.key), orm.PrimaryKey(&group.Vote{ProposalId: proposalID, Voter: voter.String()}), &v)
diff --git a/x/group/keeper/grpc_query_test.go b/x/group/keeper/grpc_query_test.go
new file mode 100644
index 000000000..053d960b6
--- /dev/null
+++ b/x/group/keeper/grpc_query_test.go
@@ -0,0 +1,66 @@
+package keeper_test
+
+import (
+ "context"
+ "testing"
+
+ "github.com/cosmos/cosmos-sdk/baseapp"
+ "github.com/cosmos/cosmos-sdk/simapp"
+ sdk "github.com/cosmos/cosmos-sdk/types"
+ "github.com/cosmos/cosmos-sdk/x/group"
+ "github.com/stretchr/testify/require"
+ tmproto "github.com/tendermint/tendermint/proto/tendermint/types"
+)
+
+func TestQueryGroupsByMember(t *testing.T) {
+ app := simapp.Setup(t, false)
+ ctx := app.BaseApp.NewContext(false, tmproto.Header{})
+ queryHelper := baseapp.NewQueryServerTestHelper(ctx, app.InterfaceRegistry())
+ group.RegisterQueryServer(queryHelper, app.GroupKeeper)
+ queryClient := group.NewQueryClient(queryHelper)
+ sdkCtx := sdk.WrapSDKContext(ctx)
+
+ addrs := simapp.AddTestAddrsIncremental(app, ctx, 6, sdk.NewInt(30000000))
+
+ // Initial group, group account and balance setup
+ members := []group.Member{
+ {Address: addrs[2].String(), Weight: "1"}, {Address: addrs[3].String(), Weight: "2"},
+ }
+ _, err := app.GroupKeeper.CreateGroup(sdkCtx, &group.MsgCreateGroup{
+ Admin: addrs[0].String(),
+ Members: members,
+ Metadata: nil,
+ })
+ require.NoError(t,err)
+
+ members = []group.Member{
+ {Address: addrs[3].String(), Weight: "1"}, {Address: addrs[4].String(), Weight: "2"},
+ }
+ _, err = app.GroupKeeper.CreateGroup(sdkCtx, &group.MsgCreateGroup{
+ Admin: addrs[1].String(),
+ Members: members,
+ Metadata: nil,
+ })
+ require.NoError(t,err)
+
+ // not part of any group
+ resp, err := queryClient.GroupsByMember(context.Background(), &group.QueryGroupsByMemberRequest{
+ Address: addrs[5].String(),
+ })
+ require.NoError(t,err)
+ require.Len(t, resp.Groups,0)
+
+ // expect one group
+ resp, err = queryClient.GroupsByMember(context.Background(), &group.QueryGroupsByMemberRequest{
+ Address: addrs[4].String(),
+ })
+ require.NoError(t,err)
+ require.Len(t, resp.Groups,1)
+
+ // expect two groups
+ resp, err = queryClient.GroupsByMember(context.Background(), &group.QueryGroupsByMemberRequest{
+ Address: addrs[3].String(),
+ })
+ require.NoError(t,err)
+ require.Len(t, resp.Groups,2)
+}
diff --git a/x/group/query.pb.go b/x/group/query.pb.go
index 9a834fb16..62774990f 100644
--- a/x/group/query.pb.go
+++ b/x/group/query.pb.go
@@ -1177,6 +1177,116 @@ func (m *QueryVotesByVoterResponse) GetPagination() *query.PageResponse {
return nil
}
+// QueryGroupsByMemberRequest is the Query/GroupsByMember request type.
+type QueryGroupsByMemberRequest struct {
+ // address is the group member address.
+ Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"`
+ // pagination defines an optional pagination for the request.
+ Pagination *query.PageRequest `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"`
+}
+
+func (m *QueryGroupsByMemberRequest) Reset() { *m = QueryGroupsByMemberRequest{} }
+func (m *QueryGroupsByMemberRequest) String() string { return proto.CompactTextString(m) }
+func (*QueryGroupsByMemberRequest) ProtoMessage() {}
+func (*QueryGroupsByMemberRequest) Descriptor() ([]byte, []int) {
+ return fileDescriptor_ae47912b18757b1a, []int{22}
+}
+func (m *QueryGroupsByMemberRequest) XXX_Unmarshal(b []byte) error {
+ return m.Unmarshal(b)
+}
+func (m *QueryGroupsByMemberRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+ if deterministic {
+ return xxx_messageInfo_QueryGroupsByMemberRequest.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 *QueryGroupsByMemberRequest) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_QueryGroupsByMemberRequest.Merge(m, src)
+}
+func (m *QueryGroupsByMemberRequest) XXX_Size() int {
+ return m.Size()
+}
+func (m *QueryGroupsByMemberRequest) XXX_DiscardUnknown() {
+ xxx_messageInfo_QueryGroupsByMemberRequest.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_QueryGroupsByMemberRequest proto.InternalMessageInfo
+
+func (m *QueryGroupsByMemberRequest) GetAddress() string {
+ if m != nil {
+ return m.Address
+ }
+ return ""
+}
+
+func (m *QueryGroupsByMemberRequest) GetPagination() *query.PageRequest {
+ if m != nil {
+ return m.Pagination
+ }
+ return nil
+}
+
+// QueryGroupsByMemberResponse is the Query/GroupsByMember response type.
+type QueryGroupsByMemberResponse struct {
+ // groups are the groups info with the provided group member.
+ Groups []*GroupInfo `protobuf:"bytes,1,rep,name=groups,proto3" json:"groups,omitempty"`
+ // pagination defines the pagination in the response.
+ Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"`
+}
+
+func (m *QueryGroupsByMemberResponse) Reset() { *m = QueryGroupsByMemberResponse{} }
+func (m *QueryGroupsByMemberResponse) String() string { return proto.CompactTextString(m) }
+func (*QueryGroupsByMemberResponse) ProtoMessage() {}
+func (*QueryGroupsByMemberResponse) Descriptor() ([]byte, []int) {
+ return fileDescriptor_ae47912b18757b1a, []int{23}
+}
+func (m *QueryGroupsByMemberResponse) XXX_Unmarshal(b []byte) error {
+ return m.Unmarshal(b)
+}
+func (m *QueryGroupsByMemberResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+ if deterministic {
+ return xxx_messageInfo_QueryGroupsByMemberResponse.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 *QueryGroupsByMemberResponse) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_QueryGroupsByMemberResponse.Merge(m, src)
+}
+func (m *QueryGroupsByMemberResponse) XXX_Size() int {
+ return m.Size()
+}
+func (m *QueryGroupsByMemberResponse) XXX_DiscardUnknown() {
+ xxx_messageInfo_QueryGroupsByMemberResponse.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_QueryGroupsByMemberResponse proto.InternalMessageInfo
+
+func (m *QueryGroupsByMemberResponse) GetGroups() []*GroupInfo {
+ if m != nil {
+ return m.Groups
+ }
+ return nil
+}
+
+func (m *QueryGroupsByMemberResponse) GetPagination() *query.PageResponse {
+ if m != nil {
+ return m.Pagination
+ }
+ return nil
+}
+
func init() {
proto.RegisterType((*QueryGroupInfoRequest)(nil), "cosmos.group.v1beta1.QueryGroupInfoRequest")
proto.RegisterType((*QueryGroupInfoResponse)(nil), "cosmos.group.v1beta1.QueryGroupInfoResponse")
@@ -1200,82 +1310,87 @@ func init() {
proto.RegisterType((*QueryVotesByProposalResponse)(nil), "cosmos.group.v1beta1.QueryVotesByProposalResponse")
proto.RegisterType((*QueryVotesByVoterRequest)(nil), "cosmos.group.v1beta1.QueryVotesByVoterRequest")
proto.RegisterType((*QueryVotesByVoterResponse)(nil), "cosmos.group.v1beta1.QueryVotesByVoterResponse")
+ proto.RegisterType((*QueryGroupsByMemberRequest)(nil), "cosmos.group.v1beta1.QueryGroupsByMemberRequest")
+ proto.RegisterType((*QueryGroupsByMemberResponse)(nil), "cosmos.group.v1beta1.QueryGroupsByMemberResponse")
}
func init() { proto.RegisterFile("cosmos/group/v1beta1/query.proto", fileDescriptor_ae47912b18757b1a) }
var fileDescriptor_ae47912b18757b1a = []byte{
- // 1109 bytes of a gzipped FileDescriptorProto
- 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x58, 0x41, 0x6f, 0x1b, 0x45,
- 0x14, 0xce, 0x94, 0xb4, 0x49, 0x5e, 0x5a, 0x8a, 0x86, 0x00, 0xce, 0x52, 0x9c, 0x74, 0xa9, 0xa0,
- 0x6a, 0x9a, 0xdd, 0xc4, 0x69, 0x62, 0x30, 0x05, 0x11, 0x0b, 0x51, 0x05, 0x29, 0x52, 0x71, 0x25,
- 0x0e, 0x70, 0x88, 0xd6, 0xf1, 0xc6, 0xac, 0xa8, 0x77, 0xdc, 0xdd, 0x75, 0x85, 0x15, 0xf9, 0x82,
- 0x04, 0x67, 0x44, 0x25, 0xa4, 0x82, 0x84, 0xc4,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 0xa3, 0x22, 0x79,
+ 0xff, 0xb8, 0x38, 0x71, 0x78, 0x5c, 0x9c, 0xf8, 0xfd, 0xb8, 0x38, 0xf1, 0xfa, 0xa5, 0x56, 0xdb,
+ 0x7b, 0xb3, 0xd7, 0xd0, 0x77, 0x59, 0x47, 0xae, 0x2a, 0xfe, 0x2c, 0xbb, 0xcd, 0xb7, 0x8c, 0xb7,
+ 0xc5, 0xa2, 0x8d, 0x33, 0xfc, 0xdf, 0xaa, 0x6b, 0x7f, 0x05, 0x00, 0x00, 0xff, 0xff, 0x46, 0x16,
+ 0x8f, 0xe9, 0x17, 0x16, 0x00, 0x00,
}
// Reference imports to suppress errors if they are not otherwise used.
@@ -1312,6 +1427,8 @@ type QueryClient interface {
VotesByProposal(ctx context.Context, in *QueryVotesByProposalRequest, opts ...grpc.CallOption) (*QueryVotesByProposalResponse, error)
// VotesByVoter queries a vote by voter.
VotesByVoter(ctx context.Context, in *QueryVotesByVoterRequest, opts ...grpc.CallOption) (*QueryVotesByVoterResponse, error)
+ // GroupsByMember queries groups by member address.
+ GroupsByMember(ctx context.Context, in *QueryGroupsByMemberRequest, opts ...grpc.CallOption) (*QueryGroupsByMemberResponse, error)
}
type queryClient struct {
@@ -1421,6 +1538,15 @@ func (c *queryClient) VotesByVoter(ctx context.Context, in *QueryVotesByVoterReq
return out, nil
}
+func (c *queryClient) GroupsByMember(ctx context.Context, in *QueryGroupsByMemberRequest, opts ...grpc.CallOption) (*QueryGroupsByMemberResponse, error) {
+ out := new(QueryGroupsByMemberResponse)
+ err := c.cc.Invoke(ctx, "/cosmos.group.v1beta1.Query/GroupsByMember", in, out, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return out, nil
+}
+
// QueryServer is the server API for Query service.
type QueryServer interface {
// GroupInfo queries group info based on group id.
@@ -1445,6 +1571,8 @@ type QueryServer interface {
VotesByProposal(context.Context, *QueryVotesByProposalRequest) (*QueryVotesByProposalResponse, error)
// VotesByVoter queries a vote by voter.
VotesByVoter(context.Context, *QueryVotesByVoterRequest) (*QueryVotesByVoterResponse, error)
+ // GroupsByMember queries groups by member address.
+ GroupsByMember(context.Context, *QueryGroupsByMemberRequest) (*QueryGroupsByMemberResponse, error)
}
// UnimplementedQueryServer can be embedded to have forward compatible implementations.
@@ -1484,6 +1612,9 @@ func (*UnimplementedQueryServer) VotesByProposal(ctx context.Context, req *Query
func (*UnimplementedQueryServer) VotesByVoter(ctx context.Context, req *QueryVotesByVoterRequest) (*QueryVotesByVoterResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method VotesByVoter not implemented")
}
+func (*UnimplementedQueryServer) GroupsByMember(ctx context.Context, req *QueryGroupsByMemberRequest) (*QueryGroupsByMemberResponse, error) {
+ return nil, status.Errorf(codes.Unimplemented, "method GroupsByMember not implemented")
+}
func RegisterQueryServer(s grpc1.Server, srv QueryServer) {
s.RegisterService(&_Query_serviceDesc, srv)
@@ -1687,6 +1818,24 @@ func _Query_VotesByVoter_Handler(srv interface{}, ctx context.Context, dec func(
return interceptor(ctx, in, info, handler)
}
+func _Query_GroupsByMember_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+ in := new(QueryGroupsByMemberRequest)
+ if err := dec(in); err != nil {
+ return nil, err
+ }
+ if interceptor == nil {
+ return srv.(QueryServer).GroupsByMember(ctx, in)
+ }
+ info := &grpc.UnaryServerInfo{
+ Server: srv,
+ FullMethod: "/cosmos.group.v1beta1.Query/GroupsByMember",
+ }
+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+ return srv.(QueryServer).GroupsByMember(ctx, req.(*QueryGroupsByMemberRequest))
+ }
+ return interceptor(ctx, in, info, handler)
+}
+
var _Query_serviceDesc = grpc.ServiceDesc{
ServiceName: "cosmos.group.v1beta1.Query",
HandlerType: (*QueryServer)(nil),
@@ -1735,6 +1884,10 @@ var _Query_serviceDesc = grpc.ServiceDesc{
MethodName: "VotesByVoter",
Handler: _Query_VotesByVoter_Handler,
},
+ {
+ MethodName: "GroupsByMember",
+ Handler: _Query_GroupsByMember_Handler,
+ },
},
Streams: []grpc.StreamDesc{},
Metadata: "cosmos/group/v1beta1/query.proto",
@@ -2632,6 +2785,97 @@ func (m *QueryVotesByVoterResponse) MarshalToSizedBuffer(dAtA []byte) (int, erro
return len(dAtA) - i, nil
}
+func (m *QueryGroupsByMemberRequest) 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 *QueryGroupsByMemberRequest) MarshalTo(dAtA []byte) (int, error) {
+ size := m.Size()
+ return m.MarshalToSizedBuffer(dAtA[:size])
+}
+
+func (m *QueryGroupsByMemberRequest) 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.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 *QueryGroupsByMemberResponse) 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 *QueryGroupsByMemberResponse) MarshalTo(dAtA []byte) (int, error) {
+ size := m.Size()
+ return m.MarshalToSizedBuffer(dAtA[:size])
+}
+
+func (m *QueryGroupsByMemberResponse) 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.Groups) > 0 {
+ for iNdEx := len(m.Groups) - 1; iNdEx >= 0; iNdEx-- {
+ {
+ size, err := m.Groups[iNdEx].MarshalToSizedBuffer(dAtA[:i])
+ if err != nil {
+ return 0, err
+ }
+ i -= size
+ i = encodeVarintQuery(dAtA, i, uint64(size))
+ }
+ i--
+ dAtA[i] = 0xa
+ }
+ }
+ return len(dAtA) - i, nil
+}
+
func encodeVarintQuery(dAtA []byte, offset int, v uint64) int {
offset -= sovQuery(v)
base := offset
@@ -2997,6 +3241,42 @@ func (m *QueryVotesByVoterResponse) Size() (n int) {
return n
}
+func (m *QueryGroupsByMemberRequest) 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))
+ }
+ if m.Pagination != nil {
+ l = m.Pagination.Size()
+ n += 1 + l + sovQuery(uint64(l))
+ }
+ return n
+}
+
+func (m *QueryGroupsByMemberResponse) Size() (n int) {
+ if m == nil {
+ return 0
+ }
+ var l int
+ _ = l
+ if len(m.Groups) > 0 {
+ for _, e := range m.Groups {
+ l = e.Size()
+ n += 1 + l + sovQuery(uint64(l))
+ }
+ }
+ if m.Pagination != nil {
+ l = m.Pagination.Size()
+ n += 1 + l + sovQuery(uint64(l))
+ }
+ return n
+}
+
func sovQuery(x uint64) (n int) {
return (math_bits.Len64(x|1) + 6) / 7
}
@@ -5295,6 +5575,244 @@ func (m *QueryVotesByVoterResponse) Unmarshal(dAtA []byte) error {
}
return nil
}
+func (m *QueryGroupsByMemberRequest) 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: QueryGroupsByMemberRequest: wiretype end group for non-group")
+ }
+ if fieldNum <= 0 {
+ return fmt.Errorf("proto: QueryGroupsByMemberRequest: 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 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 *QueryGroupsByMemberResponse) 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: QueryGroupsByMemberResponse: wiretype end group for non-group")
+ }
+ if fieldNum <= 0 {
+ return fmt.Errorf("proto: QueryGroupsByMemberResponse: illegal tag %d (wire type %d)", fieldNum, wire)
+ }
+ switch fieldNum {
+ case 1:
+ if wireType != 2 {
+ return fmt.Errorf("proto: wrong wireType = %d for field Groups", 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.Groups = append(m.Groups, &GroupInfo{})
+ if err := m.Groups[len(m.Groups)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
+ return err
+ }
+ iNdEx = postIndex
+ case 2:
+ if wireType != 2 {
+ return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType)
+ }
+ var msglen int
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowQuery
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ msglen |= int(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ if msglen < 0 {
+ return ErrInvalidLengthQuery
+ }
+ postIndex := iNdEx + msglen
+ if postIndex < 0 {
+ return ErrInvalidLengthQuery
+ }
+ if postIndex > l {
+ return io.ErrUnexpectedEOF
+ }
+ if m.Pagination == nil {
+ m.Pagination = &query.PageResponse{}
+ }
+ if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
+ return err
+ }
+ iNdEx = postIndex
+ default:
+ iNdEx = preIndex
+ skippy, err := skipQuery(dAtA[iNdEx:])
+ if err != nil {
+ return err
+ }
+ if (skippy < 0) || (iNdEx+skippy) < 0 {
+ return ErrInvalidLengthQuery
+ }
+ if (iNdEx + skippy) > l {
+ return io.ErrUnexpectedEOF
+ }
+ iNdEx += skippy
+ }
+ }
+
+ if iNdEx > l {
+ return io.ErrUnexpectedEOF
+ }
+ return nil
+}
func skipQuery(dAtA []byte) (n int, err error) {
l := len(dAtA)
iNdEx := 0
diff --git a/x/group/query.pb.gw.go b/x/group/query.pb.gw.go
index c1e73f01e..6393c0bd7 100644
--- a/x/group/query.pb.gw.go
+++ b/x/group/query.pb.gw.go
@@ -773,6 +773,78 @@ func local_request_Query_VotesByVoter_0(ctx context.Context, marshaler runtime.M
}
+var (
+ filter_Query_GroupsByMember_0 = &utilities.DoubleArray{Encoding: map[string]int{"address": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}}
+)
+
+func request_Query_GroupsByMember_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
+ var protoReq QueryGroupsByMemberRequest
+ var metadata runtime.ServerMetadata
+
+ var (
+ val string
+ ok bool
+ err error
+ _ = err
+ )
+
+ val, ok = pathParams["address"]
+ if !ok {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "address")
+ }
+
+ protoReq.Address, err = runtime.String(val)
+
+ if err != nil {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "address", err)
+ }
+
+ if err := req.ParseForm(); err != nil {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
+ }
+ if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_GroupsByMember_0); err != nil {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
+ }
+
+ msg, err := client.GroupsByMember(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
+ return msg, metadata, err
+
+}
+
+func local_request_Query_GroupsByMember_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
+ var protoReq QueryGroupsByMemberRequest
+ var metadata runtime.ServerMetadata
+
+ var (
+ val string
+ ok bool
+ err error
+ _ = err
+ )
+
+ val, ok = pathParams["address"]
+ if !ok {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "address")
+ }
+
+ protoReq.Address, err = runtime.String(val)
+
+ if err != nil {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "address", err)
+ }
+
+ if err := req.ParseForm(); err != nil {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
+ }
+ if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_GroupsByMember_0); err != nil {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
+ }
+
+ msg, err := server.GroupsByMember(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.
@@ -999,6 +1071,26 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv
})
+ mux.Handle("GET", pattern_Query_GroupsByMember_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
+ ctx, cancel := context.WithCancel(req.Context())
+ defer cancel()
+ inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
+ rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
+ if err != nil {
+ runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
+ return
+ }
+ resp, md, err := local_request_Query_GroupsByMember_0(rctx, inboundMarshaler, server, req, pathParams)
+ ctx = runtime.NewServerMetadataContext(ctx, md)
+ if err != nil {
+ runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
+ return
+ }
+
+ forward_Query_GroupsByMember_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
+
+ })
+
return nil
}
@@ -1260,6 +1352,26 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie
})
+ mux.Handle("GET", pattern_Query_GroupsByMember_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_GroupsByMember_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_GroupsByMember_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
+
+ })
+
return nil
}
@@ -1285,6 +1397,8 @@ var (
pattern_Query_VotesByProposal_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"cosmos", "group", "v1beta1", "votes_by_proposal", "proposal_id"}, "", runtime.AssumeColonVerbOpt(false)))
pattern_Query_VotesByVoter_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"cosmos", "group", "v1beta1", "votes_by_voter", "voter"}, "", runtime.AssumeColonVerbOpt(false)))
+
+ pattern_Query_GroupsByMember_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"cosmos", "group", "v1beta1", "groups_by_member", "address"}, "", runtime.AssumeColonVerbOpt(false)))
)
var (
@@ -1309,4 +1423,6 @@ var (
forward_Query_VotesByProposal_0 = runtime.ForwardResponseMessage
forward_Query_VotesByVoter_0 = runtime.ForwardResponseMessage
+
+ forward_Query_GroupsByMember_0 = runtime.ForwardResponseMessage
)