diff --git a/CHANGELOG.md b/CHANGELOG.md index 77831b75288f..f8fa184d69f0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -58,6 +58,8 @@ Ref: https://keepachangelog.com/en/1.0.0/ ### Improvements +* [13789](https://github.com/cosmos/cosmos-sdk/pull/13789) Add tx `encode` and `decode` endpoints to tx service. + > Note: This endpoint will only encode proto messages, Amino encoding is not supported. * [#13826](https://github.com/cosmos/cosmos-sdk/pull/13826) Support custom `GasConfig` configuration for applications. * [#13619](https://github.com/cosmos/cosmos-sdk/pull/13619) Add new function called LogDeferred to report errors in defers. Use the function in x/bank files. * (tools) [#13603](https://github.com/cosmos/cosmos-sdk/pull/13603) Rename cosmovisor package name to `cosmossdk.io/tools/cosmovisor`. The new tool directory contains Cosmos SDK tools. diff --git a/api/cosmos/tx/v1beta1/service.pulsar.go b/api/cosmos/tx/v1beta1/service.pulsar.go index f5f01047dac4..e4e25547d5e4 100644 --- a/api/cosmos/tx/v1beta1/service.pulsar.go +++ b/api/cosmos/tx/v1beta1/service.pulsar.go @@ -5546,6 +5546,1720 @@ func (x *fastReflection_GetBlockWithTxsResponse) ProtoMethods() *protoiface.Meth } } +var ( + md_TxDecodeRequest protoreflect.MessageDescriptor + fd_TxDecodeRequest_tx_bytes protoreflect.FieldDescriptor +) + +func init() { + file_cosmos_tx_v1beta1_service_proto_init() + md_TxDecodeRequest = File_cosmos_tx_v1beta1_service_proto.Messages().ByName("TxDecodeRequest") + fd_TxDecodeRequest_tx_bytes = md_TxDecodeRequest.Fields().ByName("tx_bytes") +} + +var _ protoreflect.Message = (*fastReflection_TxDecodeRequest)(nil) + +type fastReflection_TxDecodeRequest TxDecodeRequest + +func (x *TxDecodeRequest) ProtoReflect() protoreflect.Message { + return (*fastReflection_TxDecodeRequest)(x) +} + +func (x *TxDecodeRequest) slowProtoReflect() protoreflect.Message { + mi := &file_cosmos_tx_v1beta1_service_proto_msgTypes[10] + 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_TxDecodeRequest_messageType fastReflection_TxDecodeRequest_messageType +var _ protoreflect.MessageType = fastReflection_TxDecodeRequest_messageType{} + +type fastReflection_TxDecodeRequest_messageType struct{} + +func (x fastReflection_TxDecodeRequest_messageType) Zero() protoreflect.Message { + return (*fastReflection_TxDecodeRequest)(nil) +} +func (x fastReflection_TxDecodeRequest_messageType) New() protoreflect.Message { + return new(fastReflection_TxDecodeRequest) +} +func (x fastReflection_TxDecodeRequest_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_TxDecodeRequest +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_TxDecodeRequest) Descriptor() protoreflect.MessageDescriptor { + return md_TxDecodeRequest +} + +// 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_TxDecodeRequest) Type() protoreflect.MessageType { + return _fastReflection_TxDecodeRequest_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_TxDecodeRequest) New() protoreflect.Message { + return new(fastReflection_TxDecodeRequest) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_TxDecodeRequest) Interface() protoreflect.ProtoMessage { + return (*TxDecodeRequest)(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_TxDecodeRequest) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if len(x.TxBytes) != 0 { + value := protoreflect.ValueOfBytes(x.TxBytes) + if !f(fd_TxDecodeRequest_tx_bytes, 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_TxDecodeRequest) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "cosmos.tx.v1beta1.TxDecodeRequest.tx_bytes": + return len(x.TxBytes) != 0 + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.tx.v1beta1.TxDecodeRequest")) + } + panic(fmt.Errorf("message cosmos.tx.v1beta1.TxDecodeRequest 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_TxDecodeRequest) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "cosmos.tx.v1beta1.TxDecodeRequest.tx_bytes": + x.TxBytes = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.tx.v1beta1.TxDecodeRequest")) + } + panic(fmt.Errorf("message cosmos.tx.v1beta1.TxDecodeRequest 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_TxDecodeRequest) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "cosmos.tx.v1beta1.TxDecodeRequest.tx_bytes": + value := x.TxBytes + return protoreflect.ValueOfBytes(value) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.tx.v1beta1.TxDecodeRequest")) + } + panic(fmt.Errorf("message cosmos.tx.v1beta1.TxDecodeRequest 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_TxDecodeRequest) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "cosmos.tx.v1beta1.TxDecodeRequest.tx_bytes": + x.TxBytes = value.Bytes() + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.tx.v1beta1.TxDecodeRequest")) + } + panic(fmt.Errorf("message cosmos.tx.v1beta1.TxDecodeRequest 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_TxDecodeRequest) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "cosmos.tx.v1beta1.TxDecodeRequest.tx_bytes": + panic(fmt.Errorf("field tx_bytes of message cosmos.tx.v1beta1.TxDecodeRequest is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.tx.v1beta1.TxDecodeRequest")) + } + panic(fmt.Errorf("message cosmos.tx.v1beta1.TxDecodeRequest 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_TxDecodeRequest) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "cosmos.tx.v1beta1.TxDecodeRequest.tx_bytes": + return protoreflect.ValueOfBytes(nil) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.tx.v1beta1.TxDecodeRequest")) + } + panic(fmt.Errorf("message cosmos.tx.v1beta1.TxDecodeRequest 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_TxDecodeRequest) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in cosmos.tx.v1beta1.TxDecodeRequest", 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_TxDecodeRequest) 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_TxDecodeRequest) 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_TxDecodeRequest) 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_TxDecodeRequest) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*TxDecodeRequest) + 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.TxBytes) + 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().(*TxDecodeRequest) + 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.TxBytes) > 0 { + i -= len(x.TxBytes) + copy(dAtA[i:], x.TxBytes) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.TxBytes))) + 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().(*TxDecodeRequest) + 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: TxDecodeRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: TxDecodeRequest: 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 TxBytes", wireType) + } + var byteLen 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++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + byteLen + 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.TxBytes = append(x.TxBytes[:0], dAtA[iNdEx:postIndex]...) + if x.TxBytes == nil { + x.TxBytes = []byte{} + } + 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_TxDecodeResponse protoreflect.MessageDescriptor + fd_TxDecodeResponse_tx protoreflect.FieldDescriptor +) + +func init() { + file_cosmos_tx_v1beta1_service_proto_init() + md_TxDecodeResponse = File_cosmos_tx_v1beta1_service_proto.Messages().ByName("TxDecodeResponse") + fd_TxDecodeResponse_tx = md_TxDecodeResponse.Fields().ByName("tx") +} + +var _ protoreflect.Message = (*fastReflection_TxDecodeResponse)(nil) + +type fastReflection_TxDecodeResponse TxDecodeResponse + +func (x *TxDecodeResponse) ProtoReflect() protoreflect.Message { + return (*fastReflection_TxDecodeResponse)(x) +} + +func (x *TxDecodeResponse) slowProtoReflect() protoreflect.Message { + mi := &file_cosmos_tx_v1beta1_service_proto_msgTypes[11] + 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_TxDecodeResponse_messageType fastReflection_TxDecodeResponse_messageType +var _ protoreflect.MessageType = fastReflection_TxDecodeResponse_messageType{} + +type fastReflection_TxDecodeResponse_messageType struct{} + +func (x fastReflection_TxDecodeResponse_messageType) Zero() protoreflect.Message { + return (*fastReflection_TxDecodeResponse)(nil) +} +func (x fastReflection_TxDecodeResponse_messageType) New() protoreflect.Message { + return new(fastReflection_TxDecodeResponse) +} +func (x fastReflection_TxDecodeResponse_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_TxDecodeResponse +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_TxDecodeResponse) Descriptor() protoreflect.MessageDescriptor { + return md_TxDecodeResponse +} + +// 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_TxDecodeResponse) Type() protoreflect.MessageType { + return _fastReflection_TxDecodeResponse_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_TxDecodeResponse) New() protoreflect.Message { + return new(fastReflection_TxDecodeResponse) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_TxDecodeResponse) Interface() protoreflect.ProtoMessage { + return (*TxDecodeResponse)(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_TxDecodeResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Tx != nil { + value := protoreflect.ValueOfMessage(x.Tx.ProtoReflect()) + if !f(fd_TxDecodeResponse_tx, 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_TxDecodeResponse) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "cosmos.tx.v1beta1.TxDecodeResponse.tx": + return x.Tx != nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.tx.v1beta1.TxDecodeResponse")) + } + panic(fmt.Errorf("message cosmos.tx.v1beta1.TxDecodeResponse 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_TxDecodeResponse) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "cosmos.tx.v1beta1.TxDecodeResponse.tx": + x.Tx = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.tx.v1beta1.TxDecodeResponse")) + } + panic(fmt.Errorf("message cosmos.tx.v1beta1.TxDecodeResponse 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_TxDecodeResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "cosmos.tx.v1beta1.TxDecodeResponse.tx": + value := x.Tx + return protoreflect.ValueOfMessage(value.ProtoReflect()) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.tx.v1beta1.TxDecodeResponse")) + } + panic(fmt.Errorf("message cosmos.tx.v1beta1.TxDecodeResponse 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_TxDecodeResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "cosmos.tx.v1beta1.TxDecodeResponse.tx": + x.Tx = value.Message().Interface().(*Tx) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.tx.v1beta1.TxDecodeResponse")) + } + panic(fmt.Errorf("message cosmos.tx.v1beta1.TxDecodeResponse 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_TxDecodeResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "cosmos.tx.v1beta1.TxDecodeResponse.tx": + if x.Tx == nil { + x.Tx = new(Tx) + } + return protoreflect.ValueOfMessage(x.Tx.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.tx.v1beta1.TxDecodeResponse")) + } + panic(fmt.Errorf("message cosmos.tx.v1beta1.TxDecodeResponse 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_TxDecodeResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "cosmos.tx.v1beta1.TxDecodeResponse.tx": + m := new(Tx) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.tx.v1beta1.TxDecodeResponse")) + } + panic(fmt.Errorf("message cosmos.tx.v1beta1.TxDecodeResponse 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_TxDecodeResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in cosmos.tx.v1beta1.TxDecodeResponse", 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_TxDecodeResponse) 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_TxDecodeResponse) 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_TxDecodeResponse) 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_TxDecodeResponse) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*TxDecodeResponse) + 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.Tx != nil { + l = options.Size(x.Tx) + 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().(*TxDecodeResponse) + 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.Tx != nil { + encoded, err := options.Marshal(x.Tx) + 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().(*TxDecodeResponse) + 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: TxDecodeResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: TxDecodeResponse: 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 Tx", 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.Tx == nil { + x.Tx = &Tx{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Tx); 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_TxEncodeRequest protoreflect.MessageDescriptor + fd_TxEncodeRequest_tx protoreflect.FieldDescriptor +) + +func init() { + file_cosmos_tx_v1beta1_service_proto_init() + md_TxEncodeRequest = File_cosmos_tx_v1beta1_service_proto.Messages().ByName("TxEncodeRequest") + fd_TxEncodeRequest_tx = md_TxEncodeRequest.Fields().ByName("tx") +} + +var _ protoreflect.Message = (*fastReflection_TxEncodeRequest)(nil) + +type fastReflection_TxEncodeRequest TxEncodeRequest + +func (x *TxEncodeRequest) ProtoReflect() protoreflect.Message { + return (*fastReflection_TxEncodeRequest)(x) +} + +func (x *TxEncodeRequest) slowProtoReflect() protoreflect.Message { + mi := &file_cosmos_tx_v1beta1_service_proto_msgTypes[12] + 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_TxEncodeRequest_messageType fastReflection_TxEncodeRequest_messageType +var _ protoreflect.MessageType = fastReflection_TxEncodeRequest_messageType{} + +type fastReflection_TxEncodeRequest_messageType struct{} + +func (x fastReflection_TxEncodeRequest_messageType) Zero() protoreflect.Message { + return (*fastReflection_TxEncodeRequest)(nil) +} +func (x fastReflection_TxEncodeRequest_messageType) New() protoreflect.Message { + return new(fastReflection_TxEncodeRequest) +} +func (x fastReflection_TxEncodeRequest_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_TxEncodeRequest +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_TxEncodeRequest) Descriptor() protoreflect.MessageDescriptor { + return md_TxEncodeRequest +} + +// 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_TxEncodeRequest) Type() protoreflect.MessageType { + return _fastReflection_TxEncodeRequest_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_TxEncodeRequest) New() protoreflect.Message { + return new(fastReflection_TxEncodeRequest) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_TxEncodeRequest) Interface() protoreflect.ProtoMessage { + return (*TxEncodeRequest)(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_TxEncodeRequest) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Tx != nil { + value := protoreflect.ValueOfMessage(x.Tx.ProtoReflect()) + if !f(fd_TxEncodeRequest_tx, 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_TxEncodeRequest) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "cosmos.tx.v1beta1.TxEncodeRequest.tx": + return x.Tx != nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.tx.v1beta1.TxEncodeRequest")) + } + panic(fmt.Errorf("message cosmos.tx.v1beta1.TxEncodeRequest 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_TxEncodeRequest) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "cosmos.tx.v1beta1.TxEncodeRequest.tx": + x.Tx = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.tx.v1beta1.TxEncodeRequest")) + } + panic(fmt.Errorf("message cosmos.tx.v1beta1.TxEncodeRequest 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_TxEncodeRequest) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "cosmos.tx.v1beta1.TxEncodeRequest.tx": + value := x.Tx + return protoreflect.ValueOfMessage(value.ProtoReflect()) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.tx.v1beta1.TxEncodeRequest")) + } + panic(fmt.Errorf("message cosmos.tx.v1beta1.TxEncodeRequest 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_TxEncodeRequest) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "cosmos.tx.v1beta1.TxEncodeRequest.tx": + x.Tx = value.Message().Interface().(*Tx) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.tx.v1beta1.TxEncodeRequest")) + } + panic(fmt.Errorf("message cosmos.tx.v1beta1.TxEncodeRequest 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_TxEncodeRequest) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "cosmos.tx.v1beta1.TxEncodeRequest.tx": + if x.Tx == nil { + x.Tx = new(Tx) + } + return protoreflect.ValueOfMessage(x.Tx.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.tx.v1beta1.TxEncodeRequest")) + } + panic(fmt.Errorf("message cosmos.tx.v1beta1.TxEncodeRequest 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_TxEncodeRequest) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "cosmos.tx.v1beta1.TxEncodeRequest.tx": + m := new(Tx) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.tx.v1beta1.TxEncodeRequest")) + } + panic(fmt.Errorf("message cosmos.tx.v1beta1.TxEncodeRequest 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_TxEncodeRequest) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in cosmos.tx.v1beta1.TxEncodeRequest", 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_TxEncodeRequest) 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_TxEncodeRequest) 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_TxEncodeRequest) 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_TxEncodeRequest) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*TxEncodeRequest) + 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.Tx != nil { + l = options.Size(x.Tx) + 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().(*TxEncodeRequest) + 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.Tx != nil { + encoded, err := options.Marshal(x.Tx) + 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().(*TxEncodeRequest) + 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: TxEncodeRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: TxEncodeRequest: 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 Tx", 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.Tx == nil { + x.Tx = &Tx{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Tx); 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_TxEncodeResponse protoreflect.MessageDescriptor + fd_TxEncodeResponse_tx_bytes protoreflect.FieldDescriptor +) + +func init() { + file_cosmos_tx_v1beta1_service_proto_init() + md_TxEncodeResponse = File_cosmos_tx_v1beta1_service_proto.Messages().ByName("TxEncodeResponse") + fd_TxEncodeResponse_tx_bytes = md_TxEncodeResponse.Fields().ByName("tx_bytes") +} + +var _ protoreflect.Message = (*fastReflection_TxEncodeResponse)(nil) + +type fastReflection_TxEncodeResponse TxEncodeResponse + +func (x *TxEncodeResponse) ProtoReflect() protoreflect.Message { + return (*fastReflection_TxEncodeResponse)(x) +} + +func (x *TxEncodeResponse) slowProtoReflect() protoreflect.Message { + mi := &file_cosmos_tx_v1beta1_service_proto_msgTypes[13] + 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_TxEncodeResponse_messageType fastReflection_TxEncodeResponse_messageType +var _ protoreflect.MessageType = fastReflection_TxEncodeResponse_messageType{} + +type fastReflection_TxEncodeResponse_messageType struct{} + +func (x fastReflection_TxEncodeResponse_messageType) Zero() protoreflect.Message { + return (*fastReflection_TxEncodeResponse)(nil) +} +func (x fastReflection_TxEncodeResponse_messageType) New() protoreflect.Message { + return new(fastReflection_TxEncodeResponse) +} +func (x fastReflection_TxEncodeResponse_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_TxEncodeResponse +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_TxEncodeResponse) Descriptor() protoreflect.MessageDescriptor { + return md_TxEncodeResponse +} + +// 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_TxEncodeResponse) Type() protoreflect.MessageType { + return _fastReflection_TxEncodeResponse_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_TxEncodeResponse) New() protoreflect.Message { + return new(fastReflection_TxEncodeResponse) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_TxEncodeResponse) Interface() protoreflect.ProtoMessage { + return (*TxEncodeResponse)(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_TxEncodeResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if len(x.TxBytes) != 0 { + value := protoreflect.ValueOfBytes(x.TxBytes) + if !f(fd_TxEncodeResponse_tx_bytes, 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_TxEncodeResponse) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "cosmos.tx.v1beta1.TxEncodeResponse.tx_bytes": + return len(x.TxBytes) != 0 + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.tx.v1beta1.TxEncodeResponse")) + } + panic(fmt.Errorf("message cosmos.tx.v1beta1.TxEncodeResponse 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_TxEncodeResponse) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "cosmos.tx.v1beta1.TxEncodeResponse.tx_bytes": + x.TxBytes = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.tx.v1beta1.TxEncodeResponse")) + } + panic(fmt.Errorf("message cosmos.tx.v1beta1.TxEncodeResponse 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_TxEncodeResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "cosmos.tx.v1beta1.TxEncodeResponse.tx_bytes": + value := x.TxBytes + return protoreflect.ValueOfBytes(value) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.tx.v1beta1.TxEncodeResponse")) + } + panic(fmt.Errorf("message cosmos.tx.v1beta1.TxEncodeResponse 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_TxEncodeResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "cosmos.tx.v1beta1.TxEncodeResponse.tx_bytes": + x.TxBytes = value.Bytes() + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.tx.v1beta1.TxEncodeResponse")) + } + panic(fmt.Errorf("message cosmos.tx.v1beta1.TxEncodeResponse 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_TxEncodeResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "cosmos.tx.v1beta1.TxEncodeResponse.tx_bytes": + panic(fmt.Errorf("field tx_bytes of message cosmos.tx.v1beta1.TxEncodeResponse is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.tx.v1beta1.TxEncodeResponse")) + } + panic(fmt.Errorf("message cosmos.tx.v1beta1.TxEncodeResponse 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_TxEncodeResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "cosmos.tx.v1beta1.TxEncodeResponse.tx_bytes": + return protoreflect.ValueOfBytes(nil) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.tx.v1beta1.TxEncodeResponse")) + } + panic(fmt.Errorf("message cosmos.tx.v1beta1.TxEncodeResponse 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_TxEncodeResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in cosmos.tx.v1beta1.TxEncodeResponse", 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_TxEncodeResponse) 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_TxEncodeResponse) 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_TxEncodeResponse) 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_TxEncodeResponse) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*TxEncodeResponse) + 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.TxBytes) + 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().(*TxEncodeResponse) + 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.TxBytes) > 0 { + i -= len(x.TxBytes) + copy(dAtA[i:], x.TxBytes) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.TxBytes))) + 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().(*TxEncodeResponse) + 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: TxEncodeResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: TxEncodeResponse: 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 TxBytes", wireType) + } + var byteLen 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++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + byteLen + 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.TxBytes = append(x.TxBytes[:0], dAtA[iNdEx:postIndex]...) + if x.TxBytes == nil { + x.TxBytes = []byte{} + } + 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 @@ -6202,6 +7916,158 @@ func (x *GetBlockWithTxsResponse) GetPagination() *v1beta1.PageResponse { return nil } +// TxDecodeRequest is the request type for the Service.TxDecode +// RPC method. +type TxDecodeRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // tx_bytes is the raw transaction. + TxBytes []byte `protobuf:"bytes,1,opt,name=tx_bytes,json=txBytes,proto3" json:"tx_bytes,omitempty"` +} + +func (x *TxDecodeRequest) Reset() { + *x = TxDecodeRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_cosmos_tx_v1beta1_service_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *TxDecodeRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TxDecodeRequest) ProtoMessage() {} + +// Deprecated: Use TxDecodeRequest.ProtoReflect.Descriptor instead. +func (*TxDecodeRequest) Descriptor() ([]byte, []int) { + return file_cosmos_tx_v1beta1_service_proto_rawDescGZIP(), []int{10} +} + +func (x *TxDecodeRequest) GetTxBytes() []byte { + if x != nil { + return x.TxBytes + } + return nil +} + +// TxDecodeResponse is the response type for the +// Service.TxDecode method. +type TxDecodeResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // tx is the decoded transaction. + Tx *Tx `protobuf:"bytes,1,opt,name=tx,proto3" json:"tx,omitempty"` +} + +func (x *TxDecodeResponse) Reset() { + *x = TxDecodeResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_cosmos_tx_v1beta1_service_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *TxDecodeResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TxDecodeResponse) ProtoMessage() {} + +// Deprecated: Use TxDecodeResponse.ProtoReflect.Descriptor instead. +func (*TxDecodeResponse) Descriptor() ([]byte, []int) { + return file_cosmos_tx_v1beta1_service_proto_rawDescGZIP(), []int{11} +} + +func (x *TxDecodeResponse) GetTx() *Tx { + if x != nil { + return x.Tx + } + return nil +} + +// TxEncodeResponse is the request type for the Service.TxEncode +// RPC method. +type TxEncodeRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // tx is the transaction to encode. + Tx *Tx `protobuf:"bytes,1,opt,name=tx,proto3" json:"tx,omitempty"` +} + +func (x *TxEncodeRequest) Reset() { + *x = TxEncodeRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_cosmos_tx_v1beta1_service_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *TxEncodeRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TxEncodeRequest) ProtoMessage() {} + +// Deprecated: Use TxEncodeRequest.ProtoReflect.Descriptor instead. +func (*TxEncodeRequest) Descriptor() ([]byte, []int) { + return file_cosmos_tx_v1beta1_service_proto_rawDescGZIP(), []int{12} +} + +func (x *TxEncodeRequest) GetTx() *Tx { + if x != nil { + return x.Tx + } + return nil +} + +// TxEncodeResponse is the response type for the +// Service.TxEncode method. +type TxEncodeResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // tx_bytes is the encoded transaction bytes. + TxBytes []byte `protobuf:"bytes,1,opt,name=tx_bytes,json=txBytes,proto3" json:"tx_bytes,omitempty"` +} + +func (x *TxEncodeResponse) Reset() { + *x = TxEncodeResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_cosmos_tx_v1beta1_service_proto_msgTypes[13] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *TxEncodeResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TxEncodeResponse) ProtoMessage() {} + +// Deprecated: Use TxEncodeResponse.ProtoReflect.Descriptor instead. +func (*TxEncodeResponse) Descriptor() ([]byte, []int) { + return file_cosmos_tx_v1beta1_service_proto_rawDescGZIP(), []int{13} +} + +func (x *TxEncodeResponse) GetTxBytes() []byte { + if x != nil { + return x.TxBytes + } + return nil +} + var File_cosmos_tx_v1beta1_service_proto protoreflect.FileDescriptor var file_cosmos_tx_v1beta1_service_proto_rawDesc = []byte{ @@ -6348,34 +8214,38 @@ var file_cosmos_tx_v1beta1_service_proto_rawDesc = []byte{ 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x74, 0x78, 0x73, 0x12, 0x7c, 0x0a, 0x0b, 0x47, 0x65, 0x74, 0x54, 0x78, 0x73, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x12, 0x25, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x74, 0x78, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x47, 0x65, 0x74, - 0x54, 0x78, 0x73, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, - 0x26, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x74, 0x78, 0x2e, 0x76, 0x31, 0x62, 0x65, - 0x74, 0x61, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x54, 0x78, 0x73, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x1e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x18, 0x12, - 0x16, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x74, 0x78, 0x2f, 0x76, 0x31, 0x62, 0x65, - 0x74, 0x61, 0x31, 0x2f, 0x74, 0x78, 0x73, 0x12, 0x97, 0x01, 0x0a, 0x0f, 0x47, 0x65, 0x74, 0x42, - 0x6c, 0x6f, 0x63, 0x6b, 0x57, 0x69, 0x74, 0x68, 0x54, 0x78, 0x73, 0x12, 0x29, 0x2e, 0x63, 0x6f, - 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x74, 0x78, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, - 0x47, 0x65, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x57, 0x69, 0x74, 0x68, 0x54, 0x78, 0x73, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2a, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, - 0x74, 0x78, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x42, 0x6c, - 0x6f, 0x63, 0x6b, 0x57, 0x69, 0x74, 0x68, 0x54, 0x78, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x22, 0x2d, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x27, 0x12, 0x25, 0x2f, 0x63, 0x6f, 0x73, - 0x6d, 0x6f, 0x73, 0x2f, 0x74, 0x78, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x74, - 0x78, 0x73, 0x2f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x2f, 0x7b, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, - 0x7d, 0x42, 0xb9, 0x01, 0x0a, 0x15, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, - 0x2e, 0x74, 0x78, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x42, 0x0c, 0x53, 0x65, 0x72, - 0x76, 0x69, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x2c, 0x63, 0x6f, 0x73, - 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x6f, - 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x74, 0x78, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x3b, - 0x74, 0x78, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xa2, 0x02, 0x03, 0x43, 0x54, 0x58, 0xaa, - 0x02, 0x11, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x54, 0x78, 0x2e, 0x56, 0x31, 0x62, 0x65, - 0x74, 0x61, 0x31, 0xca, 0x02, 0x11, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x54, 0x78, 0x5c, - 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xe2, 0x02, 0x1d, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, - 0x5c, 0x54, 0x78, 0x5c, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, - 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x13, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, - 0x3a, 0x3a, 0x54, 0x78, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x62, 0x06, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x57, 0x69, 0x74, 0x68, 0x54, 0x78, 0x73, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x2d, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x27, 0x12, 0x25, 0x2f, 0x63, + 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x74, 0x78, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, + 0x2f, 0x74, 0x78, 0x73, 0x2f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x2f, 0x7b, 0x68, 0x65, 0x69, 0x67, + 0x68, 0x74, 0x7d, 0x12, 0x79, 0x0a, 0x08, 0x54, 0x78, 0x44, 0x65, 0x63, 0x6f, 0x64, 0x65, 0x12, + 0x22, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x74, 0x78, 0x2e, 0x76, 0x31, 0x62, 0x65, + 0x74, 0x61, 0x31, 0x2e, 0x54, 0x78, 0x44, 0x65, 0x63, 0x6f, 0x64, 0x65, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x23, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x74, 0x78, 0x2e, + 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x54, 0x78, 0x44, 0x65, 0x63, 0x6f, 0x64, 0x65, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x24, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1e, + 0x22, 0x19, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x74, 0x78, 0x2f, 0x76, 0x31, 0x62, + 0x65, 0x74, 0x61, 0x31, 0x2f, 0x64, 0x65, 0x63, 0x6f, 0x64, 0x65, 0x3a, 0x01, 0x2a, 0x12, 0x79, + 0x0a, 0x08, 0x54, 0x78, 0x45, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x22, 0x2e, 0x63, 0x6f, 0x73, + 0x6d, 0x6f, 0x73, 0x2e, 0x74, 0x78, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x54, + 0x78, 0x45, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x23, + 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x74, 0x78, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, + 0x61, 0x31, 0x2e, 0x54, 0x78, 0x45, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x22, 0x24, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1e, 0x22, 0x19, 0x2f, 0x63, 0x6f, + 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x74, 0x78, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, + 0x65, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x3a, 0x01, 0x2a, 0x42, 0xb9, 0x01, 0x0a, 0x15, 0x63, 0x6f, + 0x6d, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x74, 0x78, 0x2e, 0x76, 0x31, 0x62, 0x65, + 0x74, 0x61, 0x31, 0x42, 0x0c, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x74, + 0x6f, 0x50, 0x01, 0x5a, 0x2c, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, + 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x74, 0x78, 0x2f, + 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x3b, 0x74, 0x78, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, + 0x31, 0xa2, 0x02, 0x03, 0x43, 0x54, 0x58, 0xaa, 0x02, 0x11, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, + 0x2e, 0x54, 0x78, 0x2e, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xca, 0x02, 0x11, 0x43, 0x6f, + 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x54, 0x78, 0x5c, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xe2, + 0x02, 0x1d, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x54, 0x78, 0x5c, 0x56, 0x31, 0x62, 0x65, + 0x74, 0x61, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, + 0x02, 0x13, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x54, 0x78, 0x3a, 0x3a, 0x56, 0x31, + 0x62, 0x65, 0x74, 0x61, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -6391,7 +8261,7 @@ func file_cosmos_tx_v1beta1_service_proto_rawDescGZIP() []byte { } var file_cosmos_tx_v1beta1_service_proto_enumTypes = make([]protoimpl.EnumInfo, 2) -var file_cosmos_tx_v1beta1_service_proto_msgTypes = make([]protoimpl.MessageInfo, 10) +var file_cosmos_tx_v1beta1_service_proto_msgTypes = make([]protoimpl.MessageInfo, 14) var file_cosmos_tx_v1beta1_service_proto_goTypes = []interface{}{ (OrderBy)(0), // 0: cosmos.tx.v1beta1.OrderBy (BroadcastMode)(0), // 1: cosmos.tx.v1beta1.BroadcastMode @@ -6405,48 +8275,58 @@ var file_cosmos_tx_v1beta1_service_proto_goTypes = []interface{}{ (*GetTxResponse)(nil), // 9: cosmos.tx.v1beta1.GetTxResponse (*GetBlockWithTxsRequest)(nil), // 10: cosmos.tx.v1beta1.GetBlockWithTxsRequest (*GetBlockWithTxsResponse)(nil), // 11: cosmos.tx.v1beta1.GetBlockWithTxsResponse - (*v1beta1.PageRequest)(nil), // 12: cosmos.base.query.v1beta1.PageRequest - (*Tx)(nil), // 13: cosmos.tx.v1beta1.Tx - (*v1beta11.TxResponse)(nil), // 14: cosmos.base.abci.v1beta1.TxResponse - (*v1beta1.PageResponse)(nil), // 15: cosmos.base.query.v1beta1.PageResponse - (*v1beta11.GasInfo)(nil), // 16: cosmos.base.abci.v1beta1.GasInfo - (*v1beta11.Result)(nil), // 17: cosmos.base.abci.v1beta1.Result - (*types.BlockID)(nil), // 18: tendermint.types.BlockID - (*types.Block)(nil), // 19: tendermint.types.Block + (*TxDecodeRequest)(nil), // 12: cosmos.tx.v1beta1.TxDecodeRequest + (*TxDecodeResponse)(nil), // 13: cosmos.tx.v1beta1.TxDecodeResponse + (*TxEncodeRequest)(nil), // 14: cosmos.tx.v1beta1.TxEncodeRequest + (*TxEncodeResponse)(nil), // 15: cosmos.tx.v1beta1.TxEncodeResponse + (*v1beta1.PageRequest)(nil), // 16: cosmos.base.query.v1beta1.PageRequest + (*Tx)(nil), // 17: cosmos.tx.v1beta1.Tx + (*v1beta11.TxResponse)(nil), // 18: cosmos.base.abci.v1beta1.TxResponse + (*v1beta1.PageResponse)(nil), // 19: cosmos.base.query.v1beta1.PageResponse + (*v1beta11.GasInfo)(nil), // 20: cosmos.base.abci.v1beta1.GasInfo + (*v1beta11.Result)(nil), // 21: cosmos.base.abci.v1beta1.Result + (*types.BlockID)(nil), // 22: tendermint.types.BlockID + (*types.Block)(nil), // 23: tendermint.types.Block } var file_cosmos_tx_v1beta1_service_proto_depIdxs = []int32{ - 12, // 0: cosmos.tx.v1beta1.GetTxsEventRequest.pagination:type_name -> cosmos.base.query.v1beta1.PageRequest + 16, // 0: cosmos.tx.v1beta1.GetTxsEventRequest.pagination:type_name -> cosmos.base.query.v1beta1.PageRequest 0, // 1: cosmos.tx.v1beta1.GetTxsEventRequest.order_by:type_name -> cosmos.tx.v1beta1.OrderBy - 13, // 2: cosmos.tx.v1beta1.GetTxsEventResponse.txs:type_name -> cosmos.tx.v1beta1.Tx - 14, // 3: cosmos.tx.v1beta1.GetTxsEventResponse.tx_responses:type_name -> cosmos.base.abci.v1beta1.TxResponse - 15, // 4: cosmos.tx.v1beta1.GetTxsEventResponse.pagination:type_name -> cosmos.base.query.v1beta1.PageResponse + 17, // 2: cosmos.tx.v1beta1.GetTxsEventResponse.txs:type_name -> cosmos.tx.v1beta1.Tx + 18, // 3: cosmos.tx.v1beta1.GetTxsEventResponse.tx_responses:type_name -> cosmos.base.abci.v1beta1.TxResponse + 19, // 4: cosmos.tx.v1beta1.GetTxsEventResponse.pagination:type_name -> cosmos.base.query.v1beta1.PageResponse 1, // 5: cosmos.tx.v1beta1.BroadcastTxRequest.mode:type_name -> cosmos.tx.v1beta1.BroadcastMode - 14, // 6: cosmos.tx.v1beta1.BroadcastTxResponse.tx_response:type_name -> cosmos.base.abci.v1beta1.TxResponse - 13, // 7: cosmos.tx.v1beta1.SimulateRequest.tx:type_name -> cosmos.tx.v1beta1.Tx - 16, // 8: cosmos.tx.v1beta1.SimulateResponse.gas_info:type_name -> cosmos.base.abci.v1beta1.GasInfo - 17, // 9: cosmos.tx.v1beta1.SimulateResponse.result:type_name -> cosmos.base.abci.v1beta1.Result - 13, // 10: cosmos.tx.v1beta1.GetTxResponse.tx:type_name -> cosmos.tx.v1beta1.Tx - 14, // 11: cosmos.tx.v1beta1.GetTxResponse.tx_response:type_name -> cosmos.base.abci.v1beta1.TxResponse - 12, // 12: cosmos.tx.v1beta1.GetBlockWithTxsRequest.pagination:type_name -> cosmos.base.query.v1beta1.PageRequest - 13, // 13: cosmos.tx.v1beta1.GetBlockWithTxsResponse.txs:type_name -> cosmos.tx.v1beta1.Tx - 18, // 14: cosmos.tx.v1beta1.GetBlockWithTxsResponse.block_id:type_name -> tendermint.types.BlockID - 19, // 15: cosmos.tx.v1beta1.GetBlockWithTxsResponse.block:type_name -> tendermint.types.Block - 15, // 16: cosmos.tx.v1beta1.GetBlockWithTxsResponse.pagination:type_name -> cosmos.base.query.v1beta1.PageResponse - 6, // 17: cosmos.tx.v1beta1.Service.Simulate:input_type -> cosmos.tx.v1beta1.SimulateRequest - 8, // 18: cosmos.tx.v1beta1.Service.GetTx:input_type -> cosmos.tx.v1beta1.GetTxRequest - 4, // 19: cosmos.tx.v1beta1.Service.BroadcastTx:input_type -> cosmos.tx.v1beta1.BroadcastTxRequest - 2, // 20: cosmos.tx.v1beta1.Service.GetTxsEvent:input_type -> cosmos.tx.v1beta1.GetTxsEventRequest - 10, // 21: cosmos.tx.v1beta1.Service.GetBlockWithTxs:input_type -> cosmos.tx.v1beta1.GetBlockWithTxsRequest - 7, // 22: cosmos.tx.v1beta1.Service.Simulate:output_type -> cosmos.tx.v1beta1.SimulateResponse - 9, // 23: cosmos.tx.v1beta1.Service.GetTx:output_type -> cosmos.tx.v1beta1.GetTxResponse - 5, // 24: cosmos.tx.v1beta1.Service.BroadcastTx:output_type -> cosmos.tx.v1beta1.BroadcastTxResponse - 3, // 25: cosmos.tx.v1beta1.Service.GetTxsEvent:output_type -> cosmos.tx.v1beta1.GetTxsEventResponse - 11, // 26: cosmos.tx.v1beta1.Service.GetBlockWithTxs:output_type -> cosmos.tx.v1beta1.GetBlockWithTxsResponse - 22, // [22:27] is the sub-list for method output_type - 17, // [17:22] is the sub-list for method input_type - 17, // [17:17] is the sub-list for extension type_name - 17, // [17:17] is the sub-list for extension extendee - 0, // [0:17] is the sub-list for field type_name + 18, // 6: cosmos.tx.v1beta1.BroadcastTxResponse.tx_response:type_name -> cosmos.base.abci.v1beta1.TxResponse + 17, // 7: cosmos.tx.v1beta1.SimulateRequest.tx:type_name -> cosmos.tx.v1beta1.Tx + 20, // 8: cosmos.tx.v1beta1.SimulateResponse.gas_info:type_name -> cosmos.base.abci.v1beta1.GasInfo + 21, // 9: cosmos.tx.v1beta1.SimulateResponse.result:type_name -> cosmos.base.abci.v1beta1.Result + 17, // 10: cosmos.tx.v1beta1.GetTxResponse.tx:type_name -> cosmos.tx.v1beta1.Tx + 18, // 11: cosmos.tx.v1beta1.GetTxResponse.tx_response:type_name -> cosmos.base.abci.v1beta1.TxResponse + 16, // 12: cosmos.tx.v1beta1.GetBlockWithTxsRequest.pagination:type_name -> cosmos.base.query.v1beta1.PageRequest + 17, // 13: cosmos.tx.v1beta1.GetBlockWithTxsResponse.txs:type_name -> cosmos.tx.v1beta1.Tx + 22, // 14: cosmos.tx.v1beta1.GetBlockWithTxsResponse.block_id:type_name -> tendermint.types.BlockID + 23, // 15: cosmos.tx.v1beta1.GetBlockWithTxsResponse.block:type_name -> tendermint.types.Block + 19, // 16: cosmos.tx.v1beta1.GetBlockWithTxsResponse.pagination:type_name -> cosmos.base.query.v1beta1.PageResponse + 17, // 17: cosmos.tx.v1beta1.TxDecodeResponse.tx:type_name -> cosmos.tx.v1beta1.Tx + 17, // 18: cosmos.tx.v1beta1.TxEncodeRequest.tx:type_name -> cosmos.tx.v1beta1.Tx + 6, // 19: cosmos.tx.v1beta1.Service.Simulate:input_type -> cosmos.tx.v1beta1.SimulateRequest + 8, // 20: cosmos.tx.v1beta1.Service.GetTx:input_type -> cosmos.tx.v1beta1.GetTxRequest + 4, // 21: cosmos.tx.v1beta1.Service.BroadcastTx:input_type -> cosmos.tx.v1beta1.BroadcastTxRequest + 2, // 22: cosmos.tx.v1beta1.Service.GetTxsEvent:input_type -> cosmos.tx.v1beta1.GetTxsEventRequest + 10, // 23: cosmos.tx.v1beta1.Service.GetBlockWithTxs:input_type -> cosmos.tx.v1beta1.GetBlockWithTxsRequest + 12, // 24: cosmos.tx.v1beta1.Service.TxDecode:input_type -> cosmos.tx.v1beta1.TxDecodeRequest + 14, // 25: cosmos.tx.v1beta1.Service.TxEncode:input_type -> cosmos.tx.v1beta1.TxEncodeRequest + 7, // 26: cosmos.tx.v1beta1.Service.Simulate:output_type -> cosmos.tx.v1beta1.SimulateResponse + 9, // 27: cosmos.tx.v1beta1.Service.GetTx:output_type -> cosmos.tx.v1beta1.GetTxResponse + 5, // 28: cosmos.tx.v1beta1.Service.BroadcastTx:output_type -> cosmos.tx.v1beta1.BroadcastTxResponse + 3, // 29: cosmos.tx.v1beta1.Service.GetTxsEvent:output_type -> cosmos.tx.v1beta1.GetTxsEventResponse + 11, // 30: cosmos.tx.v1beta1.Service.GetBlockWithTxs:output_type -> cosmos.tx.v1beta1.GetBlockWithTxsResponse + 13, // 31: cosmos.tx.v1beta1.Service.TxDecode:output_type -> cosmos.tx.v1beta1.TxDecodeResponse + 15, // 32: cosmos.tx.v1beta1.Service.TxEncode:output_type -> cosmos.tx.v1beta1.TxEncodeResponse + 26, // [26:33] is the sub-list for method output_type + 19, // [19:26] is the sub-list for method input_type + 19, // [19:19] is the sub-list for extension type_name + 19, // [19:19] is the sub-list for extension extendee + 0, // [0:19] is the sub-list for field type_name } func init() { file_cosmos_tx_v1beta1_service_proto_init() } @@ -6576,6 +8456,54 @@ func file_cosmos_tx_v1beta1_service_proto_init() { return nil } } + file_cosmos_tx_v1beta1_service_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*TxDecodeRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_cosmos_tx_v1beta1_service_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*TxDecodeResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_cosmos_tx_v1beta1_service_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*TxEncodeRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_cosmos_tx_v1beta1_service_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*TxEncodeResponse); 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{ @@ -6583,7 +8511,7 @@ func file_cosmos_tx_v1beta1_service_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_cosmos_tx_v1beta1_service_proto_rawDesc, NumEnums: 2, - NumMessages: 10, + NumMessages: 14, NumExtensions: 0, NumServices: 1, }, diff --git a/api/cosmos/tx/v1beta1/service_grpc.pb.go b/api/cosmos/tx/v1beta1/service_grpc.pb.go index 2acab93a3c5b..565f79c98438 100644 --- a/api/cosmos/tx/v1beta1/service_grpc.pb.go +++ b/api/cosmos/tx/v1beta1/service_grpc.pb.go @@ -34,6 +34,14 @@ type ServiceClient interface { // // Since: cosmos-sdk 0.45.2 GetBlockWithTxs(ctx context.Context, in *GetBlockWithTxsRequest, opts ...grpc.CallOption) (*GetBlockWithTxsResponse, error) + // TxDecode decodes the transaction. + // + // Since: cosmos-sdk 0.47 + TxDecode(ctx context.Context, in *TxDecodeRequest, opts ...grpc.CallOption) (*TxDecodeResponse, error) + // TxEncode encodes the transaction. + // + // Since: cosmos-sdk 0.47 + TxEncode(ctx context.Context, in *TxEncodeRequest, opts ...grpc.CallOption) (*TxEncodeResponse, error) } type serviceClient struct { @@ -89,6 +97,24 @@ func (c *serviceClient) GetBlockWithTxs(ctx context.Context, in *GetBlockWithTxs return out, nil } +func (c *serviceClient) TxDecode(ctx context.Context, in *TxDecodeRequest, opts ...grpc.CallOption) (*TxDecodeResponse, error) { + out := new(TxDecodeResponse) + err := c.cc.Invoke(ctx, "/cosmos.tx.v1beta1.Service/TxDecode", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) TxEncode(ctx context.Context, in *TxEncodeRequest, opts ...grpc.CallOption) (*TxEncodeResponse, error) { + out := new(TxEncodeResponse) + err := c.cc.Invoke(ctx, "/cosmos.tx.v1beta1.Service/TxEncode", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // ServiceServer is the server API for Service service. // All implementations must embed UnimplementedServiceServer // for forward compatibility @@ -105,6 +131,14 @@ type ServiceServer interface { // // Since: cosmos-sdk 0.45.2 GetBlockWithTxs(context.Context, *GetBlockWithTxsRequest) (*GetBlockWithTxsResponse, error) + // TxDecode decodes the transaction. + // + // Since: cosmos-sdk 0.47 + TxDecode(context.Context, *TxDecodeRequest) (*TxDecodeResponse, error) + // TxEncode encodes the transaction. + // + // Since: cosmos-sdk 0.47 + TxEncode(context.Context, *TxEncodeRequest) (*TxEncodeResponse, error) mustEmbedUnimplementedServiceServer() } @@ -127,6 +161,12 @@ func (UnimplementedServiceServer) GetTxsEvent(context.Context, *GetTxsEventReque func (UnimplementedServiceServer) GetBlockWithTxs(context.Context, *GetBlockWithTxsRequest) (*GetBlockWithTxsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method GetBlockWithTxs not implemented") } +func (UnimplementedServiceServer) TxDecode(context.Context, *TxDecodeRequest) (*TxDecodeResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method TxDecode not implemented") +} +func (UnimplementedServiceServer) TxEncode(context.Context, *TxEncodeRequest) (*TxEncodeResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method TxEncode not implemented") +} func (UnimplementedServiceServer) mustEmbedUnimplementedServiceServer() {} // UnsafeServiceServer may be embedded to opt out of forward compatibility for this service. @@ -230,6 +270,42 @@ func _Service_GetBlockWithTxs_Handler(srv interface{}, ctx context.Context, dec return interceptor(ctx, in, info, handler) } +func _Service_TxDecode_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(TxDecodeRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ServiceServer).TxDecode(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cosmos.tx.v1beta1.Service/TxDecode", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ServiceServer).TxDecode(ctx, req.(*TxDecodeRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Service_TxEncode_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(TxEncodeRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ServiceServer).TxEncode(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cosmos.tx.v1beta1.Service/TxEncode", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ServiceServer).TxEncode(ctx, req.(*TxEncodeRequest)) + } + return interceptor(ctx, in, info, handler) +} + // Service_ServiceDesc is the grpc.ServiceDesc for Service service. // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) @@ -257,6 +333,14 @@ var Service_ServiceDesc = grpc.ServiceDesc{ MethodName: "GetBlockWithTxs", Handler: _Service_GetBlockWithTxs_Handler, }, + { + MethodName: "TxDecode", + Handler: _Service_TxDecode_Handler, + }, + { + MethodName: "TxEncode", + Handler: _Service_TxEncode_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "cosmos/tx/v1beta1/service.proto", diff --git a/proto/cosmos/tx/v1beta1/service.proto b/proto/cosmos/tx/v1beta1/service.proto index e2daf2c3d1d2..15504b85c380 100644 --- a/proto/cosmos/tx/v1beta1/service.proto +++ b/proto/cosmos/tx/v1beta1/service.proto @@ -40,6 +40,24 @@ service Service { rpc GetBlockWithTxs(GetBlockWithTxsRequest) returns (GetBlockWithTxsResponse) { option (google.api.http).get = "/cosmos/tx/v1beta1/txs/block/{height}"; } + // TxDecode decodes the transaction. + // + // Since: cosmos-sdk 0.47 + rpc TxDecode(TxDecodeRequest) returns (TxDecodeResponse) { + option (google.api.http) = { + post: "/cosmos/tx/v1beta1/decode" + body: "*" + }; + } + // TxEncode encodes the transaction. + // + // Since: cosmos-sdk 0.47 + rpc TxEncode(TxEncodeRequest) returns (TxEncodeResponse) { + option (google.api.http) = { + post: "/cosmos/tx/v1beta1/encode" + body: "*" + }; + } } // GetTxsEventRequest is the request type for the Service.TxsByEvents @@ -170,4 +188,40 @@ message GetBlockWithTxsResponse { .tendermint.types.Block block = 3; // pagination defines a pagination for the response. cosmos.base.query.v1beta1.PageResponse pagination = 4; -} \ No newline at end of file +} + +// TxDecodeRequest is the request type for the Service.TxDecode +// RPC method. +// +// Since: cosmos-sdk 0.47 +message TxDecodeRequest { + // tx_bytes is the raw transaction. + bytes tx_bytes = 1; +} + +// TxDecodeResponse is the response type for the +// Service.TxDecode method. +// +// Since: cosmos-sdk 0.47 +message TxDecodeResponse { + // tx is the decoded transaction. + cosmos.tx.v1beta1.Tx tx = 1; +} + +// TxEncodeResponse is the request type for the Service.TxEncode +// RPC method. +// +// Since: cosmos-sdk 0.47 +message TxEncodeRequest { + // tx is the transaction to encode. + cosmos.tx.v1beta1.Tx tx = 1; +} + +// TxEncodeResponse is the response type for the +// Service.TxEncode method. +// +// Since: cosmos-sdk 0.47 +message TxEncodeResponse { + // tx_bytes is the encoded transaction bytes. + bytes tx_bytes = 1; +} diff --git a/tests/e2e/tx/service_test.go b/tests/e2e/tx/service_test.go index 45c7ff3cde15..6eef802cdd49 100644 --- a/tests/e2e/tx/service_test.go +++ b/tests/e2e/tx/service_test.go @@ -11,6 +11,7 @@ import ( "github.com/stretchr/testify/suite" "cosmossdk.io/simapp" + "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" clienttx "github.com/cosmos/cosmos-sdk/client/tx" @@ -770,6 +771,143 @@ func (s IntegrationTestSuite) TestGetBlockWithTxs_GRPCGateway() { } } +func (s IntegrationTestSuite) TestTxEncode_GRPC() { + txBuilder := s.mkTxBuilder() + protoTx, err := txBuilderToProtoTx(txBuilder) + s.Require().NoError(err) + + testCases := []struct { + name string + req *tx.TxEncodeRequest + expErr bool + expErrMsg string + }{ + {"nil request", nil, true, "request cannot be nil"}, + {"empty request", &tx.TxEncodeRequest{}, true, "invalid empty tx"}, + {"valid request with tx bytes", &tx.TxEncodeRequest{Tx: protoTx}, false, ""}, + } + + for _, tc := range testCases { + tc := tc + s.Run(tc.name, func() { + res, err := s.queryClient.TxEncode(context.Background(), tc.req) + if tc.expErr { + s.Require().Error(err) + s.Require().Contains(err.Error(), tc.expErrMsg) + s.Require().Empty(res) + } else { + s.Require().NoError(err) + s.Require().NotEmpty(res.GetTxBytes()) + } + }) + } +} + +func (s *IntegrationTestSuite) TestTxEncode_GRPCGateway() { + val := s.network.Validators[0] + txBuilder := s.mkTxBuilder() + protoTx, err := txBuilderToProtoTx(txBuilder) + s.Require().NoError(err) + + testCases := []struct { + name string + req *tx.TxEncodeRequest + expErr bool + expErrMsg string + }{ + {"empty request", &tx.TxEncodeRequest{}, true, "invalid empty tx"}, + {"valid request with tx bytes", &tx.TxEncodeRequest{Tx: protoTx}, false, ""}, + } + + for _, tc := range testCases { + s.Run(tc.name, func() { + req, err := val.ClientCtx.Codec.MarshalJSON(tc.req) + s.Require().NoError(err) + + res, err := testutil.PostRequest(fmt.Sprintf("%s/cosmos/tx/v1beta1/encode", val.APIAddress), "application/json", req) + s.Require().NoError(err) + if tc.expErr { + s.Require().Contains(string(res), tc.expErrMsg) + } else { + s.Require().NoError(err) + } + }) + } +} + +func (s IntegrationTestSuite) TestTxDecode_GRPC() { + val := s.network.Validators[0] + txBuilder := s.mkTxBuilder() + + encodedTx, err := val.ClientCtx.TxConfig.TxEncoder()(txBuilder.GetTx()) + s.Require().NoError(err) + + invalidTxBytes := append(encodedTx, byte(0o00)) + + testCases := []struct { + name string + req *tx.TxDecodeRequest + expErr bool + expErrMsg string + }{ + {"nil request", nil, true, "request cannot be nil"}, + {"empty request", &tx.TxDecodeRequest{}, true, "invalid empty tx bytes"}, + {"invalid tx bytes", &tx.TxDecodeRequest{TxBytes: invalidTxBytes}, true, "tx parse error"}, + {"valid request with tx bytes", &tx.TxDecodeRequest{TxBytes: encodedTx}, false, ""}, + } + + for _, tc := range testCases { + tc := tc + s.Run(tc.name, func() { + res, err := s.queryClient.TxDecode(context.Background(), tc.req) + if tc.expErr { + s.Require().Error(err) + s.Require().Contains(err.Error(), tc.expErrMsg) + s.Require().Empty(res) + } else { + s.Require().NoError(err) + s.Require().NotEmpty(res.GetTx()) + } + }) + } +} + +func (s IntegrationTestSuite) TestTxDecode_GRPCGateway() { + val := s.network.Validators[0] + txBuilder := s.mkTxBuilder() + + txBytes, err := val.ClientCtx.TxConfig.TxEncoder()(txBuilder.GetTx()) + s.Require().NoError(err) + + invalidTxBytes := append(txBytes, byte(0o00)) + + testCases := []struct { + name string + req *tx.TxDecodeRequest + expErr bool + expErrMsg string + }{ + {"empty request", &tx.TxDecodeRequest{}, true, "invalid empty tx bytes"}, + {"invalid tx bytes", &tx.TxDecodeRequest{TxBytes: invalidTxBytes}, true, "tx parse error"}, + {"valid request with tx_bytes", &tx.TxDecodeRequest{TxBytes: txBytes}, false, ""}, + } + + for _, tc := range testCases { + s.Run(tc.name, func() { + req, err := val.ClientCtx.Codec.MarshalJSON(tc.req) + s.Require().NoError(err) + + res, err := testutil.PostRequest(fmt.Sprintf("%s/cosmos/tx/v1beta1/decode", val.APIAddress), "application/json", req) + s.Require().NoError(err) + if tc.expErr { + s.Require().Contains(string(res), tc.expErrMsg) + } else { + s.Require().NoError(err) + } + }) + } +} + func TestIntegrationTestSuite(t *testing.T) { suite.Run(t, new(IntegrationTestSuite)) } @@ -816,8 +954,8 @@ type protoTxProvider interface { } // txBuilderToProtoTx converts a txBuilder into a proto tx.Tx. -// Deprecated: It's only used for testing the deprecated Simulate gRPC endpoint -// using a proto Tx field. +// Deprecated: It's used for testing the deprecated Simulate gRPC endpoint +// using a proto Tx field and for testing the TxEncode endpoint. func txBuilderToProtoTx(txBuilder client.TxBuilder) (*tx.Tx, error) { // nolint protoProvider, ok := txBuilder.(protoTxProvider) if !ok { diff --git a/types/tx/service.pb.go b/types/tx/service.pb.go index 6039cfc841a1..55be6c3cc958 100644 --- a/types/tx/service.pb.go +++ b/types/tx/service.pb.go @@ -714,6 +714,194 @@ func (m *GetBlockWithTxsResponse) GetPagination() *query.PageResponse { return nil } +// TxDecodeRequest is the request type for the Service.TxDecode +// RPC method. +type TxDecodeRequest struct { + // tx_bytes is the raw transaction. + TxBytes []byte `protobuf:"bytes,1,opt,name=tx_bytes,json=txBytes,proto3" json:"tx_bytes,omitempty"` +} + +func (m *TxDecodeRequest) Reset() { *m = TxDecodeRequest{} } +func (m *TxDecodeRequest) String() string { return proto.CompactTextString(m) } +func (*TxDecodeRequest) ProtoMessage() {} +func (*TxDecodeRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_e0b00a618705eca7, []int{10} +} +func (m *TxDecodeRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *TxDecodeRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_TxDecodeRequest.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 *TxDecodeRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_TxDecodeRequest.Merge(m, src) +} +func (m *TxDecodeRequest) XXX_Size() int { + return m.Size() +} +func (m *TxDecodeRequest) XXX_DiscardUnknown() { + xxx_messageInfo_TxDecodeRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_TxDecodeRequest proto.InternalMessageInfo + +func (m *TxDecodeRequest) GetTxBytes() []byte { + if m != nil { + return m.TxBytes + } + return nil +} + +// TxDecodeResponse is the response type for the +// Service.TxDecode method. +type TxDecodeResponse struct { + // tx is the decoded transaction. + Tx *Tx `protobuf:"bytes,1,opt,name=tx,proto3" json:"tx,omitempty"` +} + +func (m *TxDecodeResponse) Reset() { *m = TxDecodeResponse{} } +func (m *TxDecodeResponse) String() string { return proto.CompactTextString(m) } +func (*TxDecodeResponse) ProtoMessage() {} +func (*TxDecodeResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_e0b00a618705eca7, []int{11} +} +func (m *TxDecodeResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *TxDecodeResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_TxDecodeResponse.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 *TxDecodeResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_TxDecodeResponse.Merge(m, src) +} +func (m *TxDecodeResponse) XXX_Size() int { + return m.Size() +} +func (m *TxDecodeResponse) XXX_DiscardUnknown() { + xxx_messageInfo_TxDecodeResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_TxDecodeResponse proto.InternalMessageInfo + +func (m *TxDecodeResponse) GetTx() *Tx { + if m != nil { + return m.Tx + } + return nil +} + +// TxEncodeResponse is the request type for the Service.TxEncode +// RPC method. +type TxEncodeRequest struct { + // tx is the transaction to encode. + Tx *Tx `protobuf:"bytes,1,opt,name=tx,proto3" json:"tx,omitempty"` +} + +func (m *TxEncodeRequest) Reset() { *m = TxEncodeRequest{} } +func (m *TxEncodeRequest) String() string { return proto.CompactTextString(m) } +func (*TxEncodeRequest) ProtoMessage() {} +func (*TxEncodeRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_e0b00a618705eca7, []int{12} +} +func (m *TxEncodeRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *TxEncodeRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_TxEncodeRequest.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 *TxEncodeRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_TxEncodeRequest.Merge(m, src) +} +func (m *TxEncodeRequest) XXX_Size() int { + return m.Size() +} +func (m *TxEncodeRequest) XXX_DiscardUnknown() { + xxx_messageInfo_TxEncodeRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_TxEncodeRequest proto.InternalMessageInfo + +func (m *TxEncodeRequest) GetTx() *Tx { + if m != nil { + return m.Tx + } + return nil +} + +// TxEncodeResponse is the response type for the +// Service.TxEncode method. +type TxEncodeResponse struct { + // tx_bytes is the encoded transaction bytes. + TxBytes []byte `protobuf:"bytes,1,opt,name=tx_bytes,json=txBytes,proto3" json:"tx_bytes,omitempty"` +} + +func (m *TxEncodeResponse) Reset() { *m = TxEncodeResponse{} } +func (m *TxEncodeResponse) String() string { return proto.CompactTextString(m) } +func (*TxEncodeResponse) ProtoMessage() {} +func (*TxEncodeResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_e0b00a618705eca7, []int{13} +} +func (m *TxEncodeResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *TxEncodeResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_TxEncodeResponse.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 *TxEncodeResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_TxEncodeResponse.Merge(m, src) +} +func (m *TxEncodeResponse) XXX_Size() int { + return m.Size() +} +func (m *TxEncodeResponse) XXX_DiscardUnknown() { + xxx_messageInfo_TxEncodeResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_TxEncodeResponse proto.InternalMessageInfo + +func (m *TxEncodeResponse) GetTxBytes() []byte { + if m != nil { + return m.TxBytes + } + return nil +} + func init() { proto.RegisterEnum("cosmos.tx.v1beta1.OrderBy", OrderBy_name, OrderBy_value) proto.RegisterEnum("cosmos.tx.v1beta1.BroadcastMode", BroadcastMode_name, BroadcastMode_value) @@ -727,6 +915,10 @@ func init() { proto.RegisterType((*GetTxResponse)(nil), "cosmos.tx.v1beta1.GetTxResponse") proto.RegisterType((*GetBlockWithTxsRequest)(nil), "cosmos.tx.v1beta1.GetBlockWithTxsRequest") proto.RegisterType((*GetBlockWithTxsResponse)(nil), "cosmos.tx.v1beta1.GetBlockWithTxsResponse") + proto.RegisterType((*TxDecodeRequest)(nil), "cosmos.tx.v1beta1.TxDecodeRequest") + proto.RegisterType((*TxDecodeResponse)(nil), "cosmos.tx.v1beta1.TxDecodeResponse") + proto.RegisterType((*TxEncodeRequest)(nil), "cosmos.tx.v1beta1.TxEncodeRequest") + proto.RegisterType((*TxEncodeResponse)(nil), "cosmos.tx.v1beta1.TxEncodeResponse") } func init() { proto.RegisterFile("cosmos/tx/v1beta1/service.proto", fileDescriptor_e0b00a618705eca7) } @@ -823,6 +1015,14 @@ type ServiceClient interface { // // Since: cosmos-sdk 0.45.2 GetBlockWithTxs(ctx context.Context, in *GetBlockWithTxsRequest, opts ...grpc.CallOption) (*GetBlockWithTxsResponse, error) + // TxDecode decodes the transaction. + // + // Since: cosmos-sdk 0.47 + TxDecode(ctx context.Context, in *TxDecodeRequest, opts ...grpc.CallOption) (*TxDecodeResponse, error) + // TxEncode encodes the transaction. + // + // Since: cosmos-sdk 0.47 + TxEncode(ctx context.Context, in *TxEncodeRequest, opts ...grpc.CallOption) (*TxEncodeResponse, error) } type serviceClient struct { @@ -878,6 +1078,24 @@ func (c *serviceClient) GetBlockWithTxs(ctx context.Context, in *GetBlockWithTxs return out, nil } +func (c *serviceClient) TxDecode(ctx context.Context, in *TxDecodeRequest, opts ...grpc.CallOption) (*TxDecodeResponse, error) { + out := new(TxDecodeResponse) + err := c.cc.Invoke(ctx, "/cosmos.tx.v1beta1.Service/TxDecode", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) TxEncode(ctx context.Context, in *TxEncodeRequest, opts ...grpc.CallOption) (*TxEncodeResponse, error) { + out := new(TxEncodeResponse) + err := c.cc.Invoke(ctx, "/cosmos.tx.v1beta1.Service/TxEncode", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // ServiceServer is the server API for Service service. type ServiceServer interface { // Simulate simulates executing a transaction for estimating gas usage. @@ -892,6 +1110,14 @@ type ServiceServer interface { // // Since: cosmos-sdk 0.45.2 GetBlockWithTxs(context.Context, *GetBlockWithTxsRequest) (*GetBlockWithTxsResponse, error) + // TxDecode decodes the transaction. + // + // Since: cosmos-sdk 0.47 + TxDecode(context.Context, *TxDecodeRequest) (*TxDecodeResponse, error) + // TxEncode encodes the transaction. + // + // Since: cosmos-sdk 0.47 + TxEncode(context.Context, *TxEncodeRequest) (*TxEncodeResponse, error) } // UnimplementedServiceServer can be embedded to have forward compatible implementations. @@ -913,6 +1139,12 @@ func (*UnimplementedServiceServer) GetTxsEvent(ctx context.Context, req *GetTxsE func (*UnimplementedServiceServer) GetBlockWithTxs(ctx context.Context, req *GetBlockWithTxsRequest) (*GetBlockWithTxsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method GetBlockWithTxs not implemented") } +func (*UnimplementedServiceServer) TxDecode(ctx context.Context, req *TxDecodeRequest) (*TxDecodeResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method TxDecode not implemented") +} +func (*UnimplementedServiceServer) TxEncode(ctx context.Context, req *TxEncodeRequest) (*TxEncodeResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method TxEncode not implemented") +} func RegisterServiceServer(s grpc1.Server, srv ServiceServer) { s.RegisterService(&_Service_serviceDesc, srv) @@ -1008,6 +1240,42 @@ func _Service_GetBlockWithTxs_Handler(srv interface{}, ctx context.Context, dec return interceptor(ctx, in, info, handler) } +func _Service_TxDecode_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(TxDecodeRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ServiceServer).TxDecode(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cosmos.tx.v1beta1.Service/TxDecode", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ServiceServer).TxDecode(ctx, req.(*TxDecodeRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Service_TxEncode_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(TxEncodeRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ServiceServer).TxEncode(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cosmos.tx.v1beta1.Service/TxEncode", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ServiceServer).TxEncode(ctx, req.(*TxEncodeRequest)) + } + return interceptor(ctx, in, info, handler) +} + var _Service_serviceDesc = grpc.ServiceDesc{ ServiceName: "cosmos.tx.v1beta1.Service", HandlerType: (*ServiceServer)(nil), @@ -1032,6 +1300,14 @@ var _Service_serviceDesc = grpc.ServiceDesc{ MethodName: "GetBlockWithTxs", Handler: _Service_GetBlockWithTxs_Handler, }, + { + MethodName: "TxDecode", + Handler: _Service_TxDecode_Handler, + }, + { + MethodName: "TxEncode", + Handler: _Service_TxEncode_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "cosmos/tx/v1beta1/service.proto", @@ -1513,87 +1789,217 @@ func (m *GetBlockWithTxsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) return len(dAtA) - i, nil } -func encodeVarintService(dAtA []byte, offset int, v uint64) int { - offset -= sovService(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ +func (m *TxDecodeRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } - dAtA[offset] = uint8(v) - return base + return dAtA[:n], nil } -func (m *GetTxsEventRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Events) > 0 { - for _, s := range m.Events { - l = len(s) - n += 1 + l + sovService(uint64(l)) - } - } - if m.Pagination != nil { - l = m.Pagination.Size() - n += 1 + l + sovService(uint64(l)) - } - if m.OrderBy != 0 { - n += 1 + sovService(uint64(m.OrderBy)) - } - if m.Page != 0 { - n += 1 + sovService(uint64(m.Page)) - } - if m.Limit != 0 { - n += 1 + sovService(uint64(m.Limit)) - } - return n + +func (m *TxDecodeRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *GetTxsEventResponse) Size() (n int) { - if m == nil { - return 0 - } +func (m *TxDecodeRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - if len(m.Txs) > 0 { - for _, e := range m.Txs { - l = e.Size() - n += 1 + l + sovService(uint64(l)) - } - } - if len(m.TxResponses) > 0 { - for _, e := range m.TxResponses { - l = e.Size() - n += 1 + l + sovService(uint64(l)) - } - } - if m.Pagination != nil { - l = m.Pagination.Size() - n += 1 + l + sovService(uint64(l)) - } - if m.Total != 0 { - n += 1 + sovService(uint64(m.Total)) + if len(m.TxBytes) > 0 { + i -= len(m.TxBytes) + copy(dAtA[i:], m.TxBytes) + i = encodeVarintService(dAtA, i, uint64(len(m.TxBytes))) + i-- + dAtA[i] = 0xa } - return n + return len(dAtA) - i, nil } -func (m *BroadcastTxRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.TxBytes) - if l > 0 { - n += 1 + l + sovService(uint64(l)) - } - if m.Mode != 0 { - n += 1 + sovService(uint64(m.Mode)) +func (m *TxDecodeResponse) 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 n + return dAtA[:n], nil +} + +func (m *TxDecodeResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *TxDecodeResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Tx != nil { + { + size, err := m.Tx.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *TxEncodeRequest) 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 *TxEncodeRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *TxEncodeRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Tx != nil { + { + size, err := m.Tx.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *TxEncodeResponse) 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 *TxEncodeResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *TxEncodeResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.TxBytes) > 0 { + i -= len(m.TxBytes) + copy(dAtA[i:], m.TxBytes) + i = encodeVarintService(dAtA, i, uint64(len(m.TxBytes))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintService(dAtA []byte, offset int, v uint64) int { + offset -= sovService(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *GetTxsEventRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Events) > 0 { + for _, s := range m.Events { + l = len(s) + n += 1 + l + sovService(uint64(l)) + } + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovService(uint64(l)) + } + if m.OrderBy != 0 { + n += 1 + sovService(uint64(m.OrderBy)) + } + if m.Page != 0 { + n += 1 + sovService(uint64(m.Page)) + } + if m.Limit != 0 { + n += 1 + sovService(uint64(m.Limit)) + } + return n +} + +func (m *GetTxsEventResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Txs) > 0 { + for _, e := range m.Txs { + l = e.Size() + n += 1 + l + sovService(uint64(l)) + } + } + if len(m.TxResponses) > 0 { + for _, e := range m.TxResponses { + l = e.Size() + n += 1 + l + sovService(uint64(l)) + } + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovService(uint64(l)) + } + if m.Total != 0 { + n += 1 + sovService(uint64(m.Total)) + } + return n +} + +func (m *BroadcastTxRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.TxBytes) + if l > 0 { + n += 1 + l + sovService(uint64(l)) + } + if m.Mode != 0 { + n += 1 + sovService(uint64(m.Mode)) + } + return n } func (m *BroadcastTxResponse) Size() (n int) { @@ -1716,6 +2122,58 @@ func (m *GetBlockWithTxsResponse) Size() (n int) { return n } +func (m *TxDecodeRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.TxBytes) + if l > 0 { + n += 1 + l + sovService(uint64(l)) + } + return n +} + +func (m *TxDecodeResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Tx != nil { + l = m.Tx.Size() + n += 1 + l + sovService(uint64(l)) + } + return n +} + +func (m *TxEncodeRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Tx != nil { + l = m.Tx.Size() + n += 1 + l + sovService(uint64(l)) + } + return n +} + +func (m *TxEncodeResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.TxBytes) + if l > 0 { + n += 1 + l + sovService(uint64(l)) + } + return n +} + func sovService(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -3002,6 +3460,346 @@ func (m *GetBlockWithTxsResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *TxDecodeRequest) 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 ErrIntOverflowService + } + 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: TxDecodeRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: TxDecodeRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TxBytes", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.TxBytes = append(m.TxBytes[:0], dAtA[iNdEx:postIndex]...) + if m.TxBytes == nil { + m.TxBytes = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipService(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *TxDecodeResponse) 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 ErrIntOverflowService + } + 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: TxDecodeResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: TxDecodeResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Tx", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Tx == nil { + m.Tx = &Tx{} + } + if err := m.Tx.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipService(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *TxEncodeRequest) 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 ErrIntOverflowService + } + 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: TxEncodeRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: TxEncodeRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Tx", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Tx == nil { + m.Tx = &Tx{} + } + if err := m.Tx.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipService(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *TxEncodeResponse) 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 ErrIntOverflowService + } + 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: TxEncodeResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: TxEncodeResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TxBytes", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.TxBytes = append(m.TxBytes[:0], dAtA[iNdEx:postIndex]...) + if m.TxBytes == nil { + m.TxBytes = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipService(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipService(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/types/tx/service.pb.gw.go b/types/tx/service.pb.gw.go index f5eec4608b17..04789ddc09ad 100644 --- a/types/tx/service.pb.gw.go +++ b/types/tx/service.pb.gw.go @@ -263,6 +263,74 @@ func local_request_Service_GetBlockWithTxs_0(ctx context.Context, marshaler runt } +func request_Service_TxDecode_0(ctx context.Context, marshaler runtime.Marshaler, client ServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq TxDecodeRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.TxDecode(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Service_TxDecode_0(ctx context.Context, marshaler runtime.Marshaler, server ServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq TxDecodeRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.TxDecode(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Service_TxEncode_0(ctx context.Context, marshaler runtime.Marshaler, client ServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq TxEncodeRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.TxEncode(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Service_TxEncode_0(ctx context.Context, marshaler runtime.Marshaler, server ServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq TxEncodeRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.TxEncode(ctx, &protoReq) + return msg, metadata, err + +} + // RegisterServiceHandlerServer registers the http handlers for service Service to "mux". // UnaryRPC :call ServiceServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. @@ -384,6 +452,52 @@ func RegisterServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, se }) + mux.Handle("POST", pattern_Service_TxDecode_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_Service_TxDecode_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_Service_TxDecode_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_Service_TxEncode_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_Service_TxEncode_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_Service_TxEncode_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -525,6 +639,46 @@ func RegisterServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, cl }) + mux.Handle("POST", pattern_Service_TxDecode_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_Service_TxDecode_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Service_TxDecode_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_Service_TxEncode_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_Service_TxEncode_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Service_TxEncode_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -538,6 +692,10 @@ var ( pattern_Service_GetTxsEvent_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"cosmos", "tx", "v1beta1", "txs"}, "", runtime.AssumeColonVerbOpt(false))) pattern_Service_GetBlockWithTxs_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 1, 0, 4, 1, 5, 5}, []string{"cosmos", "tx", "v1beta1", "txs", "block", "height"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Service_TxDecode_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"cosmos", "tx", "v1beta1", "decode"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Service_TxEncode_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"cosmos", "tx", "v1beta1", "encode"}, "", runtime.AssumeColonVerbOpt(false))) ) var ( @@ -550,4 +708,8 @@ var ( forward_Service_GetTxsEvent_0 = runtime.ForwardResponseMessage forward_Service_GetBlockWithTxs_0 = runtime.ForwardResponseMessage + + forward_Service_TxDecode_0 = runtime.ForwardResponseMessage + + forward_Service_TxEncode_0 = runtime.ForwardResponseMessage ) diff --git a/x/auth/tx/service.go b/x/auth/tx/service.go index 1d5b846dbda1..ce45dfc32dfb 100644 --- a/x/auth/tx/service.go +++ b/x/auth/tx/service.go @@ -248,10 +248,50 @@ func (s txServer) GetBlockWithTxs(ctx context.Context, req *txtypes.GetBlockWith }, nil } +// BroadcastTx implements the ServiceServer.BroadcastTx RPC method. func (s txServer) BroadcastTx(ctx context.Context, req *txtypes.BroadcastTxRequest) (*txtypes.BroadcastTxResponse, error) { return client.TxServiceBroadcast(ctx, s.clientCtx, req) } +// TxEncode implements the ServiceServer.TxEncode RPC method. +func (s txServer) TxEncode(ctx context.Context, req *txtypes.TxEncodeRequest) (*txtypes.TxEncodeResponse, error) { + if req.Tx == nil { + return nil, status.Error(codes.InvalidArgument, "invalid empty tx") + } + + txBuilder := &wrapper{tx: req.Tx} + + encodedBytes, err := s.clientCtx.TxConfig.TxEncoder()(txBuilder) + if err != nil { + return nil, err + } + + return &txtypes.TxEncodeResponse{ + TxBytes: encodedBytes, + }, nil +} + +// TxDecode implements the ServiceServer.TxDecode RPC method. +func (s txServer) TxDecode(ctx context.Context, req *txtypes.TxDecodeRequest) (*txtypes.TxDecodeResponse, error) { + if req.TxBytes == nil { + return nil, status.Error(codes.InvalidArgument, "invalid empty tx bytes") + } + + txb, err := s.clientCtx.TxConfig.TxDecoder()(req.TxBytes) + if err != nil { + return nil, err + } + + txWrapper, ok := txb.(*wrapper) + if ok { + return &txtypes.TxDecodeResponse{ + Tx: txWrapper.tx, + }, nil + } + + return nil, fmt.Errorf("expected %T, got %T", &wrapper{}, txb) +} + // RegisterTxService registers the tx service on the gRPC router. func RegisterTxService( qrt gogogrpc.Server,