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

lnrpc.PendingHTLC.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 incoming
  *   The direction within the channel that the htlc was sent
  * @param amount
  *   The total value of the htlc
  * @param outpoint
  *   The final output to be swept back to the user's wallet
  * @param maturityHeight
  *   The next block height at which we can spend the current stage
  * @param blocksTilMaturity
  *  
  *  The number of blocks remaining until the current stage can be swept.
  *  Negative values indicate how many blocks have passed since becoming
  *  mature.
  * @param stage
  *   Indicates whether the htlc is in its first or second stage of recovery
  */
@SerialVersionUID(0L)
final case class PendingHTLC(
    incoming: _root_.scala.Boolean = false,
    amount: _root_.scala.Long = 0L,
    outpoint: _root_.scala.Predef.String = "",
    maturityHeight: org.bitcoins.core.number.UInt32 = lnrpc.PendingHTLC._typemapper_maturityHeight.toCustom(0),
    blocksTilMaturity: _root_.scala.Int = 0,
    stage: org.bitcoins.core.number.UInt32 = lnrpc.PendingHTLC._typemapper_stage.toCustom(0),
    unknownFields: _root_.scalapb.UnknownFieldSet = _root_.scalapb.UnknownFieldSet.empty
    ) extends scalapb.GeneratedMessage with scalapb.lenses.Updatable[PendingHTLC] {
    @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 = outpoint
        if (!__value.isEmpty) {
          __size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(3, __value)
        }
      };
      
      {
        val __value = lnrpc.PendingHTLC._typemapper_maturityHeight.toBase(maturityHeight)
        if (__value != 0) {
          __size += _root_.com.google.protobuf.CodedOutputStream.computeUInt32Size(4, __value)
        }
      };
      
      {
        val __value = blocksTilMaturity
        if (__value != 0) {
          __size += _root_.com.google.protobuf.CodedOutputStream.computeInt32Size(5, __value)
        }
      };
      
      {
        val __value = lnrpc.PendingHTLC._typemapper_stage.toBase(stage)
        if (__value != 0) {
          __size += _root_.com.google.protobuf.CodedOutputStream.computeUInt32Size(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 = incoming
        if (__v != false) {
          _output__.writeBool(1, __v)
        }
      };
      {
        val __v = amount
        if (__v != 0L) {
          _output__.writeInt64(2, __v)
        }
      };
      {
        val __v = outpoint
        if (!__v.isEmpty) {
          _output__.writeString(3, __v)
        }
      };
      {
        val __v = lnrpc.PendingHTLC._typemapper_maturityHeight.toBase(maturityHeight)
        if (__v != 0) {
          _output__.writeUInt32(4, __v)
        }
      };
      {
        val __v = blocksTilMaturity
        if (__v != 0) {
          _output__.writeInt32(5, __v)
        }
      };
      {
        val __v = lnrpc.PendingHTLC._typemapper_stage.toBase(stage)
        if (__v != 0) {
          _output__.writeUInt32(6, __v)
        }
      };
      unknownFields.writeTo(_output__)
    }
    def withIncoming(__v: _root_.scala.Boolean): PendingHTLC = copy(incoming = __v)
    def withAmount(__v: _root_.scala.Long): PendingHTLC = copy(amount = __v)
    def withOutpoint(__v: _root_.scala.Predef.String): PendingHTLC = copy(outpoint = __v)
    def withMaturityHeight(__v: org.bitcoins.core.number.UInt32): PendingHTLC = copy(maturityHeight = __v)
    def withBlocksTilMaturity(__v: _root_.scala.Int): PendingHTLC = copy(blocksTilMaturity = __v)
    def withStage(__v: org.bitcoins.core.number.UInt32): PendingHTLC = copy(stage = __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 = outpoint
          if (__t != "") __t else null
        }
        case 4 => {
          val __t = lnrpc.PendingHTLC._typemapper_maturityHeight.toBase(maturityHeight)
          if (__t != 0) __t else null
        }
        case 5 => {
          val __t = blocksTilMaturity
          if (__t != 0) __t else null
        }
        case 6 => {
          val __t = lnrpc.PendingHTLC._typemapper_stage.toBase(stage)
          if (__t != 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.PBoolean(incoming)
        case 2 => _root_.scalapb.descriptors.PLong(amount)
        case 3 => _root_.scalapb.descriptors.PString(outpoint)
        case 4 => _root_.scalapb.descriptors.PInt(lnrpc.PendingHTLC._typemapper_maturityHeight.toBase(maturityHeight))
        case 5 => _root_.scalapb.descriptors.PInt(blocksTilMaturity)
        case 6 => _root_.scalapb.descriptors.PInt(lnrpc.PendingHTLC._typemapper_stage.toBase(stage))
      }
    }
    def toProtoString: _root_.scala.Predef.String = _root_.scalapb.TextFormat.printToUnicodeString(this)
    def companion: lnrpc.PendingHTLC.type = lnrpc.PendingHTLC
    // @@protoc_insertion_point(GeneratedMessage[lnrpc.PendingHTLC])
}

object PendingHTLC extends scalapb.GeneratedMessageCompanion[lnrpc.PendingHTLC] {
  implicit def messageCompanion: scalapb.GeneratedMessageCompanion[lnrpc.PendingHTLC] = this
  def parseFrom(`_input__`: _root_.com.google.protobuf.CodedInputStream): lnrpc.PendingHTLC = {
    var __incoming: _root_.scala.Boolean = false
    var __amount: _root_.scala.Long = 0L
    var __outpoint: _root_.scala.Predef.String = ""
    var __maturityHeight: _root_.scala.Int = 0
    var __blocksTilMaturity: _root_.scala.Int = 0
    var __stage: _root_.scala.Int = 0
    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 =>
          __outpoint = _input__.readStringRequireUtf8()
        case 32 =>
          __maturityHeight = _input__.readUInt32()
        case 40 =>
          __blocksTilMaturity = _input__.readInt32()
        case 48 =>
          __stage = _input__.readUInt32()
        case tag =>
          if (_unknownFields__ == null) {
            _unknownFields__ = new _root_.scalapb.UnknownFieldSet.Builder()
          }
          _unknownFields__.parseField(tag, _input__)
      }
    }
    lnrpc.PendingHTLC(
        incoming = __incoming,
        amount = __amount,
        outpoint = __outpoint,
        maturityHeight = lnrpc.PendingHTLC._typemapper_maturityHeight.toCustom(__maturityHeight),
        blocksTilMaturity = __blocksTilMaturity,
        stage = lnrpc.PendingHTLC._typemapper_stage.toCustom(__stage),
        unknownFields = if (_unknownFields__ == null) _root_.scalapb.UnknownFieldSet.empty else _unknownFields__.result()
    )
  }
  implicit def messageReads: _root_.scalapb.descriptors.Reads[lnrpc.PendingHTLC] = _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.PendingHTLC(
        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),
        outpoint = __fieldsMap.get(scalaDescriptor.findFieldByNumber(3).get).map(_.as[_root_.scala.Predef.String]).getOrElse(""),
        maturityHeight = lnrpc.PendingHTLC._typemapper_maturityHeight.toCustom(__fieldsMap.get(scalaDescriptor.findFieldByNumber(4).get).map(_.as[_root_.scala.Int]).getOrElse(0)),
        blocksTilMaturity = __fieldsMap.get(scalaDescriptor.findFieldByNumber(5).get).map(_.as[_root_.scala.Int]).getOrElse(0),
        stage = lnrpc.PendingHTLC._typemapper_stage.toCustom(__fieldsMap.get(scalaDescriptor.findFieldByNumber(6).get).map(_.as[_root_.scala.Int]).getOrElse(0))
      )
    case _ => throw new RuntimeException("Expected PMessage")
  }
  def javaDescriptor: _root_.com.google.protobuf.Descriptors.Descriptor = LightningProto.javaDescriptor.getMessageTypes().get(84)
  def scalaDescriptor: _root_.scalapb.descriptors.Descriptor = LightningProto.scalaDescriptor.messages(84)
  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.PendingHTLC(
    incoming = false,
    amount = 0L,
    outpoint = "",
    maturityHeight = lnrpc.PendingHTLC._typemapper_maturityHeight.toCustom(0),
    blocksTilMaturity = 0,
    stage = lnrpc.PendingHTLC._typemapper_stage.toCustom(0)
  )
  implicit class PendingHTLCLens[UpperPB](_l: _root_.scalapb.lenses.Lens[UpperPB, lnrpc.PendingHTLC]) extends _root_.scalapb.lenses.ObjectLens[UpperPB, lnrpc.PendingHTLC](_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 outpoint: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.outpoint)((c_, f_) => c_.copy(outpoint = f_))
    def maturityHeight: _root_.scalapb.lenses.Lens[UpperPB, org.bitcoins.core.number.UInt32] = field(_.maturityHeight)((c_, f_) => c_.copy(maturityHeight = f_))
    def blocksTilMaturity: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Int] = field(_.blocksTilMaturity)((c_, f_) => c_.copy(blocksTilMaturity = f_))
    def stage: _root_.scalapb.lenses.Lens[UpperPB, org.bitcoins.core.number.UInt32] = field(_.stage)((c_, f_) => c_.copy(stage = f_))
  }
  final val INCOMING_FIELD_NUMBER = 1
  final val AMOUNT_FIELD_NUMBER = 2
  final val OUTPOINT_FIELD_NUMBER = 3
  final val MATURITY_HEIGHT_FIELD_NUMBER = 4
  final val BLOCKS_TIL_MATURITY_FIELD_NUMBER = 5
  final val STAGE_FIELD_NUMBER = 6
  @transient
  private[lnrpc] val _typemapper_maturityHeight: _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_stage: _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(
    incoming: _root_.scala.Boolean,
    amount: _root_.scala.Long,
    outpoint: _root_.scala.Predef.String,
    maturityHeight: org.bitcoins.core.number.UInt32,
    blocksTilMaturity: _root_.scala.Int,
    stage: org.bitcoins.core.number.UInt32
  ): _root_.lnrpc.PendingHTLC = _root_.lnrpc.PendingHTLC(
    incoming,
    amount,
    outpoint,
    maturityHeight,
    blocksTilMaturity,
    stage
  )
  // @@protoc_insertion_point(GeneratedMessageCompanion[lnrpc.PendingHTLC])
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy