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

walletrpc.FundPsbtRequest.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 account
  *  
  *  The name of the account to fund the PSBT with. If empty, the default wallet
  *  account is used.
  * @param minConfs
  *   The minimum number of confirmations each one of your outputs used for
  *   the transaction must satisfy.
  * @param spendUnconfirmed
  *   Whether unconfirmed outputs should be used as inputs for the transaction.
  * @param changeType
  *   The address type for the change. If empty, P2WPKH addresses will be used
  *   for default accounts and single imported public keys. For custom
  *   accounts, no change type should be provided as the coin selection key
  *   scope will always be used to generate the change address.
  */
@SerialVersionUID(0L)
final case class FundPsbtRequest(
    template: walletrpc.FundPsbtRequest.Template = walletrpc.FundPsbtRequest.Template.Empty,
    fees: walletrpc.FundPsbtRequest.Fees = walletrpc.FundPsbtRequest.Fees.Empty,
    account: _root_.scala.Predef.String = "",
    minConfs: _root_.scala.Int = 0,
    spendUnconfirmed: _root_.scala.Boolean = false,
    changeType: walletrpc.ChangeAddressType = walletrpc.ChangeAddressType.CHANGE_ADDRESS_TYPE_UNSPECIFIED,
    unknownFields: _root_.scalapb.UnknownFieldSet = _root_.scalapb.UnknownFieldSet.empty
    ) extends scalapb.GeneratedMessage with scalapb.lenses.Updatable[FundPsbtRequest] {
    @transient
    private[this] var __serializedSizeMemoized: _root_.scala.Int = 0
    private[this] def __computeSerializedSize(): _root_.scala.Int = {
      var __size = 0
      if (template.psbt.isDefined) {
        val __value = template.psbt.get
        __size += _root_.com.google.protobuf.CodedOutputStream.computeBytesSize(1, __value)
      };
      if (template.raw.isDefined) {
        val __value = template.raw.get
        __size += 1 + _root_.com.google.protobuf.CodedOutputStream.computeUInt32SizeNoTag(__value.serializedSize) + __value.serializedSize
      };
      if (fees.targetConf.isDefined) {
        val __value = fees.targetConf.get
        __size += _root_.com.google.protobuf.CodedOutputStream.computeUInt32Size(3, __value)
      };
      if (fees.satPerVbyte.isDefined) {
        val __value = fees.satPerVbyte.get
        __size += _root_.com.google.protobuf.CodedOutputStream.computeUInt64Size(4, __value)
      };
      
      {
        val __value = account
        if (!__value.isEmpty) {
          __size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(5, __value)
        }
      };
      
      {
        val __value = minConfs
        if (__value != 0) {
          __size += _root_.com.google.protobuf.CodedOutputStream.computeInt32Size(6, __value)
        }
      };
      
      {
        val __value = spendUnconfirmed
        if (__value != false) {
          __size += _root_.com.google.protobuf.CodedOutputStream.computeBoolSize(7, __value)
        }
      };
      
      {
        val __value = changeType.value
        if (__value != 0) {
          __size += _root_.com.google.protobuf.CodedOutputStream.computeEnumSize(8, __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 = {
      template.psbt.foreach { __v =>
        val __m = __v
        _output__.writeBytes(1, __m)
      };
      template.raw.foreach { __v =>
        val __m = __v
        _output__.writeTag(2, 2)
        _output__.writeUInt32NoTag(__m.serializedSize)
        __m.writeTo(_output__)
      };
      fees.targetConf.foreach { __v =>
        val __m = __v
        _output__.writeUInt32(3, __m)
      };
      fees.satPerVbyte.foreach { __v =>
        val __m = __v
        _output__.writeUInt64(4, __m)
      };
      {
        val __v = account
        if (!__v.isEmpty) {
          _output__.writeString(5, __v)
        }
      };
      {
        val __v = minConfs
        if (__v != 0) {
          _output__.writeInt32(6, __v)
        }
      };
      {
        val __v = spendUnconfirmed
        if (__v != false) {
          _output__.writeBool(7, __v)
        }
      };
      {
        val __v = changeType.value
        if (__v != 0) {
          _output__.writeEnum(8, __v)
        }
      };
      unknownFields.writeTo(_output__)
    }
    def getPsbt: _root_.com.google.protobuf.ByteString = template.psbt.getOrElse(_root_.com.google.protobuf.ByteString.EMPTY)
    def withPsbt(__v: _root_.com.google.protobuf.ByteString): FundPsbtRequest = copy(template = walletrpc.FundPsbtRequest.Template.Psbt(__v))
    def getRaw: walletrpc.TxTemplate = template.raw.getOrElse(walletrpc.TxTemplate.defaultInstance)
    def withRaw(__v: walletrpc.TxTemplate): FundPsbtRequest = copy(template = walletrpc.FundPsbtRequest.Template.Raw(__v))
    def getTargetConf: _root_.scala.Int = fees.targetConf.getOrElse(0)
    def withTargetConf(__v: _root_.scala.Int): FundPsbtRequest = copy(fees = walletrpc.FundPsbtRequest.Fees.TargetConf(__v))
    def getSatPerVbyte: _root_.scala.Long = fees.satPerVbyte.getOrElse(0L)
    def withSatPerVbyte(__v: _root_.scala.Long): FundPsbtRequest = copy(fees = walletrpc.FundPsbtRequest.Fees.SatPerVbyte(__v))
    def withAccount(__v: _root_.scala.Predef.String): FundPsbtRequest = copy(account = __v)
    def withMinConfs(__v: _root_.scala.Int): FundPsbtRequest = copy(minConfs = __v)
    def withSpendUnconfirmed(__v: _root_.scala.Boolean): FundPsbtRequest = copy(spendUnconfirmed = __v)
    def withChangeType(__v: walletrpc.ChangeAddressType): FundPsbtRequest = copy(changeType = __v)
    def clearTemplate: FundPsbtRequest = copy(template = walletrpc.FundPsbtRequest.Template.Empty)
    def withTemplate(__v: walletrpc.FundPsbtRequest.Template): FundPsbtRequest = copy(template = __v)
    def clearFees: FundPsbtRequest = copy(fees = walletrpc.FundPsbtRequest.Fees.Empty)
    def withFees(__v: walletrpc.FundPsbtRequest.Fees): FundPsbtRequest = copy(fees = __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 => template.psbt.orNull
        case 2 => template.raw.orNull
        case 3 => fees.targetConf.orNull
        case 4 => fees.satPerVbyte.orNull
        case 5 => {
          val __t = account
          if (__t != "") __t else null
        }
        case 6 => {
          val __t = minConfs
          if (__t != 0) __t else null
        }
        case 7 => {
          val __t = spendUnconfirmed
          if (__t != false) __t else null
        }
        case 8 => {
          val __t = changeType.javaValueDescriptor
          if (__t.getNumber() != 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 => template.psbt.map(_root_.scalapb.descriptors.PByteString(_)).getOrElse(_root_.scalapb.descriptors.PEmpty)
        case 2 => template.raw.map(_.toPMessage).getOrElse(_root_.scalapb.descriptors.PEmpty)
        case 3 => fees.targetConf.map(_root_.scalapb.descriptors.PInt(_)).getOrElse(_root_.scalapb.descriptors.PEmpty)
        case 4 => fees.satPerVbyte.map(_root_.scalapb.descriptors.PLong(_)).getOrElse(_root_.scalapb.descriptors.PEmpty)
        case 5 => _root_.scalapb.descriptors.PString(account)
        case 6 => _root_.scalapb.descriptors.PInt(minConfs)
        case 7 => _root_.scalapb.descriptors.PBoolean(spendUnconfirmed)
        case 8 => _root_.scalapb.descriptors.PEnum(changeType.scalaValueDescriptor)
      }
    }
    def toProtoString: _root_.scala.Predef.String = _root_.scalapb.TextFormat.printToUnicodeString(this)
    def companion: walletrpc.FundPsbtRequest.type = walletrpc.FundPsbtRequest
    // @@protoc_insertion_point(GeneratedMessage[walletrpc.FundPsbtRequest])
}

object FundPsbtRequest extends scalapb.GeneratedMessageCompanion[walletrpc.FundPsbtRequest] {
  implicit def messageCompanion: scalapb.GeneratedMessageCompanion[walletrpc.FundPsbtRequest] = this
  def parseFrom(`_input__`: _root_.com.google.protobuf.CodedInputStream): walletrpc.FundPsbtRequest = {
    var __account: _root_.scala.Predef.String = ""
    var __minConfs: _root_.scala.Int = 0
    var __spendUnconfirmed: _root_.scala.Boolean = false
    var __changeType: walletrpc.ChangeAddressType = walletrpc.ChangeAddressType.CHANGE_ADDRESS_TYPE_UNSPECIFIED
    var __template: walletrpc.FundPsbtRequest.Template = walletrpc.FundPsbtRequest.Template.Empty
    var __fees: walletrpc.FundPsbtRequest.Fees = walletrpc.FundPsbtRequest.Fees.Empty
    var `_unknownFields__`: _root_.scalapb.UnknownFieldSet.Builder = null
    var _done__ = false
    while (!_done__) {
      val _tag__ = _input__.readTag()
      _tag__ match {
        case 0 => _done__ = true
        case 10 =>
          __template = walletrpc.FundPsbtRequest.Template.Psbt(_input__.readBytes())
        case 18 =>
          __template = walletrpc.FundPsbtRequest.Template.Raw(__template.raw.fold(_root_.scalapb.LiteParser.readMessage[walletrpc.TxTemplate](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _)))
        case 24 =>
          __fees = walletrpc.FundPsbtRequest.Fees.TargetConf(_input__.readUInt32())
        case 32 =>
          __fees = walletrpc.FundPsbtRequest.Fees.SatPerVbyte(_input__.readUInt64())
        case 42 =>
          __account = _input__.readStringRequireUtf8()
        case 48 =>
          __minConfs = _input__.readInt32()
        case 56 =>
          __spendUnconfirmed = _input__.readBool()
        case 64 =>
          __changeType = walletrpc.ChangeAddressType.fromValue(_input__.readEnum())
        case tag =>
          if (_unknownFields__ == null) {
            _unknownFields__ = new _root_.scalapb.UnknownFieldSet.Builder()
          }
          _unknownFields__.parseField(tag, _input__)
      }
    }
    walletrpc.FundPsbtRequest(
        account = __account,
        minConfs = __minConfs,
        spendUnconfirmed = __spendUnconfirmed,
        changeType = __changeType,
        template = __template,
        fees = __fees,
        unknownFields = if (_unknownFields__ == null) _root_.scalapb.UnknownFieldSet.empty else _unknownFields__.result()
    )
  }
  implicit def messageReads: _root_.scalapb.descriptors.Reads[walletrpc.FundPsbtRequest] = _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.FundPsbtRequest(
        account = __fieldsMap.get(scalaDescriptor.findFieldByNumber(5).get).map(_.as[_root_.scala.Predef.String]).getOrElse(""),
        minConfs = __fieldsMap.get(scalaDescriptor.findFieldByNumber(6).get).map(_.as[_root_.scala.Int]).getOrElse(0),
        spendUnconfirmed = __fieldsMap.get(scalaDescriptor.findFieldByNumber(7).get).map(_.as[_root_.scala.Boolean]).getOrElse(false),
        changeType = walletrpc.ChangeAddressType.fromValue(__fieldsMap.get(scalaDescriptor.findFieldByNumber(8).get).map(_.as[_root_.scalapb.descriptors.EnumValueDescriptor]).getOrElse(walletrpc.ChangeAddressType.CHANGE_ADDRESS_TYPE_UNSPECIFIED.scalaValueDescriptor).number),
        template = __fieldsMap.get(scalaDescriptor.findFieldByNumber(1).get).flatMap(_.as[_root_.scala.Option[_root_.com.google.protobuf.ByteString]]).map(walletrpc.FundPsbtRequest.Template.Psbt(_))
            .orElse[walletrpc.FundPsbtRequest.Template](__fieldsMap.get(scalaDescriptor.findFieldByNumber(2).get).flatMap(_.as[_root_.scala.Option[walletrpc.TxTemplate]]).map(walletrpc.FundPsbtRequest.Template.Raw(_)))
            .getOrElse(walletrpc.FundPsbtRequest.Template.Empty),
        fees = __fieldsMap.get(scalaDescriptor.findFieldByNumber(3).get).flatMap(_.as[_root_.scala.Option[_root_.scala.Int]]).map(walletrpc.FundPsbtRequest.Fees.TargetConf(_))
            .orElse[walletrpc.FundPsbtRequest.Fees](__fieldsMap.get(scalaDescriptor.findFieldByNumber(4).get).flatMap(_.as[_root_.scala.Option[_root_.scala.Long]]).map(walletrpc.FundPsbtRequest.Fees.SatPerVbyte(_)))
            .getOrElse(walletrpc.FundPsbtRequest.Fees.Empty)
      )
    case _ => throw new RuntimeException("Expected PMessage")
  }
  def javaDescriptor: _root_.com.google.protobuf.Descriptors.Descriptor = WalletkitProto.javaDescriptor.getMessageTypes().get(46)
  def scalaDescriptor: _root_.scalapb.descriptors.Descriptor = WalletkitProto.scalaDescriptor.messages(46)
  def messageCompanionForFieldNumber(__number: _root_.scala.Int): _root_.scalapb.GeneratedMessageCompanion[_] = {
    var __out: _root_.scalapb.GeneratedMessageCompanion[_] = null
    (__number: @_root_.scala.unchecked) match {
      case 2 => __out = walletrpc.TxTemplate
    }
    __out
  }
  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 8 => walletrpc.ChangeAddressType
    }
  }
  lazy val defaultInstance = walletrpc.FundPsbtRequest(
    account = "",
    minConfs = 0,
    spendUnconfirmed = false,
    changeType = walletrpc.ChangeAddressType.CHANGE_ADDRESS_TYPE_UNSPECIFIED,
    template = walletrpc.FundPsbtRequest.Template.Empty,
    fees = walletrpc.FundPsbtRequest.Fees.Empty
  )
  sealed trait Template extends _root_.scalapb.GeneratedOneof {
    def isEmpty: _root_.scala.Boolean = false
    def isDefined: _root_.scala.Boolean = true
    def isPsbt: _root_.scala.Boolean = false
    def isRaw: _root_.scala.Boolean = false
    def psbt: _root_.scala.Option[_root_.com.google.protobuf.ByteString] = _root_.scala.None
    def raw: _root_.scala.Option[walletrpc.TxTemplate] = _root_.scala.None
  }
  object Template {
    @SerialVersionUID(0L)
    case object Empty extends walletrpc.FundPsbtRequest.Template {
      type ValueType = _root_.scala.Nothing
      override def isEmpty: _root_.scala.Boolean = true
      override def isDefined: _root_.scala.Boolean = false
      override def number: _root_.scala.Int = 0
      override def value: _root_.scala.Nothing = throw new java.util.NoSuchElementException("Empty.value")
    }
  
    @SerialVersionUID(0L)
    final case class Psbt(value: _root_.com.google.protobuf.ByteString) extends walletrpc.FundPsbtRequest.Template {
      type ValueType = _root_.com.google.protobuf.ByteString
      override def isPsbt: _root_.scala.Boolean = true
      override def psbt: _root_.scala.Option[_root_.com.google.protobuf.ByteString] = Some(value)
      override def number: _root_.scala.Int = 1
    }
    @SerialVersionUID(0L)
    final case class Raw(value: walletrpc.TxTemplate) extends walletrpc.FundPsbtRequest.Template {
      type ValueType = walletrpc.TxTemplate
      override def isRaw: _root_.scala.Boolean = true
      override def raw: _root_.scala.Option[walletrpc.TxTemplate] = Some(value)
      override def number: _root_.scala.Int = 2
    }
  }
  sealed trait Fees extends _root_.scalapb.GeneratedOneof {
    def isEmpty: _root_.scala.Boolean = false
    def isDefined: _root_.scala.Boolean = true
    def isTargetConf: _root_.scala.Boolean = false
    def isSatPerVbyte: _root_.scala.Boolean = false
    def targetConf: _root_.scala.Option[_root_.scala.Int] = _root_.scala.None
    def satPerVbyte: _root_.scala.Option[_root_.scala.Long] = _root_.scala.None
  }
  object Fees {
    @SerialVersionUID(0L)
    case object Empty extends walletrpc.FundPsbtRequest.Fees {
      type ValueType = _root_.scala.Nothing
      override def isEmpty: _root_.scala.Boolean = true
      override def isDefined: _root_.scala.Boolean = false
      override def number: _root_.scala.Int = 0
      override def value: _root_.scala.Nothing = throw new java.util.NoSuchElementException("Empty.value")
    }
  
    @SerialVersionUID(0L)
    final case class TargetConf(value: _root_.scala.Int) extends walletrpc.FundPsbtRequest.Fees {
      type ValueType = _root_.scala.Int
      override def isTargetConf: _root_.scala.Boolean = true
      override def targetConf: _root_.scala.Option[_root_.scala.Int] = Some(value)
      override def number: _root_.scala.Int = 3
    }
    @SerialVersionUID(0L)
    final case class SatPerVbyte(value: _root_.scala.Long) extends walletrpc.FundPsbtRequest.Fees {
      type ValueType = _root_.scala.Long
      override def isSatPerVbyte: _root_.scala.Boolean = true
      override def satPerVbyte: _root_.scala.Option[_root_.scala.Long] = Some(value)
      override def number: _root_.scala.Int = 4
    }
  }
  implicit class FundPsbtRequestLens[UpperPB](_l: _root_.scalapb.lenses.Lens[UpperPB, walletrpc.FundPsbtRequest]) extends _root_.scalapb.lenses.ObjectLens[UpperPB, walletrpc.FundPsbtRequest](_l) {
    def psbt: _root_.scalapb.lenses.Lens[UpperPB, _root_.com.google.protobuf.ByteString] = field(_.getPsbt)((c_, f_) => c_.copy(template = walletrpc.FundPsbtRequest.Template.Psbt(f_)))
    def raw: _root_.scalapb.lenses.Lens[UpperPB, walletrpc.TxTemplate] = field(_.getRaw)((c_, f_) => c_.copy(template = walletrpc.FundPsbtRequest.Template.Raw(f_)))
    def targetConf: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Int] = field(_.getTargetConf)((c_, f_) => c_.copy(fees = walletrpc.FundPsbtRequest.Fees.TargetConf(f_)))
    def satPerVbyte: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Long] = field(_.getSatPerVbyte)((c_, f_) => c_.copy(fees = walletrpc.FundPsbtRequest.Fees.SatPerVbyte(f_)))
    def account: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.account)((c_, f_) => c_.copy(account = f_))
    def minConfs: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Int] = field(_.minConfs)((c_, f_) => c_.copy(minConfs = f_))
    def spendUnconfirmed: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Boolean] = field(_.spendUnconfirmed)((c_, f_) => c_.copy(spendUnconfirmed = f_))
    def changeType: _root_.scalapb.lenses.Lens[UpperPB, walletrpc.ChangeAddressType] = field(_.changeType)((c_, f_) => c_.copy(changeType = f_))
    def template: _root_.scalapb.lenses.Lens[UpperPB, walletrpc.FundPsbtRequest.Template] = field(_.template)((c_, f_) => c_.copy(template = f_))
    def fees: _root_.scalapb.lenses.Lens[UpperPB, walletrpc.FundPsbtRequest.Fees] = field(_.fees)((c_, f_) => c_.copy(fees = f_))
  }
  final val PSBT_FIELD_NUMBER = 1
  final val RAW_FIELD_NUMBER = 2
  final val TARGET_CONF_FIELD_NUMBER = 3
  final val SAT_PER_VBYTE_FIELD_NUMBER = 4
  final val ACCOUNT_FIELD_NUMBER = 5
  final val MIN_CONFS_FIELD_NUMBER = 6
  final val SPEND_UNCONFIRMED_FIELD_NUMBER = 7
  final val CHANGE_TYPE_FIELD_NUMBER = 8
  def of(
    template: walletrpc.FundPsbtRequest.Template,
    fees: walletrpc.FundPsbtRequest.Fees,
    account: _root_.scala.Predef.String,
    minConfs: _root_.scala.Int,
    spendUnconfirmed: _root_.scala.Boolean,
    changeType: walletrpc.ChangeAddressType
  ): _root_.walletrpc.FundPsbtRequest = _root_.walletrpc.FundPsbtRequest(
    template,
    fees,
    account,
    minConfs,
    spendUnconfirmed,
    changeType
  )
  // @@protoc_insertion_point(GeneratedMessageCompanion[walletrpc.FundPsbtRequest])
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy