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

lnrpc.ChanPointShim.scala Maven / Gradle / Ivy

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

package lnrpc
import org.bitcoins.lnd.rpc.LndUtils._

/** @param amt
  *  
  *  The size of the pre-crafted output to be used as the channel point for this
  *  channel funding.
  * @param chanPoint
  *   The target channel point to refrence in created commitment transactions.
  * @param localKey
  *   Our local key to use when creating the multi-sig output.
  * @param remoteKey
  *   The key of the remote party to use when creating the multi-sig output.
  * @param pendingChanId
  *  
  *  If non-zero, then this will be used as the pending channel ID on the wire
  *  protocol to initate the funding request. This is an optional field, and
  *  should only be set if the responder is already expecting a specific pending
  *  channel ID.
  * @param thawHeight
  *  
  *  This uint32 indicates if this channel is to be considered 'frozen'. A frozen
  *  channel does not allow a cooperative channel close by the initiator. The
  *  thaw_height is the height that this restriction stops applying to the
  *  channel. The height can be interpreted in two ways: as a relative height if
  *  the value is less than 500,000, or as an absolute height otherwise.
  * @param musig2
  *  
  *  Indicates that the funding output is using a MuSig2 multi-sig output.
  */
@SerialVersionUID(0L)
final case class ChanPointShim(
    amt: _root_.scala.Long = 0L,
    chanPoint: _root_.scala.Option[lnrpc.ChannelPoint] = _root_.scala.None,
    localKey: _root_.scala.Option[lnrpc.KeyDescriptor] = _root_.scala.None,
    remoteKey: _root_.com.google.protobuf.ByteString = _root_.com.google.protobuf.ByteString.EMPTY,
    pendingChanId: _root_.com.google.protobuf.ByteString = _root_.com.google.protobuf.ByteString.EMPTY,
    thawHeight: org.bitcoins.core.number.UInt32 = lnrpc.ChanPointShim._typemapper_thawHeight.toCustom(0),
    musig2: _root_.scala.Boolean = false,
    unknownFields: _root_.scalapb.UnknownFieldSet = _root_.scalapb.UnknownFieldSet.empty
    ) extends scalapb.GeneratedMessage with scalapb.lenses.Updatable[ChanPointShim] {
    @transient
    private[this] var __serializedSizeMemoized: _root_.scala.Int = 0
    private[this] def __computeSerializedSize(): _root_.scala.Int = {
      var __size = 0
      
      {
        val __value = amt
        if (__value != 0L) {
          __size += _root_.com.google.protobuf.CodedOutputStream.computeInt64Size(1, __value)
        }
      };
      if (chanPoint.isDefined) {
        val __value = chanPoint.get
        __size += 1 + _root_.com.google.protobuf.CodedOutputStream.computeUInt32SizeNoTag(__value.serializedSize) + __value.serializedSize
      };
      if (localKey.isDefined) {
        val __value = localKey.get
        __size += 1 + _root_.com.google.protobuf.CodedOutputStream.computeUInt32SizeNoTag(__value.serializedSize) + __value.serializedSize
      };
      
      {
        val __value = remoteKey
        if (!__value.isEmpty) {
          __size += _root_.com.google.protobuf.CodedOutputStream.computeBytesSize(4, __value)
        }
      };
      
      {
        val __value = pendingChanId
        if (!__value.isEmpty) {
          __size += _root_.com.google.protobuf.CodedOutputStream.computeBytesSize(5, __value)
        }
      };
      
      {
        val __value = lnrpc.ChanPointShim._typemapper_thawHeight.toBase(thawHeight)
        if (__value != 0) {
          __size += _root_.com.google.protobuf.CodedOutputStream.computeUInt32Size(6, __value)
        }
      };
      
      {
        val __value = musig2
        if (__value != false) {
          __size += _root_.com.google.protobuf.CodedOutputStream.computeBoolSize(7, __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 = amt
        if (__v != 0L) {
          _output__.writeInt64(1, __v)
        }
      };
      chanPoint.foreach { __v =>
        val __m = __v
        _output__.writeTag(2, 2)
        _output__.writeUInt32NoTag(__m.serializedSize)
        __m.writeTo(_output__)
      };
      localKey.foreach { __v =>
        val __m = __v
        _output__.writeTag(3, 2)
        _output__.writeUInt32NoTag(__m.serializedSize)
        __m.writeTo(_output__)
      };
      {
        val __v = remoteKey
        if (!__v.isEmpty) {
          _output__.writeBytes(4, __v)
        }
      };
      {
        val __v = pendingChanId
        if (!__v.isEmpty) {
          _output__.writeBytes(5, __v)
        }
      };
      {
        val __v = lnrpc.ChanPointShim._typemapper_thawHeight.toBase(thawHeight)
        if (__v != 0) {
          _output__.writeUInt32(6, __v)
        }
      };
      {
        val __v = musig2
        if (__v != false) {
          _output__.writeBool(7, __v)
        }
      };
      unknownFields.writeTo(_output__)
    }
    def withAmt(__v: _root_.scala.Long): ChanPointShim = copy(amt = __v)
    def getChanPoint: lnrpc.ChannelPoint = chanPoint.getOrElse(lnrpc.ChannelPoint.defaultInstance)
    def clearChanPoint: ChanPointShim = copy(chanPoint = _root_.scala.None)
    def withChanPoint(__v: lnrpc.ChannelPoint): ChanPointShim = copy(chanPoint = Option(__v))
    def getLocalKey: lnrpc.KeyDescriptor = localKey.getOrElse(lnrpc.KeyDescriptor.defaultInstance)
    def clearLocalKey: ChanPointShim = copy(localKey = _root_.scala.None)
    def withLocalKey(__v: lnrpc.KeyDescriptor): ChanPointShim = copy(localKey = Option(__v))
    def withRemoteKey(__v: _root_.com.google.protobuf.ByteString): ChanPointShim = copy(remoteKey = __v)
    def withPendingChanId(__v: _root_.com.google.protobuf.ByteString): ChanPointShim = copy(pendingChanId = __v)
    def withThawHeight(__v: org.bitcoins.core.number.UInt32): ChanPointShim = copy(thawHeight = __v)
    def withMusig2(__v: _root_.scala.Boolean): ChanPointShim = copy(musig2 = __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 = amt
          if (__t != 0L) __t else null
        }
        case 2 => chanPoint.orNull
        case 3 => localKey.orNull
        case 4 => {
          val __t = remoteKey
          if (__t != _root_.com.google.protobuf.ByteString.EMPTY) __t else null
        }
        case 5 => {
          val __t = pendingChanId
          if (__t != _root_.com.google.protobuf.ByteString.EMPTY) __t else null
        }
        case 6 => {
          val __t = lnrpc.ChanPointShim._typemapper_thawHeight.toBase(thawHeight)
          if (__t != 0) __t else null
        }
        case 7 => {
          val __t = musig2
          if (__t != false) __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.PLong(amt)
        case 2 => chanPoint.map(_.toPMessage).getOrElse(_root_.scalapb.descriptors.PEmpty)
        case 3 => localKey.map(_.toPMessage).getOrElse(_root_.scalapb.descriptors.PEmpty)
        case 4 => _root_.scalapb.descriptors.PByteString(remoteKey)
        case 5 => _root_.scalapb.descriptors.PByteString(pendingChanId)
        case 6 => _root_.scalapb.descriptors.PInt(lnrpc.ChanPointShim._typemapper_thawHeight.toBase(thawHeight))
        case 7 => _root_.scalapb.descriptors.PBoolean(musig2)
      }
    }
    def toProtoString: _root_.scala.Predef.String = _root_.scalapb.TextFormat.printToUnicodeString(this)
    def companion: lnrpc.ChanPointShim.type = lnrpc.ChanPointShim
    // @@protoc_insertion_point(GeneratedMessage[lnrpc.ChanPointShim])
}

object ChanPointShim extends scalapb.GeneratedMessageCompanion[lnrpc.ChanPointShim] {
  implicit def messageCompanion: scalapb.GeneratedMessageCompanion[lnrpc.ChanPointShim] = this
  def parseFrom(`_input__`: _root_.com.google.protobuf.CodedInputStream): lnrpc.ChanPointShim = {
    var __amt: _root_.scala.Long = 0L
    var __chanPoint: _root_.scala.Option[lnrpc.ChannelPoint] = _root_.scala.None
    var __localKey: _root_.scala.Option[lnrpc.KeyDescriptor] = _root_.scala.None
    var __remoteKey: _root_.com.google.protobuf.ByteString = _root_.com.google.protobuf.ByteString.EMPTY
    var __pendingChanId: _root_.com.google.protobuf.ByteString = _root_.com.google.protobuf.ByteString.EMPTY
    var __thawHeight: _root_.scala.Int = 0
    var __musig2: _root_.scala.Boolean = false
    var `_unknownFields__`: _root_.scalapb.UnknownFieldSet.Builder = null
    var _done__ = false
    while (!_done__) {
      val _tag__ = _input__.readTag()
      _tag__ match {
        case 0 => _done__ = true
        case 8 =>
          __amt = _input__.readInt64()
        case 18 =>
          __chanPoint = Option(__chanPoint.fold(_root_.scalapb.LiteParser.readMessage[lnrpc.ChannelPoint](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _)))
        case 26 =>
          __localKey = Option(__localKey.fold(_root_.scalapb.LiteParser.readMessage[lnrpc.KeyDescriptor](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _)))
        case 34 =>
          __remoteKey = _input__.readBytes()
        case 42 =>
          __pendingChanId = _input__.readBytes()
        case 48 =>
          __thawHeight = _input__.readUInt32()
        case 56 =>
          __musig2 = _input__.readBool()
        case tag =>
          if (_unknownFields__ == null) {
            _unknownFields__ = new _root_.scalapb.UnknownFieldSet.Builder()
          }
          _unknownFields__.parseField(tag, _input__)
      }
    }
    lnrpc.ChanPointShim(
        amt = __amt,
        chanPoint = __chanPoint,
        localKey = __localKey,
        remoteKey = __remoteKey,
        pendingChanId = __pendingChanId,
        thawHeight = lnrpc.ChanPointShim._typemapper_thawHeight.toCustom(__thawHeight),
        musig2 = __musig2,
        unknownFields = if (_unknownFields__ == null) _root_.scalapb.UnknownFieldSet.empty else _unknownFields__.result()
    )
  }
  implicit def messageReads: _root_.scalapb.descriptors.Reads[lnrpc.ChanPointShim] = _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.")
      lnrpc.ChanPointShim(
        amt = __fieldsMap.get(scalaDescriptor.findFieldByNumber(1).get).map(_.as[_root_.scala.Long]).getOrElse(0L),
        chanPoint = __fieldsMap.get(scalaDescriptor.findFieldByNumber(2).get).flatMap(_.as[_root_.scala.Option[lnrpc.ChannelPoint]]),
        localKey = __fieldsMap.get(scalaDescriptor.findFieldByNumber(3).get).flatMap(_.as[_root_.scala.Option[lnrpc.KeyDescriptor]]),
        remoteKey = __fieldsMap.get(scalaDescriptor.findFieldByNumber(4).get).map(_.as[_root_.com.google.protobuf.ByteString]).getOrElse(_root_.com.google.protobuf.ByteString.EMPTY),
        pendingChanId = __fieldsMap.get(scalaDescriptor.findFieldByNumber(5).get).map(_.as[_root_.com.google.protobuf.ByteString]).getOrElse(_root_.com.google.protobuf.ByteString.EMPTY),
        thawHeight = lnrpc.ChanPointShim._typemapper_thawHeight.toCustom(__fieldsMap.get(scalaDescriptor.findFieldByNumber(6).get).map(_.as[_root_.scala.Int]).getOrElse(0)),
        musig2 = __fieldsMap.get(scalaDescriptor.findFieldByNumber(7).get).map(_.as[_root_.scala.Boolean]).getOrElse(false)
      )
    case _ => throw new RuntimeException("Expected PMessage")
  }
  def javaDescriptor: _root_.com.google.protobuf.Descriptors.Descriptor = LightningProto.javaDescriptor.getMessageTypes().get(76)
  def scalaDescriptor: _root_.scalapb.descriptors.Descriptor = LightningProto.scalaDescriptor.messages(76)
  def messageCompanionForFieldNumber(__number: _root_.scala.Int): _root_.scalapb.GeneratedMessageCompanion[_] = {
    var __out: _root_.scalapb.GeneratedMessageCompanion[_] = null
    (__number: @_root_.scala.unchecked) match {
      case 2 => __out = lnrpc.ChannelPoint
      case 3 => __out = lnrpc.KeyDescriptor
    }
    __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 = lnrpc.ChanPointShim(
    amt = 0L,
    chanPoint = _root_.scala.None,
    localKey = _root_.scala.None,
    remoteKey = _root_.com.google.protobuf.ByteString.EMPTY,
    pendingChanId = _root_.com.google.protobuf.ByteString.EMPTY,
    thawHeight = lnrpc.ChanPointShim._typemapper_thawHeight.toCustom(0),
    musig2 = false
  )
  implicit class ChanPointShimLens[UpperPB](_l: _root_.scalapb.lenses.Lens[UpperPB, lnrpc.ChanPointShim]) extends _root_.scalapb.lenses.ObjectLens[UpperPB, lnrpc.ChanPointShim](_l) {
    def amt: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Long] = field(_.amt)((c_, f_) => c_.copy(amt = f_))
    def chanPoint: _root_.scalapb.lenses.Lens[UpperPB, lnrpc.ChannelPoint] = field(_.getChanPoint)((c_, f_) => c_.copy(chanPoint = Option(f_)))
    def optionalChanPoint: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Option[lnrpc.ChannelPoint]] = field(_.chanPoint)((c_, f_) => c_.copy(chanPoint = f_))
    def localKey: _root_.scalapb.lenses.Lens[UpperPB, lnrpc.KeyDescriptor] = field(_.getLocalKey)((c_, f_) => c_.copy(localKey = Option(f_)))
    def optionalLocalKey: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Option[lnrpc.KeyDescriptor]] = field(_.localKey)((c_, f_) => c_.copy(localKey = f_))
    def remoteKey: _root_.scalapb.lenses.Lens[UpperPB, _root_.com.google.protobuf.ByteString] = field(_.remoteKey)((c_, f_) => c_.copy(remoteKey = f_))
    def pendingChanId: _root_.scalapb.lenses.Lens[UpperPB, _root_.com.google.protobuf.ByteString] = field(_.pendingChanId)((c_, f_) => c_.copy(pendingChanId = f_))
    def thawHeight: _root_.scalapb.lenses.Lens[UpperPB, org.bitcoins.core.number.UInt32] = field(_.thawHeight)((c_, f_) => c_.copy(thawHeight = f_))
    def musig2: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Boolean] = field(_.musig2)((c_, f_) => c_.copy(musig2 = f_))
  }
  final val AMT_FIELD_NUMBER = 1
  final val CHAN_POINT_FIELD_NUMBER = 2
  final val LOCAL_KEY_FIELD_NUMBER = 3
  final val REMOTE_KEY_FIELD_NUMBER = 4
  final val PENDING_CHAN_ID_FIELD_NUMBER = 5
  final val THAW_HEIGHT_FIELD_NUMBER = 6
  final val MUSIG2_FIELD_NUMBER = 7
  @transient
  private[lnrpc] val _typemapper_thawHeight: _root_.scalapb.TypeMapper[_root_.scala.Int, org.bitcoins.core.number.UInt32] = implicitly[_root_.scalapb.TypeMapper[_root_.scala.Int, org.bitcoins.core.number.UInt32]]
  def of(
    amt: _root_.scala.Long,
    chanPoint: _root_.scala.Option[lnrpc.ChannelPoint],
    localKey: _root_.scala.Option[lnrpc.KeyDescriptor],
    remoteKey: _root_.com.google.protobuf.ByteString,
    pendingChanId: _root_.com.google.protobuf.ByteString,
    thawHeight: org.bitcoins.core.number.UInt32,
    musig2: _root_.scala.Boolean
  ): _root_.lnrpc.ChanPointShim = _root_.lnrpc.ChanPointShim(
    amt,
    chanPoint,
    localKey,
    remoteKey,
    pendingChanId,
    thawHeight,
    musig2
  )
  // @@protoc_insertion_point(GeneratedMessageCompanion[lnrpc.ChanPointShim])
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy