diff --git a/docs/ibc/proto-docs.md b/docs/ibc/proto-docs.md index c612a0180b3..be4979fea1b 100644 --- a/docs/ibc/proto-docs.md +++ b/docs/ibc/proto-docs.md @@ -89,6 +89,12 @@ - [Query](#ibc.applications.interchain_accounts.controller.v1.Query) +- [ibc/applications/interchain_accounts/controller/v1/tx.proto](#ibc/applications/interchain_accounts/controller/v1/tx.proto) + - [MsgRegisterAccount](#ibc.applications.interchain_accounts.controller.v1.MsgRegisterAccount) + - [MsgRegisterAccountResponse](#ibc.applications.interchain_accounts.controller.v1.MsgRegisterAccountResponse) + + - [Msg](#ibc.applications.interchain_accounts.controller.v1.Msg) + - [ibc/applications/interchain_accounts/host/v1/host.proto](#ibc/applications/interchain_accounts/host/v1/host.proto) - [Params](#ibc.applications.interchain_accounts.host.v1.Params) @@ -1504,6 +1510,64 @@ Query provides defines the gRPC querier service. + +
+ +## ibc/applications/interchain_accounts/controller/v1/tx.proto + + + + + +### MsgRegisterAccount +MsgRegisterAccount defines the payload for Msg/RegisterAccount + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `connection_id` | [string](#string) | | | +| `owner` | [string](#string) | | | +| `version` | [string](#string) | | | + + + + + + + + +### MsgRegisterAccountResponse +MsgRegisterAccountResponse defines the response for Msg/RegisterAccount + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `channel_id` | [string](#string) | | | + + + + + + + + + + + + + + +### Msg +Msg defines the 27-interchain-accounts/controller Msg service. + +| Method Name | Request Type | Response Type | Description | HTTP Verb | Endpoint | +| ----------- | ------------ | ------------- | ------------| ------- | -------- | +| `RegisterAccount` | [MsgRegisterAccount](#ibc.applications.interchain_accounts.controller.v1.MsgRegisterAccount) | [MsgRegisterAccountResponse](#ibc.applications.interchain_accounts.controller.v1.MsgRegisterAccountResponse) | RegisterAccount defines a rpc handler for MsgRegisterAccount. | | + + + + + diff --git a/modules/apps/27-interchain-accounts/controller/keeper/msg_server.go b/modules/apps/27-interchain-accounts/controller/keeper/msg_server.go new file mode 100644 index 00000000000..e9d6adca3c6 --- /dev/null +++ b/modules/apps/27-interchain-accounts/controller/keeper/msg_server.go @@ -0,0 +1,14 @@ +package keeper + +import ( + "context" + + "github.com/cosmos/ibc-go/v5/modules/apps/27-interchain-accounts/controller/types" +) + +var _ types.MsgServer = Keeper{} + +// RegisterAccount defines a rpc handler for MsgRegisterAccount +func (k Keeper) RegisterAccount(goCtx context.Context, msg *types.MsgRegisterAccount) (*types.MsgRegisterAccountResponse, error) { + return &types.MsgRegisterAccountResponse{}, nil +} diff --git a/modules/apps/27-interchain-accounts/controller/types/codec.go b/modules/apps/27-interchain-accounts/controller/types/codec.go new file mode 100644 index 00000000000..70f6abcdb5e --- /dev/null +++ b/modules/apps/27-interchain-accounts/controller/types/codec.go @@ -0,0 +1,11 @@ +package types + +import ( + codectypes "github.com/cosmos/cosmos-sdk/codec/types" + sdk "github.com/cosmos/cosmos-sdk/types" +) + +// RegisterInterfaces registers the interchain accounts controller message types using the provided InterfaceRegistry +func RegisterInterfaces(registry codectypes.InterfaceRegistry) { + registry.RegisterImplementations((*sdk.Msg)(nil), &MsgRegisterAccount{}) +} diff --git a/modules/apps/27-interchain-accounts/controller/types/msgs.go b/modules/apps/27-interchain-accounts/controller/types/msgs.go new file mode 100644 index 00000000000..9033df4bc3c --- /dev/null +++ b/modules/apps/27-interchain-accounts/controller/types/msgs.go @@ -0,0 +1,24 @@ +package types + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" +) + +// NewMsgRegisterAccount creates a new instance of MsgRegisterAccount +func NewMsgRegisterAccount(connectionID, owner, version string) *MsgRegisterAccount { + return &MsgRegisterAccount{ + ConnectionId: connectionID, + Owner: owner, + Version: version, + } +} + +// ValidateBasic implements sdk.Msg +func (msg MsgRegisterAccount) ValidateBasic() error { + return nil +} + +// GetSigners implements sdk.Msg +func (msg MsgRegisterAccount) GetSigners() []sdk.AccAddress { + return []sdk.AccAddress{} +} diff --git a/modules/apps/27-interchain-accounts/controller/types/tx.pb.go b/modules/apps/27-interchain-accounts/controller/types/tx.pb.go new file mode 100644 index 00000000000..12540ab7d39 --- /dev/null +++ b/modules/apps/27-interchain-accounts/controller/types/tx.pb.go @@ -0,0 +1,671 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: ibc/applications/interchain_accounts/controller/v1/tx.proto + +package types + +import ( + context "context" + fmt "fmt" + _ "github.com/gogo/protobuf/gogoproto" + grpc1 "github.com/gogo/protobuf/grpc" + proto "github.com/gogo/protobuf/proto" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// MsgRegisterAccount defines the payload for Msg/RegisterAccount +type MsgRegisterAccount struct { + ConnectionId string `protobuf:"bytes,1,opt,name=connection_id,json=connectionId,proto3" json:"connection_id,omitempty" yaml:"connection_id"` + Owner string `protobuf:"bytes,2,opt,name=owner,proto3" json:"owner,omitempty"` + Version string `protobuf:"bytes,3,opt,name=version,proto3" json:"version,omitempty"` +} + +func (m *MsgRegisterAccount) Reset() { *m = MsgRegisterAccount{} } +func (m *MsgRegisterAccount) String() string { return proto.CompactTextString(m) } +func (*MsgRegisterAccount) ProtoMessage() {} +func (*MsgRegisterAccount) Descriptor() ([]byte, []int) { + return fileDescriptor_7def041328c84a30, []int{0} +} +func (m *MsgRegisterAccount) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgRegisterAccount) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgRegisterAccount.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 *MsgRegisterAccount) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgRegisterAccount.Merge(m, src) +} +func (m *MsgRegisterAccount) XXX_Size() int { + return m.Size() +} +func (m *MsgRegisterAccount) XXX_DiscardUnknown() { + xxx_messageInfo_MsgRegisterAccount.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgRegisterAccount proto.InternalMessageInfo + +// MsgRegisterAccountResponse defines the response for Msg/RegisterAccount +type MsgRegisterAccountResponse struct { + ChannelId string `protobuf:"bytes,1,opt,name=channel_id,json=channelId,proto3" json:"channel_id,omitempty" yaml:"channel_id"` +} + +func (m *MsgRegisterAccountResponse) Reset() { *m = MsgRegisterAccountResponse{} } +func (m *MsgRegisterAccountResponse) String() string { return proto.CompactTextString(m) } +func (*MsgRegisterAccountResponse) ProtoMessage() {} +func (*MsgRegisterAccountResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_7def041328c84a30, []int{1} +} +func (m *MsgRegisterAccountResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgRegisterAccountResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgRegisterAccountResponse.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 *MsgRegisterAccountResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgRegisterAccountResponse.Merge(m, src) +} +func (m *MsgRegisterAccountResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgRegisterAccountResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgRegisterAccountResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgRegisterAccountResponse proto.InternalMessageInfo + +func (m *MsgRegisterAccountResponse) GetChannelId() string { + if m != nil { + return m.ChannelId + } + return "" +} + +func init() { + proto.RegisterType((*MsgRegisterAccount)(nil), "ibc.applications.interchain_accounts.controller.v1.MsgRegisterAccount") + proto.RegisterType((*MsgRegisterAccountResponse)(nil), "ibc.applications.interchain_accounts.controller.v1.MsgRegisterAccountResponse") +} + +func init() { + proto.RegisterFile("ibc/applications/interchain_accounts/controller/v1/tx.proto", fileDescriptor_7def041328c84a30) +} + +var fileDescriptor_7def041328c84a30 = []byte{ + // 379 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x92, 0xbd, 0x6a, 0xe3, 0x40, + 0x14, 0x85, 0x35, 0x6b, 0xf6, 0xc7, 0xc3, 0x2e, 0xcb, 0x0a, 0x2f, 0x08, 0x17, 0xd2, 0xa2, 0x6a, + 0x1b, 0xcf, 0x60, 0xef, 0x2e, 0x0b, 0x0e, 0x29, 0xe2, 0x22, 0xe0, 0xc2, 0x21, 0xa8, 0x4c, 0x63, + 0xa4, 0xd1, 0x20, 0x4f, 0x90, 0xe6, 0x0a, 0xcd, 0x58, 0x89, 0xdf, 0x20, 0x4d, 0x20, 0x8f, 0xe0, + 0x36, 0x65, 0xde, 0x22, 0xa5, 0xcb, 0x54, 0x26, 0xd8, 0x4d, 0x6a, 0x3f, 0x41, 0x90, 0x7f, 0xa2, + 0x24, 0x76, 0x13, 0x48, 0x37, 0x67, 0x2e, 0xdf, 0xe1, 0xdc, 0xcb, 0xc1, 0x7b, 0x22, 0x60, 0xd4, + 0x4f, 0xd3, 0x58, 0x30, 0x5f, 0x0b, 0x90, 0x8a, 0x0a, 0xa9, 0x79, 0xc6, 0x06, 0xbe, 0x90, 0x7d, + 0x9f, 0x31, 0x18, 0x4a, 0xad, 0x28, 0x03, 0xa9, 0x33, 0x88, 0x63, 0x9e, 0xd1, 0xbc, 0x49, 0xf5, + 0x39, 0x49, 0x33, 0xd0, 0x60, 0xb6, 0x44, 0xc0, 0xc8, 0x73, 0x98, 0xec, 0x80, 0x49, 0x09, 0x93, + 0xbc, 0x59, 0xaf, 0x45, 0x10, 0xc1, 0x12, 0xa7, 0xc5, 0x6b, 0xe5, 0xe4, 0x5e, 0x22, 0x6c, 0xf6, + 0x54, 0xe4, 0xf1, 0x48, 0x28, 0xcd, 0xb3, 0x83, 0x15, 0x6b, 0xee, 0xe3, 0x6f, 0x0c, 0xa4, 0xe4, + 0xac, 0x70, 0xef, 0x8b, 0xd0, 0x42, 0xbf, 0xd0, 0xef, 0x6a, 0xc7, 0x5a, 0x4c, 0x9d, 0xda, 0xc8, + 0x4f, 0xe2, 0xb6, 0xfb, 0x62, 0xec, 0x7a, 0x5f, 0x4b, 0xdd, 0x0d, 0xcd, 0x1a, 0xfe, 0x08, 0x67, + 0x92, 0x67, 0xd6, 0x87, 0x02, 0xf3, 0x56, 0xc2, 0xb4, 0xf0, 0xe7, 0x9c, 0x67, 0x4a, 0x80, 0xb4, + 0x2a, 0xcb, 0xff, 0x8d, 0x6c, 0x7f, 0xb9, 0x18, 0x3b, 0xc6, 0xc3, 0xd8, 0x31, 0x5c, 0x0f, 0xd7, + 0xb7, 0xe3, 0x78, 0x5c, 0xa5, 0x20, 0x15, 0x37, 0xff, 0x62, 0xcc, 0x06, 0xbe, 0x94, 0x3c, 0x2e, + 0x33, 0xfd, 0x5c, 0x4c, 0x9d, 0x1f, 0xeb, 0x4c, 0x4f, 0x33, 0xd7, 0xab, 0xae, 0x45, 0x37, 0x6c, + 0xdd, 0x20, 0x5c, 0xe9, 0xa9, 0xc8, 0xbc, 0x46, 0xf8, 0xfb, 0xeb, 0x45, 0x0f, 0xc9, 0xdb, 0x4f, + 0x49, 0xb6, 0x13, 0xd6, 0x8f, 0xde, 0xc7, 0x67, 0xb3, 0x69, 0xe7, 0xf4, 0x76, 0x66, 0xa3, 0xc9, + 0xcc, 0x46, 0xf7, 0x33, 0x1b, 0x5d, 0xcd, 0x6d, 0x63, 0x32, 0xb7, 0x8d, 0xbb, 0xb9, 0x6d, 0x9c, + 0x1c, 0x47, 0x42, 0x0f, 0x86, 0x01, 0x61, 0x90, 0x50, 0x06, 0x2a, 0x01, 0x45, 0x45, 0xc0, 0x1a, + 0x11, 0xd0, 0xfc, 0x1f, 0x4d, 0x20, 0x1c, 0xc6, 0x5c, 0x15, 0xc5, 0x52, 0xb4, 0xf5, 0xbf, 0x51, + 0x66, 0x68, 0xec, 0xea, 0x94, 0x1e, 0xa5, 0x5c, 0x05, 0x9f, 0x96, 0x55, 0xf8, 0xf3, 0x18, 0x00, + 0x00, 0xff, 0xff, 0x48, 0x33, 0x66, 0x3d, 0x93, 0x02, 0x00, 0x00, +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// MsgClient is the client API for Msg service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type MsgClient interface { + // RegisterAccount defines a rpc handler for MsgRegisterAccount. + RegisterAccount(ctx context.Context, in *MsgRegisterAccount, opts ...grpc.CallOption) (*MsgRegisterAccountResponse, error) +} + +type msgClient struct { + cc grpc1.ClientConn +} + +func NewMsgClient(cc grpc1.ClientConn) MsgClient { + return &msgClient{cc} +} + +func (c *msgClient) RegisterAccount(ctx context.Context, in *MsgRegisterAccount, opts ...grpc.CallOption) (*MsgRegisterAccountResponse, error) { + out := new(MsgRegisterAccountResponse) + err := c.cc.Invoke(ctx, "/ibc.applications.interchain_accounts.controller.v1.Msg/RegisterAccount", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// MsgServer is the server API for Msg service. +type MsgServer interface { + // RegisterAccount defines a rpc handler for MsgRegisterAccount. + RegisterAccount(context.Context, *MsgRegisterAccount) (*MsgRegisterAccountResponse, error) +} + +// UnimplementedMsgServer can be embedded to have forward compatible implementations. +type UnimplementedMsgServer struct { +} + +func (*UnimplementedMsgServer) RegisterAccount(ctx context.Context, req *MsgRegisterAccount) (*MsgRegisterAccountResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method RegisterAccount not implemented") +} + +func RegisterMsgServer(s grpc1.Server, srv MsgServer) { + s.RegisterService(&_Msg_serviceDesc, srv) +} + +func _Msg_RegisterAccount_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgRegisterAccount) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).RegisterAccount(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/ibc.applications.interchain_accounts.controller.v1.Msg/RegisterAccount", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).RegisterAccount(ctx, req.(*MsgRegisterAccount)) + } + return interceptor(ctx, in, info, handler) +} + +var _Msg_serviceDesc = grpc.ServiceDesc{ + ServiceName: "ibc.applications.interchain_accounts.controller.v1.Msg", + HandlerType: (*MsgServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "RegisterAccount", + Handler: _Msg_RegisterAccount_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "ibc/applications/interchain_accounts/controller/v1/tx.proto", +} + +func (m *MsgRegisterAccount) 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 *MsgRegisterAccount) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgRegisterAccount) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Version) > 0 { + i -= len(m.Version) + copy(dAtA[i:], m.Version) + i = encodeVarintTx(dAtA, i, uint64(len(m.Version))) + i-- + dAtA[i] = 0x1a + } + if len(m.Owner) > 0 { + i -= len(m.Owner) + copy(dAtA[i:], m.Owner) + i = encodeVarintTx(dAtA, i, uint64(len(m.Owner))) + i-- + dAtA[i] = 0x12 + } + if len(m.ConnectionId) > 0 { + i -= len(m.ConnectionId) + copy(dAtA[i:], m.ConnectionId) + i = encodeVarintTx(dAtA, i, uint64(len(m.ConnectionId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgRegisterAccountResponse) 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 *MsgRegisterAccountResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgRegisterAccountResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.ChannelId) > 0 { + i -= len(m.ChannelId) + copy(dAtA[i:], m.ChannelId) + i = encodeVarintTx(dAtA, i, uint64(len(m.ChannelId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintTx(dAtA []byte, offset int, v uint64) int { + offset -= sovTx(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *MsgRegisterAccount) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ConnectionId) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Owner) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Version) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgRegisterAccountResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ChannelId) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func sovTx(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozTx(x uint64) (n int) { + return sovTx(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *MsgRegisterAccount) 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 ErrIntOverflowTx + } + 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: MsgRegisterAccount: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgRegisterAccount: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ConnectionId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + 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 ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ConnectionId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Owner", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + 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 ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Owner = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Version", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + 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 ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Version = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgRegisterAccountResponse) 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 ErrIntOverflowTx + } + 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: MsgRegisterAccountResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgRegisterAccountResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ChannelId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + 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 ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ChannelId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipTx(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTx + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTx + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTx + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthTx + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupTx + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthTx + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthTx = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowTx = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupTx = fmt.Errorf("proto: unexpected end of group") +) diff --git a/modules/apps/27-interchain-accounts/module.go b/modules/apps/27-interchain-accounts/module.go index bb3a7f9b793..18c52693313 100644 --- a/modules/apps/27-interchain-accounts/module.go +++ b/modules/apps/27-interchain-accounts/module.go @@ -144,6 +144,7 @@ func (am AppModule) LegacyQuerierHandler(legacyQuerierCdc *codec.LegacyAmino) sd // RegisterServices registers module services func (am AppModule) RegisterServices(cfg module.Configurator) { + controllertypes.RegisterMsgServer(cfg.MsgServer(), am.controllerKeeper) controllertypes.RegisterQueryServer(cfg.QueryServer(), am.controllerKeeper) hosttypes.RegisterQueryServer(cfg.QueryServer(), am.hostKeeper) } diff --git a/modules/apps/27-interchain-accounts/types/codec.go b/modules/apps/27-interchain-accounts/types/codec.go index 033c264f9e7..f2400d3d1b7 100644 --- a/modules/apps/27-interchain-accounts/types/codec.go +++ b/modules/apps/27-interchain-accounts/types/codec.go @@ -6,6 +6,8 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + + controllertypes "github.com/cosmos/ibc-go/v5/modules/apps/27-interchain-accounts/controller/types" ) // ModuleCdc references the global interchain accounts module codec. Note, the codec @@ -15,9 +17,11 @@ import ( // defined at the application level. var ModuleCdc = codec.NewProtoCodec(codectypes.NewInterfaceRegistry()) -// RegisterInterfaces registers the concrete InterchainAccount implementation against the associated -// x/auth AccountI and GenesisAccount interfaces +// RegisterInterfaces registers the interchain accounts controller types and the concrete InterchainAccount implementation +// against the associated x/auth AccountI and GenesisAccount interfaces. func RegisterInterfaces(registry codectypes.InterfaceRegistry) { + controllertypes.RegisterInterfaces(registry) + registry.RegisterImplementations((*authtypes.AccountI)(nil), &InterchainAccount{}) registry.RegisterImplementations((*authtypes.GenesisAccount)(nil), &InterchainAccount{}) } diff --git a/proto/ibc/applications/interchain_accounts/controller/v1/tx.proto b/proto/ibc/applications/interchain_accounts/controller/v1/tx.proto new file mode 100644 index 00000000000..b72a69ae631 --- /dev/null +++ b/proto/ibc/applications/interchain_accounts/controller/v1/tx.proto @@ -0,0 +1,28 @@ +syntax = "proto3"; + +package ibc.applications.interchain_accounts.controller.v1; + +option go_package = "github.com/cosmos/ibc-go/v5/modules/apps/27-interchain-accounts/controller/types"; + +import "gogoproto/gogo.proto"; + +// Msg defines the 27-interchain-accounts/controller Msg service. +service Msg { + // RegisterAccount defines a rpc handler for MsgRegisterAccount. + rpc RegisterAccount(MsgRegisterAccount) returns (MsgRegisterAccountResponse); +} + +// MsgRegisterAccount defines the payload for Msg/RegisterAccount +message MsgRegisterAccount { + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + string connection_id = 1 [(gogoproto.moretags) = "yaml:\"connection_id\""]; + string owner = 2; + string version = 3; +} + +// MsgRegisterAccountResponse defines the response for Msg/RegisterAccount +message MsgRegisterAccountResponse { + string channel_id = 1 [(gogoproto.moretags) = "yaml:\"channel_id\""]; +}