All Downloads are FREE. Search and download functionalities are using the official Maven repository.

walletrpc.ImportTapscriptRequest.scala Maven / Gradle / Ivy

The newest version!
// Generated by the Scala Plugin for the Protocol Buffer Compiler.
// Do not edit!
//
// Protofile syntax: PROTO3

package walletrpc

/** @param internalPublicKey
  *  
  *  The internal public key, serialized as 32-byte x-only public key.
  */
@SerialVersionUID(0L)
final case class ImportTapscriptRequest(
    internalPublicKey: _root_.com.google.protobuf.ByteString = _root_.com.google.protobuf.ByteString.EMPTY,
    script: walletrpc.ImportTapscriptRequest.Script = walletrpc.ImportTapscriptRequest.Script.Empty,
    unknownFields: _root_.scalapb.UnknownFieldSet = _root_.scalapb.UnknownFieldSet.empty
    ) extends scalapb.GeneratedMessage with scalapb.lenses.Updatable[ImportTapscriptRequest] {
    @transient
    private[this] var __serializedSizeMemoized: _root_.scala.Int = 0
    private[this] def __computeSerializedSize(): _root_.scala.Int = {
      var __size = 0
      
      {
        val __value = internalPublicKey
        if (!__value.isEmpty) {
          __size += _root_.com.google.protobuf.CodedOutputStream.computeBytesSize(1, __value)
        }
      };
      if (script.fullTree.isDefined) {
        val __value = script.fullTree.get
        __size += 1 + _root_.com.google.protobuf.CodedOutputStream.computeUInt32SizeNoTag(__value.serializedSize) + __value.serializedSize
      };
      if (script.partialReveal.isDefined) {
        val __value = script.partialReveal.get
        __size += 1 + _root_.com.google.protobuf.CodedOutputStream.computeUInt32SizeNoTag(__value.serializedSize) + __value.serializedSize
      };
      if (script.rootHashOnly.isDefined) {
        val __value = script.rootHashOnly.get
        __size += _root_.com.google.protobuf.CodedOutputStream.computeBytesSize(4, __value)
      };
      if (script.fullKeyOnly.isDefined) {
        val __value = script.fullKeyOnly.get
        __size += _root_.com.google.protobuf.CodedOutputStream.computeBoolSize(5, __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 = {
      {
        val __v = internalPublicKey
        if (!__v.isEmpty) {
          _output__.writeBytes(1, __v)
        }
      };
      script.fullTree.foreach { __v =>
        val __m = __v
        _output__.writeTag(2, 2)
        _output__.writeUInt32NoTag(__m.serializedSize)
        __m.writeTo(_output__)
      };
      script.partialReveal.foreach { __v =>
        val __m = __v
        _output__.writeTag(3, 2)
        _output__.writeUInt32NoTag(__m.serializedSize)
        __m.writeTo(_output__)
      };
      script.rootHashOnly.foreach { __v =>
        val __m = __v
        _output__.writeBytes(4, __m)
      };
      script.fullKeyOnly.foreach { __v =>
        val __m = __v
        _output__.writeBool(5, __m)
      };
      unknownFields.writeTo(_output__)
    }
    def withInternalPublicKey(__v: _root_.com.google.protobuf.ByteString): ImportTapscriptRequest = copy(internalPublicKey = __v)
    def getFullTree: walletrpc.TapscriptFullTree = script.fullTree.getOrElse(walletrpc.TapscriptFullTree.defaultInstance)
    def withFullTree(__v: walletrpc.TapscriptFullTree): ImportTapscriptRequest = copy(script = walletrpc.ImportTapscriptRequest.Script.FullTree(__v))
    def getPartialReveal: walletrpc.TapscriptPartialReveal = script.partialReveal.getOrElse(walletrpc.TapscriptPartialReveal.defaultInstance)
    def withPartialReveal(__v: walletrpc.TapscriptPartialReveal): ImportTapscriptRequest = copy(script = walletrpc.ImportTapscriptRequest.Script.PartialReveal(__v))
    def getRootHashOnly: _root_.com.google.protobuf.ByteString = script.rootHashOnly.getOrElse(_root_.com.google.protobuf.ByteString.EMPTY)
    def withRootHashOnly(__v: _root_.com.google.protobuf.ByteString): ImportTapscriptRequest = copy(script = walletrpc.ImportTapscriptRequest.Script.RootHashOnly(__v))
    def getFullKeyOnly: _root_.scala.Boolean = script.fullKeyOnly.getOrElse(false)
    def withFullKeyOnly(__v: _root_.scala.Boolean): ImportTapscriptRequest = copy(script = walletrpc.ImportTapscriptRequest.Script.FullKeyOnly(__v))
    def clearScript: ImportTapscriptRequest = copy(script = walletrpc.ImportTapscriptRequest.Script.Empty)
    def withScript(__v: walletrpc.ImportTapscriptRequest.Script): ImportTapscriptRequest = copy(script = __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 => {
          val __t = internalPublicKey
          if (__t != _root_.com.google.protobuf.ByteString.EMPTY) __t else null
        }
        case 2 => script.fullTree.orNull
        case 3 => script.partialReveal.orNull
        case 4 => script.rootHashOnly.orNull
        case 5 => script.fullKeyOnly.orNull
      }
    }
    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 => _root_.scalapb.descriptors.PByteString(internalPublicKey)
        case 2 => script.fullTree.map(_.toPMessage).getOrElse(_root_.scalapb.descriptors.PEmpty)
        case 3 => script.partialReveal.map(_.toPMessage).getOrElse(_root_.scalapb.descriptors.PEmpty)
        case 4 => script.rootHashOnly.map(_root_.scalapb.descriptors.PByteString(_)).getOrElse(_root_.scalapb.descriptors.PEmpty)
        case 5 => script.fullKeyOnly.map(_root_.scalapb.descriptors.PBoolean(_)).getOrElse(_root_.scalapb.descriptors.PEmpty)
      }
    }
    def toProtoString: _root_.scala.Predef.String = _root_.scalapb.TextFormat.printToUnicodeString(this)
    def companion: walletrpc.ImportTapscriptRequest.type = walletrpc.ImportTapscriptRequest
    // @@protoc_insertion_point(GeneratedMessage[walletrpc.ImportTapscriptRequest])
}

object ImportTapscriptRequest extends scalapb.GeneratedMessageCompanion[walletrpc.ImportTapscriptRequest] {
  implicit def messageCompanion: scalapb.GeneratedMessageCompanion[walletrpc.ImportTapscriptRequest] = this
  def parseFrom(`_input__`: _root_.com.google.protobuf.CodedInputStream): walletrpc.ImportTapscriptRequest = {
    var __internalPublicKey: _root_.com.google.protobuf.ByteString = _root_.com.google.protobuf.ByteString.EMPTY
    var __script: walletrpc.ImportTapscriptRequest.Script = walletrpc.ImportTapscriptRequest.Script.Empty
    var `_unknownFields__`: _root_.scalapb.UnknownFieldSet.Builder = null
    var _done__ = false
    while (!_done__) {
      val _tag__ = _input__.readTag()
      _tag__ match {
        case 0 => _done__ = true
        case 10 =>
          __internalPublicKey = _input__.readBytes()
        case 18 =>
          __script = walletrpc.ImportTapscriptRequest.Script.FullTree(__script.fullTree.fold(_root_.scalapb.LiteParser.readMessage[walletrpc.TapscriptFullTree](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _)))
        case 26 =>
          __script = walletrpc.ImportTapscriptRequest.Script.PartialReveal(__script.partialReveal.fold(_root_.scalapb.LiteParser.readMessage[walletrpc.TapscriptPartialReveal](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _)))
        case 34 =>
          __script = walletrpc.ImportTapscriptRequest.Script.RootHashOnly(_input__.readBytes())
        case 40 =>
          __script = walletrpc.ImportTapscriptRequest.Script.FullKeyOnly(_input__.readBool())
        case tag =>
          if (_unknownFields__ == null) {
            _unknownFields__ = new _root_.scalapb.UnknownFieldSet.Builder()
          }
          _unknownFields__.parseField(tag, _input__)
      }
    }
    walletrpc.ImportTapscriptRequest(
        internalPublicKey = __internalPublicKey,
        script = __script,
        unknownFields = if (_unknownFields__ == null) _root_.scalapb.UnknownFieldSet.empty else _unknownFields__.result()
    )
  }
  implicit def messageReads: _root_.scalapb.descriptors.Reads[walletrpc.ImportTapscriptRequest] = _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.")
      walletrpc.ImportTapscriptRequest(
        internalPublicKey = __fieldsMap.get(scalaDescriptor.findFieldByNumber(1).get).map(_.as[_root_.com.google.protobuf.ByteString]).getOrElse(_root_.com.google.protobuf.ByteString.EMPTY),
        script = __fieldsMap.get(scalaDescriptor.findFieldByNumber(2).get).flatMap(_.as[_root_.scala.Option[walletrpc.TapscriptFullTree]]).map(walletrpc.ImportTapscriptRequest.Script.FullTree(_))
            .orElse[walletrpc.ImportTapscriptRequest.Script](__fieldsMap.get(scalaDescriptor.findFieldByNumber(3).get).flatMap(_.as[_root_.scala.Option[walletrpc.TapscriptPartialReveal]]).map(walletrpc.ImportTapscriptRequest.Script.PartialReveal(_)))
            .orElse[walletrpc.ImportTapscriptRequest.Script](__fieldsMap.get(scalaDescriptor.findFieldByNumber(4).get).flatMap(_.as[_root_.scala.Option[_root_.com.google.protobuf.ByteString]]).map(walletrpc.ImportTapscriptRequest.Script.RootHashOnly(_)))
            .orElse[walletrpc.ImportTapscriptRequest.Script](__fieldsMap.get(scalaDescriptor.findFieldByNumber(5).get).flatMap(_.as[_root_.scala.Option[_root_.scala.Boolean]]).map(walletrpc.ImportTapscriptRequest.Script.FullKeyOnly(_)))
            .getOrElse(walletrpc.ImportTapscriptRequest.Script.Empty)
      )
    case _ => throw new RuntimeException("Expected PMessage")
  }
  def javaDescriptor: _root_.com.google.protobuf.Descriptors.Descriptor = WalletkitProto.javaDescriptor.getMessageTypes().get(26)
  def scalaDescriptor: _root_.scalapb.descriptors.Descriptor = WalletkitProto.scalaDescriptor.messages(26)
  def messageCompanionForFieldNumber(__number: _root_.scala.Int): _root_.scalapb.GeneratedMessageCompanion[_] = {
    var __out: _root_.scalapb.GeneratedMessageCompanion[_] = null
    (__number: @_root_.scala.unchecked) match {
      case 2 => __out = walletrpc.TapscriptFullTree
      case 3 => __out = walletrpc.TapscriptPartialReveal
    }
    __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 = walletrpc.ImportTapscriptRequest(
    internalPublicKey = _root_.com.google.protobuf.ByteString.EMPTY,
    script = walletrpc.ImportTapscriptRequest.Script.Empty
  )
  sealed trait Script extends _root_.scalapb.GeneratedOneof {
    def isEmpty: _root_.scala.Boolean = false
    def isDefined: _root_.scala.Boolean = true
    def isFullTree: _root_.scala.Boolean = false
    def isPartialReveal: _root_.scala.Boolean = false
    def isRootHashOnly: _root_.scala.Boolean = false
    def isFullKeyOnly: _root_.scala.Boolean = false
    def fullTree: _root_.scala.Option[walletrpc.TapscriptFullTree] = _root_.scala.None
    def partialReveal: _root_.scala.Option[walletrpc.TapscriptPartialReveal] = _root_.scala.None
    def rootHashOnly: _root_.scala.Option[_root_.com.google.protobuf.ByteString] = _root_.scala.None
    def fullKeyOnly: _root_.scala.Option[_root_.scala.Boolean] = _root_.scala.None
  }
  object Script {
    @SerialVersionUID(0L)
    case object Empty extends walletrpc.ImportTapscriptRequest.Script {
      type ValueType = _root_.scala.Nothing
      override def isEmpty: _root_.scala.Boolean = true
      override def isDefined: _root_.scala.Boolean = false
      override def number: _root_.scala.Int = 0
      override def value: _root_.scala.Nothing = throw new java.util.NoSuchElementException("Empty.value")
    }
  
    @SerialVersionUID(0L)
    final case class FullTree(value: walletrpc.TapscriptFullTree) extends walletrpc.ImportTapscriptRequest.Script {
      type ValueType = walletrpc.TapscriptFullTree
      override def isFullTree: _root_.scala.Boolean = true
      override def fullTree: _root_.scala.Option[walletrpc.TapscriptFullTree] = Some(value)
      override def number: _root_.scala.Int = 2
    }
    @SerialVersionUID(0L)
    final case class PartialReveal(value: walletrpc.TapscriptPartialReveal) extends walletrpc.ImportTapscriptRequest.Script {
      type ValueType = walletrpc.TapscriptPartialReveal
      override def isPartialReveal: _root_.scala.Boolean = true
      override def partialReveal: _root_.scala.Option[walletrpc.TapscriptPartialReveal] = Some(value)
      override def number: _root_.scala.Int = 3
    }
    @SerialVersionUID(0L)
    final case class RootHashOnly(value: _root_.com.google.protobuf.ByteString) extends walletrpc.ImportTapscriptRequest.Script {
      type ValueType = _root_.com.google.protobuf.ByteString
      override def isRootHashOnly: _root_.scala.Boolean = true
      override def rootHashOnly: _root_.scala.Option[_root_.com.google.protobuf.ByteString] = Some(value)
      override def number: _root_.scala.Int = 4
    }
    @SerialVersionUID(0L)
    final case class FullKeyOnly(value: _root_.scala.Boolean) extends walletrpc.ImportTapscriptRequest.Script {
      type ValueType = _root_.scala.Boolean
      override def isFullKeyOnly: _root_.scala.Boolean = true
      override def fullKeyOnly: _root_.scala.Option[_root_.scala.Boolean] = Some(value)
      override def number: _root_.scala.Int = 5
    }
  }
  implicit class ImportTapscriptRequestLens[UpperPB](_l: _root_.scalapb.lenses.Lens[UpperPB, walletrpc.ImportTapscriptRequest]) extends _root_.scalapb.lenses.ObjectLens[UpperPB, walletrpc.ImportTapscriptRequest](_l) {
    def internalPublicKey: _root_.scalapb.lenses.Lens[UpperPB, _root_.com.google.protobuf.ByteString] = field(_.internalPublicKey)((c_, f_) => c_.copy(internalPublicKey = f_))
    def fullTree: _root_.scalapb.lenses.Lens[UpperPB, walletrpc.TapscriptFullTree] = field(_.getFullTree)((c_, f_) => c_.copy(script = walletrpc.ImportTapscriptRequest.Script.FullTree(f_)))
    def partialReveal: _root_.scalapb.lenses.Lens[UpperPB, walletrpc.TapscriptPartialReveal] = field(_.getPartialReveal)((c_, f_) => c_.copy(script = walletrpc.ImportTapscriptRequest.Script.PartialReveal(f_)))
    def rootHashOnly: _root_.scalapb.lenses.Lens[UpperPB, _root_.com.google.protobuf.ByteString] = field(_.getRootHashOnly)((c_, f_) => c_.copy(script = walletrpc.ImportTapscriptRequest.Script.RootHashOnly(f_)))
    def fullKeyOnly: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Boolean] = field(_.getFullKeyOnly)((c_, f_) => c_.copy(script = walletrpc.ImportTapscriptRequest.Script.FullKeyOnly(f_)))
    def script: _root_.scalapb.lenses.Lens[UpperPB, walletrpc.ImportTapscriptRequest.Script] = field(_.script)((c_, f_) => c_.copy(script = f_))
  }
  final val INTERNAL_PUBLIC_KEY_FIELD_NUMBER = 1
  final val FULL_TREE_FIELD_NUMBER = 2
  final val PARTIAL_REVEAL_FIELD_NUMBER = 3
  final val ROOT_HASH_ONLY_FIELD_NUMBER = 4
  final val FULL_KEY_ONLY_FIELD_NUMBER = 5
  def of(
    internalPublicKey: _root_.com.google.protobuf.ByteString,
    script: walletrpc.ImportTapscriptRequest.Script
  ): _root_.walletrpc.ImportTapscriptRequest = _root_.walletrpc.ImportTapscriptRequest(
    internalPublicKey,
    script
  )
  // @@protoc_insertion_point(GeneratedMessageCompanion[walletrpc.ImportTapscriptRequest])
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy