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

lnrpc.Hop.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 chanId
  *  
  *  The unique channel ID for the channel. The first 3 bytes are the block
  *  height, the next 3 the index within the block, and the last 2 bytes are the
  *  output index for the channel.
  * @param pubKey
  *  
  *  An optional public key of the hop. If the public key is given, the payment
  *  can be executed without relying on a copy of the channel graph.
  * @param tlvPayload
  *  
  *  If set to true, then this hop will be encoded using the new variable length
  *  TLV format. Note that if any custom tlv_records below are specified, then
  *  this field MUST be set to true for them to be encoded properly.
  * @param mppRecord
  *  
  *  An optional TLV record that signals the use of an MPP payment. If present,
  *  the receiver will enforce that the same mpp_record is included in the final
  *  hop payload of all non-zero payments in the HTLC set. If empty, a regular
  *  single-shot payment is or was attempted.
  * @param ampRecord
  *  
  *  An optional TLV record that signals the use of an AMP payment. If present,
  *  the receiver will treat all received payments including the same
  *  (payment_addr, set_id) pair  as being part of one logical payment. The
  *  payment will be settled by XORing the root_share's together and deriving the
  *  child hashes and preimages according to BOLT XX. Must be used in conjunction
  *  with mpp_record.
  * @param customRecords
  *  
  *  An optional set of key-value TLV records. This is useful within the context
  *  of the SendToRoute call as it allows callers to specify arbitrary K-V pairs
  *  to drop off at each hop within the onion.
  * @param metadata
  *   The payment metadata to send along with the payment to the payee.
  */
@SerialVersionUID(0L)
final case class Hop(
    chanId: org.bitcoins.core.number.UInt64 = lnrpc.Hop._typemapper_chanId.toCustom(0L),
    @scala.deprecated(message="Marked as deprecated in proto file", "") chanCapacity: _root_.scala.Long = 0L,
    @scala.deprecated(message="Marked as deprecated in proto file", "") amtToForward: _root_.scala.Long = 0L,
    @scala.deprecated(message="Marked as deprecated in proto file", "") fee: _root_.scala.Long = 0L,
    expiry: org.bitcoins.core.number.UInt32 = lnrpc.Hop._typemapper_expiry.toCustom(0),
    amtToForwardMsat: _root_.scala.Long = 0L,
    feeMsat: _root_.scala.Long = 0L,
    pubKey: _root_.scala.Predef.String = "",
    @scala.deprecated(message="Marked as deprecated in proto file", "") tlvPayload: _root_.scala.Boolean = false,
    mppRecord: _root_.scala.Option[lnrpc.MPPRecord] = _root_.scala.None,
    ampRecord: _root_.scala.Option[lnrpc.AMPRecord] = _root_.scala.None,
    customRecords: _root_.scala.collection.immutable.Map[org.bitcoins.core.number.UInt64, _root_.com.google.protobuf.ByteString] = _root_.scala.collection.immutable.Map.empty,
    metadata: _root_.com.google.protobuf.ByteString = _root_.com.google.protobuf.ByteString.EMPTY,
    unknownFields: _root_.scalapb.UnknownFieldSet = _root_.scalapb.UnknownFieldSet.empty
    ) extends scalapb.GeneratedMessage with scalapb.lenses.Updatable[Hop] {
    @transient
    private[this] var __serializedSizeMemoized: _root_.scala.Int = 0
    private[this] def __computeSerializedSize(): _root_.scala.Int = {
      var __size = 0
      
      {
        val __value = lnrpc.Hop._typemapper_chanId.toBase(chanId)
        if (__value != 0L) {
          __size += _root_.com.google.protobuf.CodedOutputStream.computeUInt64Size(1, __value)
        }
      };
      
      {
        val __value = chanCapacity
        if (__value != 0L) {
          __size += _root_.com.google.protobuf.CodedOutputStream.computeInt64Size(2, __value)
        }
      };
      
      {
        val __value = amtToForward
        if (__value != 0L) {
          __size += _root_.com.google.protobuf.CodedOutputStream.computeInt64Size(3, __value)
        }
      };
      
      {
        val __value = fee
        if (__value != 0L) {
          __size += _root_.com.google.protobuf.CodedOutputStream.computeInt64Size(4, __value)
        }
      };
      
      {
        val __value = lnrpc.Hop._typemapper_expiry.toBase(expiry)
        if (__value != 0) {
          __size += _root_.com.google.protobuf.CodedOutputStream.computeUInt32Size(5, __value)
        }
      };
      
      {
        val __value = amtToForwardMsat
        if (__value != 0L) {
          __size += _root_.com.google.protobuf.CodedOutputStream.computeInt64Size(6, __value)
        }
      };
      
      {
        val __value = feeMsat
        if (__value != 0L) {
          __size += _root_.com.google.protobuf.CodedOutputStream.computeInt64Size(7, __value)
        }
      };
      
      {
        val __value = pubKey
        if (!__value.isEmpty) {
          __size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(8, __value)
        }
      };
      
      {
        val __value = tlvPayload
        if (__value != false) {
          __size += _root_.com.google.protobuf.CodedOutputStream.computeBoolSize(9, __value)
        }
      };
      if (mppRecord.isDefined) {
        val __value = mppRecord.get
        __size += 1 + _root_.com.google.protobuf.CodedOutputStream.computeUInt32SizeNoTag(__value.serializedSize) + __value.serializedSize
      };
      if (ampRecord.isDefined) {
        val __value = ampRecord.get
        __size += 1 + _root_.com.google.protobuf.CodedOutputStream.computeUInt32SizeNoTag(__value.serializedSize) + __value.serializedSize
      };
      customRecords.foreach { __item =>
        val __value = lnrpc.Hop._typemapper_customRecords.toBase(__item)
        __size += 1 + _root_.com.google.protobuf.CodedOutputStream.computeUInt32SizeNoTag(__value.serializedSize) + __value.serializedSize
      }
      
      {
        val __value = metadata
        if (!__value.isEmpty) {
          __size += _root_.com.google.protobuf.CodedOutputStream.computeBytesSize(13, __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.Hop._typemapper_chanId.toBase(chanId)
        if (__v != 0L) {
          _output__.writeUInt64(1, __v)
        }
      };
      {
        val __v = chanCapacity
        if (__v != 0L) {
          _output__.writeInt64(2, __v)
        }
      };
      {
        val __v = amtToForward
        if (__v != 0L) {
          _output__.writeInt64(3, __v)
        }
      };
      {
        val __v = fee
        if (__v != 0L) {
          _output__.writeInt64(4, __v)
        }
      };
      {
        val __v = lnrpc.Hop._typemapper_expiry.toBase(expiry)
        if (__v != 0) {
          _output__.writeUInt32(5, __v)
        }
      };
      {
        val __v = amtToForwardMsat
        if (__v != 0L) {
          _output__.writeInt64(6, __v)
        }
      };
      {
        val __v = feeMsat
        if (__v != 0L) {
          _output__.writeInt64(7, __v)
        }
      };
      {
        val __v = pubKey
        if (!__v.isEmpty) {
          _output__.writeString(8, __v)
        }
      };
      {
        val __v = tlvPayload
        if (__v != false) {
          _output__.writeBool(9, __v)
        }
      };
      mppRecord.foreach { __v =>
        val __m = __v
        _output__.writeTag(10, 2)
        _output__.writeUInt32NoTag(__m.serializedSize)
        __m.writeTo(_output__)
      };
      customRecords.foreach { __v =>
        val __m = lnrpc.Hop._typemapper_customRecords.toBase(__v)
        _output__.writeTag(11, 2)
        _output__.writeUInt32NoTag(__m.serializedSize)
        __m.writeTo(_output__)
      };
      ampRecord.foreach { __v =>
        val __m = __v
        _output__.writeTag(12, 2)
        _output__.writeUInt32NoTag(__m.serializedSize)
        __m.writeTo(_output__)
      };
      {
        val __v = metadata
        if (!__v.isEmpty) {
          _output__.writeBytes(13, __v)
        }
      };
      unknownFields.writeTo(_output__)
    }
    def withChanId(__v: org.bitcoins.core.number.UInt64): Hop = copy(chanId = __v)
    def withChanCapacity(__v: _root_.scala.Long): Hop = copy(chanCapacity = __v)
    def withAmtToForward(__v: _root_.scala.Long): Hop = copy(amtToForward = __v)
    def withFee(__v: _root_.scala.Long): Hop = copy(fee = __v)
    def withExpiry(__v: org.bitcoins.core.number.UInt32): Hop = copy(expiry = __v)
    def withAmtToForwardMsat(__v: _root_.scala.Long): Hop = copy(amtToForwardMsat = __v)
    def withFeeMsat(__v: _root_.scala.Long): Hop = copy(feeMsat = __v)
    def withPubKey(__v: _root_.scala.Predef.String): Hop = copy(pubKey = __v)
    def withTlvPayload(__v: _root_.scala.Boolean): Hop = copy(tlvPayload = __v)
    def getMppRecord: lnrpc.MPPRecord = mppRecord.getOrElse(lnrpc.MPPRecord.defaultInstance)
    def clearMppRecord: Hop = copy(mppRecord = _root_.scala.None)
    def withMppRecord(__v: lnrpc.MPPRecord): Hop = copy(mppRecord = Option(__v))
    def getAmpRecord: lnrpc.AMPRecord = ampRecord.getOrElse(lnrpc.AMPRecord.defaultInstance)
    def clearAmpRecord: Hop = copy(ampRecord = _root_.scala.None)
    def withAmpRecord(__v: lnrpc.AMPRecord): Hop = copy(ampRecord = Option(__v))
    def clearCustomRecords = copy(customRecords = _root_.scala.collection.immutable.Map.empty)
    def addCustomRecords(__vs: (org.bitcoins.core.number.UInt64, _root_.com.google.protobuf.ByteString) *): Hop = addAllCustomRecords(__vs)
    def addAllCustomRecords(__vs: Iterable[(org.bitcoins.core.number.UInt64, _root_.com.google.protobuf.ByteString)]): Hop = copy(customRecords = customRecords ++ __vs)
    def withCustomRecords(__v: _root_.scala.collection.immutable.Map[org.bitcoins.core.number.UInt64, _root_.com.google.protobuf.ByteString]): Hop = copy(customRecords = __v)
    def withMetadata(__v: _root_.com.google.protobuf.ByteString): Hop = copy(metadata = __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.Hop._typemapper_chanId.toBase(chanId)
          if (__t != 0L) __t else null
        }
        case 2 => {
          val __t = chanCapacity
          if (__t != 0L) __t else null
        }
        case 3 => {
          val __t = amtToForward
          if (__t != 0L) __t else null
        }
        case 4 => {
          val __t = fee
          if (__t != 0L) __t else null
        }
        case 5 => {
          val __t = lnrpc.Hop._typemapper_expiry.toBase(expiry)
          if (__t != 0) __t else null
        }
        case 6 => {
          val __t = amtToForwardMsat
          if (__t != 0L) __t else null
        }
        case 7 => {
          val __t = feeMsat
          if (__t != 0L) __t else null
        }
        case 8 => {
          val __t = pubKey
          if (__t != "") __t else null
        }
        case 9 => {
          val __t = tlvPayload
          if (__t != false) __t else null
        }
        case 10 => mppRecord.orNull
        case 12 => ampRecord.orNull
        case 11 => customRecords.iterator.map(lnrpc.Hop._typemapper_customRecords.toBase(_)).toSeq
        case 13 => {
          val __t = metadata
          if (__t != _root_.com.google.protobuf.ByteString.EMPTY) __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.PLong(lnrpc.Hop._typemapper_chanId.toBase(chanId))
        case 2 => _root_.scalapb.descriptors.PLong(chanCapacity)
        case 3 => _root_.scalapb.descriptors.PLong(amtToForward)
        case 4 => _root_.scalapb.descriptors.PLong(fee)
        case 5 => _root_.scalapb.descriptors.PInt(lnrpc.Hop._typemapper_expiry.toBase(expiry))
        case 6 => _root_.scalapb.descriptors.PLong(amtToForwardMsat)
        case 7 => _root_.scalapb.descriptors.PLong(feeMsat)
        case 8 => _root_.scalapb.descriptors.PString(pubKey)
        case 9 => _root_.scalapb.descriptors.PBoolean(tlvPayload)
        case 10 => mppRecord.map(_.toPMessage).getOrElse(_root_.scalapb.descriptors.PEmpty)
        case 12 => ampRecord.map(_.toPMessage).getOrElse(_root_.scalapb.descriptors.PEmpty)
        case 11 => _root_.scalapb.descriptors.PRepeated(customRecords.iterator.map(lnrpc.Hop._typemapper_customRecords.toBase(_).toPMessage).toVector)
        case 13 => _root_.scalapb.descriptors.PByteString(metadata)
      }
    }
    def toProtoString: _root_.scala.Predef.String = _root_.scalapb.TextFormat.printToUnicodeString(this)
    def companion: lnrpc.Hop.type = lnrpc.Hop
    // @@protoc_insertion_point(GeneratedMessage[lnrpc.Hop])
}

object Hop extends scalapb.GeneratedMessageCompanion[lnrpc.Hop] {
  implicit def messageCompanion: scalapb.GeneratedMessageCompanion[lnrpc.Hop] = this
  def parseFrom(`_input__`: _root_.com.google.protobuf.CodedInputStream): lnrpc.Hop = {
    var __chanId: _root_.scala.Long = 0L
    var __chanCapacity: _root_.scala.Long = 0L
    var __amtToForward: _root_.scala.Long = 0L
    var __fee: _root_.scala.Long = 0L
    var __expiry: _root_.scala.Int = 0
    var __amtToForwardMsat: _root_.scala.Long = 0L
    var __feeMsat: _root_.scala.Long = 0L
    var __pubKey: _root_.scala.Predef.String = ""
    var __tlvPayload: _root_.scala.Boolean = false
    var __mppRecord: _root_.scala.Option[lnrpc.MPPRecord] = _root_.scala.None
    var __ampRecord: _root_.scala.Option[lnrpc.AMPRecord] = _root_.scala.None
    val __customRecords: _root_.scala.collection.mutable.Builder[(org.bitcoins.core.number.UInt64, _root_.com.google.protobuf.ByteString), _root_.scala.collection.immutable.Map[org.bitcoins.core.number.UInt64, _root_.com.google.protobuf.ByteString]] = _root_.scala.collection.immutable.Map.newBuilder[org.bitcoins.core.number.UInt64, _root_.com.google.protobuf.ByteString]
    var __metadata: _root_.com.google.protobuf.ByteString = _root_.com.google.protobuf.ByteString.EMPTY
    var `_unknownFields__`: _root_.scalapb.UnknownFieldSet.Builder = null
    var _done__ = false
    while (!_done__) {
      val _tag__ = _input__.readTag()
      _tag__ match {
        case 0 => _done__ = true
        case 8 =>
          __chanId = _input__.readUInt64()
        case 16 =>
          __chanCapacity = _input__.readInt64()
        case 24 =>
          __amtToForward = _input__.readInt64()
        case 32 =>
          __fee = _input__.readInt64()
        case 40 =>
          __expiry = _input__.readUInt32()
        case 48 =>
          __amtToForwardMsat = _input__.readInt64()
        case 56 =>
          __feeMsat = _input__.readInt64()
        case 66 =>
          __pubKey = _input__.readStringRequireUtf8()
        case 72 =>
          __tlvPayload = _input__.readBool()
        case 82 =>
          __mppRecord = Option(__mppRecord.fold(_root_.scalapb.LiteParser.readMessage[lnrpc.MPPRecord](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _)))
        case 98 =>
          __ampRecord = Option(__ampRecord.fold(_root_.scalapb.LiteParser.readMessage[lnrpc.AMPRecord](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _)))
        case 90 =>
          __customRecords += lnrpc.Hop._typemapper_customRecords.toCustom(_root_.scalapb.LiteParser.readMessage[lnrpc.Hop.CustomRecordsEntry](_input__))
        case 106 =>
          __metadata = _input__.readBytes()
        case tag =>
          if (_unknownFields__ == null) {
            _unknownFields__ = new _root_.scalapb.UnknownFieldSet.Builder()
          }
          _unknownFields__.parseField(tag, _input__)
      }
    }
    lnrpc.Hop(
        chanId = lnrpc.Hop._typemapper_chanId.toCustom(__chanId),
        chanCapacity = __chanCapacity,
        amtToForward = __amtToForward,
        fee = __fee,
        expiry = lnrpc.Hop._typemapper_expiry.toCustom(__expiry),
        amtToForwardMsat = __amtToForwardMsat,
        feeMsat = __feeMsat,
        pubKey = __pubKey,
        tlvPayload = __tlvPayload,
        mppRecord = __mppRecord,
        ampRecord = __ampRecord,
        customRecords = __customRecords.result(),
        metadata = __metadata,
        unknownFields = if (_unknownFields__ == null) _root_.scalapb.UnknownFieldSet.empty else _unknownFields__.result()
    )
  }
  implicit def messageReads: _root_.scalapb.descriptors.Reads[lnrpc.Hop] = _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.Hop(
        chanId = lnrpc.Hop._typemapper_chanId.toCustom(__fieldsMap.get(scalaDescriptor.findFieldByNumber(1).get).map(_.as[_root_.scala.Long]).getOrElse(0L)),
        chanCapacity = __fieldsMap.get(scalaDescriptor.findFieldByNumber(2).get).map(_.as[_root_.scala.Long]).getOrElse(0L),
        amtToForward = __fieldsMap.get(scalaDescriptor.findFieldByNumber(3).get).map(_.as[_root_.scala.Long]).getOrElse(0L),
        fee = __fieldsMap.get(scalaDescriptor.findFieldByNumber(4).get).map(_.as[_root_.scala.Long]).getOrElse(0L),
        expiry = lnrpc.Hop._typemapper_expiry.toCustom(__fieldsMap.get(scalaDescriptor.findFieldByNumber(5).get).map(_.as[_root_.scala.Int]).getOrElse(0)),
        amtToForwardMsat = __fieldsMap.get(scalaDescriptor.findFieldByNumber(6).get).map(_.as[_root_.scala.Long]).getOrElse(0L),
        feeMsat = __fieldsMap.get(scalaDescriptor.findFieldByNumber(7).get).map(_.as[_root_.scala.Long]).getOrElse(0L),
        pubKey = __fieldsMap.get(scalaDescriptor.findFieldByNumber(8).get).map(_.as[_root_.scala.Predef.String]).getOrElse(""),
        tlvPayload = __fieldsMap.get(scalaDescriptor.findFieldByNumber(9).get).map(_.as[_root_.scala.Boolean]).getOrElse(false),
        mppRecord = __fieldsMap.get(scalaDescriptor.findFieldByNumber(10).get).flatMap(_.as[_root_.scala.Option[lnrpc.MPPRecord]]),
        ampRecord = __fieldsMap.get(scalaDescriptor.findFieldByNumber(12).get).flatMap(_.as[_root_.scala.Option[lnrpc.AMPRecord]]),
        customRecords = __fieldsMap.get(scalaDescriptor.findFieldByNumber(11).get).map(_.as[_root_.scala.Seq[lnrpc.Hop.CustomRecordsEntry]]).getOrElse(_root_.scala.Seq.empty).iterator.map(lnrpc.Hop._typemapper_customRecords.toCustom(_)).toMap,
        metadata = __fieldsMap.get(scalaDescriptor.findFieldByNumber(13).get).map(_.as[_root_.com.google.protobuf.ByteString]).getOrElse(_root_.com.google.protobuf.ByteString.EMPTY)
      )
    case _ => throw new RuntimeException("Expected PMessage")
  }
  def javaDescriptor: _root_.com.google.protobuf.Descriptors.Descriptor = LightningProto.javaDescriptor.getMessageTypes().get(99)
  def scalaDescriptor: _root_.scalapb.descriptors.Descriptor = LightningProto.scalaDescriptor.messages(99)
  def messageCompanionForFieldNumber(__number: _root_.scala.Int): _root_.scalapb.GeneratedMessageCompanion[_] = {
    var __out: _root_.scalapb.GeneratedMessageCompanion[_] = null
    (__number: @_root_.scala.unchecked) match {
      case 10 => __out = lnrpc.MPPRecord
      case 12 => __out = lnrpc.AMPRecord
      case 11 => __out = lnrpc.Hop.CustomRecordsEntry
    }
    __out
  }
  lazy val nestedMessagesCompanions: Seq[_root_.scalapb.GeneratedMessageCompanion[_ <: _root_.scalapb.GeneratedMessage]] =
    Seq[_root_.scalapb.GeneratedMessageCompanion[_ <: _root_.scalapb.GeneratedMessage]](
      _root_.lnrpc.Hop.CustomRecordsEntry
    )
  def enumCompanionForFieldNumber(__fieldNumber: _root_.scala.Int): _root_.scalapb.GeneratedEnumCompanion[_] = throw new MatchError(__fieldNumber)
  lazy val defaultInstance = lnrpc.Hop(
    chanId = lnrpc.Hop._typemapper_chanId.toCustom(0L),
    chanCapacity = 0L,
    amtToForward = 0L,
    fee = 0L,
    expiry = lnrpc.Hop._typemapper_expiry.toCustom(0),
    amtToForwardMsat = 0L,
    feeMsat = 0L,
    pubKey = "",
    tlvPayload = false,
    mppRecord = _root_.scala.None,
    ampRecord = _root_.scala.None,
    customRecords = _root_.scala.collection.immutable.Map.empty,
    metadata = _root_.com.google.protobuf.ByteString.EMPTY
  )
  @SerialVersionUID(0L)
  final case class CustomRecordsEntry(
      key: org.bitcoins.core.number.UInt64 = lnrpc.Hop.CustomRecordsEntry._typemapper_key.toCustom(0L),
      value: _root_.com.google.protobuf.ByteString = _root_.com.google.protobuf.ByteString.EMPTY,
      unknownFields: _root_.scalapb.UnknownFieldSet = _root_.scalapb.UnknownFieldSet.empty
      ) extends scalapb.GeneratedMessage with scalapb.lenses.Updatable[CustomRecordsEntry] {
      @transient
      private[this] var __serializedSizeMemoized: _root_.scala.Int = 0
      private[this] def __computeSerializedSize(): _root_.scala.Int = {
        var __size = 0
        
        {
          val __value = lnrpc.Hop.CustomRecordsEntry._typemapper_key.toBase(key)
          if (__value != 0L) {
            __size += _root_.com.google.protobuf.CodedOutputStream.computeUInt64Size(1, __value)
          }
        };
        
        {
          val __value = value
          if (!__value.isEmpty) {
            __size += _root_.com.google.protobuf.CodedOutputStream.computeBytesSize(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 = lnrpc.Hop.CustomRecordsEntry._typemapper_key.toBase(key)
          if (__v != 0L) {
            _output__.writeUInt64(1, __v)
          }
        };
        {
          val __v = value
          if (!__v.isEmpty) {
            _output__.writeBytes(2, __v)
          }
        };
        unknownFields.writeTo(_output__)
      }
      def withKey(__v: org.bitcoins.core.number.UInt64): CustomRecordsEntry = copy(key = __v)
      def withValue(__v: _root_.com.google.protobuf.ByteString): CustomRecordsEntry = 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 = lnrpc.Hop.CustomRecordsEntry._typemapper_key.toBase(key)
            if (__t != 0L) __t else null
          }
          case 2 => {
            val __t = value
            if (__t != _root_.com.google.protobuf.ByteString.EMPTY) __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.PLong(lnrpc.Hop.CustomRecordsEntry._typemapper_key.toBase(key))
          case 2 => _root_.scalapb.descriptors.PByteString(value)
        }
      }
      def toProtoString: _root_.scala.Predef.String = _root_.scalapb.TextFormat.printToUnicodeString(this)
      def companion: lnrpc.Hop.CustomRecordsEntry.type = lnrpc.Hop.CustomRecordsEntry
      // @@protoc_insertion_point(GeneratedMessage[lnrpc.Hop.CustomRecordsEntry])
  }
  
  object CustomRecordsEntry extends scalapb.GeneratedMessageCompanion[lnrpc.Hop.CustomRecordsEntry] {
    implicit def messageCompanion: scalapb.GeneratedMessageCompanion[lnrpc.Hop.CustomRecordsEntry] = this
    def parseFrom(`_input__`: _root_.com.google.protobuf.CodedInputStream): lnrpc.Hop.CustomRecordsEntry = {
      var __key: _root_.scala.Long = 0L
      var __value: _root_.com.google.protobuf.ByteString = _root_.com.google.protobuf.ByteString.EMPTY
      var `_unknownFields__`: _root_.scalapb.UnknownFieldSet.Builder = null
      var _done__ = false
      while (!_done__) {
        val _tag__ = _input__.readTag()
        _tag__ match {
          case 0 => _done__ = true
          case 8 =>
            __key = _input__.readUInt64()
          case 18 =>
            __value = _input__.readBytes()
          case tag =>
            if (_unknownFields__ == null) {
              _unknownFields__ = new _root_.scalapb.UnknownFieldSet.Builder()
            }
            _unknownFields__.parseField(tag, _input__)
        }
      }
      lnrpc.Hop.CustomRecordsEntry(
          key = lnrpc.Hop.CustomRecordsEntry._typemapper_key.toCustom(__key),
          value = __value,
          unknownFields = if (_unknownFields__ == null) _root_.scalapb.UnknownFieldSet.empty else _unknownFields__.result()
      )
    }
    implicit def messageReads: _root_.scalapb.descriptors.Reads[lnrpc.Hop.CustomRecordsEntry] = _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.Hop.CustomRecordsEntry(
          key = lnrpc.Hop.CustomRecordsEntry._typemapper_key.toCustom(__fieldsMap.get(scalaDescriptor.findFieldByNumber(1).get).map(_.as[_root_.scala.Long]).getOrElse(0L)),
          value = __fieldsMap.get(scalaDescriptor.findFieldByNumber(2).get).map(_.as[_root_.com.google.protobuf.ByteString]).getOrElse(_root_.com.google.protobuf.ByteString.EMPTY)
        )
      case _ => throw new RuntimeException("Expected PMessage")
    }
    def javaDescriptor: _root_.com.google.protobuf.Descriptors.Descriptor = lnrpc.Hop.javaDescriptor.getNestedTypes().get(0)
    def scalaDescriptor: _root_.scalapb.descriptors.Descriptor = lnrpc.Hop.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 = lnrpc.Hop.CustomRecordsEntry(
      key = lnrpc.Hop.CustomRecordsEntry._typemapper_key.toCustom(0L),
      value = _root_.com.google.protobuf.ByteString.EMPTY
    )
    implicit class CustomRecordsEntryLens[UpperPB](_l: _root_.scalapb.lenses.Lens[UpperPB, lnrpc.Hop.CustomRecordsEntry]) extends _root_.scalapb.lenses.ObjectLens[UpperPB, lnrpc.Hop.CustomRecordsEntry](_l) {
      def key: _root_.scalapb.lenses.Lens[UpperPB, org.bitcoins.core.number.UInt64] = field(_.key)((c_, f_) => c_.copy(key = f_))
      def value: _root_.scalapb.lenses.Lens[UpperPB, _root_.com.google.protobuf.ByteString] = field(_.value)((c_, f_) => c_.copy(value = f_))
    }
    final val KEY_FIELD_NUMBER = 1
    final val VALUE_FIELD_NUMBER = 2
    @transient
    private[lnrpc] val _typemapper_key: _root_.scalapb.TypeMapper[_root_.scala.Long, org.bitcoins.core.number.UInt64] = implicitly[_root_.scalapb.TypeMapper[_root_.scala.Long, org.bitcoins.core.number.UInt64]]
    @transient
    implicit val keyValueMapper: _root_.scalapb.TypeMapper[lnrpc.Hop.CustomRecordsEntry, (org.bitcoins.core.number.UInt64, _root_.com.google.protobuf.ByteString)] =
      _root_.scalapb.TypeMapper[lnrpc.Hop.CustomRecordsEntry, (org.bitcoins.core.number.UInt64, _root_.com.google.protobuf.ByteString)](__m => (__m.key, __m.value))(__p => lnrpc.Hop.CustomRecordsEntry(__p._1, __p._2))
    def of(
      key: org.bitcoins.core.number.UInt64,
      value: _root_.com.google.protobuf.ByteString
    ): _root_.lnrpc.Hop.CustomRecordsEntry = _root_.lnrpc.Hop.CustomRecordsEntry(
      key,
      value
    )
    // @@protoc_insertion_point(GeneratedMessageCompanion[lnrpc.Hop.CustomRecordsEntry])
  }
  
  implicit class HopLens[UpperPB](_l: _root_.scalapb.lenses.Lens[UpperPB, lnrpc.Hop]) extends _root_.scalapb.lenses.ObjectLens[UpperPB, lnrpc.Hop](_l) {
    def chanId: _root_.scalapb.lenses.Lens[UpperPB, org.bitcoins.core.number.UInt64] = field(_.chanId)((c_, f_) => c_.copy(chanId = f_))
    def chanCapacity: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Long] = field(_.chanCapacity)((c_, f_) => c_.copy(chanCapacity = f_))
    def amtToForward: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Long] = field(_.amtToForward)((c_, f_) => c_.copy(amtToForward = f_))
    def fee: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Long] = field(_.fee)((c_, f_) => c_.copy(fee = f_))
    def expiry: _root_.scalapb.lenses.Lens[UpperPB, org.bitcoins.core.number.UInt32] = field(_.expiry)((c_, f_) => c_.copy(expiry = f_))
    def amtToForwardMsat: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Long] = field(_.amtToForwardMsat)((c_, f_) => c_.copy(amtToForwardMsat = f_))
    def feeMsat: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Long] = field(_.feeMsat)((c_, f_) => c_.copy(feeMsat = f_))
    def pubKey: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.pubKey)((c_, f_) => c_.copy(pubKey = f_))
    def tlvPayload: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Boolean] = field(_.tlvPayload)((c_, f_) => c_.copy(tlvPayload = f_))
    def mppRecord: _root_.scalapb.lenses.Lens[UpperPB, lnrpc.MPPRecord] = field(_.getMppRecord)((c_, f_) => c_.copy(mppRecord = Option(f_)))
    def optionalMppRecord: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Option[lnrpc.MPPRecord]] = field(_.mppRecord)((c_, f_) => c_.copy(mppRecord = f_))
    def ampRecord: _root_.scalapb.lenses.Lens[UpperPB, lnrpc.AMPRecord] = field(_.getAmpRecord)((c_, f_) => c_.copy(ampRecord = Option(f_)))
    def optionalAmpRecord: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Option[lnrpc.AMPRecord]] = field(_.ampRecord)((c_, f_) => c_.copy(ampRecord = f_))
    def customRecords: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.collection.immutable.Map[org.bitcoins.core.number.UInt64, _root_.com.google.protobuf.ByteString]] = field(_.customRecords)((c_, f_) => c_.copy(customRecords = f_))
    def metadata: _root_.scalapb.lenses.Lens[UpperPB, _root_.com.google.protobuf.ByteString] = field(_.metadata)((c_, f_) => c_.copy(metadata = f_))
  }
  final val CHAN_ID_FIELD_NUMBER = 1
  final val CHAN_CAPACITY_FIELD_NUMBER = 2
  final val AMT_TO_FORWARD_FIELD_NUMBER = 3
  final val FEE_FIELD_NUMBER = 4
  final val EXPIRY_FIELD_NUMBER = 5
  final val AMT_TO_FORWARD_MSAT_FIELD_NUMBER = 6
  final val FEE_MSAT_FIELD_NUMBER = 7
  final val PUB_KEY_FIELD_NUMBER = 8
  final val TLV_PAYLOAD_FIELD_NUMBER = 9
  final val MPP_RECORD_FIELD_NUMBER = 10
  final val AMP_RECORD_FIELD_NUMBER = 12
  final val CUSTOM_RECORDS_FIELD_NUMBER = 11
  final val METADATA_FIELD_NUMBER = 13
  @transient
  private[lnrpc] val _typemapper_chanId: _root_.scalapb.TypeMapper[_root_.scala.Long, org.bitcoins.core.number.UInt64] = implicitly[_root_.scalapb.TypeMapper[_root_.scala.Long, org.bitcoins.core.number.UInt64]]
  @transient
  private[lnrpc] val _typemapper_expiry: _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_customRecords: _root_.scalapb.TypeMapper[lnrpc.Hop.CustomRecordsEntry, (org.bitcoins.core.number.UInt64, _root_.com.google.protobuf.ByteString)] = implicitly[_root_.scalapb.TypeMapper[lnrpc.Hop.CustomRecordsEntry, (org.bitcoins.core.number.UInt64, _root_.com.google.protobuf.ByteString)]]
  def of(
    chanId: org.bitcoins.core.number.UInt64,
    chanCapacity: _root_.scala.Long,
    amtToForward: _root_.scala.Long,
    fee: _root_.scala.Long,
    expiry: org.bitcoins.core.number.UInt32,
    amtToForwardMsat: _root_.scala.Long,
    feeMsat: _root_.scala.Long,
    pubKey: _root_.scala.Predef.String,
    tlvPayload: _root_.scala.Boolean,
    mppRecord: _root_.scala.Option[lnrpc.MPPRecord],
    ampRecord: _root_.scala.Option[lnrpc.AMPRecord],
    customRecords: _root_.scala.collection.immutable.Map[org.bitcoins.core.number.UInt64, _root_.com.google.protobuf.ByteString],
    metadata: _root_.com.google.protobuf.ByteString
  ): _root_.lnrpc.Hop = _root_.lnrpc.Hop(
    chanId,
    chanCapacity,
    amtToForward,
    fee,
    expiry,
    amtToForwardMsat,
    feeMsat,
    pubKey,
    tlvPayload,
    mppRecord,
    ampRecord,
    customRecords,
    metadata
  )
  // @@protoc_insertion_point(GeneratedMessageCompanion[lnrpc.Hop])
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy