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

walletrpc.TxTemplate.scala Maven / Gradle / Ivy

The newest version!
// Generated by the Scala Plugin for the Protocol Buffer Compiler.
// Do not edit!
//
// Protofile syntax: PROTO3

package walletrpc

/** @param inputs
  *  
  *  An optional list of inputs to use. Every input must be an UTXO known to the
  *  wallet that has not been locked before. The sum of all inputs must be
  *  sufficiently greater than the sum of all outputs to pay a miner fee with the
  *  fee rate specified in the parent message.
  *  
  *  If no inputs are specified, coin selection will be performed instead and
  *  inputs of sufficient value will be added to the resulting PSBT.
  * @param outputs
  *  
  *  A map of all addresses and the amounts to send to in the funded PSBT.
  */
@SerialVersionUID(0L)
final case class TxTemplate(
    inputs: _root_.scala.Seq[lnrpc.OutPoint] = _root_.scala.Seq.empty,
    outputs: _root_.scala.collection.immutable.Map[_root_.scala.Predef.String, _root_.scala.Long] = _root_.scala.collection.immutable.Map.empty,
    unknownFields: _root_.scalapb.UnknownFieldSet = _root_.scalapb.UnknownFieldSet.empty
    ) extends scalapb.GeneratedMessage with scalapb.lenses.Updatable[TxTemplate] {
    @transient
    private[this] var __serializedSizeMemoized: _root_.scala.Int = 0
    private[this] def __computeSerializedSize(): _root_.scala.Int = {
      var __size = 0
      inputs.foreach { __item =>
        val __value = __item
        __size += 1 + _root_.com.google.protobuf.CodedOutputStream.computeUInt32SizeNoTag(__value.serializedSize) + __value.serializedSize
      }
      outputs.foreach { __item =>
        val __value = walletrpc.TxTemplate._typemapper_outputs.toBase(__item)
        __size += 1 + _root_.com.google.protobuf.CodedOutputStream.computeUInt32SizeNoTag(__value.serializedSize) + __value.serializedSize
      }
      __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 = {
      inputs.foreach { __v =>
        val __m = __v
        _output__.writeTag(1, 2)
        _output__.writeUInt32NoTag(__m.serializedSize)
        __m.writeTo(_output__)
      };
      outputs.foreach { __v =>
        val __m = walletrpc.TxTemplate._typemapper_outputs.toBase(__v)
        _output__.writeTag(2, 2)
        _output__.writeUInt32NoTag(__m.serializedSize)
        __m.writeTo(_output__)
      };
      unknownFields.writeTo(_output__)
    }
    def clearInputs = copy(inputs = _root_.scala.Seq.empty)
    def addInputs(__vs: lnrpc.OutPoint *): TxTemplate = addAllInputs(__vs)
    def addAllInputs(__vs: Iterable[lnrpc.OutPoint]): TxTemplate = copy(inputs = inputs ++ __vs)
    def withInputs(__v: _root_.scala.Seq[lnrpc.OutPoint]): TxTemplate = copy(inputs = __v)
    def clearOutputs = copy(outputs = _root_.scala.collection.immutable.Map.empty)
    def addOutputs(__vs: (_root_.scala.Predef.String, _root_.scala.Long) *): TxTemplate = addAllOutputs(__vs)
    def addAllOutputs(__vs: Iterable[(_root_.scala.Predef.String, _root_.scala.Long)]): TxTemplate = copy(outputs = outputs ++ __vs)
    def withOutputs(__v: _root_.scala.collection.immutable.Map[_root_.scala.Predef.String, _root_.scala.Long]): TxTemplate = copy(outputs = __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 => inputs
        case 2 => outputs.iterator.map(walletrpc.TxTemplate._typemapper_outputs.toBase(_)).toSeq
      }
    }
    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.PRepeated(inputs.iterator.map(_.toPMessage).toVector)
        case 2 => _root_.scalapb.descriptors.PRepeated(outputs.iterator.map(walletrpc.TxTemplate._typemapper_outputs.toBase(_).toPMessage).toVector)
      }
    }
    def toProtoString: _root_.scala.Predef.String = _root_.scalapb.TextFormat.printToUnicodeString(this)
    def companion: walletrpc.TxTemplate.type = walletrpc.TxTemplate
    // @@protoc_insertion_point(GeneratedMessage[walletrpc.TxTemplate])
}

object TxTemplate extends scalapb.GeneratedMessageCompanion[walletrpc.TxTemplate] {
  implicit def messageCompanion: scalapb.GeneratedMessageCompanion[walletrpc.TxTemplate] = this
  def parseFrom(`_input__`: _root_.com.google.protobuf.CodedInputStream): walletrpc.TxTemplate = {
    val __inputs: _root_.scala.collection.immutable.VectorBuilder[lnrpc.OutPoint] = new _root_.scala.collection.immutable.VectorBuilder[lnrpc.OutPoint]
    val __outputs: _root_.scala.collection.mutable.Builder[(_root_.scala.Predef.String, _root_.scala.Long), _root_.scala.collection.immutable.Map[_root_.scala.Predef.String, _root_.scala.Long]] = _root_.scala.collection.immutable.Map.newBuilder[_root_.scala.Predef.String, _root_.scala.Long]
    var `_unknownFields__`: _root_.scalapb.UnknownFieldSet.Builder = null
    var _done__ = false
    while (!_done__) {
      val _tag__ = _input__.readTag()
      _tag__ match {
        case 0 => _done__ = true
        case 10 =>
          __inputs += _root_.scalapb.LiteParser.readMessage[lnrpc.OutPoint](_input__)
        case 18 =>
          __outputs += walletrpc.TxTemplate._typemapper_outputs.toCustom(_root_.scalapb.LiteParser.readMessage[walletrpc.TxTemplate.OutputsEntry](_input__))
        case tag =>
          if (_unknownFields__ == null) {
            _unknownFields__ = new _root_.scalapb.UnknownFieldSet.Builder()
          }
          _unknownFields__.parseField(tag, _input__)
      }
    }
    walletrpc.TxTemplate(
        inputs = __inputs.result(),
        outputs = __outputs.result(),
        unknownFields = if (_unknownFields__ == null) _root_.scalapb.UnknownFieldSet.empty else _unknownFields__.result()
    )
  }
  implicit def messageReads: _root_.scalapb.descriptors.Reads[walletrpc.TxTemplate] = _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.")
      walletrpc.TxTemplate(
        inputs = __fieldsMap.get(scalaDescriptor.findFieldByNumber(1).get).map(_.as[_root_.scala.Seq[lnrpc.OutPoint]]).getOrElse(_root_.scala.Seq.empty),
        outputs = __fieldsMap.get(scalaDescriptor.findFieldByNumber(2).get).map(_.as[_root_.scala.Seq[walletrpc.TxTemplate.OutputsEntry]]).getOrElse(_root_.scala.Seq.empty).iterator.map(walletrpc.TxTemplate._typemapper_outputs.toCustom(_)).toMap
      )
    case _ => throw new RuntimeException("Expected PMessage")
  }
  def javaDescriptor: _root_.com.google.protobuf.Descriptors.Descriptor = WalletkitProto.javaDescriptor.getMessageTypes().get(48)
  def scalaDescriptor: _root_.scalapb.descriptors.Descriptor = WalletkitProto.scalaDescriptor.messages(48)
  def messageCompanionForFieldNumber(__number: _root_.scala.Int): _root_.scalapb.GeneratedMessageCompanion[_] = {
    var __out: _root_.scalapb.GeneratedMessageCompanion[_] = null
    (__number: @_root_.scala.unchecked) match {
      case 1 => __out = lnrpc.OutPoint
      case 2 => __out = walletrpc.TxTemplate.OutputsEntry
    }
    __out
  }
  lazy val nestedMessagesCompanions: Seq[_root_.scalapb.GeneratedMessageCompanion[_ <: _root_.scalapb.GeneratedMessage]] =
    Seq[_root_.scalapb.GeneratedMessageCompanion[_ <: _root_.scalapb.GeneratedMessage]](
      _root_.walletrpc.TxTemplate.OutputsEntry
    )
  def enumCompanionForFieldNumber(__fieldNumber: _root_.scala.Int): _root_.scalapb.GeneratedEnumCompanion[_] = throw new MatchError(__fieldNumber)
  lazy val defaultInstance = walletrpc.TxTemplate(
    inputs = _root_.scala.Seq.empty,
    outputs = _root_.scala.collection.immutable.Map.empty
  )
  @SerialVersionUID(0L)
  final case class OutputsEntry(
      key: _root_.scala.Predef.String = "",
      value: _root_.scala.Long = 0L,
      unknownFields: _root_.scalapb.UnknownFieldSet = _root_.scalapb.UnknownFieldSet.empty
      ) extends scalapb.GeneratedMessage with scalapb.lenses.Updatable[OutputsEntry] {
      @transient
      private[this] var __serializedSizeMemoized: _root_.scala.Int = 0
      private[this] def __computeSerializedSize(): _root_.scala.Int = {
        var __size = 0
        
        {
          val __value = key
          if (!__value.isEmpty) {
            __size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(1, __value)
          }
        };
        
        {
          val __value = value
          if (__value != 0L) {
            __size += _root_.com.google.protobuf.CodedOutputStream.computeUInt64Size(2, __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 = key
          if (!__v.isEmpty) {
            _output__.writeString(1, __v)
          }
        };
        {
          val __v = value
          if (__v != 0L) {
            _output__.writeUInt64(2, __v)
          }
        };
        unknownFields.writeTo(_output__)
      }
      def withKey(__v: _root_.scala.Predef.String): OutputsEntry = copy(key = __v)
      def withValue(__v: _root_.scala.Long): OutputsEntry = copy(value = __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 = key
            if (__t != "") __t else null
          }
          case 2 => {
            val __t = value
            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.PString(key)
          case 2 => _root_.scalapb.descriptors.PLong(value)
        }
      }
      def toProtoString: _root_.scala.Predef.String = _root_.scalapb.TextFormat.printToUnicodeString(this)
      def companion: walletrpc.TxTemplate.OutputsEntry.type = walletrpc.TxTemplate.OutputsEntry
      // @@protoc_insertion_point(GeneratedMessage[walletrpc.TxTemplate.OutputsEntry])
  }
  
  object OutputsEntry extends scalapb.GeneratedMessageCompanion[walletrpc.TxTemplate.OutputsEntry] {
    implicit def messageCompanion: scalapb.GeneratedMessageCompanion[walletrpc.TxTemplate.OutputsEntry] = this
    def parseFrom(`_input__`: _root_.com.google.protobuf.CodedInputStream): walletrpc.TxTemplate.OutputsEntry = {
      var __key: _root_.scala.Predef.String = ""
      var __value: _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 =>
            __key = _input__.readStringRequireUtf8()
          case 16 =>
            __value = _input__.readUInt64()
          case tag =>
            if (_unknownFields__ == null) {
              _unknownFields__ = new _root_.scalapb.UnknownFieldSet.Builder()
            }
            _unknownFields__.parseField(tag, _input__)
        }
      }
      walletrpc.TxTemplate.OutputsEntry(
          key = __key,
          value = __value,
          unknownFields = if (_unknownFields__ == null) _root_.scalapb.UnknownFieldSet.empty else _unknownFields__.result()
      )
    }
    implicit def messageReads: _root_.scalapb.descriptors.Reads[walletrpc.TxTemplate.OutputsEntry] = _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.")
        walletrpc.TxTemplate.OutputsEntry(
          key = __fieldsMap.get(scalaDescriptor.findFieldByNumber(1).get).map(_.as[_root_.scala.Predef.String]).getOrElse(""),
          value = __fieldsMap.get(scalaDescriptor.findFieldByNumber(2).get).map(_.as[_root_.scala.Long]).getOrElse(0L)
        )
      case _ => throw new RuntimeException("Expected PMessage")
    }
    def javaDescriptor: _root_.com.google.protobuf.Descriptors.Descriptor = walletrpc.TxTemplate.javaDescriptor.getNestedTypes().get(0)
    def scalaDescriptor: _root_.scalapb.descriptors.Descriptor = walletrpc.TxTemplate.scalaDescriptor.nestedMessages(0)
    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 = walletrpc.TxTemplate.OutputsEntry(
      key = "",
      value = 0L
    )
    implicit class OutputsEntryLens[UpperPB](_l: _root_.scalapb.lenses.Lens[UpperPB, walletrpc.TxTemplate.OutputsEntry]) extends _root_.scalapb.lenses.ObjectLens[UpperPB, walletrpc.TxTemplate.OutputsEntry](_l) {
      def key: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.key)((c_, f_) => c_.copy(key = f_))
      def value: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Long] = field(_.value)((c_, f_) => c_.copy(value = f_))
    }
    final val KEY_FIELD_NUMBER = 1
    final val VALUE_FIELD_NUMBER = 2
    @transient
    implicit val keyValueMapper: _root_.scalapb.TypeMapper[walletrpc.TxTemplate.OutputsEntry, (_root_.scala.Predef.String, _root_.scala.Long)] =
      _root_.scalapb.TypeMapper[walletrpc.TxTemplate.OutputsEntry, (_root_.scala.Predef.String, _root_.scala.Long)](__m => (__m.key, __m.value))(__p => walletrpc.TxTemplate.OutputsEntry(__p._1, __p._2))
    def of(
      key: _root_.scala.Predef.String,
      value: _root_.scala.Long
    ): _root_.walletrpc.TxTemplate.OutputsEntry = _root_.walletrpc.TxTemplate.OutputsEntry(
      key,
      value
    )
    // @@protoc_insertion_point(GeneratedMessageCompanion[walletrpc.TxTemplate.OutputsEntry])
  }
  
  implicit class TxTemplateLens[UpperPB](_l: _root_.scalapb.lenses.Lens[UpperPB, walletrpc.TxTemplate]) extends _root_.scalapb.lenses.ObjectLens[UpperPB, walletrpc.TxTemplate](_l) {
    def inputs: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Seq[lnrpc.OutPoint]] = field(_.inputs)((c_, f_) => c_.copy(inputs = f_))
    def outputs: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.collection.immutable.Map[_root_.scala.Predef.String, _root_.scala.Long]] = field(_.outputs)((c_, f_) => c_.copy(outputs = f_))
  }
  final val INPUTS_FIELD_NUMBER = 1
  final val OUTPUTS_FIELD_NUMBER = 2
  @transient
  private[walletrpc] val _typemapper_outputs: _root_.scalapb.TypeMapper[walletrpc.TxTemplate.OutputsEntry, (_root_.scala.Predef.String, _root_.scala.Long)] = implicitly[_root_.scalapb.TypeMapper[walletrpc.TxTemplate.OutputsEntry, (_root_.scala.Predef.String, _root_.scala.Long)]]
  def of(
    inputs: _root_.scala.Seq[lnrpc.OutPoint],
    outputs: _root_.scala.collection.immutable.Map[_root_.scala.Predef.String, _root_.scala.Long]
  ): _root_.walletrpc.TxTemplate = _root_.walletrpc.TxTemplate(
    inputs,
    outputs
  )
  // @@protoc_insertion_point(GeneratedMessageCompanion[walletrpc.TxTemplate])
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy