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

lnrpc.ChannelConstraints.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 csvDelay
  *  
  *  The CSV delay expressed in relative blocks. If the channel is force closed,
  *  we will need to wait for this many blocks before we can regain our funds.
  * @param chanReserveSat
  *   The minimum satoshis this node is required to reserve in its balance.
  * @param dustLimitSat
  *   The dust limit (in satoshis) of the initiator's commitment tx.
  * @param maxPendingAmtMsat
  *   The maximum amount of coins in millisatoshis that can be pending in this
  *   channel.
  * @param minHtlcMsat
  *   The smallest HTLC in millisatoshis that the initiator will accept.
  * @param maxAcceptedHtlcs
  *   The total number of incoming HTLC's that the initiator will accept.
  */
@SerialVersionUID(0L)
final case class ChannelConstraints(
    csvDelay: org.bitcoins.core.number.UInt32 = lnrpc.ChannelConstraints._typemapper_csvDelay.toCustom(0),
    chanReserveSat: org.bitcoins.core.number.UInt64 = lnrpc.ChannelConstraints._typemapper_chanReserveSat.toCustom(0L),
    dustLimitSat: org.bitcoins.core.number.UInt64 = lnrpc.ChannelConstraints._typemapper_dustLimitSat.toCustom(0L),
    maxPendingAmtMsat: org.bitcoins.core.number.UInt64 = lnrpc.ChannelConstraints._typemapper_maxPendingAmtMsat.toCustom(0L),
    minHtlcMsat: org.bitcoins.core.number.UInt64 = lnrpc.ChannelConstraints._typemapper_minHtlcMsat.toCustom(0L),
    maxAcceptedHtlcs: org.bitcoins.core.number.UInt32 = lnrpc.ChannelConstraints._typemapper_maxAcceptedHtlcs.toCustom(0),
    unknownFields: _root_.scalapb.UnknownFieldSet = _root_.scalapb.UnknownFieldSet.empty
    ) extends scalapb.GeneratedMessage with scalapb.lenses.Updatable[ChannelConstraints] {
    @transient
    private[this] var __serializedSizeMemoized: _root_.scala.Int = 0
    private[this] def __computeSerializedSize(): _root_.scala.Int = {
      var __size = 0
      
      {
        val __value = lnrpc.ChannelConstraints._typemapper_csvDelay.toBase(csvDelay)
        if (__value != 0) {
          __size += _root_.com.google.protobuf.CodedOutputStream.computeUInt32Size(1, __value)
        }
      };
      
      {
        val __value = lnrpc.ChannelConstraints._typemapper_chanReserveSat.toBase(chanReserveSat)
        if (__value != 0L) {
          __size += _root_.com.google.protobuf.CodedOutputStream.computeUInt64Size(2, __value)
        }
      };
      
      {
        val __value = lnrpc.ChannelConstraints._typemapper_dustLimitSat.toBase(dustLimitSat)
        if (__value != 0L) {
          __size += _root_.com.google.protobuf.CodedOutputStream.computeUInt64Size(3, __value)
        }
      };
      
      {
        val __value = lnrpc.ChannelConstraints._typemapper_maxPendingAmtMsat.toBase(maxPendingAmtMsat)
        if (__value != 0L) {
          __size += _root_.com.google.protobuf.CodedOutputStream.computeUInt64Size(4, __value)
        }
      };
      
      {
        val __value = lnrpc.ChannelConstraints._typemapper_minHtlcMsat.toBase(minHtlcMsat)
        if (__value != 0L) {
          __size += _root_.com.google.protobuf.CodedOutputStream.computeUInt64Size(5, __value)
        }
      };
      
      {
        val __value = lnrpc.ChannelConstraints._typemapper_maxAcceptedHtlcs.toBase(maxAcceptedHtlcs)
        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 = lnrpc.ChannelConstraints._typemapper_csvDelay.toBase(csvDelay)
        if (__v != 0) {
          _output__.writeUInt32(1, __v)
        }
      };
      {
        val __v = lnrpc.ChannelConstraints._typemapper_chanReserveSat.toBase(chanReserveSat)
        if (__v != 0L) {
          _output__.writeUInt64(2, __v)
        }
      };
      {
        val __v = lnrpc.ChannelConstraints._typemapper_dustLimitSat.toBase(dustLimitSat)
        if (__v != 0L) {
          _output__.writeUInt64(3, __v)
        }
      };
      {
        val __v = lnrpc.ChannelConstraints._typemapper_maxPendingAmtMsat.toBase(maxPendingAmtMsat)
        if (__v != 0L) {
          _output__.writeUInt64(4, __v)
        }
      };
      {
        val __v = lnrpc.ChannelConstraints._typemapper_minHtlcMsat.toBase(minHtlcMsat)
        if (__v != 0L) {
          _output__.writeUInt64(5, __v)
        }
      };
      {
        val __v = lnrpc.ChannelConstraints._typemapper_maxAcceptedHtlcs.toBase(maxAcceptedHtlcs)
        if (__v != 0) {
          _output__.writeUInt32(6, __v)
        }
      };
      unknownFields.writeTo(_output__)
    }
    def withCsvDelay(__v: org.bitcoins.core.number.UInt32): ChannelConstraints = copy(csvDelay = __v)
    def withChanReserveSat(__v: org.bitcoins.core.number.UInt64): ChannelConstraints = copy(chanReserveSat = __v)
    def withDustLimitSat(__v: org.bitcoins.core.number.UInt64): ChannelConstraints = copy(dustLimitSat = __v)
    def withMaxPendingAmtMsat(__v: org.bitcoins.core.number.UInt64): ChannelConstraints = copy(maxPendingAmtMsat = __v)
    def withMinHtlcMsat(__v: org.bitcoins.core.number.UInt64): ChannelConstraints = copy(minHtlcMsat = __v)
    def withMaxAcceptedHtlcs(__v: org.bitcoins.core.number.UInt32): ChannelConstraints = copy(maxAcceptedHtlcs = __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.ChannelConstraints._typemapper_csvDelay.toBase(csvDelay)
          if (__t != 0) __t else null
        }
        case 2 => {
          val __t = lnrpc.ChannelConstraints._typemapper_chanReserveSat.toBase(chanReserveSat)
          if (__t != 0L) __t else null
        }
        case 3 => {
          val __t = lnrpc.ChannelConstraints._typemapper_dustLimitSat.toBase(dustLimitSat)
          if (__t != 0L) __t else null
        }
        case 4 => {
          val __t = lnrpc.ChannelConstraints._typemapper_maxPendingAmtMsat.toBase(maxPendingAmtMsat)
          if (__t != 0L) __t else null
        }
        case 5 => {
          val __t = lnrpc.ChannelConstraints._typemapper_minHtlcMsat.toBase(minHtlcMsat)
          if (__t != 0L) __t else null
        }
        case 6 => {
          val __t = lnrpc.ChannelConstraints._typemapper_maxAcceptedHtlcs.toBase(maxAcceptedHtlcs)
          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.PInt(lnrpc.ChannelConstraints._typemapper_csvDelay.toBase(csvDelay))
        case 2 => _root_.scalapb.descriptors.PLong(lnrpc.ChannelConstraints._typemapper_chanReserveSat.toBase(chanReserveSat))
        case 3 => _root_.scalapb.descriptors.PLong(lnrpc.ChannelConstraints._typemapper_dustLimitSat.toBase(dustLimitSat))
        case 4 => _root_.scalapb.descriptors.PLong(lnrpc.ChannelConstraints._typemapper_maxPendingAmtMsat.toBase(maxPendingAmtMsat))
        case 5 => _root_.scalapb.descriptors.PLong(lnrpc.ChannelConstraints._typemapper_minHtlcMsat.toBase(minHtlcMsat))
        case 6 => _root_.scalapb.descriptors.PInt(lnrpc.ChannelConstraints._typemapper_maxAcceptedHtlcs.toBase(maxAcceptedHtlcs))
      }
    }
    def toProtoString: _root_.scala.Predef.String = _root_.scalapb.TextFormat.printToUnicodeString(this)
    def companion: lnrpc.ChannelConstraints.type = lnrpc.ChannelConstraints
    // @@protoc_insertion_point(GeneratedMessage[lnrpc.ChannelConstraints])
}

object ChannelConstraints extends scalapb.GeneratedMessageCompanion[lnrpc.ChannelConstraints] {
  implicit def messageCompanion: scalapb.GeneratedMessageCompanion[lnrpc.ChannelConstraints] = this
  def parseFrom(`_input__`: _root_.com.google.protobuf.CodedInputStream): lnrpc.ChannelConstraints = {
    var __csvDelay: _root_.scala.Int = 0
    var __chanReserveSat: _root_.scala.Long = 0L
    var __dustLimitSat: _root_.scala.Long = 0L
    var __maxPendingAmtMsat: _root_.scala.Long = 0L
    var __minHtlcMsat: _root_.scala.Long = 0L
    var __maxAcceptedHtlcs: _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 =>
          __csvDelay = _input__.readUInt32()
        case 16 =>
          __chanReserveSat = _input__.readUInt64()
        case 24 =>
          __dustLimitSat = _input__.readUInt64()
        case 32 =>
          __maxPendingAmtMsat = _input__.readUInt64()
        case 40 =>
          __minHtlcMsat = _input__.readUInt64()
        case 48 =>
          __maxAcceptedHtlcs = _input__.readUInt32()
        case tag =>
          if (_unknownFields__ == null) {
            _unknownFields__ = new _root_.scalapb.UnknownFieldSet.Builder()
          }
          _unknownFields__.parseField(tag, _input__)
      }
    }
    lnrpc.ChannelConstraints(
        csvDelay = lnrpc.ChannelConstraints._typemapper_csvDelay.toCustom(__csvDelay),
        chanReserveSat = lnrpc.ChannelConstraints._typemapper_chanReserveSat.toCustom(__chanReserveSat),
        dustLimitSat = lnrpc.ChannelConstraints._typemapper_dustLimitSat.toCustom(__dustLimitSat),
        maxPendingAmtMsat = lnrpc.ChannelConstraints._typemapper_maxPendingAmtMsat.toCustom(__maxPendingAmtMsat),
        minHtlcMsat = lnrpc.ChannelConstraints._typemapper_minHtlcMsat.toCustom(__minHtlcMsat),
        maxAcceptedHtlcs = lnrpc.ChannelConstraints._typemapper_maxAcceptedHtlcs.toCustom(__maxAcceptedHtlcs),
        unknownFields = if (_unknownFields__ == null) _root_.scalapb.UnknownFieldSet.empty else _unknownFields__.result()
    )
  }
  implicit def messageReads: _root_.scalapb.descriptors.Reads[lnrpc.ChannelConstraints] = _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.ChannelConstraints(
        csvDelay = lnrpc.ChannelConstraints._typemapper_csvDelay.toCustom(__fieldsMap.get(scalaDescriptor.findFieldByNumber(1).get).map(_.as[_root_.scala.Int]).getOrElse(0)),
        chanReserveSat = lnrpc.ChannelConstraints._typemapper_chanReserveSat.toCustom(__fieldsMap.get(scalaDescriptor.findFieldByNumber(2).get).map(_.as[_root_.scala.Long]).getOrElse(0L)),
        dustLimitSat = lnrpc.ChannelConstraints._typemapper_dustLimitSat.toCustom(__fieldsMap.get(scalaDescriptor.findFieldByNumber(3).get).map(_.as[_root_.scala.Long]).getOrElse(0L)),
        maxPendingAmtMsat = lnrpc.ChannelConstraints._typemapper_maxPendingAmtMsat.toCustom(__fieldsMap.get(scalaDescriptor.findFieldByNumber(4).get).map(_.as[_root_.scala.Long]).getOrElse(0L)),
        minHtlcMsat = lnrpc.ChannelConstraints._typemapper_minHtlcMsat.toCustom(__fieldsMap.get(scalaDescriptor.findFieldByNumber(5).get).map(_.as[_root_.scala.Long]).getOrElse(0L)),
        maxAcceptedHtlcs = lnrpc.ChannelConstraints._typemapper_maxAcceptedHtlcs.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(40)
  def scalaDescriptor: _root_.scalapb.descriptors.Descriptor = LightningProto.scalaDescriptor.messages(40)
  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.ChannelConstraints(
    csvDelay = lnrpc.ChannelConstraints._typemapper_csvDelay.toCustom(0),
    chanReserveSat = lnrpc.ChannelConstraints._typemapper_chanReserveSat.toCustom(0L),
    dustLimitSat = lnrpc.ChannelConstraints._typemapper_dustLimitSat.toCustom(0L),
    maxPendingAmtMsat = lnrpc.ChannelConstraints._typemapper_maxPendingAmtMsat.toCustom(0L),
    minHtlcMsat = lnrpc.ChannelConstraints._typemapper_minHtlcMsat.toCustom(0L),
    maxAcceptedHtlcs = lnrpc.ChannelConstraints._typemapper_maxAcceptedHtlcs.toCustom(0)
  )
  implicit class ChannelConstraintsLens[UpperPB](_l: _root_.scalapb.lenses.Lens[UpperPB, lnrpc.ChannelConstraints]) extends _root_.scalapb.lenses.ObjectLens[UpperPB, lnrpc.ChannelConstraints](_l) {
    def csvDelay: _root_.scalapb.lenses.Lens[UpperPB, org.bitcoins.core.number.UInt32] = field(_.csvDelay)((c_, f_) => c_.copy(csvDelay = f_))
    def chanReserveSat: _root_.scalapb.lenses.Lens[UpperPB, org.bitcoins.core.number.UInt64] = field(_.chanReserveSat)((c_, f_) => c_.copy(chanReserveSat = f_))
    def dustLimitSat: _root_.scalapb.lenses.Lens[UpperPB, org.bitcoins.core.number.UInt64] = field(_.dustLimitSat)((c_, f_) => c_.copy(dustLimitSat = f_))
    def maxPendingAmtMsat: _root_.scalapb.lenses.Lens[UpperPB, org.bitcoins.core.number.UInt64] = field(_.maxPendingAmtMsat)((c_, f_) => c_.copy(maxPendingAmtMsat = f_))
    def minHtlcMsat: _root_.scalapb.lenses.Lens[UpperPB, org.bitcoins.core.number.UInt64] = field(_.minHtlcMsat)((c_, f_) => c_.copy(minHtlcMsat = f_))
    def maxAcceptedHtlcs: _root_.scalapb.lenses.Lens[UpperPB, org.bitcoins.core.number.UInt32] = field(_.maxAcceptedHtlcs)((c_, f_) => c_.copy(maxAcceptedHtlcs = f_))
  }
  final val CSV_DELAY_FIELD_NUMBER = 1
  final val CHAN_RESERVE_SAT_FIELD_NUMBER = 2
  final val DUST_LIMIT_SAT_FIELD_NUMBER = 3
  final val MAX_PENDING_AMT_MSAT_FIELD_NUMBER = 4
  final val MIN_HTLC_MSAT_FIELD_NUMBER = 5
  final val MAX_ACCEPTED_HTLCS_FIELD_NUMBER = 6
  @transient
  private[lnrpc] val _typemapper_csvDelay: _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_chanReserveSat: _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_dustLimitSat: _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_maxPendingAmtMsat: _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_minHtlcMsat: _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_maxAcceptedHtlcs: _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(
    csvDelay: org.bitcoins.core.number.UInt32,
    chanReserveSat: org.bitcoins.core.number.UInt64,
    dustLimitSat: org.bitcoins.core.number.UInt64,
    maxPendingAmtMsat: org.bitcoins.core.number.UInt64,
    minHtlcMsat: org.bitcoins.core.number.UInt64,
    maxAcceptedHtlcs: org.bitcoins.core.number.UInt32
  ): _root_.lnrpc.ChannelConstraints = _root_.lnrpc.ChannelConstraints(
    csvDelay,
    chanReserveSat,
    dustLimitSat,
    maxPendingAmtMsat,
    minHtlcMsat,
    maxAcceptedHtlcs
  )
  // @@protoc_insertion_point(GeneratedMessageCompanion[lnrpc.ChannelConstraints])
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy