From e511051f3eafb71295ed5c69702567a93acbb7c5 Mon Sep 17 00:00:00 2001 From: prathamesh0 <42446521+prathamesh0@users.noreply.github.com> Date: Fri, 2 Feb 2024 15:09:10 +0530 Subject: [PATCH] Add commands to create and list bonds (#3) * Add message service with a create bond command * Add query proto file with bonds list query * Remove legacy amino coded registration * Add bond to auth module config * Use collections package for bond module state --- api/cerc/bond/v1/genesis.pulsar.go | 1 + api/cerc/bond/v1/query.pulsar.go | 1255 ++++++++++++++++++++++++++++ api/cerc/bond/v1/query_grpc.pb.go | 111 +++ api/cerc/bond/v1/tx.pulsar.go | 1216 +++++++++++++++++++++++++++ api/cerc/bond/v1/tx_grpc.pb.go | 111 +++ app/app.yaml | 1 + go.mod | 6 +- proto/cerc/bond/v1/bond.proto | 9 +- proto/cerc/bond/v1/event.proto | 1 - proto/cerc/bond/v1/genesis.proto | 1 + proto/cerc/bond/v1/query.proto | 35 + proto/cerc/bond/v1/tx.proto | 40 + x/bond/codec.go | 20 +- x/bond/events.go | 15 + x/bond/genesis.pb.go | 1 + x/bond/keeper/genesis.go | 11 +- x/bond/keeper/keeper.go | 137 ++- x/bond/keeper/msg_server.go | 45 +- x/bond/keeper/params.go | 2 +- x/bond/keeper/query_server.go | 29 +- x/bond/keys.go | 7 + x/bond/module/autocli.go | 28 +- x/bond/module/depinject.go | 13 +- x/bond/module/module.go | 27 +- x/bond/query.pb.go | 671 +++++++++++++++ x/bond/query.pb.gw.go | 171 ++++ x/bond/tx.pb.go | 656 +++++++++++++++ x/bond/tx.pb.gw.go | 171 ++++ 28 files changed, 4711 insertions(+), 80 deletions(-) create mode 100644 api/cerc/bond/v1/query.pulsar.go create mode 100644 api/cerc/bond/v1/query_grpc.pb.go create mode 100644 api/cerc/bond/v1/tx.pulsar.go create mode 100644 api/cerc/bond/v1/tx_grpc.pb.go delete mode 100644 proto/cerc/bond/v1/event.proto create mode 100644 x/bond/events.go create mode 100644 x/bond/query.pb.go create mode 100644 x/bond/query.pb.gw.go create mode 100644 x/bond/tx.pb.go create mode 100644 x/bond/tx.pb.gw.go diff --git a/api/cerc/bond/v1/genesis.pulsar.go b/api/cerc/bond/v1/genesis.pulsar.go index 608c6c79..93d1c38e 100644 --- a/api/cerc/bond/v1/genesis.pulsar.go +++ b/api/cerc/bond/v1/genesis.pulsar.go @@ -608,6 +608,7 @@ type GenesisState struct { // params defines all the parameters of the module. Params *Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params,omitempty"` // bonds defines all the bonds + // TODO: Add nullable = false ? Bonds []*Bond `protobuf:"bytes,2,rep,name=bonds,proto3" json:"bonds,omitempty"` } diff --git a/api/cerc/bond/v1/query.pulsar.go b/api/cerc/bond/v1/query.pulsar.go new file mode 100644 index 00000000..e4a0a92d --- /dev/null +++ b/api/cerc/bond/v1/query.pulsar.go @@ -0,0 +1,1255 @@ +// Code generated by protoc-gen-go-pulsar. DO NOT EDIT. +package bondv1 + +import ( + v1beta1 "cosmossdk.io/api/cosmos/base/query/v1beta1" + fmt "fmt" + runtime "github.com/cosmos/cosmos-proto/runtime" + _ "github.com/cosmos/gogoproto/gogoproto" + _ "google.golang.org/genproto/googleapis/api/annotations" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoiface "google.golang.org/protobuf/runtime/protoiface" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + io "io" + reflect "reflect" + sync "sync" +) + +var ( + md_QueryGetBondsRequest protoreflect.MessageDescriptor + fd_QueryGetBondsRequest_pagination protoreflect.FieldDescriptor +) + +func init() { + file_cerc_bond_v1_query_proto_init() + md_QueryGetBondsRequest = File_cerc_bond_v1_query_proto.Messages().ByName("QueryGetBondsRequest") + fd_QueryGetBondsRequest_pagination = md_QueryGetBondsRequest.Fields().ByName("pagination") +} + +var _ protoreflect.Message = (*fastReflection_QueryGetBondsRequest)(nil) + +type fastReflection_QueryGetBondsRequest QueryGetBondsRequest + +func (x *QueryGetBondsRequest) ProtoReflect() protoreflect.Message { + return (*fastReflection_QueryGetBondsRequest)(x) +} + +func (x *QueryGetBondsRequest) slowProtoReflect() protoreflect.Message { + mi := &file_cerc_bond_v1_query_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_QueryGetBondsRequest_messageType fastReflection_QueryGetBondsRequest_messageType +var _ protoreflect.MessageType = fastReflection_QueryGetBondsRequest_messageType{} + +type fastReflection_QueryGetBondsRequest_messageType struct{} + +func (x fastReflection_QueryGetBondsRequest_messageType) Zero() protoreflect.Message { + return (*fastReflection_QueryGetBondsRequest)(nil) +} +func (x fastReflection_QueryGetBondsRequest_messageType) New() protoreflect.Message { + return new(fastReflection_QueryGetBondsRequest) +} +func (x fastReflection_QueryGetBondsRequest_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_QueryGetBondsRequest +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_QueryGetBondsRequest) Descriptor() protoreflect.MessageDescriptor { + return md_QueryGetBondsRequest +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_QueryGetBondsRequest) Type() protoreflect.MessageType { + return _fastReflection_QueryGetBondsRequest_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_QueryGetBondsRequest) New() protoreflect.Message { + return new(fastReflection_QueryGetBondsRequest) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_QueryGetBondsRequest) Interface() protoreflect.ProtoMessage { + return (*QueryGetBondsRequest)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_QueryGetBondsRequest) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Pagination != nil { + value := protoreflect.ValueOfMessage(x.Pagination.ProtoReflect()) + if !f(fd_QueryGetBondsRequest_pagination, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_QueryGetBondsRequest) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "cerc.bond.v1.QueryGetBondsRequest.pagination": + return x.Pagination != nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cerc.bond.v1.QueryGetBondsRequest")) + } + panic(fmt.Errorf("message cerc.bond.v1.QueryGetBondsRequest does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryGetBondsRequest) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "cerc.bond.v1.QueryGetBondsRequest.pagination": + x.Pagination = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cerc.bond.v1.QueryGetBondsRequest")) + } + panic(fmt.Errorf("message cerc.bond.v1.QueryGetBondsRequest does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_QueryGetBondsRequest) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "cerc.bond.v1.QueryGetBondsRequest.pagination": + value := x.Pagination + return protoreflect.ValueOfMessage(value.ProtoReflect()) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cerc.bond.v1.QueryGetBondsRequest")) + } + panic(fmt.Errorf("message cerc.bond.v1.QueryGetBondsRequest does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryGetBondsRequest) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "cerc.bond.v1.QueryGetBondsRequest.pagination": + x.Pagination = value.Message().Interface().(*v1beta1.PageRequest) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cerc.bond.v1.QueryGetBondsRequest")) + } + panic(fmt.Errorf("message cerc.bond.v1.QueryGetBondsRequest does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryGetBondsRequest) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "cerc.bond.v1.QueryGetBondsRequest.pagination": + if x.Pagination == nil { + x.Pagination = new(v1beta1.PageRequest) + } + return protoreflect.ValueOfMessage(x.Pagination.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cerc.bond.v1.QueryGetBondsRequest")) + } + panic(fmt.Errorf("message cerc.bond.v1.QueryGetBondsRequest does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_QueryGetBondsRequest) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "cerc.bond.v1.QueryGetBondsRequest.pagination": + m := new(v1beta1.PageRequest) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cerc.bond.v1.QueryGetBondsRequest")) + } + panic(fmt.Errorf("message cerc.bond.v1.QueryGetBondsRequest does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_QueryGetBondsRequest) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in cerc.bond.v1.QueryGetBondsRequest", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_QueryGetBondsRequest) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryGetBondsRequest) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_QueryGetBondsRequest) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_QueryGetBondsRequest) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*QueryGetBondsRequest) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if x.Pagination != nil { + l = options.Size(x.Pagination) + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*QueryGetBondsRequest) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if x.Pagination != nil { + encoded, err := options.Marshal(x.Pagination) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*QueryGetBondsRequest) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, 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 protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryGetBondsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryGetBondsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if x.Pagination == nil { + x.Pagination = &v1beta1.PageRequest{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Pagination); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var _ protoreflect.List = (*_QueryGetBondsResponse_1_list)(nil) + +type _QueryGetBondsResponse_1_list struct { + list *[]*Bond +} + +func (x *_QueryGetBondsResponse_1_list) Len() int { + if x.list == nil { + return 0 + } + return len(*x.list) +} + +func (x *_QueryGetBondsResponse_1_list) Get(i int) protoreflect.Value { + return protoreflect.ValueOfMessage((*x.list)[i].ProtoReflect()) +} + +func (x *_QueryGetBondsResponse_1_list) Set(i int, value protoreflect.Value) { + valueUnwrapped := value.Message() + concreteValue := valueUnwrapped.Interface().(*Bond) + (*x.list)[i] = concreteValue +} + +func (x *_QueryGetBondsResponse_1_list) Append(value protoreflect.Value) { + valueUnwrapped := value.Message() + concreteValue := valueUnwrapped.Interface().(*Bond) + *x.list = append(*x.list, concreteValue) +} + +func (x *_QueryGetBondsResponse_1_list) AppendMutable() protoreflect.Value { + v := new(Bond) + *x.list = append(*x.list, v) + return protoreflect.ValueOfMessage(v.ProtoReflect()) +} + +func (x *_QueryGetBondsResponse_1_list) Truncate(n int) { + for i := n; i < len(*x.list); i++ { + (*x.list)[i] = nil + } + *x.list = (*x.list)[:n] +} + +func (x *_QueryGetBondsResponse_1_list) NewElement() protoreflect.Value { + v := new(Bond) + return protoreflect.ValueOfMessage(v.ProtoReflect()) +} + +func (x *_QueryGetBondsResponse_1_list) IsValid() bool { + return x.list != nil +} + +var ( + md_QueryGetBondsResponse protoreflect.MessageDescriptor + fd_QueryGetBondsResponse_bonds protoreflect.FieldDescriptor + fd_QueryGetBondsResponse_pagination protoreflect.FieldDescriptor +) + +func init() { + file_cerc_bond_v1_query_proto_init() + md_QueryGetBondsResponse = File_cerc_bond_v1_query_proto.Messages().ByName("QueryGetBondsResponse") + fd_QueryGetBondsResponse_bonds = md_QueryGetBondsResponse.Fields().ByName("bonds") + fd_QueryGetBondsResponse_pagination = md_QueryGetBondsResponse.Fields().ByName("pagination") +} + +var _ protoreflect.Message = (*fastReflection_QueryGetBondsResponse)(nil) + +type fastReflection_QueryGetBondsResponse QueryGetBondsResponse + +func (x *QueryGetBondsResponse) ProtoReflect() protoreflect.Message { + return (*fastReflection_QueryGetBondsResponse)(x) +} + +func (x *QueryGetBondsResponse) slowProtoReflect() protoreflect.Message { + mi := &file_cerc_bond_v1_query_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_QueryGetBondsResponse_messageType fastReflection_QueryGetBondsResponse_messageType +var _ protoreflect.MessageType = fastReflection_QueryGetBondsResponse_messageType{} + +type fastReflection_QueryGetBondsResponse_messageType struct{} + +func (x fastReflection_QueryGetBondsResponse_messageType) Zero() protoreflect.Message { + return (*fastReflection_QueryGetBondsResponse)(nil) +} +func (x fastReflection_QueryGetBondsResponse_messageType) New() protoreflect.Message { + return new(fastReflection_QueryGetBondsResponse) +} +func (x fastReflection_QueryGetBondsResponse_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_QueryGetBondsResponse +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_QueryGetBondsResponse) Descriptor() protoreflect.MessageDescriptor { + return md_QueryGetBondsResponse +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_QueryGetBondsResponse) Type() protoreflect.MessageType { + return _fastReflection_QueryGetBondsResponse_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_QueryGetBondsResponse) New() protoreflect.Message { + return new(fastReflection_QueryGetBondsResponse) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_QueryGetBondsResponse) Interface() protoreflect.ProtoMessage { + return (*QueryGetBondsResponse)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_QueryGetBondsResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if len(x.Bonds) != 0 { + value := protoreflect.ValueOfList(&_QueryGetBondsResponse_1_list{list: &x.Bonds}) + if !f(fd_QueryGetBondsResponse_bonds, value) { + return + } + } + if x.Pagination != nil { + value := protoreflect.ValueOfMessage(x.Pagination.ProtoReflect()) + if !f(fd_QueryGetBondsResponse_pagination, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_QueryGetBondsResponse) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "cerc.bond.v1.QueryGetBondsResponse.bonds": + return len(x.Bonds) != 0 + case "cerc.bond.v1.QueryGetBondsResponse.pagination": + return x.Pagination != nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cerc.bond.v1.QueryGetBondsResponse")) + } + panic(fmt.Errorf("message cerc.bond.v1.QueryGetBondsResponse does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryGetBondsResponse) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "cerc.bond.v1.QueryGetBondsResponse.bonds": + x.Bonds = nil + case "cerc.bond.v1.QueryGetBondsResponse.pagination": + x.Pagination = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cerc.bond.v1.QueryGetBondsResponse")) + } + panic(fmt.Errorf("message cerc.bond.v1.QueryGetBondsResponse does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_QueryGetBondsResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "cerc.bond.v1.QueryGetBondsResponse.bonds": + if len(x.Bonds) == 0 { + return protoreflect.ValueOfList(&_QueryGetBondsResponse_1_list{}) + } + listValue := &_QueryGetBondsResponse_1_list{list: &x.Bonds} + return protoreflect.ValueOfList(listValue) + case "cerc.bond.v1.QueryGetBondsResponse.pagination": + value := x.Pagination + return protoreflect.ValueOfMessage(value.ProtoReflect()) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cerc.bond.v1.QueryGetBondsResponse")) + } + panic(fmt.Errorf("message cerc.bond.v1.QueryGetBondsResponse does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryGetBondsResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "cerc.bond.v1.QueryGetBondsResponse.bonds": + lv := value.List() + clv := lv.(*_QueryGetBondsResponse_1_list) + x.Bonds = *clv.list + case "cerc.bond.v1.QueryGetBondsResponse.pagination": + x.Pagination = value.Message().Interface().(*v1beta1.PageResponse) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cerc.bond.v1.QueryGetBondsResponse")) + } + panic(fmt.Errorf("message cerc.bond.v1.QueryGetBondsResponse does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryGetBondsResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "cerc.bond.v1.QueryGetBondsResponse.bonds": + if x.Bonds == nil { + x.Bonds = []*Bond{} + } + value := &_QueryGetBondsResponse_1_list{list: &x.Bonds} + return protoreflect.ValueOfList(value) + case "cerc.bond.v1.QueryGetBondsResponse.pagination": + if x.Pagination == nil { + x.Pagination = new(v1beta1.PageResponse) + } + return protoreflect.ValueOfMessage(x.Pagination.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cerc.bond.v1.QueryGetBondsResponse")) + } + panic(fmt.Errorf("message cerc.bond.v1.QueryGetBondsResponse does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_QueryGetBondsResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "cerc.bond.v1.QueryGetBondsResponse.bonds": + list := []*Bond{} + return protoreflect.ValueOfList(&_QueryGetBondsResponse_1_list{list: &list}) + case "cerc.bond.v1.QueryGetBondsResponse.pagination": + m := new(v1beta1.PageResponse) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cerc.bond.v1.QueryGetBondsResponse")) + } + panic(fmt.Errorf("message cerc.bond.v1.QueryGetBondsResponse does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_QueryGetBondsResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in cerc.bond.v1.QueryGetBondsResponse", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_QueryGetBondsResponse) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryGetBondsResponse) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_QueryGetBondsResponse) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_QueryGetBondsResponse) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*QueryGetBondsResponse) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if len(x.Bonds) > 0 { + for _, e := range x.Bonds { + l = options.Size(e) + n += 1 + l + runtime.Sov(uint64(l)) + } + } + if x.Pagination != nil { + l = options.Size(x.Pagination) + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*QueryGetBondsResponse) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if x.Pagination != nil { + encoded, err := options.Marshal(x.Pagination) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0x12 + } + if len(x.Bonds) > 0 { + for iNdEx := len(x.Bonds) - 1; iNdEx >= 0; iNdEx-- { + encoded, err := options.Marshal(x.Bonds[iNdEx]) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0xa + } + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*QueryGetBondsResponse) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, 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 protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryGetBondsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryGetBondsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Bonds", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Bonds = append(x.Bonds, &Bond{}) + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Bonds[len(x.Bonds)-1]); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if x.Pagination == nil { + x.Pagination = &v1beta1.PageResponse{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Pagination); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.27.0 +// protoc (unknown) +// source: cerc/bond/v1/query.proto + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// QueryGetBondById queries a bonds. +type QueryGetBondsRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // pagination defines an optional pagination for the request. + Pagination *v1beta1.PageRequest `protobuf:"bytes,1,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (x *QueryGetBondsRequest) Reset() { + *x = QueryGetBondsRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_cerc_bond_v1_query_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *QueryGetBondsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*QueryGetBondsRequest) ProtoMessage() {} + +// Deprecated: Use QueryGetBondsRequest.ProtoReflect.Descriptor instead. +func (*QueryGetBondsRequest) Descriptor() ([]byte, []int) { + return file_cerc_bond_v1_query_proto_rawDescGZIP(), []int{0} +} + +func (x *QueryGetBondsRequest) GetPagination() *v1beta1.PageRequest { + if x != nil { + return x.Pagination + } + return nil +} + +// QueryGetBondsResponse is response type for get the bonds by bond-id +type QueryGetBondsResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Bonds []*Bond `protobuf:"bytes,1,rep,name=bonds,proto3" json:"bonds,omitempty"` + // pagination defines the pagination in the response. + Pagination *v1beta1.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (x *QueryGetBondsResponse) Reset() { + *x = QueryGetBondsResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_cerc_bond_v1_query_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *QueryGetBondsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*QueryGetBondsResponse) ProtoMessage() {} + +// Deprecated: Use QueryGetBondsResponse.ProtoReflect.Descriptor instead. +func (*QueryGetBondsResponse) Descriptor() ([]byte, []int) { + return file_cerc_bond_v1_query_proto_rawDescGZIP(), []int{1} +} + +func (x *QueryGetBondsResponse) GetBonds() []*Bond { + if x != nil { + return x.Bonds + } + return nil +} + +func (x *QueryGetBondsResponse) GetPagination() *v1beta1.PageResponse { + if x != nil { + return x.Pagination + } + return nil +} + +var File_cerc_bond_v1_query_proto protoreflect.FileDescriptor + +var file_cerc_bond_v1_query_proto_rawDesc = []byte{ + 0x0a, 0x18, 0x63, 0x65, 0x72, 0x63, 0x2f, 0x62, 0x6f, 0x6e, 0x64, 0x2f, 0x76, 0x31, 0x2f, 0x71, + 0x75, 0x65, 0x72, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0c, 0x63, 0x65, 0x72, 0x63, + 0x2e, 0x62, 0x6f, 0x6e, 0x64, 0x2e, 0x76, 0x31, 0x1a, 0x14, 0x67, 0x6f, 0x67, 0x6f, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x67, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x17, + 0x63, 0x65, 0x72, 0x63, 0x2f, 0x62, 0x6f, 0x6e, 0x64, 0x2f, 0x76, 0x31, 0x2f, 0x62, 0x6f, 0x6e, + 0x64, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, + 0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x2a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x62, 0x61, + 0x73, 0x65, 0x2f, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, + 0x2f, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x22, 0x5e, 0x0a, 0x14, 0x51, 0x75, 0x65, 0x72, 0x79, 0x47, 0x65, 0x74, 0x42, 0x6f, 0x6e, + 0x64, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x46, 0x0a, 0x0a, 0x70, 0x61, 0x67, + 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x26, 0x2e, + 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x71, 0x75, 0x65, 0x72, + 0x79, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x50, 0x61, 0x67, 0x65, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x52, 0x0a, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x22, 0xa9, 0x01, 0x0a, 0x15, 0x51, 0x75, 0x65, 0x72, 0x79, 0x47, 0x65, 0x74, 0x42, 0x6f, + 0x6e, 0x64, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x47, 0x0a, 0x05, 0x62, + 0x6f, 0x6e, 0x64, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x63, 0x65, 0x72, + 0x63, 0x2e, 0x62, 0x6f, 0x6e, 0x64, 0x2e, 0x76, 0x31, 0x2e, 0x42, 0x6f, 0x6e, 0x64, 0x42, 0x1d, + 0xf2, 0xde, 0x1f, 0x19, 0x6a, 0x73, 0x6f, 0x6e, 0x3a, 0x22, 0x62, 0x6f, 0x6e, 0x64, 0x73, 0x22, + 0x20, 0x79, 0x61, 0x6d, 0x6c, 0x3a, 0x22, 0x62, 0x6f, 0x6e, 0x64, 0x73, 0x22, 0x52, 0x05, 0x62, + 0x6f, 0x6e, 0x64, 0x73, 0x12, 0x47, 0x0a, 0x0a, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, + 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x62, + 0x65, 0x74, 0x61, 0x31, 0x2e, 0x50, 0x61, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x52, 0x0a, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x32, 0x76, 0x0a, + 0x05, 0x51, 0x75, 0x65, 0x72, 0x79, 0x12, 0x6d, 0x0a, 0x05, 0x42, 0x6f, 0x6e, 0x64, 0x73, 0x12, + 0x22, 0x2e, 0x63, 0x65, 0x72, 0x63, 0x2e, 0x62, 0x6f, 0x6e, 0x64, 0x2e, 0x76, 0x31, 0x2e, 0x51, + 0x75, 0x65, 0x72, 0x79, 0x47, 0x65, 0x74, 0x42, 0x6f, 0x6e, 0x64, 0x73, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x23, 0x2e, 0x63, 0x65, 0x72, 0x63, 0x2e, 0x62, 0x6f, 0x6e, 0x64, 0x2e, + 0x76, 0x31, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x47, 0x65, 0x74, 0x42, 0x6f, 0x6e, 0x64, 0x73, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x1b, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x15, + 0x12, 0x13, 0x2f, 0x63, 0x65, 0x72, 0x63, 0x2f, 0x62, 0x6f, 0x6e, 0x64, 0x2f, 0x76, 0x31, 0x2f, + 0x62, 0x6f, 0x6e, 0x64, 0x73, 0x42, 0xa6, 0x01, 0x0a, 0x10, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x65, + 0x72, 0x63, 0x2e, 0x62, 0x6f, 0x6e, 0x64, 0x2e, 0x76, 0x31, 0x42, 0x0a, 0x51, 0x75, 0x65, 0x72, + 0x79, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x34, 0x67, 0x69, 0x74, 0x2e, 0x76, 0x64, + 0x62, 0x2e, 0x74, 0x6f, 0x2f, 0x63, 0x65, 0x72, 0x63, 0x2d, 0x69, 0x6f, 0x2f, 0x6c, 0x61, 0x63, + 0x6f, 0x6e, 0x69, 0x63, 0x32, 0x64, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x65, 0x72, 0x63, 0x2f, + 0x62, 0x6f, 0x6e, 0x64, 0x2f, 0x76, 0x31, 0x3b, 0x62, 0x6f, 0x6e, 0x64, 0x76, 0x31, 0xa2, 0x02, + 0x03, 0x43, 0x42, 0x58, 0xaa, 0x02, 0x0c, 0x43, 0x65, 0x72, 0x63, 0x2e, 0x42, 0x6f, 0x6e, 0x64, + 0x2e, 0x56, 0x31, 0xca, 0x02, 0x0c, 0x43, 0x65, 0x72, 0x63, 0x5c, 0x42, 0x6f, 0x6e, 0x64, 0x5c, + 0x56, 0x31, 0xe2, 0x02, 0x18, 0x43, 0x65, 0x72, 0x63, 0x5c, 0x42, 0x6f, 0x6e, 0x64, 0x5c, 0x56, + 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0e, + 0x43, 0x65, 0x72, 0x63, 0x3a, 0x3a, 0x42, 0x6f, 0x6e, 0x64, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_cerc_bond_v1_query_proto_rawDescOnce sync.Once + file_cerc_bond_v1_query_proto_rawDescData = file_cerc_bond_v1_query_proto_rawDesc +) + +func file_cerc_bond_v1_query_proto_rawDescGZIP() []byte { + file_cerc_bond_v1_query_proto_rawDescOnce.Do(func() { + file_cerc_bond_v1_query_proto_rawDescData = protoimpl.X.CompressGZIP(file_cerc_bond_v1_query_proto_rawDescData) + }) + return file_cerc_bond_v1_query_proto_rawDescData +} + +var file_cerc_bond_v1_query_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_cerc_bond_v1_query_proto_goTypes = []interface{}{ + (*QueryGetBondsRequest)(nil), // 0: cerc.bond.v1.QueryGetBondsRequest + (*QueryGetBondsResponse)(nil), // 1: cerc.bond.v1.QueryGetBondsResponse + (*v1beta1.PageRequest)(nil), // 2: cosmos.base.query.v1beta1.PageRequest + (*Bond)(nil), // 3: cerc.bond.v1.Bond + (*v1beta1.PageResponse)(nil), // 4: cosmos.base.query.v1beta1.PageResponse +} +var file_cerc_bond_v1_query_proto_depIdxs = []int32{ + 2, // 0: cerc.bond.v1.QueryGetBondsRequest.pagination:type_name -> cosmos.base.query.v1beta1.PageRequest + 3, // 1: cerc.bond.v1.QueryGetBondsResponse.bonds:type_name -> cerc.bond.v1.Bond + 4, // 2: cerc.bond.v1.QueryGetBondsResponse.pagination:type_name -> cosmos.base.query.v1beta1.PageResponse + 0, // 3: cerc.bond.v1.Query.Bonds:input_type -> cerc.bond.v1.QueryGetBondsRequest + 1, // 4: cerc.bond.v1.Query.Bonds:output_type -> cerc.bond.v1.QueryGetBondsResponse + 4, // [4:5] is the sub-list for method output_type + 3, // [3:4] is the sub-list for method input_type + 3, // [3:3] is the sub-list for extension type_name + 3, // [3:3] is the sub-list for extension extendee + 0, // [0:3] is the sub-list for field type_name +} + +func init() { file_cerc_bond_v1_query_proto_init() } +func file_cerc_bond_v1_query_proto_init() { + if File_cerc_bond_v1_query_proto != nil { + return + } + file_cerc_bond_v1_bond_proto_init() + if !protoimpl.UnsafeEnabled { + file_cerc_bond_v1_query_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*QueryGetBondsRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_cerc_bond_v1_query_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*QueryGetBondsResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_cerc_bond_v1_query_proto_rawDesc, + NumEnums: 0, + NumMessages: 2, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_cerc_bond_v1_query_proto_goTypes, + DependencyIndexes: file_cerc_bond_v1_query_proto_depIdxs, + MessageInfos: file_cerc_bond_v1_query_proto_msgTypes, + }.Build() + File_cerc_bond_v1_query_proto = out.File + file_cerc_bond_v1_query_proto_rawDesc = nil + file_cerc_bond_v1_query_proto_goTypes = nil + file_cerc_bond_v1_query_proto_depIdxs = nil +} diff --git a/api/cerc/bond/v1/query_grpc.pb.go b/api/cerc/bond/v1/query_grpc.pb.go new file mode 100644 index 00000000..0d7797bd --- /dev/null +++ b/api/cerc/bond/v1/query_grpc.pb.go @@ -0,0 +1,111 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.3.0 +// - protoc (unknown) +// source: cerc/bond/v1/query.proto + +package bondv1 + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +const ( + Query_Bonds_FullMethodName = "/cerc.bond.v1.Query/Bonds" +) + +// QueryClient is the client API for Query service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type QueryClient interface { + // Bonds queries bonds list. + Bonds(ctx context.Context, in *QueryGetBondsRequest, opts ...grpc.CallOption) (*QueryGetBondsResponse, error) +} + +type queryClient struct { + cc grpc.ClientConnInterface +} + +func NewQueryClient(cc grpc.ClientConnInterface) QueryClient { + return &queryClient{cc} +} + +func (c *queryClient) Bonds(ctx context.Context, in *QueryGetBondsRequest, opts ...grpc.CallOption) (*QueryGetBondsResponse, error) { + out := new(QueryGetBondsResponse) + err := c.cc.Invoke(ctx, Query_Bonds_FullMethodName, 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 +type QueryServer interface { + // Bonds queries bonds list. + Bonds(context.Context, *QueryGetBondsRequest) (*QueryGetBondsResponse, error) + mustEmbedUnimplementedQueryServer() +} + +// UnimplementedQueryServer must be embedded to have forward compatible implementations. +type UnimplementedQueryServer struct { +} + +func (UnimplementedQueryServer) Bonds(context.Context, *QueryGetBondsRequest) (*QueryGetBondsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Bonds not implemented") +} +func (UnimplementedQueryServer) mustEmbedUnimplementedQueryServer() {} + +// UnsafeQueryServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to QueryServer will +// result in compilation errors. +type UnsafeQueryServer interface { + mustEmbedUnimplementedQueryServer() +} + +func RegisterQueryServer(s grpc.ServiceRegistrar, srv QueryServer) { + s.RegisterService(&Query_ServiceDesc, srv) +} + +func _Query_Bonds_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryGetBondsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Bonds(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Query_Bonds_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Bonds(ctx, req.(*QueryGetBondsRequest)) + } + 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) +var Query_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "cerc.bond.v1.Query", + HandlerType: (*QueryServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Bonds", + Handler: _Query_Bonds_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "cerc/bond/v1/query.proto", +} diff --git a/api/cerc/bond/v1/tx.pulsar.go b/api/cerc/bond/v1/tx.pulsar.go new file mode 100644 index 00000000..53501cf5 --- /dev/null +++ b/api/cerc/bond/v1/tx.pulsar.go @@ -0,0 +1,1216 @@ +// Code generated by protoc-gen-go-pulsar. DO NOT EDIT. +package bondv1 + +import ( + v1beta1 "cosmossdk.io/api/cosmos/base/v1beta1" + fmt "fmt" + runtime "github.com/cosmos/cosmos-proto/runtime" + _ "github.com/cosmos/cosmos-sdk/types/msgservice" + _ "github.com/cosmos/gogoproto/gogoproto" + _ "google.golang.org/genproto/googleapis/api/annotations" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoiface "google.golang.org/protobuf/runtime/protoiface" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + io "io" + reflect "reflect" + sync "sync" +) + +var _ protoreflect.List = (*_MsgCreateBond_2_list)(nil) + +type _MsgCreateBond_2_list struct { + list *[]*v1beta1.Coin +} + +func (x *_MsgCreateBond_2_list) Len() int { + if x.list == nil { + return 0 + } + return len(*x.list) +} + +func (x *_MsgCreateBond_2_list) Get(i int) protoreflect.Value { + return protoreflect.ValueOfMessage((*x.list)[i].ProtoReflect()) +} + +func (x *_MsgCreateBond_2_list) Set(i int, value protoreflect.Value) { + valueUnwrapped := value.Message() + concreteValue := valueUnwrapped.Interface().(*v1beta1.Coin) + (*x.list)[i] = concreteValue +} + +func (x *_MsgCreateBond_2_list) Append(value protoreflect.Value) { + valueUnwrapped := value.Message() + concreteValue := valueUnwrapped.Interface().(*v1beta1.Coin) + *x.list = append(*x.list, concreteValue) +} + +func (x *_MsgCreateBond_2_list) AppendMutable() protoreflect.Value { + v := new(v1beta1.Coin) + *x.list = append(*x.list, v) + return protoreflect.ValueOfMessage(v.ProtoReflect()) +} + +func (x *_MsgCreateBond_2_list) Truncate(n int) { + for i := n; i < len(*x.list); i++ { + (*x.list)[i] = nil + } + *x.list = (*x.list)[:n] +} + +func (x *_MsgCreateBond_2_list) NewElement() protoreflect.Value { + v := new(v1beta1.Coin) + return protoreflect.ValueOfMessage(v.ProtoReflect()) +} + +func (x *_MsgCreateBond_2_list) IsValid() bool { + return x.list != nil +} + +var ( + md_MsgCreateBond protoreflect.MessageDescriptor + fd_MsgCreateBond_signer protoreflect.FieldDescriptor + fd_MsgCreateBond_coins protoreflect.FieldDescriptor +) + +func init() { + file_cerc_bond_v1_tx_proto_init() + md_MsgCreateBond = File_cerc_bond_v1_tx_proto.Messages().ByName("MsgCreateBond") + fd_MsgCreateBond_signer = md_MsgCreateBond.Fields().ByName("signer") + fd_MsgCreateBond_coins = md_MsgCreateBond.Fields().ByName("coins") +} + +var _ protoreflect.Message = (*fastReflection_MsgCreateBond)(nil) + +type fastReflection_MsgCreateBond MsgCreateBond + +func (x *MsgCreateBond) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgCreateBond)(x) +} + +func (x *MsgCreateBond) slowProtoReflect() protoreflect.Message { + mi := &file_cerc_bond_v1_tx_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_MsgCreateBond_messageType fastReflection_MsgCreateBond_messageType +var _ protoreflect.MessageType = fastReflection_MsgCreateBond_messageType{} + +type fastReflection_MsgCreateBond_messageType struct{} + +func (x fastReflection_MsgCreateBond_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgCreateBond)(nil) +} +func (x fastReflection_MsgCreateBond_messageType) New() protoreflect.Message { + return new(fastReflection_MsgCreateBond) +} +func (x fastReflection_MsgCreateBond_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgCreateBond +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_MsgCreateBond) Descriptor() protoreflect.MessageDescriptor { + return md_MsgCreateBond +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_MsgCreateBond) Type() protoreflect.MessageType { + return _fastReflection_MsgCreateBond_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_MsgCreateBond) New() protoreflect.Message { + return new(fastReflection_MsgCreateBond) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_MsgCreateBond) Interface() protoreflect.ProtoMessage { + return (*MsgCreateBond)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_MsgCreateBond) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Signer != "" { + value := protoreflect.ValueOfString(x.Signer) + if !f(fd_MsgCreateBond_signer, value) { + return + } + } + if len(x.Coins) != 0 { + value := protoreflect.ValueOfList(&_MsgCreateBond_2_list{list: &x.Coins}) + if !f(fd_MsgCreateBond_coins, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_MsgCreateBond) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "cerc.bond.v1.MsgCreateBond.signer": + return x.Signer != "" + case "cerc.bond.v1.MsgCreateBond.coins": + return len(x.Coins) != 0 + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cerc.bond.v1.MsgCreateBond")) + } + panic(fmt.Errorf("message cerc.bond.v1.MsgCreateBond does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgCreateBond) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "cerc.bond.v1.MsgCreateBond.signer": + x.Signer = "" + case "cerc.bond.v1.MsgCreateBond.coins": + x.Coins = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cerc.bond.v1.MsgCreateBond")) + } + panic(fmt.Errorf("message cerc.bond.v1.MsgCreateBond does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_MsgCreateBond) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "cerc.bond.v1.MsgCreateBond.signer": + value := x.Signer + return protoreflect.ValueOfString(value) + case "cerc.bond.v1.MsgCreateBond.coins": + if len(x.Coins) == 0 { + return protoreflect.ValueOfList(&_MsgCreateBond_2_list{}) + } + listValue := &_MsgCreateBond_2_list{list: &x.Coins} + return protoreflect.ValueOfList(listValue) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cerc.bond.v1.MsgCreateBond")) + } + panic(fmt.Errorf("message cerc.bond.v1.MsgCreateBond does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgCreateBond) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "cerc.bond.v1.MsgCreateBond.signer": + x.Signer = value.Interface().(string) + case "cerc.bond.v1.MsgCreateBond.coins": + lv := value.List() + clv := lv.(*_MsgCreateBond_2_list) + x.Coins = *clv.list + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cerc.bond.v1.MsgCreateBond")) + } + panic(fmt.Errorf("message cerc.bond.v1.MsgCreateBond does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgCreateBond) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "cerc.bond.v1.MsgCreateBond.coins": + if x.Coins == nil { + x.Coins = []*v1beta1.Coin{} + } + value := &_MsgCreateBond_2_list{list: &x.Coins} + return protoreflect.ValueOfList(value) + case "cerc.bond.v1.MsgCreateBond.signer": + panic(fmt.Errorf("field signer of message cerc.bond.v1.MsgCreateBond is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cerc.bond.v1.MsgCreateBond")) + } + panic(fmt.Errorf("message cerc.bond.v1.MsgCreateBond does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_MsgCreateBond) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "cerc.bond.v1.MsgCreateBond.signer": + return protoreflect.ValueOfString("") + case "cerc.bond.v1.MsgCreateBond.coins": + list := []*v1beta1.Coin{} + return protoreflect.ValueOfList(&_MsgCreateBond_2_list{list: &list}) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cerc.bond.v1.MsgCreateBond")) + } + panic(fmt.Errorf("message cerc.bond.v1.MsgCreateBond does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_MsgCreateBond) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in cerc.bond.v1.MsgCreateBond", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_MsgCreateBond) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgCreateBond) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_MsgCreateBond) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_MsgCreateBond) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*MsgCreateBond) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + l = len(x.Signer) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if len(x.Coins) > 0 { + for _, e := range x.Coins { + l = options.Size(e) + n += 1 + l + runtime.Sov(uint64(l)) + } + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*MsgCreateBond) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if len(x.Coins) > 0 { + for iNdEx := len(x.Coins) - 1; iNdEx >= 0; iNdEx-- { + encoded, err := options.Marshal(x.Coins[iNdEx]) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0x12 + } + } + if len(x.Signer) > 0 { + i -= len(x.Signer) + copy(dAtA[i:], x.Signer) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Signer))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*MsgCreateBond) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, 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 protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgCreateBond: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgCreateBond: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Signer", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Signer = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Coins", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Coins = append(x.Coins, &v1beta1.Coin{}) + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Coins[len(x.Coins)-1]); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var ( + md_MsgCreateBondResponse protoreflect.MessageDescriptor + fd_MsgCreateBondResponse_id protoreflect.FieldDescriptor +) + +func init() { + file_cerc_bond_v1_tx_proto_init() + md_MsgCreateBondResponse = File_cerc_bond_v1_tx_proto.Messages().ByName("MsgCreateBondResponse") + fd_MsgCreateBondResponse_id = md_MsgCreateBondResponse.Fields().ByName("id") +} + +var _ protoreflect.Message = (*fastReflection_MsgCreateBondResponse)(nil) + +type fastReflection_MsgCreateBondResponse MsgCreateBondResponse + +func (x *MsgCreateBondResponse) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgCreateBondResponse)(x) +} + +func (x *MsgCreateBondResponse) slowProtoReflect() protoreflect.Message { + mi := &file_cerc_bond_v1_tx_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_MsgCreateBondResponse_messageType fastReflection_MsgCreateBondResponse_messageType +var _ protoreflect.MessageType = fastReflection_MsgCreateBondResponse_messageType{} + +type fastReflection_MsgCreateBondResponse_messageType struct{} + +func (x fastReflection_MsgCreateBondResponse_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgCreateBondResponse)(nil) +} +func (x fastReflection_MsgCreateBondResponse_messageType) New() protoreflect.Message { + return new(fastReflection_MsgCreateBondResponse) +} +func (x fastReflection_MsgCreateBondResponse_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgCreateBondResponse +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_MsgCreateBondResponse) Descriptor() protoreflect.MessageDescriptor { + return md_MsgCreateBondResponse +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_MsgCreateBondResponse) Type() protoreflect.MessageType { + return _fastReflection_MsgCreateBondResponse_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_MsgCreateBondResponse) New() protoreflect.Message { + return new(fastReflection_MsgCreateBondResponse) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_MsgCreateBondResponse) Interface() protoreflect.ProtoMessage { + return (*MsgCreateBondResponse)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_MsgCreateBondResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Id != "" { + value := protoreflect.ValueOfString(x.Id) + if !f(fd_MsgCreateBondResponse_id, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_MsgCreateBondResponse) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "cerc.bond.v1.MsgCreateBondResponse.id": + return x.Id != "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cerc.bond.v1.MsgCreateBondResponse")) + } + panic(fmt.Errorf("message cerc.bond.v1.MsgCreateBondResponse does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgCreateBondResponse) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "cerc.bond.v1.MsgCreateBondResponse.id": + x.Id = "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cerc.bond.v1.MsgCreateBondResponse")) + } + panic(fmt.Errorf("message cerc.bond.v1.MsgCreateBondResponse does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_MsgCreateBondResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "cerc.bond.v1.MsgCreateBondResponse.id": + value := x.Id + return protoreflect.ValueOfString(value) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cerc.bond.v1.MsgCreateBondResponse")) + } + panic(fmt.Errorf("message cerc.bond.v1.MsgCreateBondResponse does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgCreateBondResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "cerc.bond.v1.MsgCreateBondResponse.id": + x.Id = value.Interface().(string) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cerc.bond.v1.MsgCreateBondResponse")) + } + panic(fmt.Errorf("message cerc.bond.v1.MsgCreateBondResponse does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgCreateBondResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "cerc.bond.v1.MsgCreateBondResponse.id": + panic(fmt.Errorf("field id of message cerc.bond.v1.MsgCreateBondResponse is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cerc.bond.v1.MsgCreateBondResponse")) + } + panic(fmt.Errorf("message cerc.bond.v1.MsgCreateBondResponse does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_MsgCreateBondResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "cerc.bond.v1.MsgCreateBondResponse.id": + return protoreflect.ValueOfString("") + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cerc.bond.v1.MsgCreateBondResponse")) + } + panic(fmt.Errorf("message cerc.bond.v1.MsgCreateBondResponse does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_MsgCreateBondResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in cerc.bond.v1.MsgCreateBondResponse", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_MsgCreateBondResponse) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgCreateBondResponse) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_MsgCreateBondResponse) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_MsgCreateBondResponse) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*MsgCreateBondResponse) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + l = len(x.Id) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*MsgCreateBondResponse) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if len(x.Id) > 0 { + i -= len(x.Id) + copy(dAtA[i:], x.Id) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Id))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*MsgCreateBondResponse) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, 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 protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgCreateBondResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgCreateBondResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Id = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.27.0 +// protoc (unknown) +// source: cerc/bond/v1/tx.proto + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// MsgCreateBond defines a SDK message for creating a new bond. +type MsgCreateBond struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Signer string `protobuf:"bytes,1,opt,name=signer,proto3" json:"signer,omitempty"` + Coins []*v1beta1.Coin `protobuf:"bytes,2,rep,name=coins,proto3" json:"coins,omitempty"` +} + +func (x *MsgCreateBond) Reset() { + *x = MsgCreateBond{} + if protoimpl.UnsafeEnabled { + mi := &file_cerc_bond_v1_tx_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgCreateBond) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgCreateBond) ProtoMessage() {} + +// Deprecated: Use MsgCreateBond.ProtoReflect.Descriptor instead. +func (*MsgCreateBond) Descriptor() ([]byte, []int) { + return file_cerc_bond_v1_tx_proto_rawDescGZIP(), []int{0} +} + +func (x *MsgCreateBond) GetSigner() string { + if x != nil { + return x.Signer + } + return "" +} + +func (x *MsgCreateBond) GetCoins() []*v1beta1.Coin { + if x != nil { + return x.Coins + } + return nil +} + +// MsgCreateBondResponse defines the Msg/CreateBond response type. +type MsgCreateBondResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` +} + +func (x *MsgCreateBondResponse) Reset() { + *x = MsgCreateBondResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_cerc_bond_v1_tx_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgCreateBondResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgCreateBondResponse) ProtoMessage() {} + +// Deprecated: Use MsgCreateBondResponse.ProtoReflect.Descriptor instead. +func (*MsgCreateBondResponse) Descriptor() ([]byte, []int) { + return file_cerc_bond_v1_tx_proto_rawDescGZIP(), []int{1} +} + +func (x *MsgCreateBondResponse) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +var File_cerc_bond_v1_tx_proto protoreflect.FileDescriptor + +var file_cerc_bond_v1_tx_proto_rawDesc = []byte{ + 0x0a, 0x15, 0x63, 0x65, 0x72, 0x63, 0x2f, 0x62, 0x6f, 0x6e, 0x64, 0x2f, 0x76, 0x31, 0x2f, 0x74, + 0x78, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0c, 0x63, 0x65, 0x72, 0x63, 0x2e, 0x62, 0x6f, + 0x6e, 0x64, 0x2e, 0x76, 0x31, 0x1a, 0x17, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x6d, 0x73, + 0x67, 0x2f, 0x76, 0x31, 0x2f, 0x6d, 0x73, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x14, + 0x67, 0x6f, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x67, 0x6f, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, + 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x1a, 0x1e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x62, 0x61, 0x73, 0x65, 0x2f, + 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x63, 0x6f, 0x69, 0x6e, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x22, 0xb4, 0x01, 0x0a, 0x0d, 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, + 0x42, 0x6f, 0x6e, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x69, 0x67, 0x6e, 0x65, 0x72, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x69, 0x67, 0x6e, 0x65, 0x72, 0x12, 0x7e, 0x0a, 0x05, + 0x63, 0x6f, 0x69, 0x6e, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, + 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, + 0x31, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x42, 0x4d, 0xc8, 0xde, 0x1f, 0x00, 0xf2, 0xde, 0x1f, 0x19, + 0x6a, 0x73, 0x6f, 0x6e, 0x3a, 0x22, 0x63, 0x6f, 0x69, 0x6e, 0x73, 0x22, 0x20, 0x79, 0x61, 0x6d, + 0x6c, 0x3a, 0x22, 0x63, 0x6f, 0x69, 0x6e, 0x73, 0x22, 0xaa, 0xdf, 0x1f, 0x28, 0x67, 0x69, 0x74, + 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x63, + 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2d, 0x73, 0x64, 0x6b, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, + 0x43, 0x6f, 0x69, 0x6e, 0x73, 0x52, 0x05, 0x63, 0x6f, 0x69, 0x6e, 0x73, 0x3a, 0x0b, 0x82, 0xe7, + 0xb0, 0x2a, 0x06, 0x73, 0x69, 0x67, 0x6e, 0x65, 0x72, 0x22, 0x27, 0x0a, 0x15, 0x4d, 0x73, 0x67, + 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x42, 0x6f, 0x6e, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, + 0x69, 0x64, 0x32, 0x7f, 0x0a, 0x03, 0x4d, 0x73, 0x67, 0x12, 0x71, 0x0a, 0x0a, 0x43, 0x72, 0x65, + 0x61, 0x74, 0x65, 0x42, 0x6f, 0x6e, 0x64, 0x12, 0x1b, 0x2e, 0x63, 0x65, 0x72, 0x63, 0x2e, 0x62, + 0x6f, 0x6e, 0x64, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, + 0x42, 0x6f, 0x6e, 0x64, 0x1a, 0x23, 0x2e, 0x63, 0x65, 0x72, 0x63, 0x2e, 0x62, 0x6f, 0x6e, 0x64, + 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x42, 0x6f, 0x6e, + 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x21, 0x82, 0xd3, 0xe4, 0x93, 0x02, + 0x1b, 0x22, 0x19, 0x2f, 0x63, 0x65, 0x72, 0x63, 0x2f, 0x62, 0x6f, 0x6e, 0x64, 0x2f, 0x76, 0x31, + 0x2f, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x5f, 0x62, 0x6f, 0x6e, 0x64, 0x1a, 0x05, 0x80, 0xe7, + 0xb0, 0x2a, 0x01, 0x42, 0xa3, 0x01, 0x0a, 0x10, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x65, 0x72, 0x63, + 0x2e, 0x62, 0x6f, 0x6e, 0x64, 0x2e, 0x76, 0x31, 0x42, 0x07, 0x54, 0x78, 0x50, 0x72, 0x6f, 0x74, + 0x6f, 0x50, 0x01, 0x5a, 0x34, 0x67, 0x69, 0x74, 0x2e, 0x76, 0x64, 0x62, 0x2e, 0x74, 0x6f, 0x2f, + 0x63, 0x65, 0x72, 0x63, 0x2d, 0x69, 0x6f, 0x2f, 0x6c, 0x61, 0x63, 0x6f, 0x6e, 0x69, 0x63, 0x32, + 0x64, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x65, 0x72, 0x63, 0x2f, 0x62, 0x6f, 0x6e, 0x64, 0x2f, + 0x76, 0x31, 0x3b, 0x62, 0x6f, 0x6e, 0x64, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x43, 0x42, 0x58, 0xaa, + 0x02, 0x0c, 0x43, 0x65, 0x72, 0x63, 0x2e, 0x42, 0x6f, 0x6e, 0x64, 0x2e, 0x56, 0x31, 0xca, 0x02, + 0x0c, 0x43, 0x65, 0x72, 0x63, 0x5c, 0x42, 0x6f, 0x6e, 0x64, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x18, + 0x43, 0x65, 0x72, 0x63, 0x5c, 0x42, 0x6f, 0x6e, 0x64, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, + 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0e, 0x43, 0x65, 0x72, 0x63, 0x3a, + 0x3a, 0x42, 0x6f, 0x6e, 0x64, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x33, +} + +var ( + file_cerc_bond_v1_tx_proto_rawDescOnce sync.Once + file_cerc_bond_v1_tx_proto_rawDescData = file_cerc_bond_v1_tx_proto_rawDesc +) + +func file_cerc_bond_v1_tx_proto_rawDescGZIP() []byte { + file_cerc_bond_v1_tx_proto_rawDescOnce.Do(func() { + file_cerc_bond_v1_tx_proto_rawDescData = protoimpl.X.CompressGZIP(file_cerc_bond_v1_tx_proto_rawDescData) + }) + return file_cerc_bond_v1_tx_proto_rawDescData +} + +var file_cerc_bond_v1_tx_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_cerc_bond_v1_tx_proto_goTypes = []interface{}{ + (*MsgCreateBond)(nil), // 0: cerc.bond.v1.MsgCreateBond + (*MsgCreateBondResponse)(nil), // 1: cerc.bond.v1.MsgCreateBondResponse + (*v1beta1.Coin)(nil), // 2: cosmos.base.v1beta1.Coin +} +var file_cerc_bond_v1_tx_proto_depIdxs = []int32{ + 2, // 0: cerc.bond.v1.MsgCreateBond.coins:type_name -> cosmos.base.v1beta1.Coin + 0, // 1: cerc.bond.v1.Msg.CreateBond:input_type -> cerc.bond.v1.MsgCreateBond + 1, // 2: cerc.bond.v1.Msg.CreateBond:output_type -> cerc.bond.v1.MsgCreateBondResponse + 2, // [2:3] is the sub-list for method output_type + 1, // [1:2] is the sub-list for method input_type + 1, // [1:1] is the sub-list for extension type_name + 1, // [1:1] is the sub-list for extension extendee + 0, // [0:1] is the sub-list for field type_name +} + +func init() { file_cerc_bond_v1_tx_proto_init() } +func file_cerc_bond_v1_tx_proto_init() { + if File_cerc_bond_v1_tx_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_cerc_bond_v1_tx_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MsgCreateBond); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_cerc_bond_v1_tx_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MsgCreateBondResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_cerc_bond_v1_tx_proto_rawDesc, + NumEnums: 0, + NumMessages: 2, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_cerc_bond_v1_tx_proto_goTypes, + DependencyIndexes: file_cerc_bond_v1_tx_proto_depIdxs, + MessageInfos: file_cerc_bond_v1_tx_proto_msgTypes, + }.Build() + File_cerc_bond_v1_tx_proto = out.File + file_cerc_bond_v1_tx_proto_rawDesc = nil + file_cerc_bond_v1_tx_proto_goTypes = nil + file_cerc_bond_v1_tx_proto_depIdxs = nil +} diff --git a/api/cerc/bond/v1/tx_grpc.pb.go b/api/cerc/bond/v1/tx_grpc.pb.go new file mode 100644 index 00000000..f0f7592f --- /dev/null +++ b/api/cerc/bond/v1/tx_grpc.pb.go @@ -0,0 +1,111 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.3.0 +// - protoc (unknown) +// source: cerc/bond/v1/tx.proto + +package bondv1 + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +const ( + Msg_CreateBond_FullMethodName = "/cerc.bond.v1.Msg/CreateBond" +) + +// MsgClient is the client API for Msg service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type MsgClient interface { + // CreateBond defines a method for creating a new bond. + CreateBond(ctx context.Context, in *MsgCreateBond, opts ...grpc.CallOption) (*MsgCreateBondResponse, error) +} + +type msgClient struct { + cc grpc.ClientConnInterface +} + +func NewMsgClient(cc grpc.ClientConnInterface) MsgClient { + return &msgClient{cc} +} + +func (c *msgClient) CreateBond(ctx context.Context, in *MsgCreateBond, opts ...grpc.CallOption) (*MsgCreateBondResponse, error) { + out := new(MsgCreateBondResponse) + err := c.cc.Invoke(ctx, Msg_CreateBond_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// MsgServer is the server API for Msg service. +// All implementations must embed UnimplementedMsgServer +// for forward compatibility +type MsgServer interface { + // CreateBond defines a method for creating a new bond. + CreateBond(context.Context, *MsgCreateBond) (*MsgCreateBondResponse, error) + mustEmbedUnimplementedMsgServer() +} + +// UnimplementedMsgServer must be embedded to have forward compatible implementations. +type UnimplementedMsgServer struct { +} + +func (UnimplementedMsgServer) CreateBond(context.Context, *MsgCreateBond) (*MsgCreateBondResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CreateBond not implemented") +} +func (UnimplementedMsgServer) mustEmbedUnimplementedMsgServer() {} + +// UnsafeMsgServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to MsgServer will +// result in compilation errors. +type UnsafeMsgServer interface { + mustEmbedUnimplementedMsgServer() +} + +func RegisterMsgServer(s grpc.ServiceRegistrar, srv MsgServer) { + s.RegisterService(&Msg_ServiceDesc, srv) +} + +func _Msg_CreateBond_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgCreateBond) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).CreateBond(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Msg_CreateBond_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).CreateBond(ctx, req.(*MsgCreateBond)) + } + return interceptor(ctx, in, info, handler) +} + +// Msg_ServiceDesc is the grpc.ServiceDesc for Msg service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var Msg_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "cerc.bond.v1.Msg", + HandlerType: (*MsgServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "CreateBond", + Handler: _Msg_CreateBond_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "cerc/bond/v1/tx.proto", +} diff --git a/app/app.yaml b/app/app.yaml index 4bfc469f..1a7cc815 100644 --- a/app/app.yaml +++ b/app/app.yaml @@ -25,6 +25,7 @@ modules: permissions: [burner, staking] - account: not_bonded_tokens_pool permissions: [burner, staking] + - account: bond - name: bank config: "@type": cosmos.bank.module.v1.Module diff --git a/go.mod b/go.mod index 73080abc..c2d1a241 100644 --- a/go.mod +++ b/go.mod @@ -27,9 +27,12 @@ require ( github.com/cosmos/cosmos-proto v1.0.0-beta.3 github.com/cosmos/cosmos-sdk v0.50.3 github.com/cosmos/gogoproto v1.4.11 + github.com/golang/protobuf v1.5.3 github.com/grpc-ecosystem/grpc-gateway v1.16.0 github.com/spf13/cobra v1.8.0 github.com/spf13/viper v1.17.0 + google.golang.org/genproto/googleapis/api v0.0.0-20231120223509-83a465c0220f + google.golang.org/grpc v1.60.1 google.golang.org/protobuf v1.32.0 ) @@ -84,7 +87,6 @@ require ( github.com/gogo/protobuf v1.3.2 // indirect github.com/golang/glog v1.2.0 // indirect github.com/golang/mock v1.6.0 // indirect - github.com/golang/protobuf v1.5.3 // indirect github.com/golang/snappy v0.0.4 // indirect github.com/google/btree v1.1.2 // indirect github.com/google/go-cmp v0.6.0 // indirect @@ -159,9 +161,7 @@ require ( golang.org/x/term v0.15.0 // indirect golang.org/x/text v0.14.0 // indirect google.golang.org/genproto v0.0.0-20231211222908-989df2bf70f3 // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20231120223509-83a465c0220f // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20231212172506-995d672761c0 // indirect - google.golang.org/grpc v1.60.1 // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/proto/cerc/bond/v1/bond.proto b/proto/cerc/bond/v1/bond.proto index ed3baacc..500511cc 100644 --- a/proto/cerc/bond/v1/bond.proto +++ b/proto/cerc/bond/v1/bond.proto @@ -10,11 +10,10 @@ import "cosmos/base/v1beta1/coin.proto"; // Params defines the parameters of the bond module. message Params { // max_bond_amount is maximum amount to bond - cosmos.base.v1beta1.Coin max_bond_amount = 1 - [ - (gogoproto.nullable) = false, - (gogoproto.moretags) = "json:\"max_bond_amount\" yaml:\"max_bond_amount\"" - ]; + cosmos.base.v1beta1.Coin max_bond_amount = 1 [ + (gogoproto.nullable) = false, + (gogoproto.moretags) = "json:\"max_bond_amount\" yaml:\"max_bond_amount\"" + ]; } // Bond represents funds deposited by an account for record rent payments. diff --git a/proto/cerc/bond/v1/event.proto b/proto/cerc/bond/v1/event.proto deleted file mode 100644 index b7b7f9e7..00000000 --- a/proto/cerc/bond/v1/event.proto +++ /dev/null @@ -1 +0,0 @@ -// Not present in laconicd diff --git a/proto/cerc/bond/v1/genesis.proto b/proto/cerc/bond/v1/genesis.proto index e86fef82..3fb8d522 100644 --- a/proto/cerc/bond/v1/genesis.proto +++ b/proto/cerc/bond/v1/genesis.proto @@ -13,5 +13,6 @@ message GenesisState { Params params = 1 [(gogoproto.nullable) = false]; // bonds defines all the bonds + // TODO: Add nullable = false ? repeated Bond bonds = 2 [(gogoproto.moretags) = "json:\"bonds\" yaml:\"bonds\""]; } diff --git a/proto/cerc/bond/v1/query.proto b/proto/cerc/bond/v1/query.proto index e69de29b..b61e3014 100644 --- a/proto/cerc/bond/v1/query.proto +++ b/proto/cerc/bond/v1/query.proto @@ -0,0 +1,35 @@ +syntax = "proto3"; + +package cerc.bond.v1; + +option go_package = "git.vdb.to/cerc-io/laconic2d/x/bond"; + +import "gogoproto/gogo.proto"; +import "cerc/bond/v1/bond.proto"; +import "google/api/annotations.proto"; +import "cosmos/base/query/v1beta1/pagination.proto"; +// import "cosmos/query/v1/query.proto"; + +// Query defines the gRPC querier service for bond module +service Query { + // Bonds queries bonds list. + rpc Bonds(QueryGetBondsRequest) returns (QueryGetBondsResponse) { + // option (cosmos.query.v1.module_query_safe) = true; // Add? + option (google.api.http).get = "/cerc/bond/v1/bonds"; + } +} + +// QueryGetBondById queries a bonds. +message QueryGetBondsRequest { + // pagination defines an optional pagination for the request. + cosmos.base.query.v1beta1.PageRequest pagination = 1; +} + +// QueryGetBondsResponse is response type for get the bonds by bond-id +message QueryGetBondsResponse { + repeated Bond bonds = 1 [(gogoproto.moretags) = "json:\"bonds\" yaml:\"bonds\""]; + + // pagination defines the pagination in the response. + cosmos.base.query.v1beta1.PageResponse pagination = 2; +} + diff --git a/proto/cerc/bond/v1/tx.proto b/proto/cerc/bond/v1/tx.proto index e69de29b..0ce4c9fc 100644 --- a/proto/cerc/bond/v1/tx.proto +++ b/proto/cerc/bond/v1/tx.proto @@ -0,0 +1,40 @@ +syntax = "proto3"; + +package cerc.bond.v1; + +option go_package = "git.vdb.to/cerc-io/laconic2d/x/bond"; + +import "cosmos/msg/v1/msg.proto"; +import "gogoproto/gogo.proto"; +import "google/api/annotations.proto"; +import "cosmos/base/v1beta1/coin.proto"; + +// TODO: Add remaining messages + +// Msg defines the bond Msg service. +service Msg { + option (cosmos.msg.v1.service) = true; + + // CreateBond defines a method for creating a new bond. + rpc CreateBond(MsgCreateBond) returns (MsgCreateBondResponse) { + option (google.api.http).post = "/cerc/bond/v1/create_bond"; + }; + +} + +// MsgCreateBond defines a SDK message for creating a new bond. +message MsgCreateBond { + option (cosmos.msg.v1.signer) = "signer"; + + string signer = 1; + repeated cosmos.base.v1beta1.Coin coins = 2 [ + (gogoproto.nullable) = false, + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins", + (gogoproto.moretags) = "json:\"coins\" yaml:\"coins\"" + ]; +} + +// MsgCreateBondResponse defines the Msg/CreateBond response type. +message MsgCreateBondResponse { + string id = 1; +} diff --git a/x/bond/codec.go b/x/bond/codec.go index 4a75ea3c..eff38a2a 100644 --- a/x/bond/codec.go +++ b/x/bond/codec.go @@ -1,26 +1,18 @@ package bond import ( - "github.com/cosmos/cosmos-sdk/codec" types "github.com/cosmos/cosmos-sdk/codec/types" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/msgservice" ) -// RegisterLegacyAminoCodec registers the necessary x/bond interfaces and concrete types -// on the provided LegacyAmino codec. These types are used for Amino JSON serialization. -func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { - // cdc.RegisterConcrete(&MsgCreateBond{}, "bond/MsgCreateBond", nil) - // cdc.RegisterConcrete(&MsgRefillBond{}, "bond/MsgRefillBond", nil) - // cdc.RegisterConcrete(&MsgWithdrawBond{}, "bond/MsgWithdrawBond", nil) - // cdc.RegisterConcrete(&MsgCancelBond{}, "bond/MsgCancelBond", nil) -} - // RegisterInterfaces registers the interfaces types with the interface registry. func RegisterInterfaces(registry types.InterfaceRegistry) { - // registry.RegisterImplementations((*sdk.Msg)(nil), - // &MsgCreateBond{}, + registry.RegisterImplementations((*sdk.Msg)(nil), + &MsgCreateBond{}, // &MsgRefillBond{}, // &MsgCancelBond{}, // &MsgWithdrawBond{}, - // ) - // msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) + ) + msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) } diff --git a/x/bond/events.go b/x/bond/events.go new file mode 100644 index 00000000..a4dceeef --- /dev/null +++ b/x/bond/events.go @@ -0,0 +1,15 @@ +package bond + +// bond module event types + +const ( + EventTypeCreateBond = "crate_bond" + EventTypeRefillBond = "refill_bond" + EventTypeCancelBond = "cancel_bond" + EventTypeWithdrawBond = "withdraw_bond" + + AttributeKeySigner = "signer" + AttributeKeyAmount = "amount" + AttributeKeyBondID = "bond_id" + AttributeValueCategory = ModuleName +) diff --git a/x/bond/genesis.pb.go b/x/bond/genesis.pb.go index 8d55cf9e..3b841b38 100644 --- a/x/bond/genesis.pb.go +++ b/x/bond/genesis.pb.go @@ -28,6 +28,7 @@ type GenesisState struct { // params defines all the parameters of the module. Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` // bonds defines all the bonds + // TODO: Add nullable = false ? Bonds []*Bond `protobuf:"bytes,2,rep,name=bonds,proto3" json:"bonds,omitempty" json:"bonds" yaml:"bonds"` } diff --git a/x/bond/keeper/genesis.go b/x/bond/keeper/genesis.go index d38c416d..b8a97b9b 100644 --- a/x/bond/keeper/genesis.go +++ b/x/bond/keeper/genesis.go @@ -9,8 +9,11 @@ import ( func (k *Keeper) InitGenesis(ctx sdk.Context, data *bond.GenesisState) error { k.SetParams(ctx, data.Params) + // Save bonds in store. for _, bond := range data.Bonds { - k.SaveBond(ctx, bond) + if err := k.Bonds.Set(ctx, bond.Id, *bond); err != nil { + return err + } } return nil @@ -19,7 +22,11 @@ func (k *Keeper) InitGenesis(ctx sdk.Context, data *bond.GenesisState) error { // ExportGenesis exports the module state to a genesis state. func (k *Keeper) ExportGenesis(ctx sdk.Context) (*bond.GenesisState, error) { params := k.GetParams(ctx) - bonds := k.ListBonds(ctx) + + bonds, err := k.ListBonds(ctx) + if err != nil { + return nil, err + } return &bond.GenesisState{Params: params, Bonds: bonds}, nil } diff --git a/x/bond/keeper/keeper.go b/x/bond/keeper/keeper.go index dc5d391d..2f8bef6f 100644 --- a/x/bond/keeper/keeper.go +++ b/x/bond/keeper/keeper.go @@ -1,38 +1,48 @@ package keeper import ( - storetypes "cosmossdk.io/store/types" - "git.vdb.to/cerc-io/laconic2d/x/bond" + "crypto/sha256" + "encoding/hex" + "fmt" + + "cosmossdk.io/collections" + "cosmossdk.io/core/store" + errorsmod "cosmossdk.io/errors" + "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + auth "github.com/cosmos/cosmos-sdk/x/auth/keeper" + bank "github.com/cosmos/cosmos-sdk/x/bank/keeper" + + bondtypes "git.vdb.to/cerc-io/laconic2d/x/bond" ) -// TODO: Add genesis.go? - type Keeper struct { - // Store keys - storeKey storetypes.StoreKey - // Codecs cdc codec.BinaryCodec // External keepers - // accountKeeper auth.AccountKeeper - // bankKeeper bank.Keeper + accountKeeper auth.AccountKeeper + bankKeeper bank.Keeper // Track bond usage in other cosmos-sdk modules (more like a usage tracker). // usageKeepers []types.BondUsageKeeper // paramSubspace paramtypes.Subspace + + // State management + Schema collections.Schema + Bonds collections.Map[string, bondtypes.Bond] } // NewKeeper creates new instances of the bond Keeper func NewKeeper( cdc codec.BinaryCodec, - // accountKeeper auth.AccountKeeper, - // bankKeeper bank.Keeper, + storeService store.KVStoreService, + accountKeeper auth.AccountKeeper, + bankKeeper bank.Keeper, // usageKeepers []types.BondUsageKeeper, - storeKey storetypes.StoreKey, // ps paramtypes.Subspace, ) Keeper { // set KeyTable if it has not already been set @@ -40,26 +50,103 @@ func NewKeeper( // ps = ps.WithKeyTable(types.ParamKeyTable()) // } - return Keeper{ - // accountKeeper: accountKeeper, - // bankKeeper: bankKeeper, - storeKey: storeKey, - cdc: cdc, + sb := collections.NewSchemaBuilder(storeService) + k := Keeper{ + cdc: cdc, + accountKeeper: accountKeeper, + bankKeeper: bankKeeper, + Bonds: collections.NewMap(sb, bondtypes.BondsKey, "bonds", collections.StringKey, codec.CollValue[bondtypes.Bond](cdc)), // usageKeepers: usageKeepers, // paramSubspace: ps, } + + schema, err := sb.Build() + if err != nil { + panic(err) + } + + k.Schema = schema + + return k } -// TODO: Add keeper methods +// BondID simplifies generation of bond IDs. +type BondID struct { + Address sdk.Address + AccNum uint64 + Sequence uint64 +} -// SaveBond - saves a bond to the store. -func (k Keeper) SaveBond(ctx sdk.Context, bond *bond.Bond) { - // TODO: Implement +// Generate creates the bond ID. +func (bondID BondID) Generate() string { + hasher := sha256.New() + str := fmt.Sprintf("%s:%d:%d", bondID.Address.String(), bondID.AccNum, bondID.Sequence) + hasher.Write([]byte(str)) + return hex.EncodeToString(hasher.Sum(nil)) +} + +// CreateBond creates a new bond. +func (k Keeper) CreateBond(ctx sdk.Context, ownerAddress sdk.AccAddress, coins sdk.Coins) (*bondtypes.Bond, error) { + // Check if account has funds. + for _, coin := range coins { + balance := k.bankKeeper.HasBalance(ctx, ownerAddress, coin) + if !balance { + return nil, errorsmod.Wrap(sdkerrors.ErrInsufficientFunds, "failed to create bond; Insufficient funds") + } + } + + // Generate bond ID. + account := k.accountKeeper.GetAccount(ctx, ownerAddress) + bondID := BondID{ + Address: ownerAddress, + AccNum: account.GetAccountNumber(), + Sequence: account.GetSequence(), + }.Generate() + + maxBondAmount := k.getMaxBondAmount(ctx) + + bond := bondtypes.Bond{Id: bondID, Owner: ownerAddress.String(), Balance: coins} + if bond.Balance.IsAnyGT(maxBondAmount) { + return nil, errorsmod.Wrap(sdkerrors.ErrInvalidRequest, "Max bond amount exceeded.") + } + + // Move funds into the bond account module. + err := k.bankKeeper.SendCoinsFromAccountToModule(ctx, ownerAddress, bondtypes.ModuleName, bond.Balance) + if err != nil { + return nil, err + } + + // Save bond in store. + if err := k.Bonds.Set(ctx, bond.Id, bond); err != nil { + return nil, err + } + + return &bond, nil } // ListBonds - get all bonds. -func (k Keeper) ListBonds(ctx sdk.Context) []*bond.Bond { - // TODO: Implement - var bonds []*bond.Bond - return bonds +func (k Keeper) ListBonds(ctx sdk.Context) ([]*bondtypes.Bond, error) { + var bonds []*bondtypes.Bond + + iter, err := k.Bonds.Iterate(ctx, nil) + if err != nil { + return nil, err + } + + for ; iter.Valid(); iter.Next() { + bond, err := iter.Value() + if err != nil { + return nil, err + } + + bonds = append(bonds, &bond) + } + + return bonds, nil +} + +func (k Keeper) getMaxBondAmount(ctx sdk.Context) sdk.Coins { + params := k.GetParams(ctx) + maxBondAmount := params.MaxBondAmount + return sdk.NewCoins(maxBondAmount) } diff --git a/x/bond/keeper/msg_server.go b/x/bond/keeper/msg_server.go index 8ba510e1..bbca76b9 100644 --- a/x/bond/keeper/msg_server.go +++ b/x/bond/keeper/msg_server.go @@ -1,15 +1,50 @@ package keeper +import ( + "context" + + sdk "github.com/cosmos/cosmos-sdk/types" + + "git.vdb.to/cerc-io/laconic2d/x/bond" +) + type msgServer struct { k Keeper } // TODO: Generate types -// var _ bond.MsgServer = msgServer{} +var _ bond.MsgServer = msgServer{} // NewMsgServerImpl returns an implementation of the module MsgServer interface. -// func NewMsgServerImpl(keeper Keeper) bond.MsgServer { -// return &msgServer{k: keeper} -// } +func NewMsgServerImpl(keeper Keeper) bond.MsgServer { + return &msgServer{k: keeper} +} -// TODO: Add write methods +// TODO: Add remaining write methods + +func (ms msgServer) CreateBond(c context.Context, msg *bond.MsgCreateBond) (*bond.MsgCreateBondResponse, error) { + ctx := sdk.UnwrapSDKContext(c) + signerAddress, err := sdk.AccAddressFromBech32(msg.Signer) + if err != nil { + return nil, err + } + _, err = ms.k.CreateBond(ctx, signerAddress, msg.Coins) + if err != nil { + return nil, err + } + + ctx.EventManager().EmitEvents(sdk.Events{ + sdk.NewEvent( + bond.EventTypeCreateBond, + sdk.NewAttribute(bond.AttributeKeySigner, msg.Signer), + sdk.NewAttribute(sdk.AttributeKeyAmount, msg.Coins.String()), + ), + sdk.NewEvent( + sdk.EventTypeMessage, + sdk.NewAttribute(sdk.AttributeKeyModule, bond.AttributeValueCategory), + sdk.NewAttribute(bond.AttributeKeySigner, msg.Signer), + ), + }) + + return &bond.MsgCreateBondResponse{}, nil +} diff --git a/x/bond/keeper/params.go b/x/bond/keeper/params.go index 008100b7..ceafa772 100644 --- a/x/bond/keeper/params.go +++ b/x/bond/keeper/params.go @@ -8,7 +8,7 @@ import ( // GetMaxBondAmount max bond amount func (k Keeper) GetMaxBondAmount(ctx sdk.Context) (res sdk.Coin) { // TODO: Implement - return sdk.Coin{} + return sdk.NewCoin(sdk.DefaultBondDenom, bond.DefaultMaxBondAmountTokens) } // GetParams - Get all parameter as types.Params. diff --git a/x/bond/keeper/query_server.go b/x/bond/keeper/query_server.go index ffc1ffa7..79d9498f 100644 --- a/x/bond/keeper/query_server.go +++ b/x/bond/keeper/query_server.go @@ -1,15 +1,32 @@ package keeper +import ( + "context" + + "git.vdb.to/cerc-io/laconic2d/x/bond" + sdk "github.com/cosmos/cosmos-sdk/types" +) + +// TODO: Add remaining query methods + type queryServer struct { k Keeper } -// TODO: Generate types -// var _ bond.QueryServer = queryServer{} +var _ bond.QueryServer = queryServer{} // NewQueryServerImpl returns an implementation of the module QueryServer. -// func NewQueryServerImpl(k Keeper) checkers.QueryServer { -// return queryServer{k} -// } +func NewQueryServerImpl(k Keeper) bond.QueryServer { + return queryServer{k} +} -// TODO: Add read methods +func (qs queryServer) Bonds(c context.Context, _ *bond.QueryGetBondsRequest) (*bond.QueryGetBondsResponse, error) { + ctx := sdk.UnwrapSDKContext(c) + + resp, err := qs.k.ListBonds(ctx) + if err != nil { + return nil, err + } + + return &bond.QueryGetBondsResponse{Bonds: resp}, nil +} diff --git a/x/bond/keys.go b/x/bond/keys.go index 637d05e0..b1d746b3 100644 --- a/x/bond/keys.go +++ b/x/bond/keys.go @@ -1,5 +1,7 @@ package bond +import "cosmossdk.io/collections" + const ( ModuleName = "bond" @@ -8,3 +10,8 @@ const ( // TODO: Add required keys ) + +// Store prefixes +var ( + BondsKey = collections.NewPrefix(0) +) diff --git a/x/bond/module/autocli.go b/x/bond/module/autocli.go index 7f12797d..43c8e473 100644 --- a/x/bond/module/autocli.go +++ b/x/bond/module/autocli.go @@ -3,6 +3,8 @@ package module import ( autocliv1 "cosmossdk.io/api/cosmos/autocli/v1" "cosmossdk.io/client/v2/autocli" + + bondv1 "git.vdb.to/cerc-io/laconic2d/api/cerc/bond/v1" ) var _ autocli.HasAutoCLIConfig = AppModule{} @@ -10,7 +12,29 @@ var _ autocli.HasAutoCLIConfig = AppModule{} // AutoCLIOptions implements the autocli.HasAutoCLIConfig interface. func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions { return &autocliv1.ModuleOptions{ - Query: nil, - Tx: nil, + Query: &autocliv1.ServiceCommandDescriptor{ + Service: bondv1.Query_ServiceDesc.ServiceName, + RpcCommandOptions: []*autocliv1.RpcCommandOptions{ + { + RpcMethod: "Bonds", + Use: "list", + Short: "List bonds", + PositionalArgs: []*autocliv1.PositionalArgDescriptor{}, + }, + }, + }, + Tx: &autocliv1.ServiceCommandDescriptor{ + Service: bondv1.Msg_ServiceDesc.ServiceName, + RpcCommandOptions: []*autocliv1.RpcCommandOptions{ + { + RpcMethod: "CreateBond", + Use: "create [amount]", + Short: "Create bond", + PositionalArgs: []*autocliv1.PositionalArgDescriptor{ + {ProtoField: "coins"}, + }, + }, + }, + }, } } diff --git a/x/bond/module/depinject.go b/x/bond/module/depinject.go index 6a39b8ad..db48f83d 100644 --- a/x/bond/module/depinject.go +++ b/x/bond/module/depinject.go @@ -2,10 +2,12 @@ package module import ( "cosmossdk.io/core/appmodule" + "cosmossdk.io/core/store" "cosmossdk.io/depinject" - storetypes "cosmossdk.io/store/types" "github.com/cosmos/cosmos-sdk/codec" + auth "github.com/cosmos/cosmos-sdk/x/auth/keeper" + bank "github.com/cosmos/cosmos-sdk/x/bank/keeper" modulev1 "git.vdb.to/cerc-io/laconic2d/api/cerc/bond/module/v1" "git.vdb.to/cerc-io/laconic2d/x/bond/keeper" @@ -29,8 +31,11 @@ func init() { type ModuleInputs struct { depinject.In - Key *storetypes.KVStoreKey - Cdc codec.Codec + Cdc codec.Codec + StoreService store.KVStoreService + + AccountKeeper auth.AccountKeeper + BankKeeper bank.Keeper } type ModuleOutputs struct { @@ -41,7 +46,7 @@ type ModuleOutputs struct { } func ProvideModule(in ModuleInputs) ModuleOutputs { - k := keeper.NewKeeper(in.Cdc, in.Key) + k := keeper.NewKeeper(in.Cdc, in.StoreService, in.AccountKeeper, in.BankKeeper) m := NewAppModule(in.Cdc, k) return ModuleOutputs{Module: m, Keeper: k} diff --git a/x/bond/module/module.go b/x/bond/module/module.go index 391db7c5..2fb5b834 100644 --- a/x/bond/module/module.go +++ b/x/bond/module/module.go @@ -1,6 +1,7 @@ package module import ( + "context" "encoding/json" "fmt" @@ -20,10 +21,11 @@ import ( // TODO: Port remaining AppModule methods var ( - _ module.AppModuleBasic = AppModule{} - _ appmodule.AppModule = AppModule{} - _ module.HasGenesis = AppModule{} - _ module.HasServices = AppModule{} + _ module.AppModuleBasic = AppModule{} + _ appmodule.AppModule = AppModule{} + _ module.HasGenesis = AppModule{} + _ module.HasServices = AppModule{} + _ module.HasConsensusVersion = AppModule{} ) // ConsensusVersion defines the current module consensus version @@ -53,15 +55,13 @@ func (AppModule) Name() string { return bond.ModuleName } // RegisterLegacyAminoCodec registers the bond module's types on the LegacyAmino codec. // New modules do not need to support Amino. -func (AppModule) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { - bond.RegisterLegacyAminoCodec(cdc) -} +func (AppModule) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) {} // RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the bond module. func (AppModule) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *gwruntime.ServeMux) { - // if err := bond.RegisterQueryHandlerClient(context.Background(), mux, bond.NewQueryClient(clientCtx)); err != nil { - // panic(err) - // } + if err := bond.RegisterQueryHandlerClient(context.Background(), mux, bond.NewQueryClient(clientCtx)); err != nil { + panic(err) + } } // RegisterInterfaces registers interfaces and implementations of the bond module. @@ -69,6 +69,9 @@ func (AppModule) RegisterInterfaces(registry codectypes.InterfaceRegistry) { bond.RegisterInterfaces(registry) } +// ConsensusVersion implements AppModule/ConsensusVersion. +func (AppModule) ConsensusVersion() uint64 { return ConsensusVersion } + // module.HasGenesis // DefaultGenesis returns default genesis state as raw bytes for the module. @@ -112,6 +115,6 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.Raw func (am AppModule) RegisterServices(cfg module.Configurator) { // Register servers - // bond.RegisterMsgServer(cfg.MsgServer(), keeper.NewMsgServerImpl(am.keeper)) - // bond.RegisterQueryServer(cfg.QueryServer(), keeper.NewQueryServerImpl(am.keeper)) + bond.RegisterMsgServer(cfg.MsgServer(), keeper.NewMsgServerImpl(am.keeper)) + bond.RegisterQueryServer(cfg.QueryServer(), keeper.NewQueryServerImpl(am.keeper)) } diff --git a/x/bond/query.pb.go b/x/bond/query.pb.go new file mode 100644 index 00000000..2911acc9 --- /dev/null +++ b/x/bond/query.pb.go @@ -0,0 +1,671 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: cerc/bond/v1/query.proto + +package bond + +import ( + context "context" + fmt "fmt" + query "github.com/cosmos/cosmos-sdk/types/query" + _ "github.com/cosmos/gogoproto/gogoproto" + grpc1 "github.com/cosmos/gogoproto/grpc" + proto "github.com/cosmos/gogoproto/proto" + _ "google.golang.org/genproto/googleapis/api/annotations" + 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 + +// QueryGetBondById queries a bonds. +type QueryGetBondsRequest struct { + // pagination defines an optional pagination for the request. + Pagination *query.PageRequest `protobuf:"bytes,1,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryGetBondsRequest) Reset() { *m = QueryGetBondsRequest{} } +func (m *QueryGetBondsRequest) String() string { return proto.CompactTextString(m) } +func (*QueryGetBondsRequest) ProtoMessage() {} +func (*QueryGetBondsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_d3221677ed35cdfb, []int{0} +} +func (m *QueryGetBondsRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryGetBondsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryGetBondsRequest.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 *QueryGetBondsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryGetBondsRequest.Merge(m, src) +} +func (m *QueryGetBondsRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryGetBondsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryGetBondsRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryGetBondsRequest proto.InternalMessageInfo + +func (m *QueryGetBondsRequest) GetPagination() *query.PageRequest { + if m != nil { + return m.Pagination + } + return nil +} + +// QueryGetBondsResponse is response type for get the bonds by bond-id +type QueryGetBondsResponse struct { + Bonds []*Bond `protobuf:"bytes,1,rep,name=bonds,proto3" json:"bonds,omitempty" json:"bonds" yaml:"bonds"` + // pagination defines the pagination in the response. + Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryGetBondsResponse) Reset() { *m = QueryGetBondsResponse{} } +func (m *QueryGetBondsResponse) String() string { return proto.CompactTextString(m) } +func (*QueryGetBondsResponse) ProtoMessage() {} +func (*QueryGetBondsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_d3221677ed35cdfb, []int{1} +} +func (m *QueryGetBondsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryGetBondsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryGetBondsResponse.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 *QueryGetBondsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryGetBondsResponse.Merge(m, src) +} +func (m *QueryGetBondsResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryGetBondsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryGetBondsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryGetBondsResponse proto.InternalMessageInfo + +func (m *QueryGetBondsResponse) GetBonds() []*Bond { + if m != nil { + return m.Bonds + } + return nil +} + +func (m *QueryGetBondsResponse) GetPagination() *query.PageResponse { + if m != nil { + return m.Pagination + } + return nil +} + +func init() { + proto.RegisterType((*QueryGetBondsRequest)(nil), "cerc.bond.v1.QueryGetBondsRequest") + proto.RegisterType((*QueryGetBondsResponse)(nil), "cerc.bond.v1.QueryGetBondsResponse") +} + +func init() { proto.RegisterFile("cerc/bond/v1/query.proto", fileDescriptor_d3221677ed35cdfb) } + +var fileDescriptor_d3221677ed35cdfb = []byte{ + // 368 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x91, 0xc1, 0x4a, 0x2b, 0x31, + 0x14, 0x86, 0x3b, 0xbd, 0xf4, 0x2e, 0xd2, 0xbb, 0xca, 0x6d, 0xb9, 0xbd, 0x55, 0xc7, 0x32, 0x05, + 0x2d, 0x82, 0x09, 0x33, 0xee, 0x04, 0x37, 0x5d, 0xd8, 0xad, 0x76, 0xe9, 0x42, 0xc8, 0xcc, 0x84, + 0x30, 0xd2, 0xe6, 0x4c, 0x9b, 0x74, 0xb0, 0x5b, 0x9f, 0x40, 0xf0, 0x29, 0x7c, 0x13, 0x97, 0x05, + 0x37, 0xae, 0x44, 0x5a, 0x9f, 0xc0, 0x27, 0x90, 0x24, 0x15, 0x5b, 0x15, 0xdd, 0xcd, 0xf0, 0x7f, + 0xff, 0x39, 0x5f, 0x12, 0xd4, 0x48, 0xf8, 0x38, 0xa1, 0x31, 0xc8, 0x94, 0x16, 0x21, 0x1d, 0x4d, + 0xf8, 0x78, 0x4a, 0xf2, 0x31, 0x68, 0xc0, 0x7f, 0x4c, 0x42, 0x4c, 0x42, 0x8a, 0xb0, 0x59, 0x13, + 0x20, 0xc0, 0x06, 0xd4, 0x7c, 0x39, 0xa6, 0xf9, 0x6f, 0xad, 0x6d, 0x59, 0x17, 0x6c, 0x0a, 0x00, + 0x31, 0xe0, 0x94, 0xe5, 0x19, 0x65, 0x52, 0x82, 0x66, 0x3a, 0x03, 0xa9, 0x96, 0xe9, 0x5e, 0x02, + 0x6a, 0x08, 0x8a, 0xc6, 0x4c, 0x71, 0xb7, 0x93, 0x16, 0x61, 0xcc, 0x35, 0x0b, 0x69, 0xce, 0x44, + 0x26, 0x2d, 0xec, 0xd8, 0xe0, 0x1c, 0xd5, 0x4e, 0x0d, 0xd1, 0xe3, 0xba, 0x0b, 0x32, 0x55, 0x7d, + 0x3e, 0x9a, 0x70, 0xa5, 0xf1, 0x31, 0x42, 0xef, 0x6c, 0xc3, 0x6b, 0x79, 0x9d, 0x6a, 0xb4, 0x43, + 0xdc, 0x60, 0x62, 0x06, 0x13, 0x77, 0x98, 0xe5, 0x60, 0x72, 0xc2, 0x04, 0x5f, 0x76, 0xfb, 0x2b, + 0xcd, 0xe0, 0xd6, 0x43, 0xf5, 0x0f, 0x0b, 0x54, 0x0e, 0x52, 0x71, 0xdc, 0x43, 0x15, 0x73, 0x22, + 0xd5, 0xf0, 0x5a, 0xbf, 0x3a, 0xd5, 0x08, 0x93, 0xd5, 0x0b, 0x21, 0x86, 0xed, 0x6e, 0xbd, 0x3c, + 0x6e, 0xff, 0xbf, 0x50, 0x20, 0x0f, 0x03, 0x8b, 0x06, 0xad, 0x29, 0x1b, 0x0e, 0xde, 0x7e, 0xfa, + 0xae, 0x8f, 0x7b, 0x6b, 0xaa, 0x65, 0xab, 0xba, 0xfb, 0xa3, 0xaa, 0xb3, 0x58, 0x75, 0x8d, 0x0a, + 0x54, 0xb1, 0xaa, 0x78, 0x88, 0x2a, 0xd6, 0x15, 0x07, 0xeb, 0x52, 0x5f, 0xdd, 0x54, 0xb3, 0xfd, + 0x2d, 0xe3, 0xd6, 0x04, 0x1b, 0x57, 0xf7, 0xcf, 0x37, 0xe5, 0x3a, 0xfe, 0x4b, 0x3f, 0x3d, 0xa9, + 0xea, 0x1e, 0xdd, 0xcd, 0x7d, 0x6f, 0x36, 0xf7, 0xbd, 0xa7, 0xb9, 0xef, 0x5d, 0x2f, 0xfc, 0xd2, + 0x6c, 0xe1, 0x97, 0x1e, 0x16, 0x7e, 0xe9, 0xac, 0x2d, 0x32, 0x4d, 0x8a, 0x34, 0x26, 0x1a, 0x6c, + 0x71, 0x3f, 0x03, 0x3a, 0x60, 0x09, 0xc8, 0x2c, 0x89, 0x52, 0x7a, 0x69, 0xfb, 0xf1, 0x6f, 0xfb, + 0x92, 0x07, 0xaf, 0x01, 0x00, 0x00, 0xff, 0xff, 0xbb, 0x32, 0xed, 0x9c, 0x6c, 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 + +// QueryClient is the client API for Query service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type QueryClient interface { + // Bonds queries bonds list. + Bonds(ctx context.Context, in *QueryGetBondsRequest, opts ...grpc.CallOption) (*QueryGetBondsResponse, error) +} + +type queryClient struct { + cc grpc1.ClientConn +} + +func NewQueryClient(cc grpc1.ClientConn) QueryClient { + return &queryClient{cc} +} + +func (c *queryClient) Bonds(ctx context.Context, in *QueryGetBondsRequest, opts ...grpc.CallOption) (*QueryGetBondsResponse, error) { + out := new(QueryGetBondsResponse) + err := c.cc.Invoke(ctx, "/cerc.bond.v1.Query/Bonds", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// QueryServer is the server API for Query service. +type QueryServer interface { + // Bonds queries bonds list. + Bonds(context.Context, *QueryGetBondsRequest) (*QueryGetBondsResponse, error) +} + +// UnimplementedQueryServer can be embedded to have forward compatible implementations. +type UnimplementedQueryServer struct { +} + +func (*UnimplementedQueryServer) Bonds(ctx context.Context, req *QueryGetBondsRequest) (*QueryGetBondsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Bonds not implemented") +} + +func RegisterQueryServer(s grpc1.Server, srv QueryServer) { + s.RegisterService(&_Query_serviceDesc, srv) +} + +func _Query_Bonds_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryGetBondsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Bonds(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cerc.bond.v1.Query/Bonds", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Bonds(ctx, req.(*QueryGetBondsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _Query_serviceDesc = grpc.ServiceDesc{ + ServiceName: "cerc.bond.v1.Query", + HandlerType: (*QueryServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Bonds", + Handler: _Query_Bonds_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "cerc/bond/v1/query.proto", +} + +func (m *QueryGetBondsRequest) 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 *QueryGetBondsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryGetBondsRequest) 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] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryGetBondsResponse) 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 *QueryGetBondsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryGetBondsResponse) 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.Bonds) > 0 { + for iNdEx := len(m.Bonds) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Bonds[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 + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *QueryGetBondsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryGetBondsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Bonds) > 0 { + for _, e := range m.Bonds { + 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 +} +func sozQuery(x uint64) (n int) { + return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *QueryGetBondsRequest) 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: QueryGetBondsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryGetBondsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + 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 *QueryGetBondsResponse) 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: QueryGetBondsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryGetBondsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Bonds", 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.Bonds = append(m.Bonds, &Bond{}) + if err := m.Bonds[len(m.Bonds)-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 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowQuery + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowQuery + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowQuery + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthQuery + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupQuery + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthQuery + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthQuery = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowQuery = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupQuery = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/bond/query.pb.gw.go b/x/bond/query.pb.gw.go new file mode 100644 index 00000000..2b52b238 --- /dev/null +++ b/x/bond/query.pb.gw.go @@ -0,0 +1,171 @@ +// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. +// source: cerc/bond/v1/query.proto + +/* +Package bond is a reverse proxy. + +It translates gRPC into RESTful JSON APIs. +*/ +package bond + +import ( + "context" + "io" + "net/http" + + "github.com/golang/protobuf/descriptor" + "github.com/golang/protobuf/proto" + "github.com/grpc-ecosystem/grpc-gateway/runtime" + "github.com/grpc-ecosystem/grpc-gateway/utilities" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/metadata" + "google.golang.org/grpc/status" +) + +// Suppress "imported and not used" errors +var _ codes.Code +var _ io.Reader +var _ status.Status +var _ = runtime.String +var _ = utilities.NewDoubleArray +var _ = descriptor.ForMessage +var _ = metadata.Join + +var ( + filter_Query_Bonds_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_Query_Bonds_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryGetBondsRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_Bonds_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.Bonds(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_Bonds_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryGetBondsRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_Bonds_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.Bonds(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. +// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. +func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error { + + mux.Handle("GET", pattern_Query_Bonds_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + 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_Bonds_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Bonds_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +// RegisterQueryHandlerFromEndpoint is same as RegisterQueryHandler but +// automatically dials to "endpoint" and closes the connection when "ctx" gets done. +func RegisterQueryHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { + conn, err := grpc.Dial(endpoint, opts...) + if err != nil { + return err + } + defer func() { + if err != nil { + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + return + } + go func() { + <-ctx.Done() + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + }() + }() + + return RegisterQueryHandler(ctx, mux, conn) +} + +// RegisterQueryHandler registers the http handlers for service Query to "mux". +// The handlers forward requests to the grpc endpoint over "conn". +func RegisterQueryHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { + return RegisterQueryHandlerClient(ctx, mux, NewQueryClient(conn)) +} + +// RegisterQueryHandlerClient registers the http handlers for service Query +// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "QueryClient". +// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "QueryClient" +// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in +// "QueryClient" to call the correct interceptors. +func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QueryClient) error { + + mux.Handle("GET", pattern_Query_Bonds_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_Bonds_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_Bonds_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +var ( + pattern_Query_Bonds_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"cerc", "bond", "v1", "bonds"}, "", runtime.AssumeColonVerbOpt(false))) +) + +var ( + forward_Query_Bonds_0 = runtime.ForwardResponseMessage +) diff --git a/x/bond/tx.pb.go b/x/bond/tx.pb.go new file mode 100644 index 00000000..74a18f8c --- /dev/null +++ b/x/bond/tx.pb.go @@ -0,0 +1,656 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: cerc/bond/v1/tx.proto + +package bond + +import ( + context "context" + fmt "fmt" + github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" + types "github.com/cosmos/cosmos-sdk/types" + _ "github.com/cosmos/cosmos-sdk/types/msgservice" + _ "github.com/cosmos/gogoproto/gogoproto" + grpc1 "github.com/cosmos/gogoproto/grpc" + proto "github.com/cosmos/gogoproto/proto" + _ "google.golang.org/genproto/googleapis/api/annotations" + 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 + +// MsgCreateBond defines a SDK message for creating a new bond. +type MsgCreateBond struct { + Signer string `protobuf:"bytes,1,opt,name=signer,proto3" json:"signer,omitempty"` + Coins github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,2,rep,name=coins,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"coins" json:"coins" yaml:"coins"` +} + +func (m *MsgCreateBond) Reset() { *m = MsgCreateBond{} } +func (m *MsgCreateBond) String() string { return proto.CompactTextString(m) } +func (*MsgCreateBond) ProtoMessage() {} +func (*MsgCreateBond) Descriptor() ([]byte, []int) { + return fileDescriptor_efb1a132c2c5bd62, []int{0} +} +func (m *MsgCreateBond) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgCreateBond) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgCreateBond.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 *MsgCreateBond) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgCreateBond.Merge(m, src) +} +func (m *MsgCreateBond) XXX_Size() int { + return m.Size() +} +func (m *MsgCreateBond) XXX_DiscardUnknown() { + xxx_messageInfo_MsgCreateBond.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgCreateBond proto.InternalMessageInfo + +func (m *MsgCreateBond) GetSigner() string { + if m != nil { + return m.Signer + } + return "" +} + +func (m *MsgCreateBond) GetCoins() github_com_cosmos_cosmos_sdk_types.Coins { + if m != nil { + return m.Coins + } + return nil +} + +// MsgCreateBondResponse defines the Msg/CreateBond response type. +type MsgCreateBondResponse struct { + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` +} + +func (m *MsgCreateBondResponse) Reset() { *m = MsgCreateBondResponse{} } +func (m *MsgCreateBondResponse) String() string { return proto.CompactTextString(m) } +func (*MsgCreateBondResponse) ProtoMessage() {} +func (*MsgCreateBondResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_efb1a132c2c5bd62, []int{1} +} +func (m *MsgCreateBondResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgCreateBondResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgCreateBondResponse.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 *MsgCreateBondResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgCreateBondResponse.Merge(m, src) +} +func (m *MsgCreateBondResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgCreateBondResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgCreateBondResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgCreateBondResponse proto.InternalMessageInfo + +func (m *MsgCreateBondResponse) GetId() string { + if m != nil { + return m.Id + } + return "" +} + +func init() { + proto.RegisterType((*MsgCreateBond)(nil), "cerc.bond.v1.MsgCreateBond") + proto.RegisterType((*MsgCreateBondResponse)(nil), "cerc.bond.v1.MsgCreateBondResponse") +} + +func init() { proto.RegisterFile("cerc/bond/v1/tx.proto", fileDescriptor_efb1a132c2c5bd62) } + +var fileDescriptor_efb1a132c2c5bd62 = []byte{ + // 405 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x91, 0xbf, 0x6f, 0xd3, 0x40, + 0x14, 0xc7, 0x6d, 0x57, 0xad, 0xc4, 0x15, 0x18, 0x2c, 0x0a, 0x8d, 0x8b, 0x9c, 0xe0, 0x0e, 0x44, + 0x95, 0x7a, 0x27, 0x87, 0xad, 0x12, 0x4b, 0x3a, 0x67, 0xc9, 0xc8, 0x82, 0xce, 0xe7, 0xd3, 0x71, + 0x10, 0xdf, 0x33, 0x7e, 0x87, 0xd5, 0x2e, 0x80, 0xfa, 0x17, 0x20, 0xf1, 0x5f, 0x30, 0x75, 0xe0, + 0x8f, 0xe8, 0x18, 0x89, 0x85, 0x29, 0xa0, 0x04, 0x29, 0x3b, 0x7f, 0x01, 0xb2, 0x7d, 0x91, 0x92, + 0x85, 0xc9, 0xef, 0xc7, 0xf7, 0x7d, 0xde, 0xd7, 0xf7, 0xc8, 0x91, 0x90, 0x95, 0x60, 0x19, 0x98, + 0x9c, 0xd5, 0x29, 0xb3, 0x57, 0xb4, 0xac, 0xc0, 0x42, 0x78, 0xbf, 0x29, 0xd3, 0xa6, 0x4c, 0xeb, + 0x34, 0x7a, 0x22, 0x00, 0x0b, 0x40, 0x56, 0xa0, 0x6a, 0x54, 0x05, 0xaa, 0x4e, 0x16, 0x3d, 0x52, + 0xa0, 0xa0, 0x0d, 0x59, 0x13, 0xb9, 0xea, 0x53, 0x05, 0xa0, 0x66, 0x92, 0xf1, 0x52, 0x33, 0x6e, + 0x0c, 0x58, 0x6e, 0x35, 0x18, 0x74, 0xdd, 0xd8, 0xc1, 0x32, 0x8e, 0x92, 0xd5, 0x69, 0x26, 0x2d, + 0x4f, 0x99, 0x00, 0x6d, 0xba, 0x7e, 0xf2, 0xdd, 0x27, 0x0f, 0x26, 0xa8, 0x2e, 0x2b, 0xc9, 0xad, + 0x1c, 0x83, 0xc9, 0xc3, 0xc7, 0xe4, 0x00, 0xb5, 0x32, 0xb2, 0x3a, 0xf6, 0x07, 0xfe, 0xf0, 0xde, + 0xd4, 0x65, 0xe1, 0x47, 0xb2, 0xdf, 0xcc, 0xe1, 0x71, 0x30, 0xd8, 0x1b, 0x1e, 0x8e, 0x7a, 0xb4, + 0x23, 0xd3, 0x86, 0x4c, 0x1d, 0x99, 0x5e, 0x82, 0x36, 0xe3, 0xc9, 0xdd, 0xa2, 0xef, 0xfd, 0x5d, + 0xf4, 0x7b, 0x6f, 0x11, 0xcc, 0x45, 0xd2, 0x4e, 0x25, 0x83, 0x6b, 0x5e, 0xcc, 0x36, 0xc9, 0xb7, + 0x5f, 0xfd, 0xa1, 0xd2, 0xf6, 0xcd, 0x87, 0x8c, 0x0a, 0x28, 0x98, 0xf3, 0xd8, 0x7d, 0xce, 0x31, + 0x7f, 0xc7, 0xec, 0x75, 0x29, 0xb1, 0xa5, 0xe1, 0xb4, 0x5b, 0x7b, 0x71, 0x78, 0xb3, 0xbe, 0x3d, + 0x73, 0x66, 0x92, 0xe7, 0xe4, 0x68, 0xc7, 0xf5, 0x54, 0x62, 0x09, 0x06, 0x65, 0xf8, 0x90, 0x04, + 0x3a, 0x77, 0xce, 0x03, 0x9d, 0x8f, 0x3e, 0x91, 0xbd, 0x09, 0xaa, 0xf0, 0x3d, 0x21, 0x5b, 0xbf, + 0x78, 0x42, 0xb7, 0x1f, 0x9c, 0xee, 0x90, 0xa2, 0xd3, 0xff, 0x34, 0x37, 0x6b, 0x92, 0x67, 0x37, + 0x3f, 0xfe, 0x7c, 0x0d, 0x4e, 0x92, 0x1e, 0xdb, 0xb9, 0xa8, 0x68, 0x95, 0xaf, 0x9b, 0x34, 0xda, + 0xff, 0xbc, 0xbe, 0x3d, 0xf3, 0xc7, 0x2f, 0xef, 0x96, 0xb1, 0x3f, 0x5f, 0xc6, 0xfe, 0xef, 0x65, + 0xec, 0x7f, 0x59, 0xc5, 0xde, 0x7c, 0x15, 0x7b, 0x3f, 0x57, 0xb1, 0xf7, 0xea, 0x54, 0x69, 0x4b, + 0xeb, 0x3c, 0xa3, 0x16, 0x5a, 0xca, 0xb9, 0x06, 0x36, 0xe3, 0x02, 0x8c, 0x16, 0xa3, 0x9c, 0x5d, + 0xb5, 0xd0, 0xec, 0xa0, 0x3d, 0xd3, 0x8b, 0x7f, 0x01, 0x00, 0x00, 0xff, 0xff, 0xbd, 0x7f, 0x1d, + 0xaa, 0x3a, 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 { + // CreateBond defines a method for creating a new bond. + CreateBond(ctx context.Context, in *MsgCreateBond, opts ...grpc.CallOption) (*MsgCreateBondResponse, error) +} + +type msgClient struct { + cc grpc1.ClientConn +} + +func NewMsgClient(cc grpc1.ClientConn) MsgClient { + return &msgClient{cc} +} + +func (c *msgClient) CreateBond(ctx context.Context, in *MsgCreateBond, opts ...grpc.CallOption) (*MsgCreateBondResponse, error) { + out := new(MsgCreateBondResponse) + err := c.cc.Invoke(ctx, "/cerc.bond.v1.Msg/CreateBond", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// MsgServer is the server API for Msg service. +type MsgServer interface { + // CreateBond defines a method for creating a new bond. + CreateBond(context.Context, *MsgCreateBond) (*MsgCreateBondResponse, error) +} + +// UnimplementedMsgServer can be embedded to have forward compatible implementations. +type UnimplementedMsgServer struct { +} + +func (*UnimplementedMsgServer) CreateBond(ctx context.Context, req *MsgCreateBond) (*MsgCreateBondResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CreateBond not implemented") +} + +func RegisterMsgServer(s grpc1.Server, srv MsgServer) { + s.RegisterService(&_Msg_serviceDesc, srv) +} + +func _Msg_CreateBond_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgCreateBond) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).CreateBond(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cerc.bond.v1.Msg/CreateBond", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).CreateBond(ctx, req.(*MsgCreateBond)) + } + return interceptor(ctx, in, info, handler) +} + +var _Msg_serviceDesc = grpc.ServiceDesc{ + ServiceName: "cerc.bond.v1.Msg", + HandlerType: (*MsgServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "CreateBond", + Handler: _Msg_CreateBond_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "cerc/bond/v1/tx.proto", +} + +func (m *MsgCreateBond) 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 *MsgCreateBond) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgCreateBond) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Coins) > 0 { + for iNdEx := len(m.Coins) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Coins[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + if len(m.Signer) > 0 { + i -= len(m.Signer) + copy(dAtA[i:], m.Signer) + i = encodeVarintTx(dAtA, i, uint64(len(m.Signer))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgCreateBondResponse) 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 *MsgCreateBondResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgCreateBondResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Id) > 0 { + i -= len(m.Id) + copy(dAtA[i:], m.Id) + i = encodeVarintTx(dAtA, i, uint64(len(m.Id))) + 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 *MsgCreateBond) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Signer) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if len(m.Coins) > 0 { + for _, e := range m.Coins { + l = e.Size() + n += 1 + l + sovTx(uint64(l)) + } + } + return n +} + +func (m *MsgCreateBondResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Id) + 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 *MsgCreateBond) 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: MsgCreateBond: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgCreateBond: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Signer", 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.Signer = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Coins", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Coins = append(m.Coins, types.Coin{}) + if err := m.Coins[len(m.Coins)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + 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 *MsgCreateBondResponse) 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: MsgCreateBondResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgCreateBondResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Id", 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.Id = 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/x/bond/tx.pb.gw.go b/x/bond/tx.pb.gw.go new file mode 100644 index 00000000..3c5a609b --- /dev/null +++ b/x/bond/tx.pb.gw.go @@ -0,0 +1,171 @@ +// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. +// source: cerc/bond/v1/tx.proto + +/* +Package bond is a reverse proxy. + +It translates gRPC into RESTful JSON APIs. +*/ +package bond + +import ( + "context" + "io" + "net/http" + + "github.com/golang/protobuf/descriptor" + "github.com/golang/protobuf/proto" + "github.com/grpc-ecosystem/grpc-gateway/runtime" + "github.com/grpc-ecosystem/grpc-gateway/utilities" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/metadata" + "google.golang.org/grpc/status" +) + +// Suppress "imported and not used" errors +var _ codes.Code +var _ io.Reader +var _ status.Status +var _ = runtime.String +var _ = utilities.NewDoubleArray +var _ = descriptor.ForMessage +var _ = metadata.Join + +var ( + filter_Msg_CreateBond_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_Msg_CreateBond_0(ctx context.Context, marshaler runtime.Marshaler, client MsgClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq MsgCreateBond + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Msg_CreateBond_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.CreateBond(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Msg_CreateBond_0(ctx context.Context, marshaler runtime.Marshaler, server MsgServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq MsgCreateBond + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Msg_CreateBond_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.CreateBond(ctx, &protoReq) + return msg, metadata, err + +} + +// RegisterMsgHandlerServer registers the http handlers for service Msg to "mux". +// UnaryRPC :call MsgServer directly. +// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. +// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterMsgHandlerFromEndpoint instead. +func RegisterMsgHandlerServer(ctx context.Context, mux *runtime.ServeMux, server MsgServer) error { + + mux.Handle("POST", pattern_Msg_CreateBond_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + 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_Msg_CreateBond_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Msg_CreateBond_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +// RegisterMsgHandlerFromEndpoint is same as RegisterMsgHandler but +// automatically dials to "endpoint" and closes the connection when "ctx" gets done. +func RegisterMsgHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { + conn, err := grpc.Dial(endpoint, opts...) + if err != nil { + return err + } + defer func() { + if err != nil { + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + return + } + go func() { + <-ctx.Done() + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + }() + }() + + return RegisterMsgHandler(ctx, mux, conn) +} + +// RegisterMsgHandler registers the http handlers for service Msg to "mux". +// The handlers forward requests to the grpc endpoint over "conn". +func RegisterMsgHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { + return RegisterMsgHandlerClient(ctx, mux, NewMsgClient(conn)) +} + +// RegisterMsgHandlerClient registers the http handlers for service Msg +// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "MsgClient". +// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "MsgClient" +// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in +// "MsgClient" to call the correct interceptors. +func RegisterMsgHandlerClient(ctx context.Context, mux *runtime.ServeMux, client MsgClient) error { + + mux.Handle("POST", pattern_Msg_CreateBond_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_Msg_CreateBond_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Msg_CreateBond_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +var ( + pattern_Msg_CreateBond_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"cerc", "bond", "v1", "create_bond"}, "", runtime.AssumeColonVerbOpt(false))) +) + +var ( + forward_Msg_CreateBond_0 = runtime.ForwardResponseMessage +)