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

lnrpc.HTLC.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 htlcIndex
  *   Index identifying the htlc on the channel.
  * @param forwardingChannel
  *   If this HTLC is involved in a forwarding operation, this field indicates
  *   the forwarding channel. For an outgoing htlc, it is the incoming channel.
  *   For an incoming htlc, it is the outgoing channel. When the htlc
  *   originates from this node or this node is the final destination,
  *   forwarding_channel will be zero. The forwarding channel will also be zero
  *   for htlcs that need to be forwarded but don't have a forwarding decision
  *   persisted yet.
  * @param forwardingHtlcIndex
  *   Index identifying the htlc on the forwarding channel.
  */
@SerialVersionUID(0L)
final case class HTLC(
    incoming: _root_.scala.Boolean = false,
    amount: _root_.scala.Long = 0L,
    hashLock: _root_.com.google.protobuf.ByteString = _root_.com.google.protobuf.ByteString.EMPTY,
    expirationHeight: org.bitcoins.core.number.UInt32 = lnrpc.HTLC._typemapper_expirationHeight.toCustom(0),
    htlcIndex: org.bitcoins.core.number.UInt64 = lnrpc.HTLC._typemapper_htlcIndex.toCustom(0L),
    forwardingChannel: org.bitcoins.core.number.UInt64 = lnrpc.HTLC._typemapper_forwardingChannel.toCustom(0L),
    forwardingHtlcIndex: org.bitcoins.core.number.UInt64 = lnrpc.HTLC._typemapper_forwardingHtlcIndex.toCustom(0L),
    unknownFields: _root_.scalapb.UnknownFieldSet = _root_.scalapb.UnknownFieldSet.empty
    ) extends scalapb.GeneratedMessage with scalapb.lenses.Updatable[HTLC] {
    @transient
    private[this] var __serializedSizeMemoized: _root_.scala.Int = 0
    private[this] def __computeSerializedSize(): _root_.scala.Int = {
      var __size = 0
      
      {
        val __value = incoming
        if (__value != false) {
          __size += _root_.com.google.protobuf.CodedOutputStream.computeBoolSize(1, __value)
        }
      };
      
      {
        val __value = amount
        if (__value != 0L) {
          __size += _root_.com.google.protobuf.CodedOutputStream.computeInt64Size(2, __value)
        }
      };
      
      {
        val __value = hashLock
        if (!__value.isEmpty) {
          __size += _root_.com.google.protobuf.CodedOutputStream.computeBytesSize(3, __value)
        }
      };
      
      {
        val __value = lnrpc.HTLC._typemapper_expirationHeight.toBase(expirationHeight)
        if (__value != 0) {
          __size += _root_.com.google.protobuf.CodedOutputStream.computeUInt32Size(4, __value)
        }
      };
      
      {
        val __value = lnrpc.HTLC._typemapper_htlcIndex.toBase(htlcIndex)
        if (__value != 0L) {
          __size += _root_.com.google.protobuf.CodedOutputStream.computeUInt64Size(5, __value)
        }
      };
      
      {
        val __value = lnrpc.HTLC._typemapper_forwardingChannel.toBase(forwardingChannel)
        if (__value != 0L) {
          __size += _root_.com.google.protobuf.CodedOutputStream.computeUInt64Size(6, __value)
        }
      };
      
      {
        val __value = lnrpc.HTLC._typemapper_forwardingHtlcIndex.toBase(forwardingHtlcIndex)
        if (__value != 0L) {
          __size += _root_.com.google.protobuf.CodedOutputStream.computeUInt64Size(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 = incoming
        if (__v != false) {
          _output__.writeBool(1, __v)
        }
      };
      {
        val __v = amount
        if (__v != 0L) {
          _output__.writeInt64(2, __v)
        }
      };
      {
        val __v = hashLock
        if (!__v.isEmpty) {
          _output__.writeBytes(3, __v)
        }
      };
      {
        val __v = lnrpc.HTLC._typemapper_expirationHeight.toBase(expirationHeight)
        if (__v != 0) {
          _output__.writeUInt32(4, __v)
        }
      };
      {
        val __v = lnrpc.HTLC._typemapper_htlcIndex.toBase(htlcIndex)
        if (__v != 0L) {
          _output__.writeUInt64(5, __v)
        }
      };
      {
        val __v = lnrpc.HTLC._typemapper_forwardingChannel.toBase(forwardingChannel)
        if (__v != 0L) {
          _output__.writeUInt64(6, __v)
        }
      };
      {
        val __v = lnrpc.HTLC._typemapper_forwardingHtlcIndex.toBase(forwardingHtlcIndex)
        if (__v != 0L) {
          _output__.writeUInt64(7, __v)
        }
      };
      unknownFields.writeTo(_output__)
    }
    def withIncoming(__v: _root_.scala.Boolean): HTLC = copy(incoming = __v)
    def withAmount(__v: _root_.scala.Long): HTLC = copy(amount = __v)
    def withHashLock(__v: _root_.com.google.protobuf.ByteString): HTLC = copy(hashLock = __v)
    def withExpirationHeight(__v: org.bitcoins.core.number.UInt32): HTLC = copy(expirationHeight = __v)
    def withHtlcIndex(__v: org.bitcoins.core.number.UInt64): HTLC = copy(htlcIndex = __v)
    def withForwardingChannel(__v: org.bitcoins.core.number.UInt64): HTLC = copy(forwardingChannel = __v)
    def withForwardingHtlcIndex(__v: org.bitcoins.core.number.UInt64): HTLC = copy(forwardingHtlcIndex = __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 = incoming
          if (__t != false) __t else null
        }
        case 2 => {
          val __t = amount
          if (__t != 0L) __t else null
        }
        case 3 => {
          val __t = hashLock
          if (__t != _root_.com.google.protobuf.ByteString.EMPTY) __t else null
        }
        case 4 => {
          val __t = lnrpc.HTLC._typemapper_expirationHeight.toBase(expirationHeight)
          if (__t != 0) __t else null
        }
        case 5 => {
          val __t = lnrpc.HTLC._typemapper_htlcIndex.toBase(htlcIndex)
          if (__t != 0L) __t else null
        }
        case 6 => {
          val __t = lnrpc.HTLC._typemapper_forwardingChannel.toBase(forwardingChannel)
          if (__t != 0L) __t else null
        }
        case 7 => {
          val __t = lnrpc.HTLC._typemapper_forwardingHtlcIndex.toBase(forwardingHtlcIndex)
          if (__t != 0L) __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.PBoolean(incoming)
        case 2 => _root_.scalapb.descriptors.PLong(amount)
        case 3 => _root_.scalapb.descriptors.PByteString(hashLock)
        case 4 => _root_.scalapb.descriptors.PInt(lnrpc.HTLC._typemapper_expirationHeight.toBase(expirationHeight))
        case 5 => _root_.scalapb.descriptors.PLong(lnrpc.HTLC._typemapper_htlcIndex.toBase(htlcIndex))
        case 6 => _root_.scalapb.descriptors.PLong(lnrpc.HTLC._typemapper_forwardingChannel.toBase(forwardingChannel))
        case 7 => _root_.scalapb.descriptors.PLong(lnrpc.HTLC._typemapper_forwardingHtlcIndex.toBase(forwardingHtlcIndex))
      }
    }
    def toProtoString: _root_.scala.Predef.String = _root_.scalapb.TextFormat.printToUnicodeString(this)
    def companion: lnrpc.HTLC.type = lnrpc.HTLC
    // @@protoc_insertion_point(GeneratedMessage[lnrpc.HTLC])
}

object HTLC extends scalapb.GeneratedMessageCompanion[lnrpc.HTLC] {
  implicit def messageCompanion: scalapb.GeneratedMessageCompanion[lnrpc.HTLC] = this
  def parseFrom(`_input__`: _root_.com.google.protobuf.CodedInputStream): lnrpc.HTLC = {
    var __incoming: _root_.scala.Boolean = false
    var __amount: _root_.scala.Long = 0L
    var __hashLock: _root_.com.google.protobuf.ByteString = _root_.com.google.protobuf.ByteString.EMPTY
    var __expirationHeight: _root_.scala.Int = 0
    var __htlcIndex: _root_.scala.Long = 0L
    var __forwardingChannel: _root_.scala.Long = 0L
    var __forwardingHtlcIndex: _root_.scala.Long = 0L
    var `_unknownFields__`: _root_.scalapb.UnknownFieldSet.Builder = null
    var _done__ = false
    while (!_done__) {
      val _tag__ = _input__.readTag()
      _tag__ match {
        case 0 => _done__ = true
        case 8 =>
          __incoming = _input__.readBool()
        case 16 =>
          __amount = _input__.readInt64()
        case 26 =>
          __hashLock = _input__.readBytes()
        case 32 =>
          __expirationHeight = _input__.readUInt32()
        case 40 =>
          __htlcIndex = _input__.readUInt64()
        case 48 =>
          __forwardingChannel = _input__.readUInt64()
        case 56 =>
          __forwardingHtlcIndex = _input__.readUInt64()
        case tag =>
          if (_unknownFields__ == null) {
            _unknownFields__ = new _root_.scalapb.UnknownFieldSet.Builder()
          }
          _unknownFields__.parseField(tag, _input__)
      }
    }
    lnrpc.HTLC(
        incoming = __incoming,
        amount = __amount,
        hashLock = __hashLock,
        expirationHeight = lnrpc.HTLC._typemapper_expirationHeight.toCustom(__expirationHeight),
        htlcIndex = lnrpc.HTLC._typemapper_htlcIndex.toCustom(__htlcIndex),
        forwardingChannel = lnrpc.HTLC._typemapper_forwardingChannel.toCustom(__forwardingChannel),
        forwardingHtlcIndex = lnrpc.HTLC._typemapper_forwardingHtlcIndex.toCustom(__forwardingHtlcIndex),
        unknownFields = if (_unknownFields__ == null) _root_.scalapb.UnknownFieldSet.empty else _unknownFields__.result()
    )
  }
  implicit def messageReads: _root_.scalapb.descriptors.Reads[lnrpc.HTLC] = _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.HTLC(
        incoming = __fieldsMap.get(scalaDescriptor.findFieldByNumber(1).get).map(_.as[_root_.scala.Boolean]).getOrElse(false),
        amount = __fieldsMap.get(scalaDescriptor.findFieldByNumber(2).get).map(_.as[_root_.scala.Long]).getOrElse(0L),
        hashLock = __fieldsMap.get(scalaDescriptor.findFieldByNumber(3).get).map(_.as[_root_.com.google.protobuf.ByteString]).getOrElse(_root_.com.google.protobuf.ByteString.EMPTY),
        expirationHeight = lnrpc.HTLC._typemapper_expirationHeight.toCustom(__fieldsMap.get(scalaDescriptor.findFieldByNumber(4).get).map(_.as[_root_.scala.Int]).getOrElse(0)),
        htlcIndex = lnrpc.HTLC._typemapper_htlcIndex.toCustom(__fieldsMap.get(scalaDescriptor.findFieldByNumber(5).get).map(_.as[_root_.scala.Long]).getOrElse(0L)),
        forwardingChannel = lnrpc.HTLC._typemapper_forwardingChannel.toCustom(__fieldsMap.get(scalaDescriptor.findFieldByNumber(6).get).map(_.as[_root_.scala.Long]).getOrElse(0L)),
        forwardingHtlcIndex = lnrpc.HTLC._typemapper_forwardingHtlcIndex.toCustom(__fieldsMap.get(scalaDescriptor.findFieldByNumber(7).get).map(_.as[_root_.scala.Long]).getOrElse(0L))
      )
    case _ => throw new RuntimeException("Expected PMessage")
  }
  def javaDescriptor: _root_.com.google.protobuf.Descriptors.Descriptor = LightningProto.javaDescriptor.getMessageTypes().get(39)
  def scalaDescriptor: _root_.scalapb.descriptors.Descriptor = LightningProto.scalaDescriptor.messages(39)
  def messageCompanionForFieldNumber(__number: _root_.scala.Int): _root_.scalapb.GeneratedMessageCompanion[_] = throw new MatchError(__number)
  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.HTLC(
    incoming = false,
    amount = 0L,
    hashLock = _root_.com.google.protobuf.ByteString.EMPTY,
    expirationHeight = lnrpc.HTLC._typemapper_expirationHeight.toCustom(0),
    htlcIndex = lnrpc.HTLC._typemapper_htlcIndex.toCustom(0L),
    forwardingChannel = lnrpc.HTLC._typemapper_forwardingChannel.toCustom(0L),
    forwardingHtlcIndex = lnrpc.HTLC._typemapper_forwardingHtlcIndex.toCustom(0L)
  )
  implicit class HTLCLens[UpperPB](_l: _root_.scalapb.lenses.Lens[UpperPB, lnrpc.HTLC]) extends _root_.scalapb.lenses.ObjectLens[UpperPB, lnrpc.HTLC](_l) {
    def incoming: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Boolean] = field(_.incoming)((c_, f_) => c_.copy(incoming = f_))
    def amount: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Long] = field(_.amount)((c_, f_) => c_.copy(amount = f_))
    def hashLock: _root_.scalapb.lenses.Lens[UpperPB, _root_.com.google.protobuf.ByteString] = field(_.hashLock)((c_, f_) => c_.copy(hashLock = f_))
    def expirationHeight: _root_.scalapb.lenses.Lens[UpperPB, org.bitcoins.core.number.UInt32] = field(_.expirationHeight)((c_, f_) => c_.copy(expirationHeight = f_))
    def htlcIndex: _root_.scalapb.lenses.Lens[UpperPB, org.bitcoins.core.number.UInt64] = field(_.htlcIndex)((c_, f_) => c_.copy(htlcIndex = f_))
    def forwardingChannel: _root_.scalapb.lenses.Lens[UpperPB, org.bitcoins.core.number.UInt64] = field(_.forwardingChannel)((c_, f_) => c_.copy(forwardingChannel = f_))
    def forwardingHtlcIndex: _root_.scalapb.lenses.Lens[UpperPB, org.bitcoins.core.number.UInt64] = field(_.forwardingHtlcIndex)((c_, f_) => c_.copy(forwardingHtlcIndex = f_))
  }
  final val INCOMING_FIELD_NUMBER = 1
  final val AMOUNT_FIELD_NUMBER = 2
  final val HASH_LOCK_FIELD_NUMBER = 3
  final val EXPIRATION_HEIGHT_FIELD_NUMBER = 4
  final val HTLC_INDEX_FIELD_NUMBER = 5
  final val FORWARDING_CHANNEL_FIELD_NUMBER = 6
  final val FORWARDING_HTLC_INDEX_FIELD_NUMBER = 7
  @transient
  private[lnrpc] val _typemapper_expirationHeight: _root_.scalapb.TypeMapper[_root_.scala.Int, org.bitcoins.core.number.UInt32] = implicitly[_root_.scalapb.TypeMapper[_root_.scala.Int, org.bitcoins.core.number.UInt32]]
  @transient
  private[lnrpc] val _typemapper_htlcIndex: _root_.scalapb.TypeMapper[_root_.scala.Long, org.bitcoins.core.number.UInt64] = implicitly[_root_.scalapb.TypeMapper[_root_.scala.Long, org.bitcoins.core.number.UInt64]]
  @transient
  private[lnrpc] val _typemapper_forwardingChannel: _root_.scalapb.TypeMapper[_root_.scala.Long, org.bitcoins.core.number.UInt64] = implicitly[_root_.scalapb.TypeMapper[_root_.scala.Long, org.bitcoins.core.number.UInt64]]
  @transient
  private[lnrpc] val _typemapper_forwardingHtlcIndex: _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(
    incoming: _root_.scala.Boolean,
    amount: _root_.scala.Long,
    hashLock: _root_.com.google.protobuf.ByteString,
    expirationHeight: org.bitcoins.core.number.UInt32,
    htlcIndex: org.bitcoins.core.number.UInt64,
    forwardingChannel: org.bitcoins.core.number.UInt64,
    forwardingHtlcIndex: org.bitcoins.core.number.UInt64
  ): _root_.lnrpc.HTLC = _root_.lnrpc.HTLC(
    incoming,
    amount,
    hashLock,
    expirationHeight,
    htlcIndex,
    forwardingChannel,
    forwardingHtlcIndex
  )
  // @@protoc_insertion_point(GeneratedMessageCompanion[lnrpc.HTLC])
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy