feat: Add MsgCreateGroupWithPolicy to x/group (#10963)
## Description Closes: #10655 This PR adds a new msg MsgCreateGroupWithPolicy It has a boolean field GroupPolicyAsAdmin, if set to true, that would update also the admin of the newly created group and group policy to the group policy address itself --- ### 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)
This commit is contained in:
+1782
-293
File diff suppressed because it is too large
Load Diff
@@ -32,6 +32,8 @@ type MsgClient interface {
|
||||
UpdateGroupMetadata(ctx context.Context, in *MsgUpdateGroupMetadata, opts ...grpc.CallOption) (*MsgUpdateGroupMetadataResponse, error)
|
||||
// CreateGroupPolicy creates a new group policy using given DecisionPolicy.
|
||||
CreateGroupPolicy(ctx context.Context, in *MsgCreateGroupPolicy, opts ...grpc.CallOption) (*MsgCreateGroupPolicyResponse, error)
|
||||
// CreateGroupWithPolicy creates a new group with policy.
|
||||
CreateGroupWithPolicy(ctx context.Context, in *MsgCreateGroupWithPolicy, opts ...grpc.CallOption) (*MsgCreateGroupWithPolicyResponse, error)
|
||||
// UpdateGroupPolicyAdmin updates a group policy admin.
|
||||
UpdateGroupPolicyAdmin(ctx context.Context, in *MsgUpdateGroupPolicyAdmin, opts ...grpc.CallOption) (*MsgUpdateGroupPolicyAdminResponse, error)
|
||||
// UpdateGroupPolicyDecisionPolicy allows a group policy's decision policy to be updated.
|
||||
@@ -101,6 +103,15 @@ func (c *msgClient) CreateGroupPolicy(ctx context.Context, in *MsgCreateGroupPol
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *msgClient) CreateGroupWithPolicy(ctx context.Context, in *MsgCreateGroupWithPolicy, opts ...grpc.CallOption) (*MsgCreateGroupWithPolicyResponse, error) {
|
||||
out := new(MsgCreateGroupWithPolicyResponse)
|
||||
err := c.cc.Invoke(ctx, "/cosmos.group.v1beta1.Msg/CreateGroupWithPolicy", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *msgClient) UpdateGroupPolicyAdmin(ctx context.Context, in *MsgUpdateGroupPolicyAdmin, opts ...grpc.CallOption) (*MsgUpdateGroupPolicyAdminResponse, error) {
|
||||
out := new(MsgUpdateGroupPolicyAdminResponse)
|
||||
err := c.cc.Invoke(ctx, "/cosmos.group.v1beta1.Msg/UpdateGroupPolicyAdmin", in, out, opts...)
|
||||
@@ -178,6 +189,8 @@ type MsgServer interface {
|
||||
UpdateGroupMetadata(context.Context, *MsgUpdateGroupMetadata) (*MsgUpdateGroupMetadataResponse, error)
|
||||
// CreateGroupPolicy creates a new group policy using given DecisionPolicy.
|
||||
CreateGroupPolicy(context.Context, *MsgCreateGroupPolicy) (*MsgCreateGroupPolicyResponse, error)
|
||||
// CreateGroupWithPolicy creates a new group with policy.
|
||||
CreateGroupWithPolicy(context.Context, *MsgCreateGroupWithPolicy) (*MsgCreateGroupWithPolicyResponse, error)
|
||||
// UpdateGroupPolicyAdmin updates a group policy admin.
|
||||
UpdateGroupPolicyAdmin(context.Context, *MsgUpdateGroupPolicyAdmin) (*MsgUpdateGroupPolicyAdminResponse, error)
|
||||
// UpdateGroupPolicyDecisionPolicy allows a group policy's decision policy to be updated.
|
||||
@@ -214,6 +227,9 @@ func (UnimplementedMsgServer) UpdateGroupMetadata(context.Context, *MsgUpdateGro
|
||||
func (UnimplementedMsgServer) CreateGroupPolicy(context.Context, *MsgCreateGroupPolicy) (*MsgCreateGroupPolicyResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method CreateGroupPolicy not implemented")
|
||||
}
|
||||
func (UnimplementedMsgServer) CreateGroupWithPolicy(context.Context, *MsgCreateGroupWithPolicy) (*MsgCreateGroupWithPolicyResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method CreateGroupWithPolicy not implemented")
|
||||
}
|
||||
func (UnimplementedMsgServer) UpdateGroupPolicyAdmin(context.Context, *MsgUpdateGroupPolicyAdmin) (*MsgUpdateGroupPolicyAdminResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method UpdateGroupPolicyAdmin not implemented")
|
||||
}
|
||||
@@ -338,6 +354,24 @@ func _Msg_CreateGroupPolicy_Handler(srv interface{}, ctx context.Context, dec fu
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Msg_CreateGroupWithPolicy_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(MsgCreateGroupWithPolicy)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(MsgServer).CreateGroupWithPolicy(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/cosmos.group.v1beta1.Msg/CreateGroupWithPolicy",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(MsgServer).CreateGroupWithPolicy(ctx, req.(*MsgCreateGroupWithPolicy))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Msg_UpdateGroupPolicyAdmin_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(MsgUpdateGroupPolicyAdmin)
|
||||
if err := dec(in); err != nil {
|
||||
@@ -491,6 +525,10 @@ var Msg_ServiceDesc = grpc.ServiceDesc{
|
||||
MethodName: "CreateGroupPolicy",
|
||||
Handler: _Msg_CreateGroupPolicy_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "CreateGroupWithPolicy",
|
||||
Handler: _Msg_CreateGroupWithPolicy_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "UpdateGroupPolicyAdmin",
|
||||
Handler: _Msg_UpdateGroupPolicyAdmin_Handler,
|
||||
|
||||
Reference in New Issue
Block a user