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

lnrpc.OutputDetail.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 outputType
  *   The type of the output
  * @param address
  *   The address
  * @param pkScript
  *   The pkscript in hex
  * @param outputIndex
  *   The output index used in the raw transaction
  * @param amount
  *   The value of the output coin in satoshis
  * @param isOurAddress
  *   Denotes if the output is controlled by the internal wallet
  */
@SerialVersionUID(0L)
final case class OutputDetail(
    outputType: lnrpc.OutputScriptType = lnrpc.OutputScriptType.SCRIPT_TYPE_PUBKEY_HASH,
    address: _root_.scala.Predef.String = "",
    pkScript: _root_.scala.Predef.String = "",
    outputIndex: _root_.scala.Long = 0L,
    amount: _root_.scala.Long = 0L,
    isOurAddress: _root_.scala.Boolean = false,
    unknownFields: _root_.scalapb.UnknownFieldSet = _root_.scalapb.UnknownFieldSet.empty
    ) extends scalapb.GeneratedMessage with scalapb.lenses.Updatable[OutputDetail] {
    @transient
    private[this] var __serializedSizeMemoized: _root_.scala.Int = 0
    private[this] def __computeSerializedSize(): _root_.scala.Int = {
      var __size = 0
      
      {
        val __value = outputType.value
        if (__value != 0) {
          __size += _root_.com.google.protobuf.CodedOutputStream.computeEnumSize(1, __value)
        }
      };
      
      {
        val __value = address
        if (!__value.isEmpty) {
          __size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(2, __value)
        }
      };
      
      {
        val __value = pkScript
        if (!__value.isEmpty) {
          __size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(3, __value)
        }
      };
      
      {
        val __value = outputIndex
        if (__value != 0L) {
          __size += _root_.com.google.protobuf.CodedOutputStream.computeInt64Size(4, __value)
        }
      };
      
      {
        val __value = amount
        if (__value != 0L) {
          __size += _root_.com.google.protobuf.CodedOutputStream.computeInt64Size(5, __value)
        }
      };
      
      {
        val __value = isOurAddress
        if (__value != false) {
          __size += _root_.com.google.protobuf.CodedOutputStream.computeBoolSize(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 = outputType.value
        if (__v != 0) {
          _output__.writeEnum(1, __v)
        }
      };
      {
        val __v = address
        if (!__v.isEmpty) {
          _output__.writeString(2, __v)
        }
      };
      {
        val __v = pkScript
        if (!__v.isEmpty) {
          _output__.writeString(3, __v)
        }
      };
      {
        val __v = outputIndex
        if (__v != 0L) {
          _output__.writeInt64(4, __v)
        }
      };
      {
        val __v = amount
        if (__v != 0L) {
          _output__.writeInt64(5, __v)
        }
      };
      {
        val __v = isOurAddress
        if (__v != false) {
          _output__.writeBool(6, __v)
        }
      };
      unknownFields.writeTo(_output__)
    }
    def withOutputType(__v: lnrpc.OutputScriptType): OutputDetail = copy(outputType = __v)
    def withAddress(__v: _root_.scala.Predef.String): OutputDetail = copy(address = __v)
    def withPkScript(__v: _root_.scala.Predef.String): OutputDetail = copy(pkScript = __v)
    def withOutputIndex(__v: _root_.scala.Long): OutputDetail = copy(outputIndex = __v)
    def withAmount(__v: _root_.scala.Long): OutputDetail = copy(amount = __v)
    def withIsOurAddress(__v: _root_.scala.Boolean): OutputDetail = copy(isOurAddress = __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 = outputType.javaValueDescriptor
          if (__t.getNumber() != 0) __t else null
        }
        case 2 => {
          val __t = address
          if (__t != "") __t else null
        }
        case 3 => {
          val __t = pkScript
          if (__t != "") __t else null
        }
        case 4 => {
          val __t = outputIndex
          if (__t != 0L) __t else null
        }
        case 5 => {
          val __t = amount
          if (__t != 0L) __t else null
        }
        case 6 => {
          val __t = isOurAddress
          if (__t != false) __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.PEnum(outputType.scalaValueDescriptor)
        case 2 => _root_.scalapb.descriptors.PString(address)
        case 3 => _root_.scalapb.descriptors.PString(pkScript)
        case 4 => _root_.scalapb.descriptors.PLong(outputIndex)
        case 5 => _root_.scalapb.descriptors.PLong(amount)
        case 6 => _root_.scalapb.descriptors.PBoolean(isOurAddress)
      }
    }
    def toProtoString: _root_.scala.Predef.String = _root_.scalapb.TextFormat.printToUnicodeString(this)
    def companion: lnrpc.OutputDetail.type = lnrpc.OutputDetail
    // @@protoc_insertion_point(GeneratedMessage[lnrpc.OutputDetail])
}

object OutputDetail extends scalapb.GeneratedMessageCompanion[lnrpc.OutputDetail] {
  implicit def messageCompanion: scalapb.GeneratedMessageCompanion[lnrpc.OutputDetail] = this
  def parseFrom(`_input__`: _root_.com.google.protobuf.CodedInputStream): lnrpc.OutputDetail = {
    var __outputType: lnrpc.OutputScriptType = lnrpc.OutputScriptType.SCRIPT_TYPE_PUBKEY_HASH
    var __address: _root_.scala.Predef.String = ""
    var __pkScript: _root_.scala.Predef.String = ""
    var __outputIndex: _root_.scala.Long = 0L
    var __amount: _root_.scala.Long = 0L
    var __isOurAddress: _root_.scala.Boolean = false
    var `_unknownFields__`: _root_.scalapb.UnknownFieldSet.Builder = null
    var _done__ = false
    while (!_done__) {
      val _tag__ = _input__.readTag()
      _tag__ match {
        case 0 => _done__ = true
        case 8 =>
          __outputType = lnrpc.OutputScriptType.fromValue(_input__.readEnum())
        case 18 =>
          __address = _input__.readStringRequireUtf8()
        case 26 =>
          __pkScript = _input__.readStringRequireUtf8()
        case 32 =>
          __outputIndex = _input__.readInt64()
        case 40 =>
          __amount = _input__.readInt64()
        case 48 =>
          __isOurAddress = _input__.readBool()
        case tag =>
          if (_unknownFields__ == null) {
            _unknownFields__ = new _root_.scalapb.UnknownFieldSet.Builder()
          }
          _unknownFields__.parseField(tag, _input__)
      }
    }
    lnrpc.OutputDetail(
        outputType = __outputType,
        address = __address,
        pkScript = __pkScript,
        outputIndex = __outputIndex,
        amount = __amount,
        isOurAddress = __isOurAddress,
        unknownFields = if (_unknownFields__ == null) _root_.scalapb.UnknownFieldSet.empty else _unknownFields__.result()
    )
  }
  implicit def messageReads: _root_.scalapb.descriptors.Reads[lnrpc.OutputDetail] = _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.OutputDetail(
        outputType = lnrpc.OutputScriptType.fromValue(__fieldsMap.get(scalaDescriptor.findFieldByNumber(1).get).map(_.as[_root_.scalapb.descriptors.EnumValueDescriptor]).getOrElse(lnrpc.OutputScriptType.SCRIPT_TYPE_PUBKEY_HASH.scalaValueDescriptor).number),
        address = __fieldsMap.get(scalaDescriptor.findFieldByNumber(2).get).map(_.as[_root_.scala.Predef.String]).getOrElse(""),
        pkScript = __fieldsMap.get(scalaDescriptor.findFieldByNumber(3).get).map(_.as[_root_.scala.Predef.String]).getOrElse(""),
        outputIndex = __fieldsMap.get(scalaDescriptor.findFieldByNumber(4).get).map(_.as[_root_.scala.Long]).getOrElse(0L),
        amount = __fieldsMap.get(scalaDescriptor.findFieldByNumber(5).get).map(_.as[_root_.scala.Long]).getOrElse(0L),
        isOurAddress = __fieldsMap.get(scalaDescriptor.findFieldByNumber(6).get).map(_.as[_root_.scala.Boolean]).getOrElse(false)
      )
    case _ => throw new RuntimeException("Expected PMessage")
  }
  def javaDescriptor: _root_.com.google.protobuf.Descriptors.Descriptor = LightningProto.javaDescriptor.getMessageTypes().get(7)
  def scalaDescriptor: _root_.scalapb.descriptors.Descriptor = LightningProto.scalaDescriptor.messages(7)
  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[_] = {
    (__fieldNumber: @_root_.scala.unchecked) match {
      case 1 => lnrpc.OutputScriptType
    }
  }
  lazy val defaultInstance = lnrpc.OutputDetail(
    outputType = lnrpc.OutputScriptType.SCRIPT_TYPE_PUBKEY_HASH,
    address = "",
    pkScript = "",
    outputIndex = 0L,
    amount = 0L,
    isOurAddress = false
  )
  implicit class OutputDetailLens[UpperPB](_l: _root_.scalapb.lenses.Lens[UpperPB, lnrpc.OutputDetail]) extends _root_.scalapb.lenses.ObjectLens[UpperPB, lnrpc.OutputDetail](_l) {
    def outputType: _root_.scalapb.lenses.Lens[UpperPB, lnrpc.OutputScriptType] = field(_.outputType)((c_, f_) => c_.copy(outputType = f_))
    def address: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.address)((c_, f_) => c_.copy(address = f_))
    def pkScript: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.pkScript)((c_, f_) => c_.copy(pkScript = f_))
    def outputIndex: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Long] = field(_.outputIndex)((c_, f_) => c_.copy(outputIndex = f_))
    def amount: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Long] = field(_.amount)((c_, f_) => c_.copy(amount = f_))
    def isOurAddress: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Boolean] = field(_.isOurAddress)((c_, f_) => c_.copy(isOurAddress = f_))
  }
  final val OUTPUT_TYPE_FIELD_NUMBER = 1
  final val ADDRESS_FIELD_NUMBER = 2
  final val PK_SCRIPT_FIELD_NUMBER = 3
  final val OUTPUT_INDEX_FIELD_NUMBER = 4
  final val AMOUNT_FIELD_NUMBER = 5
  final val IS_OUR_ADDRESS_FIELD_NUMBER = 6
  def of(
    outputType: lnrpc.OutputScriptType,
    address: _root_.scala.Predef.String,
    pkScript: _root_.scala.Predef.String,
    outputIndex: _root_.scala.Long,
    amount: _root_.scala.Long,
    isOurAddress: _root_.scala.Boolean
  ): _root_.lnrpc.OutputDetail = _root_.lnrpc.OutputDetail(
    outputType,
    address,
    pkScript,
    outputIndex,
    amount,
    isOurAddress
  )
  // @@protoc_insertion_point(GeneratedMessageCompanion[lnrpc.OutputDetail])
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy