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

lnrpc.WatchOnly.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 masterKeyBirthdayTimestamp
  *  
  *  The unix timestamp in seconds of when the master key was created. lnd will
  *  only start scanning for funds in blocks that are after the birthday which
  *  can speed up the process significantly. If the birthday is not known, this
  *  should be left at its default value of 0 in which case lnd will start
  *  scanning from the first SegWit block (481824 on mainnet).
  * @param masterKeyFingerprint
  *  
  *  The fingerprint of the root key (also known as the key with derivation path
  *  m/) from which the account public keys were derived from. This may be
  *  required by some hardware wallets for proper identification and signing. The
  *  bytes must be in big-endian order.
  * @param accounts
  *  
  *  The list of accounts to import. There _must_ be an account for all of lnd's
  *  main key scopes: BIP49/BIP84 (m/49'/0'/0', m/84'/0'/0', note that the
  *  coin type is always 0, even for testnet/regtest) and lnd's internal key
  *  scope (m/1017'/<coin_type>'/<account>'), where account is the key family as
  *  defined in `keychain/derivation.go` (currently indices 0 to 9).
  */
@SerialVersionUID(0L)
final case class WatchOnly(
    masterKeyBirthdayTimestamp: org.bitcoins.core.number.UInt64 = lnrpc.WatchOnly._typemapper_masterKeyBirthdayTimestamp.toCustom(0L),
    masterKeyFingerprint: _root_.com.google.protobuf.ByteString = _root_.com.google.protobuf.ByteString.EMPTY,
    accounts: _root_.scala.Seq[lnrpc.WatchOnlyAccount] = _root_.scala.Seq.empty,
    unknownFields: _root_.scalapb.UnknownFieldSet = _root_.scalapb.UnknownFieldSet.empty
    ) extends scalapb.GeneratedMessage with scalapb.lenses.Updatable[WatchOnly] {
    @transient
    private[this] var __serializedSizeMemoized: _root_.scala.Int = 0
    private[this] def __computeSerializedSize(): _root_.scala.Int = {
      var __size = 0
      
      {
        val __value = lnrpc.WatchOnly._typemapper_masterKeyBirthdayTimestamp.toBase(masterKeyBirthdayTimestamp)
        if (__value != 0L) {
          __size += _root_.com.google.protobuf.CodedOutputStream.computeUInt64Size(1, __value)
        }
      };
      
      {
        val __value = masterKeyFingerprint
        if (!__value.isEmpty) {
          __size += _root_.com.google.protobuf.CodedOutputStream.computeBytesSize(2, __value)
        }
      };
      accounts.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 = lnrpc.WatchOnly._typemapper_masterKeyBirthdayTimestamp.toBase(masterKeyBirthdayTimestamp)
        if (__v != 0L) {
          _output__.writeUInt64(1, __v)
        }
      };
      {
        val __v = masterKeyFingerprint
        if (!__v.isEmpty) {
          _output__.writeBytes(2, __v)
        }
      };
      accounts.foreach { __v =>
        val __m = __v
        _output__.writeTag(3, 2)
        _output__.writeUInt32NoTag(__m.serializedSize)
        __m.writeTo(_output__)
      };
      unknownFields.writeTo(_output__)
    }
    def withMasterKeyBirthdayTimestamp(__v: org.bitcoins.core.number.UInt64): WatchOnly = copy(masterKeyBirthdayTimestamp = __v)
    def withMasterKeyFingerprint(__v: _root_.com.google.protobuf.ByteString): WatchOnly = copy(masterKeyFingerprint = __v)
    def clearAccounts = copy(accounts = _root_.scala.Seq.empty)
    def addAccounts(__vs: lnrpc.WatchOnlyAccount *): WatchOnly = addAllAccounts(__vs)
    def addAllAccounts(__vs: Iterable[lnrpc.WatchOnlyAccount]): WatchOnly = copy(accounts = accounts ++ __vs)
    def withAccounts(__v: _root_.scala.Seq[lnrpc.WatchOnlyAccount]): WatchOnly = copy(accounts = __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.WatchOnly._typemapper_masterKeyBirthdayTimestamp.toBase(masterKeyBirthdayTimestamp)
          if (__t != 0L) __t else null
        }
        case 2 => {
          val __t = masterKeyFingerprint
          if (__t != _root_.com.google.protobuf.ByteString.EMPTY) __t else null
        }
        case 3 => accounts
      }
    }
    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.PLong(lnrpc.WatchOnly._typemapper_masterKeyBirthdayTimestamp.toBase(masterKeyBirthdayTimestamp))
        case 2 => _root_.scalapb.descriptors.PByteString(masterKeyFingerprint)
        case 3 => _root_.scalapb.descriptors.PRepeated(accounts.iterator.map(_.toPMessage).toVector)
      }
    }
    def toProtoString: _root_.scala.Predef.String = _root_.scalapb.TextFormat.printToUnicodeString(this)
    def companion: lnrpc.WatchOnly.type = lnrpc.WatchOnly
    // @@protoc_insertion_point(GeneratedMessage[lnrpc.WatchOnly])
}

object WatchOnly extends scalapb.GeneratedMessageCompanion[lnrpc.WatchOnly] {
  implicit def messageCompanion: scalapb.GeneratedMessageCompanion[lnrpc.WatchOnly] = this
  def parseFrom(`_input__`: _root_.com.google.protobuf.CodedInputStream): lnrpc.WatchOnly = {
    var __masterKeyBirthdayTimestamp: _root_.scala.Long = 0L
    var __masterKeyFingerprint: _root_.com.google.protobuf.ByteString = _root_.com.google.protobuf.ByteString.EMPTY
    val __accounts: _root_.scala.collection.immutable.VectorBuilder[lnrpc.WatchOnlyAccount] = new _root_.scala.collection.immutable.VectorBuilder[lnrpc.WatchOnlyAccount]
    var `_unknownFields__`: _root_.scalapb.UnknownFieldSet.Builder = null
    var _done__ = false
    while (!_done__) {
      val _tag__ = _input__.readTag()
      _tag__ match {
        case 0 => _done__ = true
        case 8 =>
          __masterKeyBirthdayTimestamp = _input__.readUInt64()
        case 18 =>
          __masterKeyFingerprint = _input__.readBytes()
        case 26 =>
          __accounts += _root_.scalapb.LiteParser.readMessage[lnrpc.WatchOnlyAccount](_input__)
        case tag =>
          if (_unknownFields__ == null) {
            _unknownFields__ = new _root_.scalapb.UnknownFieldSet.Builder()
          }
          _unknownFields__.parseField(tag, _input__)
      }
    }
    lnrpc.WatchOnly(
        masterKeyBirthdayTimestamp = lnrpc.WatchOnly._typemapper_masterKeyBirthdayTimestamp.toCustom(__masterKeyBirthdayTimestamp),
        masterKeyFingerprint = __masterKeyFingerprint,
        accounts = __accounts.result(),
        unknownFields = if (_unknownFields__ == null) _root_.scalapb.UnknownFieldSet.empty else _unknownFields__.result()
    )
  }
  implicit def messageReads: _root_.scalapb.descriptors.Reads[lnrpc.WatchOnly] = _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.WatchOnly(
        masterKeyBirthdayTimestamp = lnrpc.WatchOnly._typemapper_masterKeyBirthdayTimestamp.toCustom(__fieldsMap.get(scalaDescriptor.findFieldByNumber(1).get).map(_.as[_root_.scala.Long]).getOrElse(0L)),
        masterKeyFingerprint = __fieldsMap.get(scalaDescriptor.findFieldByNumber(2).get).map(_.as[_root_.com.google.protobuf.ByteString]).getOrElse(_root_.com.google.protobuf.ByteString.EMPTY),
        accounts = __fieldsMap.get(scalaDescriptor.findFieldByNumber(3).get).map(_.as[_root_.scala.Seq[lnrpc.WatchOnlyAccount]]).getOrElse(_root_.scala.Seq.empty)
      )
    case _ => throw new RuntimeException("Expected PMessage")
  }
  def javaDescriptor: _root_.com.google.protobuf.Descriptors.Descriptor = WalletunlockerProto.javaDescriptor.getMessageTypes().get(4)
  def scalaDescriptor: _root_.scalapb.descriptors.Descriptor = WalletunlockerProto.scalaDescriptor.messages(4)
  def messageCompanionForFieldNumber(__number: _root_.scala.Int): _root_.scalapb.GeneratedMessageCompanion[_] = {
    var __out: _root_.scalapb.GeneratedMessageCompanion[_] = null
    (__number: @_root_.scala.unchecked) match {
      case 3 => __out = lnrpc.WatchOnlyAccount
    }
    __out
  }
  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.WatchOnly(
    masterKeyBirthdayTimestamp = lnrpc.WatchOnly._typemapper_masterKeyBirthdayTimestamp.toCustom(0L),
    masterKeyFingerprint = _root_.com.google.protobuf.ByteString.EMPTY,
    accounts = _root_.scala.Seq.empty
  )
  implicit class WatchOnlyLens[UpperPB](_l: _root_.scalapb.lenses.Lens[UpperPB, lnrpc.WatchOnly]) extends _root_.scalapb.lenses.ObjectLens[UpperPB, lnrpc.WatchOnly](_l) {
    def masterKeyBirthdayTimestamp: _root_.scalapb.lenses.Lens[UpperPB, org.bitcoins.core.number.UInt64] = field(_.masterKeyBirthdayTimestamp)((c_, f_) => c_.copy(masterKeyBirthdayTimestamp = f_))
    def masterKeyFingerprint: _root_.scalapb.lenses.Lens[UpperPB, _root_.com.google.protobuf.ByteString] = field(_.masterKeyFingerprint)((c_, f_) => c_.copy(masterKeyFingerprint = f_))
    def accounts: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Seq[lnrpc.WatchOnlyAccount]] = field(_.accounts)((c_, f_) => c_.copy(accounts = f_))
  }
  final val MASTER_KEY_BIRTHDAY_TIMESTAMP_FIELD_NUMBER = 1
  final val MASTER_KEY_FINGERPRINT_FIELD_NUMBER = 2
  final val ACCOUNTS_FIELD_NUMBER = 3
  @transient
  private[lnrpc] val _typemapper_masterKeyBirthdayTimestamp: _root_.scalapb.TypeMapper[_root_.scala.Long, org.bitcoins.core.number.UInt64] = implicitly[_root_.scalapb.TypeMapper[_root_.scala.Long, org.bitcoins.core.number.UInt64]]
  def of(
    masterKeyBirthdayTimestamp: org.bitcoins.core.number.UInt64,
    masterKeyFingerprint: _root_.com.google.protobuf.ByteString,
    accounts: _root_.scala.Seq[lnrpc.WatchOnlyAccount]
  ): _root_.lnrpc.WatchOnly = _root_.lnrpc.WatchOnly(
    masterKeyBirthdayTimestamp,
    masterKeyFingerprint,
    accounts
  )
  // @@protoc_insertion_point(GeneratedMessageCompanion[lnrpc.WatchOnly])
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy