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

lnrpc.CloseChannelRequest.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 channelPoint
  *  
  *  The outpoint (txid:index) of the funding transaction. With this value, Bob
  *  will be able to generate a signature for Alice's version of the commitment
  *  transaction.
  * @param force
  *   If true, then the channel will be closed forcibly. This means the
  *   current commitment transaction will be signed and broadcast.
  * @param targetConf
  *   The target number of blocks that the closure transaction should be
  *   confirmed by.
  * @param satPerByte
  *   Deprecated, use sat_per_vbyte.
  *   A manual fee rate set in sat/vbyte that should be used when crafting the
  *   closure transaction.
  * @param deliveryAddress
  *  
  *  An optional address to send funds to in the case of a cooperative close.
  *  If the channel was opened with an upfront shutdown script and this field
  *  is set, the request to close will fail because the channel must pay out
  *  to the upfront shutdown addresss.
  * @param satPerVbyte
  *   A manual fee rate set in sat/vbyte that should be used when crafting the
  *   closure transaction.
  * @param maxFeePerVbyte
  *   The maximum fee rate the closer is willing to pay.
  *  
  *   NOTE: This field is only respected if we're the initiator of the channel.
  */
@SerialVersionUID(0L)
final case class CloseChannelRequest(
    channelPoint: _root_.scala.Option[lnrpc.ChannelPoint] = _root_.scala.None,
    force: _root_.scala.Boolean = false,
    targetConf: _root_.scala.Int = 0,
    @scala.deprecated(message="Marked as deprecated in proto file", "") satPerByte: _root_.scala.Long = 0L,
    deliveryAddress: _root_.scala.Predef.String = "",
    satPerVbyte: org.bitcoins.core.number.UInt64 = lnrpc.CloseChannelRequest._typemapper_satPerVbyte.toCustom(0L),
    maxFeePerVbyte: org.bitcoins.core.number.UInt64 = lnrpc.CloseChannelRequest._typemapper_maxFeePerVbyte.toCustom(0L),
    unknownFields: _root_.scalapb.UnknownFieldSet = _root_.scalapb.UnknownFieldSet.empty
    ) extends scalapb.GeneratedMessage with scalapb.lenses.Updatable[CloseChannelRequest] {
    @transient
    private[this] var __serializedSizeMemoized: _root_.scala.Int = 0
    private[this] def __computeSerializedSize(): _root_.scala.Int = {
      var __size = 0
      if (channelPoint.isDefined) {
        val __value = channelPoint.get
        __size += 1 + _root_.com.google.protobuf.CodedOutputStream.computeUInt32SizeNoTag(__value.serializedSize) + __value.serializedSize
      };
      
      {
        val __value = force
        if (__value != false) {
          __size += _root_.com.google.protobuf.CodedOutputStream.computeBoolSize(2, __value)
        }
      };
      
      {
        val __value = targetConf
        if (__value != 0) {
          __size += _root_.com.google.protobuf.CodedOutputStream.computeInt32Size(3, __value)
        }
      };
      
      {
        val __value = satPerByte
        if (__value != 0L) {
          __size += _root_.com.google.protobuf.CodedOutputStream.computeInt64Size(4, __value)
        }
      };
      
      {
        val __value = deliveryAddress
        if (!__value.isEmpty) {
          __size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(5, __value)
        }
      };
      
      {
        val __value = lnrpc.CloseChannelRequest._typemapper_satPerVbyte.toBase(satPerVbyte)
        if (__value != 0L) {
          __size += _root_.com.google.protobuf.CodedOutputStream.computeUInt64Size(6, __value)
        }
      };
      
      {
        val __value = lnrpc.CloseChannelRequest._typemapper_maxFeePerVbyte.toBase(maxFeePerVbyte)
        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 = {
      channelPoint.foreach { __v =>
        val __m = __v
        _output__.writeTag(1, 2)
        _output__.writeUInt32NoTag(__m.serializedSize)
        __m.writeTo(_output__)
      };
      {
        val __v = force
        if (__v != false) {
          _output__.writeBool(2, __v)
        }
      };
      {
        val __v = targetConf
        if (__v != 0) {
          _output__.writeInt32(3, __v)
        }
      };
      {
        val __v = satPerByte
        if (__v != 0L) {
          _output__.writeInt64(4, __v)
        }
      };
      {
        val __v = deliveryAddress
        if (!__v.isEmpty) {
          _output__.writeString(5, __v)
        }
      };
      {
        val __v = lnrpc.CloseChannelRequest._typemapper_satPerVbyte.toBase(satPerVbyte)
        if (__v != 0L) {
          _output__.writeUInt64(6, __v)
        }
      };
      {
        val __v = lnrpc.CloseChannelRequest._typemapper_maxFeePerVbyte.toBase(maxFeePerVbyte)
        if (__v != 0L) {
          _output__.writeUInt64(7, __v)
        }
      };
      unknownFields.writeTo(_output__)
    }
    def getChannelPoint: lnrpc.ChannelPoint = channelPoint.getOrElse(lnrpc.ChannelPoint.defaultInstance)
    def clearChannelPoint: CloseChannelRequest = copy(channelPoint = _root_.scala.None)
    def withChannelPoint(__v: lnrpc.ChannelPoint): CloseChannelRequest = copy(channelPoint = Option(__v))
    def withForce(__v: _root_.scala.Boolean): CloseChannelRequest = copy(force = __v)
    def withTargetConf(__v: _root_.scala.Int): CloseChannelRequest = copy(targetConf = __v)
    def withSatPerByte(__v: _root_.scala.Long): CloseChannelRequest = copy(satPerByte = __v)
    def withDeliveryAddress(__v: _root_.scala.Predef.String): CloseChannelRequest = copy(deliveryAddress = __v)
    def withSatPerVbyte(__v: org.bitcoins.core.number.UInt64): CloseChannelRequest = copy(satPerVbyte = __v)
    def withMaxFeePerVbyte(__v: org.bitcoins.core.number.UInt64): CloseChannelRequest = copy(maxFeePerVbyte = __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 => channelPoint.orNull
        case 2 => {
          val __t = force
          if (__t != false) __t else null
        }
        case 3 => {
          val __t = targetConf
          if (__t != 0) __t else null
        }
        case 4 => {
          val __t = satPerByte
          if (__t != 0L) __t else null
        }
        case 5 => {
          val __t = deliveryAddress
          if (__t != "") __t else null
        }
        case 6 => {
          val __t = lnrpc.CloseChannelRequest._typemapper_satPerVbyte.toBase(satPerVbyte)
          if (__t != 0L) __t else null
        }
        case 7 => {
          val __t = lnrpc.CloseChannelRequest._typemapper_maxFeePerVbyte.toBase(maxFeePerVbyte)
          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 => channelPoint.map(_.toPMessage).getOrElse(_root_.scalapb.descriptors.PEmpty)
        case 2 => _root_.scalapb.descriptors.PBoolean(force)
        case 3 => _root_.scalapb.descriptors.PInt(targetConf)
        case 4 => _root_.scalapb.descriptors.PLong(satPerByte)
        case 5 => _root_.scalapb.descriptors.PString(deliveryAddress)
        case 6 => _root_.scalapb.descriptors.PLong(lnrpc.CloseChannelRequest._typemapper_satPerVbyte.toBase(satPerVbyte))
        case 7 => _root_.scalapb.descriptors.PLong(lnrpc.CloseChannelRequest._typemapper_maxFeePerVbyte.toBase(maxFeePerVbyte))
      }
    }
    def toProtoString: _root_.scala.Predef.String = _root_.scalapb.TextFormat.printToUnicodeString(this)
    def companion: lnrpc.CloseChannelRequest.type = lnrpc.CloseChannelRequest
    // @@protoc_insertion_point(GeneratedMessage[lnrpc.CloseChannelRequest])
}

object CloseChannelRequest extends scalapb.GeneratedMessageCompanion[lnrpc.CloseChannelRequest] {
  implicit def messageCompanion: scalapb.GeneratedMessageCompanion[lnrpc.CloseChannelRequest] = this
  def parseFrom(`_input__`: _root_.com.google.protobuf.CodedInputStream): lnrpc.CloseChannelRequest = {
    var __channelPoint: _root_.scala.Option[lnrpc.ChannelPoint] = _root_.scala.None
    var __force: _root_.scala.Boolean = false
    var __targetConf: _root_.scala.Int = 0
    var __satPerByte: _root_.scala.Long = 0L
    var __deliveryAddress: _root_.scala.Predef.String = ""
    var __satPerVbyte: _root_.scala.Long = 0L
    var __maxFeePerVbyte: _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 10 =>
          __channelPoint = Option(__channelPoint.fold(_root_.scalapb.LiteParser.readMessage[lnrpc.ChannelPoint](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _)))
        case 16 =>
          __force = _input__.readBool()
        case 24 =>
          __targetConf = _input__.readInt32()
        case 32 =>
          __satPerByte = _input__.readInt64()
        case 42 =>
          __deliveryAddress = _input__.readStringRequireUtf8()
        case 48 =>
          __satPerVbyte = _input__.readUInt64()
        case 56 =>
          __maxFeePerVbyte = _input__.readUInt64()
        case tag =>
          if (_unknownFields__ == null) {
            _unknownFields__ = new _root_.scalapb.UnknownFieldSet.Builder()
          }
          _unknownFields__.parseField(tag, _input__)
      }
    }
    lnrpc.CloseChannelRequest(
        channelPoint = __channelPoint,
        force = __force,
        targetConf = __targetConf,
        satPerByte = __satPerByte,
        deliveryAddress = __deliveryAddress,
        satPerVbyte = lnrpc.CloseChannelRequest._typemapper_satPerVbyte.toCustom(__satPerVbyte),
        maxFeePerVbyte = lnrpc.CloseChannelRequest._typemapper_maxFeePerVbyte.toCustom(__maxFeePerVbyte),
        unknownFields = if (_unknownFields__ == null) _root_.scalapb.UnknownFieldSet.empty else _unknownFields__.result()
    )
  }
  implicit def messageReads: _root_.scalapb.descriptors.Reads[lnrpc.CloseChannelRequest] = _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.CloseChannelRequest(
        channelPoint = __fieldsMap.get(scalaDescriptor.findFieldByNumber(1).get).flatMap(_.as[_root_.scala.Option[lnrpc.ChannelPoint]]),
        force = __fieldsMap.get(scalaDescriptor.findFieldByNumber(2).get).map(_.as[_root_.scala.Boolean]).getOrElse(false),
        targetConf = __fieldsMap.get(scalaDescriptor.findFieldByNumber(3).get).map(_.as[_root_.scala.Int]).getOrElse(0),
        satPerByte = __fieldsMap.get(scalaDescriptor.findFieldByNumber(4).get).map(_.as[_root_.scala.Long]).getOrElse(0L),
        deliveryAddress = __fieldsMap.get(scalaDescriptor.findFieldByNumber(5).get).map(_.as[_root_.scala.Predef.String]).getOrElse(""),
        satPerVbyte = lnrpc.CloseChannelRequest._typemapper_satPerVbyte.toCustom(__fieldsMap.get(scalaDescriptor.findFieldByNumber(6).get).map(_.as[_root_.scala.Long]).getOrElse(0L)),
        maxFeePerVbyte = lnrpc.CloseChannelRequest._typemapper_maxFeePerVbyte.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(65)
  def scalaDescriptor: _root_.scalapb.descriptors.Descriptor = LightningProto.scalaDescriptor.messages(65)
  def messageCompanionForFieldNumber(__number: _root_.scala.Int): _root_.scalapb.GeneratedMessageCompanion[_] = {
    var __out: _root_.scalapb.GeneratedMessageCompanion[_] = null
    (__number: @_root_.scala.unchecked) match {
      case 1 => __out = lnrpc.ChannelPoint
    }
    __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.CloseChannelRequest(
    channelPoint = _root_.scala.None,
    force = false,
    targetConf = 0,
    satPerByte = 0L,
    deliveryAddress = "",
    satPerVbyte = lnrpc.CloseChannelRequest._typemapper_satPerVbyte.toCustom(0L),
    maxFeePerVbyte = lnrpc.CloseChannelRequest._typemapper_maxFeePerVbyte.toCustom(0L)
  )
  implicit class CloseChannelRequestLens[UpperPB](_l: _root_.scalapb.lenses.Lens[UpperPB, lnrpc.CloseChannelRequest]) extends _root_.scalapb.lenses.ObjectLens[UpperPB, lnrpc.CloseChannelRequest](_l) {
    def channelPoint: _root_.scalapb.lenses.Lens[UpperPB, lnrpc.ChannelPoint] = field(_.getChannelPoint)((c_, f_) => c_.copy(channelPoint = Option(f_)))
    def optionalChannelPoint: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Option[lnrpc.ChannelPoint]] = field(_.channelPoint)((c_, f_) => c_.copy(channelPoint = f_))
    def force: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Boolean] = field(_.force)((c_, f_) => c_.copy(force = f_))
    def targetConf: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Int] = field(_.targetConf)((c_, f_) => c_.copy(targetConf = f_))
    def satPerByte: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Long] = field(_.satPerByte)((c_, f_) => c_.copy(satPerByte = f_))
    def deliveryAddress: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.deliveryAddress)((c_, f_) => c_.copy(deliveryAddress = f_))
    def satPerVbyte: _root_.scalapb.lenses.Lens[UpperPB, org.bitcoins.core.number.UInt64] = field(_.satPerVbyte)((c_, f_) => c_.copy(satPerVbyte = f_))
    def maxFeePerVbyte: _root_.scalapb.lenses.Lens[UpperPB, org.bitcoins.core.number.UInt64] = field(_.maxFeePerVbyte)((c_, f_) => c_.copy(maxFeePerVbyte = f_))
  }
  final val CHANNEL_POINT_FIELD_NUMBER = 1
  final val FORCE_FIELD_NUMBER = 2
  final val TARGET_CONF_FIELD_NUMBER = 3
  final val SAT_PER_BYTE_FIELD_NUMBER = 4
  final val DELIVERY_ADDRESS_FIELD_NUMBER = 5
  final val SAT_PER_VBYTE_FIELD_NUMBER = 6
  final val MAX_FEE_PER_VBYTE_FIELD_NUMBER = 7
  @transient
  private[lnrpc] val _typemapper_satPerVbyte: _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_maxFeePerVbyte: _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(
    channelPoint: _root_.scala.Option[lnrpc.ChannelPoint],
    force: _root_.scala.Boolean,
    targetConf: _root_.scala.Int,
    satPerByte: _root_.scala.Long,
    deliveryAddress: _root_.scala.Predef.String,
    satPerVbyte: org.bitcoins.core.number.UInt64,
    maxFeePerVbyte: org.bitcoins.core.number.UInt64
  ): _root_.lnrpc.CloseChannelRequest = _root_.lnrpc.CloseChannelRequest(
    channelPoint,
    force,
    targetConf,
    satPerByte,
    deliveryAddress,
    satPerVbyte,
    maxFeePerVbyte
  )
  // @@protoc_insertion_point(GeneratedMessageCompanion[lnrpc.CloseChannelRequest])
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy