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

signrpc.MuSig2CombineKeysRequest.scala Maven / Gradle / Ivy

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

package signrpc

/** @param allSignerPubkeys
  *  
  *  A list of all public keys (serialized in 32-byte x-only format for v0.4.0
  *  and 33-byte compressed format for v1.0.0rc2!) participating in the signing
  *  session. The list will always be sorted lexicographically internally. This
  *  must include the local key which is described by the above key_loc.
  * @param tweaks
  *  
  *  A series of optional generic tweaks to be applied to the the aggregated
  *  public key.
  * @param taprootTweak
  *  
  *  An optional taproot specific tweak that must be specified if the MuSig2
  *  combined key will be used as the main taproot key of a taproot output
  *  on-chain.
  * @param version
  *  
  *  The mandatory version of the MuSig2 BIP draft to use. This is necessary to
  *  differentiate between the changes that were made to the BIP while this
  *  experimental RPC was already released. Some of those changes affect how the
  *  combined key and nonces are created.
  */
@SerialVersionUID(0L)
final case class MuSig2CombineKeysRequest(
    allSignerPubkeys: _root_.scala.Seq[_root_.com.google.protobuf.ByteString] = _root_.scala.Seq.empty,
    tweaks: _root_.scala.Seq[signrpc.TweakDesc] = _root_.scala.Seq.empty,
    taprootTweak: _root_.scala.Option[signrpc.TaprootTweakDesc] = _root_.scala.None,
    version: signrpc.MuSig2Version = signrpc.MuSig2Version.MUSIG2_VERSION_UNDEFINED,
    unknownFields: _root_.scalapb.UnknownFieldSet = _root_.scalapb.UnknownFieldSet.empty
    ) extends scalapb.GeneratedMessage with scalapb.lenses.Updatable[MuSig2CombineKeysRequest] {
    @transient
    private[this] var __serializedSizeMemoized: _root_.scala.Int = 0
    private[this] def __computeSerializedSize(): _root_.scala.Int = {
      var __size = 0
      allSignerPubkeys.foreach { __item =>
        val __value = __item
        __size += _root_.com.google.protobuf.CodedOutputStream.computeBytesSize(1, __value)
      }
      tweaks.foreach { __item =>
        val __value = __item
        __size += 1 + _root_.com.google.protobuf.CodedOutputStream.computeUInt32SizeNoTag(__value.serializedSize) + __value.serializedSize
      }
      if (taprootTweak.isDefined) {
        val __value = taprootTweak.get
        __size += 1 + _root_.com.google.protobuf.CodedOutputStream.computeUInt32SizeNoTag(__value.serializedSize) + __value.serializedSize
      };
      
      {
        val __value = version.value
        if (__value != 0) {
          __size += _root_.com.google.protobuf.CodedOutputStream.computeEnumSize(4, __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 = {
      allSignerPubkeys.foreach { __v =>
        val __m = __v
        _output__.writeBytes(1, __m)
      };
      tweaks.foreach { __v =>
        val __m = __v
        _output__.writeTag(2, 2)
        _output__.writeUInt32NoTag(__m.serializedSize)
        __m.writeTo(_output__)
      };
      taprootTweak.foreach { __v =>
        val __m = __v
        _output__.writeTag(3, 2)
        _output__.writeUInt32NoTag(__m.serializedSize)
        __m.writeTo(_output__)
      };
      {
        val __v = version.value
        if (__v != 0) {
          _output__.writeEnum(4, __v)
        }
      };
      unknownFields.writeTo(_output__)
    }
    def clearAllSignerPubkeys = copy(allSignerPubkeys = _root_.scala.Seq.empty)
    def addAllSignerPubkeys(__vs: _root_.com.google.protobuf.ByteString *): MuSig2CombineKeysRequest = addAllAllSignerPubkeys(__vs)
    def addAllAllSignerPubkeys(__vs: Iterable[_root_.com.google.protobuf.ByteString]): MuSig2CombineKeysRequest = copy(allSignerPubkeys = allSignerPubkeys ++ __vs)
    def withAllSignerPubkeys(__v: _root_.scala.Seq[_root_.com.google.protobuf.ByteString]): MuSig2CombineKeysRequest = copy(allSignerPubkeys = __v)
    def clearTweaks = copy(tweaks = _root_.scala.Seq.empty)
    def addTweaks(__vs: signrpc.TweakDesc *): MuSig2CombineKeysRequest = addAllTweaks(__vs)
    def addAllTweaks(__vs: Iterable[signrpc.TweakDesc]): MuSig2CombineKeysRequest = copy(tweaks = tweaks ++ __vs)
    def withTweaks(__v: _root_.scala.Seq[signrpc.TweakDesc]): MuSig2CombineKeysRequest = copy(tweaks = __v)
    def getTaprootTweak: signrpc.TaprootTweakDesc = taprootTweak.getOrElse(signrpc.TaprootTweakDesc.defaultInstance)
    def clearTaprootTweak: MuSig2CombineKeysRequest = copy(taprootTweak = _root_.scala.None)
    def withTaprootTweak(__v: signrpc.TaprootTweakDesc): MuSig2CombineKeysRequest = copy(taprootTweak = Option(__v))
    def withVersion(__v: signrpc.MuSig2Version): MuSig2CombineKeysRequest = copy(version = __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 => allSignerPubkeys
        case 2 => tweaks
        case 3 => taprootTweak.orNull
        case 4 => {
          val __t = version.javaValueDescriptor
          if (__t.getNumber() != 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 => _root_.scalapb.descriptors.PRepeated(allSignerPubkeys.iterator.map(_root_.scalapb.descriptors.PByteString(_)).toVector)
        case 2 => _root_.scalapb.descriptors.PRepeated(tweaks.iterator.map(_.toPMessage).toVector)
        case 3 => taprootTweak.map(_.toPMessage).getOrElse(_root_.scalapb.descriptors.PEmpty)
        case 4 => _root_.scalapb.descriptors.PEnum(version.scalaValueDescriptor)
      }
    }
    def toProtoString: _root_.scala.Predef.String = _root_.scalapb.TextFormat.printToUnicodeString(this)
    def companion: signrpc.MuSig2CombineKeysRequest.type = signrpc.MuSig2CombineKeysRequest
    // @@protoc_insertion_point(GeneratedMessage[signrpc.MuSig2CombineKeysRequest])
}

object MuSig2CombineKeysRequest extends scalapb.GeneratedMessageCompanion[signrpc.MuSig2CombineKeysRequest] {
  implicit def messageCompanion: scalapb.GeneratedMessageCompanion[signrpc.MuSig2CombineKeysRequest] = this
  def parseFrom(`_input__`: _root_.com.google.protobuf.CodedInputStream): signrpc.MuSig2CombineKeysRequest = {
    val __allSignerPubkeys: _root_.scala.collection.immutable.VectorBuilder[_root_.com.google.protobuf.ByteString] = new _root_.scala.collection.immutable.VectorBuilder[_root_.com.google.protobuf.ByteString]
    val __tweaks: _root_.scala.collection.immutable.VectorBuilder[signrpc.TweakDesc] = new _root_.scala.collection.immutable.VectorBuilder[signrpc.TweakDesc]
    var __taprootTweak: _root_.scala.Option[signrpc.TaprootTweakDesc] = _root_.scala.None
    var __version: signrpc.MuSig2Version = signrpc.MuSig2Version.MUSIG2_VERSION_UNDEFINED
    var `_unknownFields__`: _root_.scalapb.UnknownFieldSet.Builder = null
    var _done__ = false
    while (!_done__) {
      val _tag__ = _input__.readTag()
      _tag__ match {
        case 0 => _done__ = true
        case 10 =>
          __allSignerPubkeys += _input__.readBytes()
        case 18 =>
          __tweaks += _root_.scalapb.LiteParser.readMessage[signrpc.TweakDesc](_input__)
        case 26 =>
          __taprootTweak = Option(__taprootTweak.fold(_root_.scalapb.LiteParser.readMessage[signrpc.TaprootTweakDesc](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _)))
        case 32 =>
          __version = signrpc.MuSig2Version.fromValue(_input__.readEnum())
        case tag =>
          if (_unknownFields__ == null) {
            _unknownFields__ = new _root_.scalapb.UnknownFieldSet.Builder()
          }
          _unknownFields__.parseField(tag, _input__)
      }
    }
    signrpc.MuSig2CombineKeysRequest(
        allSignerPubkeys = __allSignerPubkeys.result(),
        tweaks = __tweaks.result(),
        taprootTweak = __taprootTweak,
        version = __version,
        unknownFields = if (_unknownFields__ == null) _root_.scalapb.UnknownFieldSet.empty else _unknownFields__.result()
    )
  }
  implicit def messageReads: _root_.scalapb.descriptors.Reads[signrpc.MuSig2CombineKeysRequest] = _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.")
      signrpc.MuSig2CombineKeysRequest(
        allSignerPubkeys = __fieldsMap.get(scalaDescriptor.findFieldByNumber(1).get).map(_.as[_root_.scala.Seq[_root_.com.google.protobuf.ByteString]]).getOrElse(_root_.scala.Seq.empty),
        tweaks = __fieldsMap.get(scalaDescriptor.findFieldByNumber(2).get).map(_.as[_root_.scala.Seq[signrpc.TweakDesc]]).getOrElse(_root_.scala.Seq.empty),
        taprootTweak = __fieldsMap.get(scalaDescriptor.findFieldByNumber(3).get).flatMap(_.as[_root_.scala.Option[signrpc.TaprootTweakDesc]]),
        version = signrpc.MuSig2Version.fromValue(__fieldsMap.get(scalaDescriptor.findFieldByNumber(4).get).map(_.as[_root_.scalapb.descriptors.EnumValueDescriptor]).getOrElse(signrpc.MuSig2Version.MUSIG2_VERSION_UNDEFINED.scalaValueDescriptor).number)
      )
    case _ => throw new RuntimeException("Expected PMessage")
  }
  def javaDescriptor: _root_.com.google.protobuf.Descriptors.Descriptor = SignerProto.javaDescriptor.getMessageTypes().get(16)
  def scalaDescriptor: _root_.scalapb.descriptors.Descriptor = SignerProto.scalaDescriptor.messages(16)
  def messageCompanionForFieldNumber(__number: _root_.scala.Int): _root_.scalapb.GeneratedMessageCompanion[_] = {
    var __out: _root_.scalapb.GeneratedMessageCompanion[_] = null
    (__number: @_root_.scala.unchecked) match {
      case 2 => __out = signrpc.TweakDesc
      case 3 => __out = signrpc.TaprootTweakDesc
    }
    __out
  }
  lazy val nestedMessagesCompanions: Seq[_root_.scalapb.GeneratedMessageCompanion[_ <: _root_.scalapb.GeneratedMessage]] = Seq.empty
  def enumCompanionForFieldNumber(__fieldNumber: _root_.scala.Int): _root_.scalapb.GeneratedEnumCompanion[_] = {
    (__fieldNumber: @_root_.scala.unchecked) match {
      case 4 => signrpc.MuSig2Version
    }
  }
  lazy val defaultInstance = signrpc.MuSig2CombineKeysRequest(
    allSignerPubkeys = _root_.scala.Seq.empty,
    tweaks = _root_.scala.Seq.empty,
    taprootTweak = _root_.scala.None,
    version = signrpc.MuSig2Version.MUSIG2_VERSION_UNDEFINED
  )
  implicit class MuSig2CombineKeysRequestLens[UpperPB](_l: _root_.scalapb.lenses.Lens[UpperPB, signrpc.MuSig2CombineKeysRequest]) extends _root_.scalapb.lenses.ObjectLens[UpperPB, signrpc.MuSig2CombineKeysRequest](_l) {
    def allSignerPubkeys: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Seq[_root_.com.google.protobuf.ByteString]] = field(_.allSignerPubkeys)((c_, f_) => c_.copy(allSignerPubkeys = f_))
    def tweaks: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Seq[signrpc.TweakDesc]] = field(_.tweaks)((c_, f_) => c_.copy(tweaks = f_))
    def taprootTweak: _root_.scalapb.lenses.Lens[UpperPB, signrpc.TaprootTweakDesc] = field(_.getTaprootTweak)((c_, f_) => c_.copy(taprootTweak = Option(f_)))
    def optionalTaprootTweak: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Option[signrpc.TaprootTweakDesc]] = field(_.taprootTweak)((c_, f_) => c_.copy(taprootTweak = f_))
    def version: _root_.scalapb.lenses.Lens[UpperPB, signrpc.MuSig2Version] = field(_.version)((c_, f_) => c_.copy(version = f_))
  }
  final val ALL_SIGNER_PUBKEYS_FIELD_NUMBER = 1
  final val TWEAKS_FIELD_NUMBER = 2
  final val TAPROOT_TWEAK_FIELD_NUMBER = 3
  final val VERSION_FIELD_NUMBER = 4
  def of(
    allSignerPubkeys: _root_.scala.Seq[_root_.com.google.protobuf.ByteString],
    tweaks: _root_.scala.Seq[signrpc.TweakDesc],
    taprootTweak: _root_.scala.Option[signrpc.TaprootTweakDesc],
    version: signrpc.MuSig2Version
  ): _root_.signrpc.MuSig2CombineKeysRequest = _root_.signrpc.MuSig2CombineKeysRequest(
    allSignerPubkeys,
    tweaks,
    taprootTweak,
    version
  )
  // @@protoc_insertion_point(GeneratedMessageCompanion[signrpc.MuSig2CombineKeysRequest])
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy