feat: add feegrant query to see allowances from a given granter (#10947)
This commit is contained in:
parent
628547cb4e
commit
eb01537f3c
|
@ -56,6 +56,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
|
|||
* [\#10507](https://github.com/cosmos/cosmos-sdk/pull/10507) Add middleware for tx priority.
|
||||
* [\#10311](https://github.com/cosmos/cosmos-sdk/pull/10311) Adds cli to use tips transactions. It adds an `--aux` flag to all CLI tx commands to generate the aux signer data (with optional tip), and a new `tx aux-to-fee` subcommand to let the fee payer gather aux signer data and broadcast the tx
|
||||
* [\#10430](https://github.com/cosmos/cosmos-sdk/pull/10430) ADR-040: Add store/v2 `MultiStore` implementation
|
||||
* [\#10947](https://github.com/cosmos/cosmos-sdk/pull/10947) Add `AllowancesByGranter` query to the feegrant module
|
||||
|
||||
### API Breaking Changes
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -26,6 +26,9 @@ type QueryClient interface {
|
|||
Allowance(ctx context.Context, in *QueryAllowanceRequest, opts ...grpc.CallOption) (*QueryAllowanceResponse, error)
|
||||
// Allowances returns all the grants for address.
|
||||
Allowances(ctx context.Context, in *QueryAllowancesRequest, opts ...grpc.CallOption) (*QueryAllowancesResponse, error)
|
||||
// AllowancesByGranter returns all the grants given by an address
|
||||
// Since v0.46
|
||||
AllowancesByGranter(ctx context.Context, in *QueryAllowancesByGranterRequest, opts ...grpc.CallOption) (*QueryAllowancesByGranterResponse, error)
|
||||
}
|
||||
|
||||
type queryClient struct {
|
||||
|
@ -54,6 +57,15 @@ func (c *queryClient) Allowances(ctx context.Context, in *QueryAllowancesRequest
|
|||
return out, nil
|
||||
}
|
||||
|
||||
func (c *queryClient) AllowancesByGranter(ctx context.Context, in *QueryAllowancesByGranterRequest, opts ...grpc.CallOption) (*QueryAllowancesByGranterResponse, error) {
|
||||
out := new(QueryAllowancesByGranterResponse)
|
||||
err := c.cc.Invoke(ctx, "/cosmos.feegrant.v1beta1.Query/AllowancesByGranter", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// QueryServer is the server API for Query service.
|
||||
// All implementations must embed UnimplementedQueryServer
|
||||
// for forward compatibility
|
||||
|
@ -62,6 +74,9 @@ type QueryServer interface {
|
|||
Allowance(context.Context, *QueryAllowanceRequest) (*QueryAllowanceResponse, error)
|
||||
// Allowances returns all the grants for address.
|
||||
Allowances(context.Context, *QueryAllowancesRequest) (*QueryAllowancesResponse, error)
|
||||
// AllowancesByGranter returns all the grants given by an address
|
||||
// Since v0.46
|
||||
AllowancesByGranter(context.Context, *QueryAllowancesByGranterRequest) (*QueryAllowancesByGranterResponse, error)
|
||||
mustEmbedUnimplementedQueryServer()
|
||||
}
|
||||
|
||||
|
@ -75,6 +90,9 @@ func (UnimplementedQueryServer) Allowance(context.Context, *QueryAllowanceReques
|
|||
func (UnimplementedQueryServer) Allowances(context.Context, *QueryAllowancesRequest) (*QueryAllowancesResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method Allowances not implemented")
|
||||
}
|
||||
func (UnimplementedQueryServer) AllowancesByGranter(context.Context, *QueryAllowancesByGranterRequest) (*QueryAllowancesByGranterResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method AllowancesByGranter not implemented")
|
||||
}
|
||||
func (UnimplementedQueryServer) mustEmbedUnimplementedQueryServer() {}
|
||||
|
||||
// UnsafeQueryServer may be embedded to opt out of forward compatibility for this service.
|
||||
|
@ -124,6 +142,24 @@ func _Query_Allowances_Handler(srv interface{}, ctx context.Context, dec func(in
|
|||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Query_AllowancesByGranter_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(QueryAllowancesByGranterRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(QueryServer).AllowancesByGranter(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/cosmos.feegrant.v1beta1.Query/AllowancesByGranter",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(QueryServer).AllowancesByGranter(ctx, req.(*QueryAllowancesByGranterRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
// Query_ServiceDesc is the grpc.ServiceDesc for Query service.
|
||||
// It's only intended for direct use with grpc.RegisterService,
|
||||
// and not to be introspected or modified (even as a copy)
|
||||
|
@ -139,6 +175,10 @@ var Query_ServiceDesc = grpc.ServiceDesc{
|
|||
MethodName: "Allowances",
|
||||
Handler: _Query_Allowances_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "AllowancesByGranter",
|
||||
Handler: _Query_AllowancesByGranter_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
Metadata: "cosmos/feegrant/v1beta1/query.proto",
|
||||
|
|
|
@ -21,6 +21,12 @@ service Query {
|
|||
rpc Allowances(QueryAllowancesRequest) returns (QueryAllowancesResponse) {
|
||||
option (google.api.http).get = "/cosmos/feegrant/v1beta1/allowances/{grantee}";
|
||||
}
|
||||
|
||||
// AllowancesByGranter returns all the grants given by an address
|
||||
// Since v0.46
|
||||
rpc AllowancesByGranter(QueryAllowancesByGranterRequest) returns (QueryAllowancesByGranterResponse) {
|
||||
option (google.api.http).get = "/cosmos/feegrant/v1beta1/issued/{granter}";
|
||||
}
|
||||
}
|
||||
|
||||
// QueryAllowanceRequest is the request type for the Query/Allowance RPC method.
|
||||
|
@ -54,3 +60,20 @@ message QueryAllowancesResponse {
|
|||
// pagination defines an pagination for the response.
|
||||
cosmos.base.query.v1beta1.PageResponse pagination = 2;
|
||||
}
|
||||
|
||||
// QueryAllowancesByGranterRequest is the request type for the Query/AllowancesByGranter RPC method.
|
||||
message QueryAllowancesByGranterRequest {
|
||||
string granter = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
|
||||
|
||||
// pagination defines an pagination for the request.
|
||||
cosmos.base.query.v1beta1.PageRequest pagination = 2;
|
||||
}
|
||||
|
||||
// QueryAllowancesByGranterResponse is the response type for the Query/AllowancesByGranter RPC method.
|
||||
message QueryAllowancesByGranterResponse {
|
||||
// allowances that have been issued by the granter.
|
||||
repeated cosmos.feegrant.v1beta1.Grant allowances = 1;
|
||||
|
||||
// pagination defines an pagination for the response.
|
||||
cosmos.base.query.v1beta1.PageResponse pagination = 2;
|
||||
}
|
||||
|
|
|
@ -25,7 +25,8 @@ func GetQueryCmd() *cobra.Command {
|
|||
|
||||
feegrantQueryCmd.AddCommand(
|
||||
GetCmdQueryFeeGrant(),
|
||||
GetCmdQueryFeeGrants(),
|
||||
GetCmdQueryFeeGrantsByGrantee(),
|
||||
GetCmdQueryFeeGrantsByGranter(),
|
||||
)
|
||||
|
||||
return feegrantQueryCmd
|
||||
|
@ -80,8 +81,8 @@ $ %s query feegrant grant [granter] [grantee]
|
|||
return cmd
|
||||
}
|
||||
|
||||
// GetCmdQueryFeeGrants returns cmd to query for all grants for a grantee.
|
||||
func GetCmdQueryFeeGrants() *cobra.Command {
|
||||
// GetCmdQueryFeeGrantsByGrantee returns cmd to query for all grants for a grantee.
|
||||
func GetCmdQueryFeeGrantsByGrantee() *cobra.Command {
|
||||
cmd := &cobra.Command{
|
||||
Use: "grants [grantee]",
|
||||
Args: cobra.ExactArgs(1),
|
||||
|
@ -128,3 +129,52 @@ $ %s query feegrant grants [grantee]
|
|||
|
||||
return cmd
|
||||
}
|
||||
|
||||
// GetCmdQueryFeeGrantsByGranter returns cmd to query for all grants by a granter.
|
||||
func GetCmdQueryFeeGrantsByGranter() *cobra.Command {
|
||||
cmd := &cobra.Command{
|
||||
Use: "grants [granter]",
|
||||
Args: cobra.ExactArgs(1),
|
||||
Short: "Query all grants by a granter",
|
||||
Long: strings.TrimSpace(
|
||||
fmt.Sprintf(`Queries all the grants issued for a granter address.
|
||||
|
||||
Example:
|
||||
$ %s query feegrant grants [granter]
|
||||
`, version.AppName),
|
||||
),
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
clientCtx := client.GetClientContextFromCmd(cmd)
|
||||
queryClient := feegrant.NewQueryClient(clientCtx)
|
||||
|
||||
granterAddr, err := sdk.AccAddressFromBech32(args[0])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
pageReq, err := client.ReadPageRequest(cmd.Flags())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
res, err := queryClient.AllowancesByGranter(
|
||||
cmd.Context(),
|
||||
&feegrant.QueryAllowancesByGranterRequest{
|
||||
Granter: granterAddr.String(),
|
||||
Pagination: pageReq,
|
||||
},
|
||||
)
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return clientCtx.PrintProto(res)
|
||||
},
|
||||
}
|
||||
|
||||
flags.AddQueryFlagsToCmd(cmd)
|
||||
flags.AddPaginationFlagsToCmd(cmd, "grants")
|
||||
|
||||
return cmd
|
||||
}
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
//go:build norace
|
||||
// +build norace
|
||||
|
||||
package testutil
|
||||
|
|
|
@ -198,7 +198,7 @@ func (s *IntegrationTestSuite) TestCmdGetFeeGrant() {
|
|||
}
|
||||
}
|
||||
|
||||
func (s *IntegrationTestSuite) TestCmdGetFeeGrants() {
|
||||
func (s *IntegrationTestSuite) TestCmdGetFeeGrantsByGrantee() {
|
||||
val := s.network.Validators[0]
|
||||
grantee := s.addedGrantee
|
||||
clientCtx := val.ClientCtx
|
||||
|
@ -219,7 +219,7 @@ func (s *IntegrationTestSuite) TestCmdGetFeeGrants() {
|
|||
true, nil, 0,
|
||||
},
|
||||
{
|
||||
"non existed grantee",
|
||||
"non existent grantee",
|
||||
[]string{
|
||||
"cosmos1nph3cfzk6trsmfxkeu943nvach5qw4vwstnvkl",
|
||||
fmt.Sprintf("--%s=json", tmcli.OutputFlag),
|
||||
|
@ -240,7 +240,63 @@ func (s *IntegrationTestSuite) TestCmdGetFeeGrants() {
|
|||
tc := tc
|
||||
|
||||
s.Run(tc.name, func() {
|
||||
cmd := cli.GetCmdQueryFeeGrants()
|
||||
cmd := cli.GetCmdQueryFeeGrantsByGrantee()
|
||||
out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, tc.args)
|
||||
|
||||
if tc.expectErr {
|
||||
s.Require().Error(err)
|
||||
} else {
|
||||
s.Require().NoError(err)
|
||||
s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), tc.resp), out.String())
|
||||
s.Require().Len(tc.resp.Allowances, tc.expectLength)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func (s *IntegrationTestSuite) TestCmdGetFeeGrantsByGranter() {
|
||||
val := s.network.Validators[0]
|
||||
granter := s.addedGranter
|
||||
clientCtx := val.ClientCtx
|
||||
|
||||
testCases := []struct {
|
||||
name string
|
||||
args []string
|
||||
expectErr bool
|
||||
resp *feegrant.QueryAllowancesByGranterResponse
|
||||
expectLength int
|
||||
}{
|
||||
{
|
||||
"wrong grantee",
|
||||
[]string{
|
||||
"wrong_grantee",
|
||||
fmt.Sprintf("--%s=json", tmcli.OutputFlag),
|
||||
},
|
||||
true, nil, 0,
|
||||
},
|
||||
{
|
||||
"non existent grantee",
|
||||
[]string{
|
||||
"cosmos1nph3cfzk6trsmfxkeu943nvach5qw4vwstnvkl",
|
||||
fmt.Sprintf("--%s=json", tmcli.OutputFlag),
|
||||
},
|
||||
false, &feegrant.QueryAllowancesByGranterResponse{}, 0,
|
||||
},
|
||||
{
|
||||
"valid req",
|
||||
[]string{
|
||||
granter.String(),
|
||||
fmt.Sprintf("--%s=json", tmcli.OutputFlag),
|
||||
},
|
||||
false, &feegrant.QueryAllowancesByGranterResponse{}, 1,
|
||||
},
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
tc := tc
|
||||
|
||||
s.Run(tc.name, func() {
|
||||
cmd := cli.GetCmdQueryFeeGrantsByGranter()
|
||||
out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, tc.args)
|
||||
|
||||
if tc.expectErr {
|
||||
|
|
|
@ -93,3 +93,42 @@ func (q Keeper) Allowances(c context.Context, req *feegrant.QueryAllowancesReque
|
|||
|
||||
return &feegrant.QueryAllowancesResponse{Allowances: grants, Pagination: pageRes}, nil
|
||||
}
|
||||
|
||||
// AllowancesByGranter queries all the allowances granted by the given granter
|
||||
func (q Keeper) AllowancesByGranter(c context.Context, req *feegrant.QueryAllowancesByGranterRequest) (*feegrant.QueryAllowancesByGranterResponse, error) {
|
||||
if req == nil {
|
||||
return nil, status.Error(codes.InvalidArgument, "invalid request")
|
||||
}
|
||||
|
||||
granterAddr, err := sdk.AccAddressFromBech32(req.Granter)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
ctx := sdk.UnwrapSDKContext(c)
|
||||
|
||||
var grants []*feegrant.Grant
|
||||
|
||||
store := ctx.KVStore(q.storeKey)
|
||||
pageRes, err := query.Paginate(store, req.Pagination, func(key []byte, value []byte) error {
|
||||
var grant feegrant.Grant
|
||||
|
||||
granter, _ := feegrant.ParseAddressesFromFeeAllowanceKey(key)
|
||||
if !granter.Equals(granterAddr) {
|
||||
return nil
|
||||
}
|
||||
|
||||
if err := q.cdc.Unmarshal(value, &grant); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
grants = append(grants, &grant)
|
||||
return nil
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
return nil, status.Error(codes.Internal, err.Error())
|
||||
}
|
||||
|
||||
return &feegrant.QueryAllowancesByGranterResponse{Allowances: grants, Pagination: pageRes}, nil
|
||||
}
|
||||
|
|
|
@ -148,6 +148,72 @@ func (suite *KeeperTestSuite) TestFeeAllowances() {
|
|||
}
|
||||
}
|
||||
|
||||
func (suite *KeeperTestSuite) TestFeeAllowancesByGranter() {
|
||||
testCases := []struct {
|
||||
name string
|
||||
req *feegrant.QueryAllowancesByGranterRequest
|
||||
expectErr bool
|
||||
preRun func()
|
||||
postRun func(_ *feegrant.QueryAllowancesByGranterResponse)
|
||||
}{
|
||||
{
|
||||
"nil request",
|
||||
nil,
|
||||
true,
|
||||
func() {},
|
||||
func(*feegrant.QueryAllowancesByGranterResponse) {},
|
||||
},
|
||||
{
|
||||
"fail: invalid grantee",
|
||||
&feegrant.QueryAllowancesByGranterRequest{
|
||||
Granter: "invalid_grantee",
|
||||
},
|
||||
true,
|
||||
func() {},
|
||||
func(*feegrant.QueryAllowancesByGranterResponse) {},
|
||||
},
|
||||
{
|
||||
"no grants",
|
||||
&feegrant.QueryAllowancesByGranterRequest{
|
||||
Granter: suite.addrs[0].String(),
|
||||
},
|
||||
false,
|
||||
func() {},
|
||||
func(resp *feegrant.QueryAllowancesByGranterResponse) {
|
||||
suite.Require().Equal(len(resp.Allowances), 0)
|
||||
},
|
||||
},
|
||||
{
|
||||
"valid query: expect single grant",
|
||||
&feegrant.QueryAllowancesByGranterRequest{
|
||||
Granter: suite.addrs[0].String(),
|
||||
},
|
||||
false,
|
||||
func() {
|
||||
grantFeeAllowance(suite)
|
||||
},
|
||||
func(resp *feegrant.QueryAllowancesByGranterResponse) {
|
||||
suite.Require().Equal(len(resp.Allowances), 1)
|
||||
suite.Require().Equal(resp.Allowances[0].Granter, suite.addrs[0].String())
|
||||
suite.Require().Equal(resp.Allowances[0].Grantee, suite.addrs[1].String())
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
suite.Run(tc.name, func() {
|
||||
tc.preRun()
|
||||
resp, err := suite.keeper.AllowancesByGranter(suite.ctx, tc.req)
|
||||
if tc.expectErr {
|
||||
suite.Require().Error(err)
|
||||
} else {
|
||||
suite.Require().NoError(err)
|
||||
tc.postRun(resp)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func grantFeeAllowance(suite *KeeperTestSuite) {
|
||||
exp := suite.sdkCtx.BlockTime().AddDate(1, 0, 0)
|
||||
err := suite.app.FeeGrantKeeper.GrantAllowance(suite.sdkCtx, suite.addrs[0], suite.addrs[1], &feegrant.BasicAllowance{
|
||||
|
|
|
@ -3,6 +3,7 @@ package feegrant
|
|||
import (
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
"github.com/cosmos/cosmos-sdk/types/address"
|
||||
"github.com/cosmos/cosmos-sdk/types/kv"
|
||||
)
|
||||
|
||||
const (
|
||||
|
@ -34,3 +35,17 @@ func FeeAllowanceKey(granter sdk.AccAddress, grantee sdk.AccAddress) []byte {
|
|||
func FeeAllowancePrefixByGrantee(grantee sdk.AccAddress) []byte {
|
||||
return append(FeeAllowanceKeyPrefix, address.MustLengthPrefix(grantee.Bytes())...)
|
||||
}
|
||||
|
||||
func ParseAddressesFromFeeAllowanceKey(key []byte) (granter, grantee sdk.AccAddress) {
|
||||
// key is of format:
|
||||
// 0x00<granteeAddressLen (1 Byte)><granteeAddress_Bytes><granterAddressLen (1 Byte)><granterAddress_Bytes><msgType_Bytes>
|
||||
kv.AssertKeyAtLeastLength(key, 2)
|
||||
granteeAddrLen := key[1] // remove prefix key
|
||||
kv.AssertKeyAtLeastLength(key, int(2+granteeAddrLen))
|
||||
grantee = sdk.AccAddress(key[2 : 2+granteeAddrLen])
|
||||
granterAddrLen := int(key[2+granteeAddrLen])
|
||||
kv.AssertKeyAtLeastLength(key, 3+int(granteeAddrLen+byte(granterAddrLen)))
|
||||
granter = sdk.AccAddress(key[3+granterAddrLen : 3+granteeAddrLen+byte(granterAddrLen)])
|
||||
|
||||
return granter, grantee
|
||||
}
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
package feegrant_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
"github.com/cosmos/cosmos-sdk/x/feegrant"
|
||||
)
|
||||
|
||||
func TestMarshalAndUnmarshalFeegrantKey(t *testing.T) {
|
||||
grantee, err := sdk.AccAddressFromBech32("cosmos1qk93t4j0yyzgqgt6k5qf8deh8fq6smpn3ntu3x")
|
||||
require.NoError(t, err)
|
||||
granter, err := sdk.AccAddressFromBech32("cosmos1p9qh4ldfd6n0qehujsal4k7g0e37kel90rc4ts")
|
||||
require.NoError(t, err)
|
||||
|
||||
key := feegrant.FeeAllowanceKey(granter, grantee)
|
||||
require.Len(t, key, len(grantee.Bytes())+len(granter.Bytes())+3)
|
||||
require.Equal(t, feegrant.FeeAllowancePrefixByGrantee(grantee), key[:len(grantee.Bytes())+2])
|
||||
|
||||
g1, g2 := feegrant.ParseAddressesFromFeeAllowanceKey(key)
|
||||
require.Equal(t, granter, g1)
|
||||
require.Equal(t, grantee, g2)
|
||||
}
|
|
@ -240,11 +240,122 @@ func (m *QueryAllowancesResponse) GetPagination() *query.PageResponse {
|
|||
return nil
|
||||
}
|
||||
|
||||
// QueryAllowancesByGranterRequest is the request type for the Query/AllowancesByGranter RPC method.
|
||||
type QueryAllowancesByGranterRequest struct {
|
||||
Granter string `protobuf:"bytes,1,opt,name=granter,proto3" json:"granter,omitempty"`
|
||||
// pagination defines an pagination for the request.
|
||||
Pagination *query.PageRequest `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"`
|
||||
}
|
||||
|
||||
func (m *QueryAllowancesByGranterRequest) Reset() { *m = QueryAllowancesByGranterRequest{} }
|
||||
func (m *QueryAllowancesByGranterRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*QueryAllowancesByGranterRequest) ProtoMessage() {}
|
||||
func (*QueryAllowancesByGranterRequest) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_59efc303945de53f, []int{4}
|
||||
}
|
||||
func (m *QueryAllowancesByGranterRequest) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
}
|
||||
func (m *QueryAllowancesByGranterRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
if deterministic {
|
||||
return xxx_messageInfo_QueryAllowancesByGranterRequest.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 *QueryAllowancesByGranterRequest) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_QueryAllowancesByGranterRequest.Merge(m, src)
|
||||
}
|
||||
func (m *QueryAllowancesByGranterRequest) XXX_Size() int {
|
||||
return m.Size()
|
||||
}
|
||||
func (m *QueryAllowancesByGranterRequest) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_QueryAllowancesByGranterRequest.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_QueryAllowancesByGranterRequest proto.InternalMessageInfo
|
||||
|
||||
func (m *QueryAllowancesByGranterRequest) GetGranter() string {
|
||||
if m != nil {
|
||||
return m.Granter
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *QueryAllowancesByGranterRequest) GetPagination() *query.PageRequest {
|
||||
if m != nil {
|
||||
return m.Pagination
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// QueryAllowancesByGranterResponse is the response type for the Query/AllowancesByGranter RPC method.
|
||||
type QueryAllowancesByGranterResponse struct {
|
||||
// allowances that have been issued by the granter.
|
||||
Allowances []*Grant `protobuf:"bytes,1,rep,name=allowances,proto3" json:"allowances,omitempty"`
|
||||
// pagination defines an pagination for the response.
|
||||
Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"`
|
||||
}
|
||||
|
||||
func (m *QueryAllowancesByGranterResponse) Reset() { *m = QueryAllowancesByGranterResponse{} }
|
||||
func (m *QueryAllowancesByGranterResponse) String() string { return proto.CompactTextString(m) }
|
||||
func (*QueryAllowancesByGranterResponse) ProtoMessage() {}
|
||||
func (*QueryAllowancesByGranterResponse) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_59efc303945de53f, []int{5}
|
||||
}
|
||||
func (m *QueryAllowancesByGranterResponse) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
}
|
||||
func (m *QueryAllowancesByGranterResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
if deterministic {
|
||||
return xxx_messageInfo_QueryAllowancesByGranterResponse.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 *QueryAllowancesByGranterResponse) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_QueryAllowancesByGranterResponse.Merge(m, src)
|
||||
}
|
||||
func (m *QueryAllowancesByGranterResponse) XXX_Size() int {
|
||||
return m.Size()
|
||||
}
|
||||
func (m *QueryAllowancesByGranterResponse) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_QueryAllowancesByGranterResponse.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_QueryAllowancesByGranterResponse proto.InternalMessageInfo
|
||||
|
||||
func (m *QueryAllowancesByGranterResponse) GetAllowances() []*Grant {
|
||||
if m != nil {
|
||||
return m.Allowances
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *QueryAllowancesByGranterResponse) GetPagination() *query.PageResponse {
|
||||
if m != nil {
|
||||
return m.Pagination
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*QueryAllowanceRequest)(nil), "cosmos.feegrant.v1beta1.QueryAllowanceRequest")
|
||||
proto.RegisterType((*QueryAllowanceResponse)(nil), "cosmos.feegrant.v1beta1.QueryAllowanceResponse")
|
||||
proto.RegisterType((*QueryAllowancesRequest)(nil), "cosmos.feegrant.v1beta1.QueryAllowancesRequest")
|
||||
proto.RegisterType((*QueryAllowancesResponse)(nil), "cosmos.feegrant.v1beta1.QueryAllowancesResponse")
|
||||
proto.RegisterType((*QueryAllowancesByGranterRequest)(nil), "cosmos.feegrant.v1beta1.QueryAllowancesByGranterRequest")
|
||||
proto.RegisterType((*QueryAllowancesByGranterResponse)(nil), "cosmos.feegrant.v1beta1.QueryAllowancesByGranterResponse")
|
||||
}
|
||||
|
||||
func init() {
|
||||
|
@ -252,36 +363,40 @@ func init() {
|
|||
}
|
||||
|
||||
var fileDescriptor_59efc303945de53f = []byte{
|
||||
// 461 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x93, 0x4f, 0x8b, 0x13, 0x31,
|
||||
0x18, 0xc6, 0x9b, 0x8a, 0x4a, 0xb3, 0xb7, 0xa0, 0xee, 0x38, 0xc8, 0xb0, 0x8c, 0xb0, 0x2b, 0x42,
|
||||
0x13, 0x77, 0x44, 0xf1, 0x20, 0x0b, 0xdd, 0x83, 0x7b, 0xd5, 0x11, 0x3c, 0x78, 0x91, 0x4c, 0xfb,
|
||||
0x3a, 0x0e, 0x76, 0x93, 0xd9, 0x49, 0xea, 0x1f, 0x64, 0x11, 0xfc, 0x04, 0x82, 0x7e, 0x02, 0x0f,
|
||||
0x9e, 0x3c, 0xfa, 0x21, 0x3c, 0x2e, 0x7a, 0xf1, 0xa6, 0xb4, 0x7e, 0x10, 0x69, 0x26, 0x99, 0x29,
|
||||
0x6d, 0x87, 0xce, 0xa9, 0xcd, 0xe4, 0x79, 0x9e, 0xfc, 0xde, 0x37, 0x6f, 0xf0, 0xf5, 0xa1, 0x54,
|
||||
0xc7, 0x52, 0xb1, 0xe7, 0x00, 0x69, 0xc1, 0x85, 0x66, 0xaf, 0xf6, 0x13, 0xd0, 0x7c, 0x9f, 0x9d,
|
||||
0x4c, 0xa0, 0x78, 0x4b, 0xf3, 0x42, 0x6a, 0x49, 0xb6, 0x4b, 0x11, 0x75, 0x22, 0x6a, 0x45, 0xfe,
|
||||
0x6e, 0x93, 0xbb, 0x52, 0x9a, 0x00, 0xff, 0xa6, 0xd5, 0x25, 0x5c, 0x41, 0x99, 0x5c, 0x29, 0x73,
|
||||
0x9e, 0x66, 0x82, 0xeb, 0x4c, 0x0a, 0xab, 0xbd, 0x96, 0x4a, 0x99, 0x8e, 0x81, 0xf1, 0x3c, 0x63,
|
||||
0x5c, 0x08, 0xa9, 0xcd, 0xa6, 0xb2, 0xbb, 0x57, 0xcb, 0xa4, 0x67, 0x66, 0xc5, 0x2c, 0x97, 0x59,
|
||||
0x84, 0xef, 0xf1, 0xe5, 0x47, 0xf3, 0xe8, 0xc1, 0x78, 0x2c, 0x5f, 0x73, 0x31, 0x84, 0x18, 0x4e,
|
||||
0x26, 0xa0, 0x34, 0x89, 0xf0, 0x45, 0x03, 0x03, 0x85, 0x87, 0x76, 0xd0, 0x8d, 0xde, 0xa1, 0xf7,
|
||||
0xf3, 0x7b, 0xff, 0x92, 0xf5, 0x0e, 0x46, 0xa3, 0x02, 0x94, 0x7a, 0xac, 0x8b, 0x4c, 0xa4, 0xb1,
|
||||
0x13, 0xd6, 0x1e, 0xf0, 0xba, 0xed, 0x3c, 0x10, 0x3e, 0xc1, 0x57, 0x96, 0x01, 0x54, 0x2e, 0x85,
|
||||
0x02, 0x72, 0x1f, 0xf7, 0xb8, 0xfb, 0x68, 0x18, 0xb6, 0xa2, 0x80, 0x36, 0x34, 0x95, 0x1e, 0xcd,
|
||||
0x57, 0x71, 0x6d, 0x08, 0x3f, 0xa3, 0xe5, 0x60, 0xb5, 0x52, 0x1a, 0xb4, 0x2d, 0x0d, 0xc8, 0x03,
|
||||
0x8c, 0xeb, 0xa6, 0x9b, 0xea, 0xb6, 0xa2, 0x5d, 0x47, 0x33, 0xbf, 0x21, 0x5a, 0xde, 0xbd, 0xe3,
|
||||
0x79, 0xc8, 0x53, 0xd7, 0xca, 0x78, 0xc1, 0x19, 0x7e, 0x41, 0x78, 0x7b, 0x05, 0xcb, 0x16, 0x7c,
|
||||
0x80, 0x71, 0xc5, 0xaf, 0x3c, 0xb4, 0x73, 0xae, 0x45, 0xc5, 0x0b, 0x0e, 0x72, 0xb4, 0x86, 0x71,
|
||||
0x6f, 0x23, 0x63, 0x79, 0xf8, 0x22, 0x64, 0xf4, 0xa7, 0x8b, 0xcf, 0x1b, 0x48, 0xf2, 0x0d, 0xe1,
|
||||
0x5e, 0x45, 0x4a, 0x68, 0x23, 0xcc, 0xda, 0x19, 0xf2, 0x59, 0x6b, 0x7d, 0x09, 0x11, 0x1e, 0x7c,
|
||||
0xf8, 0xf5, 0xef, 0x53, 0xf7, 0x1e, 0xb9, 0xcb, 0x9a, 0xde, 0x48, 0x55, 0x2e, 0x7b, 0x67, 0xa7,
|
||||
0xee, 0xd4, 0xfd, 0x83, 0x53, 0xf2, 0x15, 0x61, 0x5c, 0x37, 0x96, 0xb4, 0x3d, 0xdf, 0x4d, 0x86,
|
||||
0x7f, 0xab, 0xbd, 0xc1, 0x12, 0xdf, 0x31, 0xc4, 0x8c, 0xf4, 0x37, 0x13, 0xab, 0x1a, 0xf4, 0x70,
|
||||
0xf0, 0x63, 0x1a, 0xa0, 0xb3, 0x69, 0x80, 0xfe, 0x4e, 0x03, 0xf4, 0x71, 0x16, 0x74, 0xce, 0x66,
|
||||
0x41, 0xe7, 0xf7, 0x2c, 0xe8, 0x3c, 0xdd, 0x4b, 0x33, 0xfd, 0x62, 0x92, 0xd0, 0xa1, 0x3c, 0x76,
|
||||
0x91, 0xe5, 0x4f, 0x5f, 0x8d, 0x5e, 0xb2, 0x37, 0x55, 0x7e, 0x72, 0xc1, 0x3c, 0xe0, 0xdb, 0xff,
|
||||
0x03, 0x00, 0x00, 0xff, 0xff, 0x15, 0x17, 0x19, 0x54, 0x8d, 0x04, 0x00, 0x00,
|
||||
// 525 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x94, 0xbd, 0x8b, 0x13, 0x41,
|
||||
0x18, 0xc6, 0x33, 0xe7, 0x17, 0x79, 0xaf, 0x1b, 0x3f, 0x2e, 0x2e, 0xb2, 0x86, 0x15, 0xee, 0xfc,
|
||||
0x20, 0x3b, 0x26, 0xa2, 0x9c, 0x20, 0x07, 0x49, 0x61, 0x5a, 0x8d, 0x60, 0x61, 0x23, 0x93, 0xe4,
|
||||
0x75, 0x5d, 0xcc, 0xed, 0xe4, 0x76, 0x36, 0xea, 0x21, 0x87, 0xe0, 0x5f, 0x20, 0x68, 0x2b, 0x82,
|
||||
0x85, 0x8d, 0x96, 0xb6, 0xf6, 0x96, 0x87, 0x36, 0x96, 0x92, 0xf8, 0x87, 0x48, 0xe6, 0x63, 0x37,
|
||||
0xe6, 0xb2, 0x64, 0x51, 0x0b, 0xab, 0x64, 0x76, 0x9f, 0xe7, 0xdd, 0xdf, 0xf3, 0xbe, 0x33, 0x03,
|
||||
0xe7, 0x7a, 0x42, 0x6e, 0x0b, 0xc9, 0x1e, 0x20, 0x06, 0x31, 0x8f, 0x12, 0xf6, 0xb8, 0xde, 0xc5,
|
||||
0x84, 0xd7, 0xd9, 0xce, 0x08, 0xe3, 0x5d, 0x7f, 0x18, 0x8b, 0x44, 0xd0, 0x35, 0x2d, 0xf2, 0xad,
|
||||
0xc8, 0x37, 0x22, 0x67, 0x3d, 0xcf, 0x9d, 0x2a, 0x55, 0x01, 0xe7, 0xa2, 0xd1, 0x75, 0xb9, 0x44,
|
||||
0x5d, 0x39, 0x55, 0x0e, 0x79, 0x10, 0x46, 0x3c, 0x09, 0x45, 0x64, 0xb4, 0x67, 0x02, 0x21, 0x82,
|
||||
0x01, 0x32, 0x3e, 0x0c, 0x19, 0x8f, 0x22, 0x91, 0xa8, 0x97, 0xd2, 0xbc, 0x3d, 0xad, 0x2b, 0xdd,
|
||||
0x57, 0x2b, 0x66, 0xb8, 0xd4, 0xc2, 0x7b, 0x0e, 0x27, 0x6f, 0x4f, 0x4b, 0x37, 0x07, 0x03, 0xf1,
|
||||
0x84, 0x47, 0x3d, 0xec, 0xe0, 0xce, 0x08, 0x65, 0x42, 0x1b, 0x70, 0x4c, 0xc1, 0x60, 0x5c, 0x21,
|
||||
0x55, 0x72, 0xbe, 0xdc, 0xaa, 0x7c, 0xfd, 0x54, 0x3b, 0x61, 0xbc, 0xcd, 0x7e, 0x3f, 0x46, 0x29,
|
||||
0xef, 0x24, 0x71, 0x18, 0x05, 0x1d, 0x2b, 0xcc, 0x3c, 0x58, 0x59, 0x29, 0xe6, 0x41, 0xef, 0x2e,
|
||||
0x9c, 0x9a, 0x07, 0x90, 0x43, 0x11, 0x49, 0xa4, 0x37, 0xa0, 0xcc, 0xed, 0x43, 0xc5, 0xb0, 0xda,
|
||||
0x70, 0xfd, 0x9c, 0xa6, 0xfa, 0xed, 0xe9, 0xaa, 0x93, 0x19, 0xbc, 0xd7, 0x64, 0xbe, 0xb0, 0x3c,
|
||||
0x10, 0x0d, 0x8b, 0x46, 0x43, 0x7a, 0x13, 0x20, 0x6b, 0xba, 0x4a, 0xb7, 0xda, 0x58, 0xb7, 0x34,
|
||||
0xd3, 0x09, 0xf9, 0x7a, 0xf6, 0x96, 0xe7, 0x16, 0x0f, 0x6c, 0x2b, 0x3b, 0x33, 0x4e, 0xef, 0x1d,
|
||||
0x81, 0xb5, 0x03, 0x58, 0x26, 0xf0, 0x16, 0x40, 0xca, 0x2f, 0x2b, 0xa4, 0x7a, 0xa8, 0x40, 0xe2,
|
||||
0x19, 0x07, 0x6d, 0x2f, 0x60, 0xdc, 0x58, 0xca, 0xa8, 0x3f, 0xfe, 0x1b, 0xe4, 0x1b, 0x02, 0x67,
|
||||
0xe7, 0x20, 0x5b, 0xbb, 0x6d, 0x3d, 0xe4, 0xbf, 0xd9, 0x1f, 0xff, 0xaa, 0x89, 0x1f, 0x08, 0x54,
|
||||
0xf3, 0xf9, 0xfe, 0xb3, 0x6e, 0x36, 0xde, 0x1e, 0x86, 0x23, 0x8a, 0x96, 0x7e, 0x24, 0x50, 0x4e,
|
||||
0x91, 0xa9, 0x9f, 0x0b, 0xb3, 0xf0, 0x44, 0x3a, 0xac, 0xb0, 0x5e, 0x43, 0x78, 0x5b, 0x2f, 0xbe,
|
||||
0xfd, 0x7c, 0xb5, 0xb2, 0x49, 0xaf, 0xb1, 0xbc, 0x1b, 0x27, 0x8d, 0xcb, 0x9e, 0x99, 0x19, 0xed,
|
||||
0xd9, 0x7f, 0xb8, 0x47, 0xdf, 0x13, 0x80, 0xac, 0xc3, 0xb4, 0xe8, 0xf7, 0xed, 0x39, 0x73, 0x2e,
|
||||
0x17, 0x37, 0x18, 0xe2, 0xab, 0x8a, 0x98, 0xd1, 0xda, 0x72, 0x62, 0x39, 0x03, 0xfa, 0x99, 0xc0,
|
||||
0xf1, 0x05, 0x5b, 0x81, 0x6e, 0x16, 0x05, 0x98, 0xdf, 0xdd, 0xce, 0xf5, 0x3f, 0x70, 0x9a, 0x0c,
|
||||
0x75, 0x95, 0xe1, 0x12, 0xbd, 0x90, 0x9b, 0x21, 0x94, 0x72, 0x84, 0xfd, 0xac, 0xe5, 0xad, 0xe6,
|
||||
0x97, 0xb1, 0x4b, 0xf6, 0xc7, 0x2e, 0xf9, 0x31, 0x76, 0xc9, 0xcb, 0x89, 0x5b, 0xda, 0x9f, 0xb8,
|
||||
0xa5, 0xef, 0x13, 0xb7, 0x74, 0x6f, 0x23, 0x08, 0x93, 0x87, 0xa3, 0xae, 0xdf, 0x13, 0xdb, 0xb6,
|
||||
0x9c, 0xfe, 0xa9, 0xc9, 0xfe, 0x23, 0xf6, 0x34, 0xad, 0xdd, 0x3d, 0xaa, 0xae, 0xf3, 0x2b, 0xbf,
|
||||
0x02, 0x00, 0x00, 0xff, 0xff, 0x67, 0xde, 0x8f, 0xb5, 0x9b, 0x06, 0x00, 0x00,
|
||||
}
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
|
@ -300,6 +415,9 @@ type QueryClient interface {
|
|||
Allowance(ctx context.Context, in *QueryAllowanceRequest, opts ...grpc.CallOption) (*QueryAllowanceResponse, error)
|
||||
// Allowances returns all the grants for address.
|
||||
Allowances(ctx context.Context, in *QueryAllowancesRequest, opts ...grpc.CallOption) (*QueryAllowancesResponse, error)
|
||||
// AllowancesByGranter returns all the grants given by an address
|
||||
// Since v0.46
|
||||
AllowancesByGranter(ctx context.Context, in *QueryAllowancesByGranterRequest, opts ...grpc.CallOption) (*QueryAllowancesByGranterResponse, error)
|
||||
}
|
||||
|
||||
type queryClient struct {
|
||||
|
@ -328,12 +446,24 @@ func (c *queryClient) Allowances(ctx context.Context, in *QueryAllowancesRequest
|
|||
return out, nil
|
||||
}
|
||||
|
||||
func (c *queryClient) AllowancesByGranter(ctx context.Context, in *QueryAllowancesByGranterRequest, opts ...grpc.CallOption) (*QueryAllowancesByGranterResponse, error) {
|
||||
out := new(QueryAllowancesByGranterResponse)
|
||||
err := c.cc.Invoke(ctx, "/cosmos.feegrant.v1beta1.Query/AllowancesByGranter", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// QueryServer is the server API for Query service.
|
||||
type QueryServer interface {
|
||||
// Allowance returns fee granted to the grantee by the granter.
|
||||
Allowance(context.Context, *QueryAllowanceRequest) (*QueryAllowanceResponse, error)
|
||||
// Allowances returns all the grants for address.
|
||||
Allowances(context.Context, *QueryAllowancesRequest) (*QueryAllowancesResponse, error)
|
||||
// AllowancesByGranter returns all the grants given by an address
|
||||
// Since v0.46
|
||||
AllowancesByGranter(context.Context, *QueryAllowancesByGranterRequest) (*QueryAllowancesByGranterResponse, error)
|
||||
}
|
||||
|
||||
// UnimplementedQueryServer can be embedded to have forward compatible implementations.
|
||||
|
@ -346,6 +476,9 @@ func (*UnimplementedQueryServer) Allowance(ctx context.Context, req *QueryAllowa
|
|||
func (*UnimplementedQueryServer) Allowances(ctx context.Context, req *QueryAllowancesRequest) (*QueryAllowancesResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method Allowances not implemented")
|
||||
}
|
||||
func (*UnimplementedQueryServer) AllowancesByGranter(ctx context.Context, req *QueryAllowancesByGranterRequest) (*QueryAllowancesByGranterResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method AllowancesByGranter not implemented")
|
||||
}
|
||||
|
||||
func RegisterQueryServer(s grpc1.Server, srv QueryServer) {
|
||||
s.RegisterService(&_Query_serviceDesc, srv)
|
||||
|
@ -387,6 +520,24 @@ func _Query_Allowances_Handler(srv interface{}, ctx context.Context, dec func(in
|
|||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Query_AllowancesByGranter_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(QueryAllowancesByGranterRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(QueryServer).AllowancesByGranter(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/cosmos.feegrant.v1beta1.Query/AllowancesByGranter",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(QueryServer).AllowancesByGranter(ctx, req.(*QueryAllowancesByGranterRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
var _Query_serviceDesc = grpc.ServiceDesc{
|
||||
ServiceName: "cosmos.feegrant.v1beta1.Query",
|
||||
HandlerType: (*QueryServer)(nil),
|
||||
|
@ -399,6 +550,10 @@ var _Query_serviceDesc = grpc.ServiceDesc{
|
|||
MethodName: "Allowances",
|
||||
Handler: _Query_Allowances_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "AllowancesByGranter",
|
||||
Handler: _Query_AllowancesByGranter_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
Metadata: "cosmos/feegrant/v1beta1/query.proto",
|
||||
|
@ -567,6 +722,97 @@ func (m *QueryAllowancesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error)
|
|||
return len(dAtA) - i, nil
|
||||
}
|
||||
|
||||
func (m *QueryAllowancesByGranterRequest) 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 *QueryAllowancesByGranterRequest) MarshalTo(dAtA []byte) (int, error) {
|
||||
size := m.Size()
|
||||
return m.MarshalToSizedBuffer(dAtA[:size])
|
||||
}
|
||||
|
||||
func (m *QueryAllowancesByGranterRequest) 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.Granter) > 0 {
|
||||
i -= len(m.Granter)
|
||||
copy(dAtA[i:], m.Granter)
|
||||
i = encodeVarintQuery(dAtA, i, uint64(len(m.Granter)))
|
||||
i--
|
||||
dAtA[i] = 0xa
|
||||
}
|
||||
return len(dAtA) - i, nil
|
||||
}
|
||||
|
||||
func (m *QueryAllowancesByGranterResponse) 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 *QueryAllowancesByGranterResponse) MarshalTo(dAtA []byte) (int, error) {
|
||||
size := m.Size()
|
||||
return m.MarshalToSizedBuffer(dAtA[:size])
|
||||
}
|
||||
|
||||
func (m *QueryAllowancesByGranterResponse) 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.Allowances) > 0 {
|
||||
for iNdEx := len(m.Allowances) - 1; iNdEx >= 0; iNdEx-- {
|
||||
{
|
||||
size, err := m.Allowances[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
|
||||
|
@ -644,6 +890,42 @@ func (m *QueryAllowancesResponse) Size() (n int) {
|
|||
return n
|
||||
}
|
||||
|
||||
func (m *QueryAllowancesByGranterRequest) Size() (n int) {
|
||||
if m == nil {
|
||||
return 0
|
||||
}
|
||||
var l int
|
||||
_ = l
|
||||
l = len(m.Granter)
|
||||
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 *QueryAllowancesByGranterResponse) Size() (n int) {
|
||||
if m == nil {
|
||||
return 0
|
||||
}
|
||||
var l int
|
||||
_ = l
|
||||
if len(m.Allowances) > 0 {
|
||||
for _, e := range m.Allowances {
|
||||
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
|
||||
}
|
||||
|
@ -1088,6 +1370,244 @@ func (m *QueryAllowancesResponse) Unmarshal(dAtA []byte) error {
|
|||
}
|
||||
return nil
|
||||
}
|
||||
func (m *QueryAllowancesByGranterRequest) 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: QueryAllowancesByGranterRequest: wiretype end group for non-group")
|
||||
}
|
||||
if fieldNum <= 0 {
|
||||
return fmt.Errorf("proto: QueryAllowancesByGranterRequest: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||
}
|
||||
switch fieldNum {
|
||||
case 1:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Granter", 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.Granter = 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 *QueryAllowancesByGranterResponse) 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: QueryAllowancesByGranterResponse: wiretype end group for non-group")
|
||||
}
|
||||
if fieldNum <= 0 {
|
||||
return fmt.Errorf("proto: QueryAllowancesByGranterResponse: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||
}
|
||||
switch fieldNum {
|
||||
case 1:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Allowances", 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.Allowances = append(m.Allowances, &Grant{})
|
||||
if err := m.Allowances[len(m.Allowances)-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
|
||||
|
|
|
@ -179,6 +179,78 @@ func local_request_Query_Allowances_0(ctx context.Context, marshaler runtime.Mar
|
|||
|
||||
}
|
||||
|
||||
var (
|
||||
filter_Query_AllowancesByGranter_0 = &utilities.DoubleArray{Encoding: map[string]int{"granter": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}}
|
||||
)
|
||||
|
||||
func request_Query_AllowancesByGranter_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq QueryAllowancesByGranterRequest
|
||||
var metadata runtime.ServerMetadata
|
||||
|
||||
var (
|
||||
val string
|
||||
ok bool
|
||||
err error
|
||||
_ = err
|
||||
)
|
||||
|
||||
val, ok = pathParams["granter"]
|
||||
if !ok {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "granter")
|
||||
}
|
||||
|
||||
protoReq.Granter, err = runtime.String(val)
|
||||
|
||||
if err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "granter", 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_AllowancesByGranter_0); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
|
||||
msg, err := client.AllowancesByGranter(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
func local_request_Query_AllowancesByGranter_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq QueryAllowancesByGranterRequest
|
||||
var metadata runtime.ServerMetadata
|
||||
|
||||
var (
|
||||
val string
|
||||
ok bool
|
||||
err error
|
||||
_ = err
|
||||
)
|
||||
|
||||
val, ok = pathParams["granter"]
|
||||
if !ok {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "granter")
|
||||
}
|
||||
|
||||
protoReq.Granter, err = runtime.String(val)
|
||||
|
||||
if err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "granter", 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_AllowancesByGranter_0); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
|
||||
msg, err := server.AllowancesByGranter(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.
|
||||
|
@ -225,6 +297,26 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv
|
|||
|
||||
})
|
||||
|
||||
mux.Handle("GET", pattern_Query_AllowancesByGranter_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_AllowancesByGranter_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_AllowancesByGranter_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -306,6 +398,26 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie
|
|||
|
||||
})
|
||||
|
||||
mux.Handle("GET", pattern_Query_AllowancesByGranter_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_AllowancesByGranter_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_AllowancesByGranter_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -313,10 +425,14 @@ var (
|
|||
pattern_Query_Allowance_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4, 1, 0, 4, 1, 5, 5}, []string{"cosmos", "feegrant", "v1beta1", "allowance", "granter", "grantee"}, "", runtime.AssumeColonVerbOpt(false)))
|
||||
|
||||
pattern_Query_Allowances_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"cosmos", "feegrant", "v1beta1", "allowances", "grantee"}, "", runtime.AssumeColonVerbOpt(false)))
|
||||
|
||||
pattern_Query_AllowancesByGranter_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"cosmos", "feegrant", "v1beta1", "issued", "granter"}, "", runtime.AssumeColonVerbOpt(false)))
|
||||
)
|
||||
|
||||
var (
|
||||
forward_Query_Allowance_0 = runtime.ForwardResponseMessage
|
||||
|
||||
forward_Query_Allowances_0 = runtime.ForwardResponseMessage
|
||||
|
||||
forward_Query_AllowancesByGranter_0 = runtime.ForwardResponseMessage
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue