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

walletrpc.AccountWithAddresses.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 name
  *   The name used to identify the account.
  * @param addressType
  *   The type of addresses the account supports.
  * @param derivationPath
  *  
  *  The derivation path corresponding to the account public key. This will
  *  always be empty for the default imported account in which single public keys
  *  are imported into.
  * @param addresses
  *  
  *  List of address, its type internal/external & balance.
  *  Note that the order of addresses will be random and not according to the
  *  derivation index, since that information is not stored by the underlying
  *  wallet.
  */
@SerialVersionUID(0L)
final case class AccountWithAddresses(
    name: _root_.scala.Predef.String = "",
    addressType: walletrpc.AddressType = walletrpc.AddressType.UNKNOWN,
    derivationPath: _root_.scala.Predef.String = "",
    addresses: _root_.scala.Seq[walletrpc.AddressProperty] = _root_.scala.Seq.empty,
    unknownFields: _root_.scalapb.UnknownFieldSet = _root_.scalapb.UnknownFieldSet.empty
    ) extends scalapb.GeneratedMessage with scalapb.lenses.Updatable[AccountWithAddresses] {
    @transient
    private[this] var __serializedSizeMemoized: _root_.scala.Int = 0
    private[this] def __computeSerializedSize(): _root_.scala.Int = {
      var __size = 0
      
      {
        val __value = name
        if (!__value.isEmpty) {
          __size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(1, __value)
        }
      };
      
      {
        val __value = addressType.value
        if (__value != 0) {
          __size += _root_.com.google.protobuf.CodedOutputStream.computeEnumSize(2, __value)
        }
      };
      
      {
        val __value = derivationPath
        if (!__value.isEmpty) {
          __size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(3, __value)
        }
      };
      addresses.foreach { __item =>
        val __value = __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 = {
      {
        val __v = name
        if (!__v.isEmpty) {
          _output__.writeString(1, __v)
        }
      };
      {
        val __v = addressType.value
        if (__v != 0) {
          _output__.writeEnum(2, __v)
        }
      };
      {
        val __v = derivationPath
        if (!__v.isEmpty) {
          _output__.writeString(3, __v)
        }
      };
      addresses.foreach { __v =>
        val __m = __v
        _output__.writeTag(4, 2)
        _output__.writeUInt32NoTag(__m.serializedSize)
        __m.writeTo(_output__)
      };
      unknownFields.writeTo(_output__)
    }
    def withName(__v: _root_.scala.Predef.String): AccountWithAddresses = copy(name = __v)
    def withAddressType(__v: walletrpc.AddressType): AccountWithAddresses = copy(addressType = __v)
    def withDerivationPath(__v: _root_.scala.Predef.String): AccountWithAddresses = copy(derivationPath = __v)
    def clearAddresses = copy(addresses = _root_.scala.Seq.empty)
    def addAddresses(__vs: walletrpc.AddressProperty *): AccountWithAddresses = addAllAddresses(__vs)
    def addAllAddresses(__vs: Iterable[walletrpc.AddressProperty]): AccountWithAddresses = copy(addresses = addresses ++ __vs)
    def withAddresses(__v: _root_.scala.Seq[walletrpc.AddressProperty]): AccountWithAddresses = copy(addresses = __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 = name
          if (__t != "") __t else null
        }
        case 2 => {
          val __t = addressType.javaValueDescriptor
          if (__t.getNumber() != 0) __t else null
        }
        case 3 => {
          val __t = derivationPath
          if (__t != "") __t else null
        }
        case 4 => addresses
      }
    }
    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(name)
        case 2 => _root_.scalapb.descriptors.PEnum(addressType.scalaValueDescriptor)
        case 3 => _root_.scalapb.descriptors.PString(derivationPath)
        case 4 => _root_.scalapb.descriptors.PRepeated(addresses.iterator.map(_.toPMessage).toVector)
      }
    }
    def toProtoString: _root_.scala.Predef.String = _root_.scalapb.TextFormat.printToUnicodeString(this)
    def companion: walletrpc.AccountWithAddresses.type = walletrpc.AccountWithAddresses
    // @@protoc_insertion_point(GeneratedMessage[walletrpc.AccountWithAddresses])
}

object AccountWithAddresses extends scalapb.GeneratedMessageCompanion[walletrpc.AccountWithAddresses] {
  implicit def messageCompanion: scalapb.GeneratedMessageCompanion[walletrpc.AccountWithAddresses] = this
  def parseFrom(`_input__`: _root_.com.google.protobuf.CodedInputStream): walletrpc.AccountWithAddresses = {
    var __name: _root_.scala.Predef.String = ""
    var __addressType: walletrpc.AddressType = walletrpc.AddressType.UNKNOWN
    var __derivationPath: _root_.scala.Predef.String = ""
    val __addresses: _root_.scala.collection.immutable.VectorBuilder[walletrpc.AddressProperty] = new _root_.scala.collection.immutable.VectorBuilder[walletrpc.AddressProperty]
    var `_unknownFields__`: _root_.scalapb.UnknownFieldSet.Builder = null
    var _done__ = false
    while (!_done__) {
      val _tag__ = _input__.readTag()
      _tag__ match {
        case 0 => _done__ = true
        case 10 =>
          __name = _input__.readStringRequireUtf8()
        case 16 =>
          __addressType = walletrpc.AddressType.fromValue(_input__.readEnum())
        case 26 =>
          __derivationPath = _input__.readStringRequireUtf8()
        case 34 =>
          __addresses += _root_.scalapb.LiteParser.readMessage[walletrpc.AddressProperty](_input__)
        case tag =>
          if (_unknownFields__ == null) {
            _unknownFields__ = new _root_.scalapb.UnknownFieldSet.Builder()
          }
          _unknownFields__.parseField(tag, _input__)
      }
    }
    walletrpc.AccountWithAddresses(
        name = __name,
        addressType = __addressType,
        derivationPath = __derivationPath,
        addresses = __addresses.result(),
        unknownFields = if (_unknownFields__ == null) _root_.scalapb.UnknownFieldSet.empty else _unknownFields__.result()
    )
  }
  implicit def messageReads: _root_.scalapb.descriptors.Reads[walletrpc.AccountWithAddresses] = _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.AccountWithAddresses(
        name = __fieldsMap.get(scalaDescriptor.findFieldByNumber(1).get).map(_.as[_root_.scala.Predef.String]).getOrElse(""),
        addressType = walletrpc.AddressType.fromValue(__fieldsMap.get(scalaDescriptor.findFieldByNumber(2).get).map(_.as[_root_.scalapb.descriptors.EnumValueDescriptor]).getOrElse(walletrpc.AddressType.UNKNOWN.scalaValueDescriptor).number),
        derivationPath = __fieldsMap.get(scalaDescriptor.findFieldByNumber(3).get).map(_.as[_root_.scala.Predef.String]).getOrElse(""),
        addresses = __fieldsMap.get(scalaDescriptor.findFieldByNumber(4).get).map(_.as[_root_.scala.Seq[walletrpc.AddressProperty]]).getOrElse(_root_.scala.Seq.empty)
      )
    case _ => throw new RuntimeException("Expected PMessage")
  }
  def javaDescriptor: _root_.com.google.protobuf.Descriptors.Descriptor = WalletkitProto.javaDescriptor.getMessageTypes().get(11)
  def scalaDescriptor: _root_.scalapb.descriptors.Descriptor = WalletkitProto.scalaDescriptor.messages(11)
  def messageCompanionForFieldNumber(__number: _root_.scala.Int): _root_.scalapb.GeneratedMessageCompanion[_] = {
    var __out: _root_.scalapb.GeneratedMessageCompanion[_] = null
    (__number: @_root_.scala.unchecked) match {
      case 4 => __out = walletrpc.AddressProperty
    }
    __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 2 => walletrpc.AddressType
    }
  }
  lazy val defaultInstance = walletrpc.AccountWithAddresses(
    name = "",
    addressType = walletrpc.AddressType.UNKNOWN,
    derivationPath = "",
    addresses = _root_.scala.Seq.empty
  )
  implicit class AccountWithAddressesLens[UpperPB](_l: _root_.scalapb.lenses.Lens[UpperPB, walletrpc.AccountWithAddresses]) extends _root_.scalapb.lenses.ObjectLens[UpperPB, walletrpc.AccountWithAddresses](_l) {
    def name: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.name)((c_, f_) => c_.copy(name = f_))
    def addressType: _root_.scalapb.lenses.Lens[UpperPB, walletrpc.AddressType] = field(_.addressType)((c_, f_) => c_.copy(addressType = f_))
    def derivationPath: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.derivationPath)((c_, f_) => c_.copy(derivationPath = f_))
    def addresses: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Seq[walletrpc.AddressProperty]] = field(_.addresses)((c_, f_) => c_.copy(addresses = f_))
  }
  final val NAME_FIELD_NUMBER = 1
  final val ADDRESS_TYPE_FIELD_NUMBER = 2
  final val DERIVATION_PATH_FIELD_NUMBER = 3
  final val ADDRESSES_FIELD_NUMBER = 4
  def of(
    name: _root_.scala.Predef.String,
    addressType: walletrpc.AddressType,
    derivationPath: _root_.scala.Predef.String,
    addresses: _root_.scala.Seq[walletrpc.AddressProperty]
  ): _root_.walletrpc.AccountWithAddresses = _root_.walletrpc.AccountWithAddresses(
    name,
    addressType,
    derivationPath,
    addresses
  )
  // @@protoc_insertion_point(GeneratedMessageCompanion[walletrpc.AccountWithAddresses])
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy