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

lnrpc.WatchOnlyAccount.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 purpose
  *  
  *  Purpose is the first number in the derivation path, must be either 49, 84
  *  or 1017.
  * @param coinType
  *  
  *  Coin type is the second number in the derivation path, this is _always_ 0
  *  for purposes 49 and 84. It only needs to be set to 1 for purpose 1017 on
  *  testnet or regtest.
  * @param account
  *  
  *  Account is the third number in the derivation path. For purposes 49 and 84
  *  at least the default account (index 0) needs to be created but optional
  *  additional accounts are allowed. For purpose 1017 there needs to be exactly
  *  one account for each of the key families defined in `keychain/derivation.go`
  *  (currently indices 0 to 9)
  * @param xpub
  *  
  *  The extended public key at depth 3 for the given account.
  */
@SerialVersionUID(0L)
final case class WatchOnlyAccount(
    purpose: org.bitcoins.core.number.UInt32 = lnrpc.WatchOnlyAccount._typemapper_purpose.toCustom(0),
    coinType: org.bitcoins.core.number.UInt32 = lnrpc.WatchOnlyAccount._typemapper_coinType.toCustom(0),
    account: org.bitcoins.core.number.UInt32 = lnrpc.WatchOnlyAccount._typemapper_account.toCustom(0),
    xpub: _root_.scala.Predef.String = "",
    unknownFields: _root_.scalapb.UnknownFieldSet = _root_.scalapb.UnknownFieldSet.empty
    ) extends scalapb.GeneratedMessage with scalapb.lenses.Updatable[WatchOnlyAccount] {
    @transient
    private[this] var __serializedSizeMemoized: _root_.scala.Int = 0
    private[this] def __computeSerializedSize(): _root_.scala.Int = {
      var __size = 0
      
      {
        val __value = lnrpc.WatchOnlyAccount._typemapper_purpose.toBase(purpose)
        if (__value != 0) {
          __size += _root_.com.google.protobuf.CodedOutputStream.computeUInt32Size(1, __value)
        }
      };
      
      {
        val __value = lnrpc.WatchOnlyAccount._typemapper_coinType.toBase(coinType)
        if (__value != 0) {
          __size += _root_.com.google.protobuf.CodedOutputStream.computeUInt32Size(2, __value)
        }
      };
      
      {
        val __value = lnrpc.WatchOnlyAccount._typemapper_account.toBase(account)
        if (__value != 0) {
          __size += _root_.com.google.protobuf.CodedOutputStream.computeUInt32Size(3, __value)
        }
      };
      
      {
        val __value = xpub
        if (!__value.isEmpty) {
          __size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(4, __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 = lnrpc.WatchOnlyAccount._typemapper_purpose.toBase(purpose)
        if (__v != 0) {
          _output__.writeUInt32(1, __v)
        }
      };
      {
        val __v = lnrpc.WatchOnlyAccount._typemapper_coinType.toBase(coinType)
        if (__v != 0) {
          _output__.writeUInt32(2, __v)
        }
      };
      {
        val __v = lnrpc.WatchOnlyAccount._typemapper_account.toBase(account)
        if (__v != 0) {
          _output__.writeUInt32(3, __v)
        }
      };
      {
        val __v = xpub
        if (!__v.isEmpty) {
          _output__.writeString(4, __v)
        }
      };
      unknownFields.writeTo(_output__)
    }
    def withPurpose(__v: org.bitcoins.core.number.UInt32): WatchOnlyAccount = copy(purpose = __v)
    def withCoinType(__v: org.bitcoins.core.number.UInt32): WatchOnlyAccount = copy(coinType = __v)
    def withAccount(__v: org.bitcoins.core.number.UInt32): WatchOnlyAccount = copy(account = __v)
    def withXpub(__v: _root_.scala.Predef.String): WatchOnlyAccount = copy(xpub = __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 = lnrpc.WatchOnlyAccount._typemapper_purpose.toBase(purpose)
          if (__t != 0) __t else null
        }
        case 2 => {
          val __t = lnrpc.WatchOnlyAccount._typemapper_coinType.toBase(coinType)
          if (__t != 0) __t else null
        }
        case 3 => {
          val __t = lnrpc.WatchOnlyAccount._typemapper_account.toBase(account)
          if (__t != 0) __t else null
        }
        case 4 => {
          val __t = xpub
          if (__t != "") __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.PInt(lnrpc.WatchOnlyAccount._typemapper_purpose.toBase(purpose))
        case 2 => _root_.scalapb.descriptors.PInt(lnrpc.WatchOnlyAccount._typemapper_coinType.toBase(coinType))
        case 3 => _root_.scalapb.descriptors.PInt(lnrpc.WatchOnlyAccount._typemapper_account.toBase(account))
        case 4 => _root_.scalapb.descriptors.PString(xpub)
      }
    }
    def toProtoString: _root_.scala.Predef.String = _root_.scalapb.TextFormat.printToUnicodeString(this)
    def companion: lnrpc.WatchOnlyAccount.type = lnrpc.WatchOnlyAccount
    // @@protoc_insertion_point(GeneratedMessage[lnrpc.WatchOnlyAccount])
}

object WatchOnlyAccount extends scalapb.GeneratedMessageCompanion[lnrpc.WatchOnlyAccount] {
  implicit def messageCompanion: scalapb.GeneratedMessageCompanion[lnrpc.WatchOnlyAccount] = this
  def parseFrom(`_input__`: _root_.com.google.protobuf.CodedInputStream): lnrpc.WatchOnlyAccount = {
    var __purpose: _root_.scala.Int = 0
    var __coinType: _root_.scala.Int = 0
    var __account: _root_.scala.Int = 0
    var __xpub: _root_.scala.Predef.String = ""
    var `_unknownFields__`: _root_.scalapb.UnknownFieldSet.Builder = null
    var _done__ = false
    while (!_done__) {
      val _tag__ = _input__.readTag()
      _tag__ match {
        case 0 => _done__ = true
        case 8 =>
          __purpose = _input__.readUInt32()
        case 16 =>
          __coinType = _input__.readUInt32()
        case 24 =>
          __account = _input__.readUInt32()
        case 34 =>
          __xpub = _input__.readStringRequireUtf8()
        case tag =>
          if (_unknownFields__ == null) {
            _unknownFields__ = new _root_.scalapb.UnknownFieldSet.Builder()
          }
          _unknownFields__.parseField(tag, _input__)
      }
    }
    lnrpc.WatchOnlyAccount(
        purpose = lnrpc.WatchOnlyAccount._typemapper_purpose.toCustom(__purpose),
        coinType = lnrpc.WatchOnlyAccount._typemapper_coinType.toCustom(__coinType),
        account = lnrpc.WatchOnlyAccount._typemapper_account.toCustom(__account),
        xpub = __xpub,
        unknownFields = if (_unknownFields__ == null) _root_.scalapb.UnknownFieldSet.empty else _unknownFields__.result()
    )
  }
  implicit def messageReads: _root_.scalapb.descriptors.Reads[lnrpc.WatchOnlyAccount] = _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.WatchOnlyAccount(
        purpose = lnrpc.WatchOnlyAccount._typemapper_purpose.toCustom(__fieldsMap.get(scalaDescriptor.findFieldByNumber(1).get).map(_.as[_root_.scala.Int]).getOrElse(0)),
        coinType = lnrpc.WatchOnlyAccount._typemapper_coinType.toCustom(__fieldsMap.get(scalaDescriptor.findFieldByNumber(2).get).map(_.as[_root_.scala.Int]).getOrElse(0)),
        account = lnrpc.WatchOnlyAccount._typemapper_account.toCustom(__fieldsMap.get(scalaDescriptor.findFieldByNumber(3).get).map(_.as[_root_.scala.Int]).getOrElse(0)),
        xpub = __fieldsMap.get(scalaDescriptor.findFieldByNumber(4).get).map(_.as[_root_.scala.Predef.String]).getOrElse("")
      )
    case _ => throw new RuntimeException("Expected PMessage")
  }
  def javaDescriptor: _root_.com.google.protobuf.Descriptors.Descriptor = WalletunlockerProto.javaDescriptor.getMessageTypes().get(5)
  def scalaDescriptor: _root_.scalapb.descriptors.Descriptor = WalletunlockerProto.scalaDescriptor.messages(5)
  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 = lnrpc.WatchOnlyAccount(
    purpose = lnrpc.WatchOnlyAccount._typemapper_purpose.toCustom(0),
    coinType = lnrpc.WatchOnlyAccount._typemapper_coinType.toCustom(0),
    account = lnrpc.WatchOnlyAccount._typemapper_account.toCustom(0),
    xpub = ""
  )
  implicit class WatchOnlyAccountLens[UpperPB](_l: _root_.scalapb.lenses.Lens[UpperPB, lnrpc.WatchOnlyAccount]) extends _root_.scalapb.lenses.ObjectLens[UpperPB, lnrpc.WatchOnlyAccount](_l) {
    def purpose: _root_.scalapb.lenses.Lens[UpperPB, org.bitcoins.core.number.UInt32] = field(_.purpose)((c_, f_) => c_.copy(purpose = f_))
    def coinType: _root_.scalapb.lenses.Lens[UpperPB, org.bitcoins.core.number.UInt32] = field(_.coinType)((c_, f_) => c_.copy(coinType = f_))
    def account: _root_.scalapb.lenses.Lens[UpperPB, org.bitcoins.core.number.UInt32] = field(_.account)((c_, f_) => c_.copy(account = f_))
    def xpub: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.xpub)((c_, f_) => c_.copy(xpub = f_))
  }
  final val PURPOSE_FIELD_NUMBER = 1
  final val COIN_TYPE_FIELD_NUMBER = 2
  final val ACCOUNT_FIELD_NUMBER = 3
  final val XPUB_FIELD_NUMBER = 4
  @transient
  private[lnrpc] val _typemapper_purpose: _root_.scalapb.TypeMapper[_root_.scala.Int, org.bitcoins.core.number.UInt32] = implicitly[_root_.scalapb.TypeMapper[_root_.scala.Int, org.bitcoins.core.number.UInt32]]
  @transient
  private[lnrpc] val _typemapper_coinType: _root_.scalapb.TypeMapper[_root_.scala.Int, org.bitcoins.core.number.UInt32] = implicitly[_root_.scalapb.TypeMapper[_root_.scala.Int, org.bitcoins.core.number.UInt32]]
  @transient
  private[lnrpc] val _typemapper_account: _root_.scalapb.TypeMapper[_root_.scala.Int, org.bitcoins.core.number.UInt32] = implicitly[_root_.scalapb.TypeMapper[_root_.scala.Int, org.bitcoins.core.number.UInt32]]
  def of(
    purpose: org.bitcoins.core.number.UInt32,
    coinType: org.bitcoins.core.number.UInt32,
    account: org.bitcoins.core.number.UInt32,
    xpub: _root_.scala.Predef.String
  ): _root_.lnrpc.WatchOnlyAccount = _root_.lnrpc.WatchOnlyAccount(
    purpose,
    coinType,
    account,
    xpub
  )
  // @@protoc_insertion_point(GeneratedMessageCompanion[lnrpc.WatchOnlyAccount])
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy