chainrpc.SpendRequest.scala Maven / Gradle / Ivy
The newest version!
// Generated by the Scala Plugin for the Protocol Buffer Compiler.
// Do not edit!
//
// Protofile syntax: PROTO3
package chainrpc
/** @param outpoint
*
* The outpoint for which we should request a spend notification for. If set to
* a zero outpoint, then the spend notification will be requested for the
* script instead. A zero or nil outpoint is not supported for Taproot spends
* because the output script cannot reliably be computed from the witness alone
* and the spent output script is not always available in the rescan context.
* So an outpoint must _always_ be specified when registering a spend
* notification for a Taproot output.
* @param script
*
* The output script for the outpoint above. This will be used by light clients
* to match block filters. If the outpoint is set to a zero outpoint, then a
* spend notification will be requested for this script instead.
* @param heightHint
*
* The earliest height in the chain for which the outpoint/output script could
* have been spent. This should in most cases be set to the broadcast height of
* the outpoint/output script.
*/
@SerialVersionUID(0L)
final case class SpendRequest(
outpoint: _root_.scala.Option[chainrpc.Outpoint] = _root_.scala.None,
script: _root_.com.google.protobuf.ByteString = _root_.com.google.protobuf.ByteString.EMPTY,
heightHint: _root_.scala.Int = 0,
unknownFields: _root_.scalapb.UnknownFieldSet = _root_.scalapb.UnknownFieldSet.empty
) extends scalapb.GeneratedMessage with scalapb.lenses.Updatable[SpendRequest] {
@transient
private[this] var __serializedSizeMemoized: _root_.scala.Int = 0
private[this] def __computeSerializedSize(): _root_.scala.Int = {
var __size = 0
if (outpoint.isDefined) {
val __value = outpoint.get
__size += 1 + _root_.com.google.protobuf.CodedOutputStream.computeUInt32SizeNoTag(__value.serializedSize) + __value.serializedSize
};
{
val __value = script
if (!__value.isEmpty) {
__size += _root_.com.google.protobuf.CodedOutputStream.computeBytesSize(2, __value)
}
};
{
val __value = heightHint
if (__value != 0) {
__size += _root_.com.google.protobuf.CodedOutputStream.computeUInt32Size(3, __value)
}
};
__size += unknownFields.serializedSize
__size
}
override def serializedSize: _root_.scala.Int = {
var __size = __serializedSizeMemoized
if (__size == 0) {
__size = __computeSerializedSize() + 1
__serializedSizeMemoized = __size
}
__size - 1
}
def writeTo(`_output__`: _root_.com.google.protobuf.CodedOutputStream): _root_.scala.Unit = {
outpoint.foreach { __v =>
val __m = __v
_output__.writeTag(1, 2)
_output__.writeUInt32NoTag(__m.serializedSize)
__m.writeTo(_output__)
};
{
val __v = script
if (!__v.isEmpty) {
_output__.writeBytes(2, __v)
}
};
{
val __v = heightHint
if (__v != 0) {
_output__.writeUInt32(3, __v)
}
};
unknownFields.writeTo(_output__)
}
def getOutpoint: chainrpc.Outpoint = outpoint.getOrElse(chainrpc.Outpoint.defaultInstance)
def clearOutpoint: SpendRequest = copy(outpoint = _root_.scala.None)
def withOutpoint(__v: chainrpc.Outpoint): SpendRequest = copy(outpoint = Option(__v))
def withScript(__v: _root_.com.google.protobuf.ByteString): SpendRequest = copy(script = __v)
def withHeightHint(__v: _root_.scala.Int): SpendRequest = copy(heightHint = __v)
def withUnknownFields(__v: _root_.scalapb.UnknownFieldSet) = copy(unknownFields = __v)
def discardUnknownFields = copy(unknownFields = _root_.scalapb.UnknownFieldSet.empty)
def getFieldByNumber(__fieldNumber: _root_.scala.Int): _root_.scala.Any = {
(__fieldNumber: @_root_.scala.unchecked) match {
case 1 => outpoint.orNull
case 2 => {
val __t = script
if (__t != _root_.com.google.protobuf.ByteString.EMPTY) __t else null
}
case 3 => {
val __t = heightHint
if (__t != 0) __t else null
}
}
}
def getField(__field: _root_.scalapb.descriptors.FieldDescriptor): _root_.scalapb.descriptors.PValue = {
_root_.scala.Predef.require(__field.containingMessage eq companion.scalaDescriptor)
(__field.number: @_root_.scala.unchecked) match {
case 1 => outpoint.map(_.toPMessage).getOrElse(_root_.scalapb.descriptors.PEmpty)
case 2 => _root_.scalapb.descriptors.PByteString(script)
case 3 => _root_.scalapb.descriptors.PInt(heightHint)
}
}
def toProtoString: _root_.scala.Predef.String = _root_.scalapb.TextFormat.printToUnicodeString(this)
def companion: chainrpc.SpendRequest.type = chainrpc.SpendRequest
// @@protoc_insertion_point(GeneratedMessage[chainrpc.SpendRequest])
}
object SpendRequest extends scalapb.GeneratedMessageCompanion[chainrpc.SpendRequest] {
implicit def messageCompanion: scalapb.GeneratedMessageCompanion[chainrpc.SpendRequest] = this
def parseFrom(`_input__`: _root_.com.google.protobuf.CodedInputStream): chainrpc.SpendRequest = {
var __outpoint: _root_.scala.Option[chainrpc.Outpoint] = _root_.scala.None
var __script: _root_.com.google.protobuf.ByteString = _root_.com.google.protobuf.ByteString.EMPTY
var __heightHint: _root_.scala.Int = 0
var `_unknownFields__`: _root_.scalapb.UnknownFieldSet.Builder = null
var _done__ = false
while (!_done__) {
val _tag__ = _input__.readTag()
_tag__ match {
case 0 => _done__ = true
case 10 =>
__outpoint = Option(__outpoint.fold(_root_.scalapb.LiteParser.readMessage[chainrpc.Outpoint](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _)))
case 18 =>
__script = _input__.readBytes()
case 24 =>
__heightHint = _input__.readUInt32()
case tag =>
if (_unknownFields__ == null) {
_unknownFields__ = new _root_.scalapb.UnknownFieldSet.Builder()
}
_unknownFields__.parseField(tag, _input__)
}
}
chainrpc.SpendRequest(
outpoint = __outpoint,
script = __script,
heightHint = __heightHint,
unknownFields = if (_unknownFields__ == null) _root_.scalapb.UnknownFieldSet.empty else _unknownFields__.result()
)
}
implicit def messageReads: _root_.scalapb.descriptors.Reads[chainrpc.SpendRequest] = _root_.scalapb.descriptors.Reads{
case _root_.scalapb.descriptors.PMessage(__fieldsMap) =>
_root_.scala.Predef.require(__fieldsMap.keys.forall(_.containingMessage eq scalaDescriptor), "FieldDescriptor does not match message type.")
chainrpc.SpendRequest(
outpoint = __fieldsMap.get(scalaDescriptor.findFieldByNumber(1).get).flatMap(_.as[_root_.scala.Option[chainrpc.Outpoint]]),
script = __fieldsMap.get(scalaDescriptor.findFieldByNumber(2).get).map(_.as[_root_.com.google.protobuf.ByteString]).getOrElse(_root_.com.google.protobuf.ByteString.EMPTY),
heightHint = __fieldsMap.get(scalaDescriptor.findFieldByNumber(3).get).map(_.as[_root_.scala.Int]).getOrElse(0)
)
case _ => throw new RuntimeException("Expected PMessage")
}
def javaDescriptor: _root_.com.google.protobuf.Descriptors.Descriptor = ChainnotifierProto.javaDescriptor.getMessageTypes().get(5)
def scalaDescriptor: _root_.scalapb.descriptors.Descriptor = ChainnotifierProto.scalaDescriptor.messages(5)
def messageCompanionForFieldNumber(__number: _root_.scala.Int): _root_.scalapb.GeneratedMessageCompanion[_] = {
var __out: _root_.scalapb.GeneratedMessageCompanion[_] = null
(__number: @_root_.scala.unchecked) match {
case 1 => __out = chainrpc.Outpoint
}
__out
}
lazy val nestedMessagesCompanions: Seq[_root_.scalapb.GeneratedMessageCompanion[_ <: _root_.scalapb.GeneratedMessage]] = Seq.empty
def enumCompanionForFieldNumber(__fieldNumber: _root_.scala.Int): _root_.scalapb.GeneratedEnumCompanion[_] = throw new MatchError(__fieldNumber)
lazy val defaultInstance = chainrpc.SpendRequest(
outpoint = _root_.scala.None,
script = _root_.com.google.protobuf.ByteString.EMPTY,
heightHint = 0
)
implicit class SpendRequestLens[UpperPB](_l: _root_.scalapb.lenses.Lens[UpperPB, chainrpc.SpendRequest]) extends _root_.scalapb.lenses.ObjectLens[UpperPB, chainrpc.SpendRequest](_l) {
def outpoint: _root_.scalapb.lenses.Lens[UpperPB, chainrpc.Outpoint] = field(_.getOutpoint)((c_, f_) => c_.copy(outpoint = Option(f_)))
def optionalOutpoint: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Option[chainrpc.Outpoint]] = field(_.outpoint)((c_, f_) => c_.copy(outpoint = f_))
def script: _root_.scalapb.lenses.Lens[UpperPB, _root_.com.google.protobuf.ByteString] = field(_.script)((c_, f_) => c_.copy(script = f_))
def heightHint: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Int] = field(_.heightHint)((c_, f_) => c_.copy(heightHint = f_))
}
final val OUTPOINT_FIELD_NUMBER = 1
final val SCRIPT_FIELD_NUMBER = 2
final val HEIGHT_HINT_FIELD_NUMBER = 3
def of(
outpoint: _root_.scala.Option[chainrpc.Outpoint],
script: _root_.com.google.protobuf.ByteString,
heightHint: _root_.scala.Int
): _root_.chainrpc.SpendRequest = _root_.chainrpc.SpendRequest(
outpoint,
script,
heightHint
)
// @@protoc_insertion_point(GeneratedMessageCompanion[chainrpc.SpendRequest])
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy