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

lnrpc.ChannelEdgeUpdate.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 chanId
  *  
  *  The unique channel ID for the channel. The first 3 bytes are the block
  *  height, the next 3 the index within the block, and the last 2 bytes are the
  *  output index for the channel.
  */
@SerialVersionUID(0L)
final case class ChannelEdgeUpdate(
    chanId: org.bitcoins.core.number.UInt64 = lnrpc.ChannelEdgeUpdate._typemapper_chanId.toCustom(0L),
    chanPoint: _root_.scala.Option[lnrpc.ChannelPoint] = _root_.scala.None,
    capacity: _root_.scala.Long = 0L,
    routingPolicy: _root_.scala.Option[lnrpc.RoutingPolicy] = _root_.scala.None,
    advertisingNode: _root_.scala.Predef.String = "",
    connectingNode: _root_.scala.Predef.String = "",
    unknownFields: _root_.scalapb.UnknownFieldSet = _root_.scalapb.UnknownFieldSet.empty
    ) extends scalapb.GeneratedMessage with scalapb.lenses.Updatable[ChannelEdgeUpdate] {
    @transient
    private[this] var __serializedSizeMemoized: _root_.scala.Int = 0
    private[this] def __computeSerializedSize(): _root_.scala.Int = {
      var __size = 0
      
      {
        val __value = lnrpc.ChannelEdgeUpdate._typemapper_chanId.toBase(chanId)
        if (__value != 0L) {
          __size += _root_.com.google.protobuf.CodedOutputStream.computeUInt64Size(1, __value)
        }
      };
      if (chanPoint.isDefined) {
        val __value = chanPoint.get
        __size += 1 + _root_.com.google.protobuf.CodedOutputStream.computeUInt32SizeNoTag(__value.serializedSize) + __value.serializedSize
      };
      
      {
        val __value = capacity
        if (__value != 0L) {
          __size += _root_.com.google.protobuf.CodedOutputStream.computeInt64Size(3, __value)
        }
      };
      if (routingPolicy.isDefined) {
        val __value = routingPolicy.get
        __size += 1 + _root_.com.google.protobuf.CodedOutputStream.computeUInt32SizeNoTag(__value.serializedSize) + __value.serializedSize
      };
      
      {
        val __value = advertisingNode
        if (!__value.isEmpty) {
          __size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(5, __value)
        }
      };
      
      {
        val __value = connectingNode
        if (!__value.isEmpty) {
          __size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(6, __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 = lnrpc.ChannelEdgeUpdate._typemapper_chanId.toBase(chanId)
        if (__v != 0L) {
          _output__.writeUInt64(1, __v)
        }
      };
      chanPoint.foreach { __v =>
        val __m = __v
        _output__.writeTag(2, 2)
        _output__.writeUInt32NoTag(__m.serializedSize)
        __m.writeTo(_output__)
      };
      {
        val __v = capacity
        if (__v != 0L) {
          _output__.writeInt64(3, __v)
        }
      };
      routingPolicy.foreach { __v =>
        val __m = __v
        _output__.writeTag(4, 2)
        _output__.writeUInt32NoTag(__m.serializedSize)
        __m.writeTo(_output__)
      };
      {
        val __v = advertisingNode
        if (!__v.isEmpty) {
          _output__.writeString(5, __v)
        }
      };
      {
        val __v = connectingNode
        if (!__v.isEmpty) {
          _output__.writeString(6, __v)
        }
      };
      unknownFields.writeTo(_output__)
    }
    def withChanId(__v: org.bitcoins.core.number.UInt64): ChannelEdgeUpdate = copy(chanId = __v)
    def getChanPoint: lnrpc.ChannelPoint = chanPoint.getOrElse(lnrpc.ChannelPoint.defaultInstance)
    def clearChanPoint: ChannelEdgeUpdate = copy(chanPoint = _root_.scala.None)
    def withChanPoint(__v: lnrpc.ChannelPoint): ChannelEdgeUpdate = copy(chanPoint = Option(__v))
    def withCapacity(__v: _root_.scala.Long): ChannelEdgeUpdate = copy(capacity = __v)
    def getRoutingPolicy: lnrpc.RoutingPolicy = routingPolicy.getOrElse(lnrpc.RoutingPolicy.defaultInstance)
    def clearRoutingPolicy: ChannelEdgeUpdate = copy(routingPolicy = _root_.scala.None)
    def withRoutingPolicy(__v: lnrpc.RoutingPolicy): ChannelEdgeUpdate = copy(routingPolicy = Option(__v))
    def withAdvertisingNode(__v: _root_.scala.Predef.String): ChannelEdgeUpdate = copy(advertisingNode = __v)
    def withConnectingNode(__v: _root_.scala.Predef.String): ChannelEdgeUpdate = copy(connectingNode = __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 = lnrpc.ChannelEdgeUpdate._typemapper_chanId.toBase(chanId)
          if (__t != 0L) __t else null
        }
        case 2 => chanPoint.orNull
        case 3 => {
          val __t = capacity
          if (__t != 0L) __t else null
        }
        case 4 => routingPolicy.orNull
        case 5 => {
          val __t = advertisingNode
          if (__t != "") __t else null
        }
        case 6 => {
          val __t = connectingNode
          if (__t != "") __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(lnrpc.ChannelEdgeUpdate._typemapper_chanId.toBase(chanId))
        case 2 => chanPoint.map(_.toPMessage).getOrElse(_root_.scalapb.descriptors.PEmpty)
        case 3 => _root_.scalapb.descriptors.PLong(capacity)
        case 4 => routingPolicy.map(_.toPMessage).getOrElse(_root_.scalapb.descriptors.PEmpty)
        case 5 => _root_.scalapb.descriptors.PString(advertisingNode)
        case 6 => _root_.scalapb.descriptors.PString(connectingNode)
      }
    }
    def toProtoString: _root_.scala.Predef.String = _root_.scalapb.TextFormat.printToUnicodeString(this)
    def companion: lnrpc.ChannelEdgeUpdate.type = lnrpc.ChannelEdgeUpdate
    // @@protoc_insertion_point(GeneratedMessage[lnrpc.ChannelEdgeUpdate])
}

object ChannelEdgeUpdate extends scalapb.GeneratedMessageCompanion[lnrpc.ChannelEdgeUpdate] {
  implicit def messageCompanion: scalapb.GeneratedMessageCompanion[lnrpc.ChannelEdgeUpdate] = this
  def parseFrom(`_input__`: _root_.com.google.protobuf.CodedInputStream): lnrpc.ChannelEdgeUpdate = {
    var __chanId: _root_.scala.Long = 0L
    var __chanPoint: _root_.scala.Option[lnrpc.ChannelPoint] = _root_.scala.None
    var __capacity: _root_.scala.Long = 0L
    var __routingPolicy: _root_.scala.Option[lnrpc.RoutingPolicy] = _root_.scala.None
    var __advertisingNode: _root_.scala.Predef.String = ""
    var __connectingNode: _root_.scala.Predef.String = ""
    var `_unknownFields__`: _root_.scalapb.UnknownFieldSet.Builder = null
    var _done__ = false
    while (!_done__) {
      val _tag__ = _input__.readTag()
      _tag__ match {
        case 0 => _done__ = true
        case 8 =>
          __chanId = _input__.readUInt64()
        case 18 =>
          __chanPoint = Option(__chanPoint.fold(_root_.scalapb.LiteParser.readMessage[lnrpc.ChannelPoint](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _)))
        case 24 =>
          __capacity = _input__.readInt64()
        case 34 =>
          __routingPolicy = Option(__routingPolicy.fold(_root_.scalapb.LiteParser.readMessage[lnrpc.RoutingPolicy](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _)))
        case 42 =>
          __advertisingNode = _input__.readStringRequireUtf8()
        case 50 =>
          __connectingNode = _input__.readStringRequireUtf8()
        case tag =>
          if (_unknownFields__ == null) {
            _unknownFields__ = new _root_.scalapb.UnknownFieldSet.Builder()
          }
          _unknownFields__.parseField(tag, _input__)
      }
    }
    lnrpc.ChannelEdgeUpdate(
        chanId = lnrpc.ChannelEdgeUpdate._typemapper_chanId.toCustom(__chanId),
        chanPoint = __chanPoint,
        capacity = __capacity,
        routingPolicy = __routingPolicy,
        advertisingNode = __advertisingNode,
        connectingNode = __connectingNode,
        unknownFields = if (_unknownFields__ == null) _root_.scalapb.UnknownFieldSet.empty else _unknownFields__.result()
    )
  }
  implicit def messageReads: _root_.scalapb.descriptors.Reads[lnrpc.ChannelEdgeUpdate] = _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.ChannelEdgeUpdate(
        chanId = lnrpc.ChannelEdgeUpdate._typemapper_chanId.toCustom(__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]]),
        capacity = __fieldsMap.get(scalaDescriptor.findFieldByNumber(3).get).map(_.as[_root_.scala.Long]).getOrElse(0L),
        routingPolicy = __fieldsMap.get(scalaDescriptor.findFieldByNumber(4).get).flatMap(_.as[_root_.scala.Option[lnrpc.RoutingPolicy]]),
        advertisingNode = __fieldsMap.get(scalaDescriptor.findFieldByNumber(5).get).map(_.as[_root_.scala.Predef.String]).getOrElse(""),
        connectingNode = __fieldsMap.get(scalaDescriptor.findFieldByNumber(6).get).map(_.as[_root_.scala.Predef.String]).getOrElse("")
      )
    case _ => throw new RuntimeException("Expected PMessage")
  }
  def javaDescriptor: _root_.com.google.protobuf.Descriptors.Descriptor = LightningProto.javaDescriptor.getMessageTypes().get(122)
  def scalaDescriptor: _root_.scalapb.descriptors.Descriptor = LightningProto.scalaDescriptor.messages(122)
  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 4 => __out = lnrpc.RoutingPolicy
    }
    __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.ChannelEdgeUpdate(
    chanId = lnrpc.ChannelEdgeUpdate._typemapper_chanId.toCustom(0L),
    chanPoint = _root_.scala.None,
    capacity = 0L,
    routingPolicy = _root_.scala.None,
    advertisingNode = "",
    connectingNode = ""
  )
  implicit class ChannelEdgeUpdateLens[UpperPB](_l: _root_.scalapb.lenses.Lens[UpperPB, lnrpc.ChannelEdgeUpdate]) extends _root_.scalapb.lenses.ObjectLens[UpperPB, lnrpc.ChannelEdgeUpdate](_l) {
    def chanId: _root_.scalapb.lenses.Lens[UpperPB, org.bitcoins.core.number.UInt64] = field(_.chanId)((c_, f_) => c_.copy(chanId = 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 capacity: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Long] = field(_.capacity)((c_, f_) => c_.copy(capacity = f_))
    def routingPolicy: _root_.scalapb.lenses.Lens[UpperPB, lnrpc.RoutingPolicy] = field(_.getRoutingPolicy)((c_, f_) => c_.copy(routingPolicy = Option(f_)))
    def optionalRoutingPolicy: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Option[lnrpc.RoutingPolicy]] = field(_.routingPolicy)((c_, f_) => c_.copy(routingPolicy = f_))
    def advertisingNode: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.advertisingNode)((c_, f_) => c_.copy(advertisingNode = f_))
    def connectingNode: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.connectingNode)((c_, f_) => c_.copy(connectingNode = f_))
  }
  final val CHAN_ID_FIELD_NUMBER = 1
  final val CHAN_POINT_FIELD_NUMBER = 2
  final val CAPACITY_FIELD_NUMBER = 3
  final val ROUTING_POLICY_FIELD_NUMBER = 4
  final val ADVERTISING_NODE_FIELD_NUMBER = 5
  final val CONNECTING_NODE_FIELD_NUMBER = 6
  @transient
  private[lnrpc] val _typemapper_chanId: _root_.scalapb.TypeMapper[_root_.scala.Long, org.bitcoins.core.number.UInt64] = implicitly[_root_.scalapb.TypeMapper[_root_.scala.Long, org.bitcoins.core.number.UInt64]]
  def of(
    chanId: org.bitcoins.core.number.UInt64,
    chanPoint: _root_.scala.Option[lnrpc.ChannelPoint],
    capacity: _root_.scala.Long,
    routingPolicy: _root_.scala.Option[lnrpc.RoutingPolicy],
    advertisingNode: _root_.scala.Predef.String,
    connectingNode: _root_.scala.Predef.String
  ): _root_.lnrpc.ChannelEdgeUpdate = _root_.lnrpc.ChannelEdgeUpdate(
    chanId,
    chanPoint,
    capacity,
    routingPolicy,
    advertisingNode,
    connectingNode
  )
  // @@protoc_insertion_point(GeneratedMessageCompanion[lnrpc.ChannelEdgeUpdate])
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy