xyz.stratalab.sdk.models.box.Lock.scala Maven / Gradle / Ivy
The newest version!
// Generated by the Scala Plugin for the Protocol Buffer Compiler.
// Do not edit!
//
// Protofile syntax: PROTO3
package xyz.stratalab.sdk.models.box
/** used to lock a box value and needs to be satisfied in order for the value of the box to be spent
* should be able to calculate or retrieve the root of the Lock
* - from Predicate -> Image -> Commitment -> Signable -> Evidence
*/
@SerialVersionUID(0L)
final case class Lock(
value: xyz.stratalab.sdk.models.box.Lock.Value = xyz.stratalab.sdk.models.box.Lock.Value.Empty,
unknownFields: _root_.scalapb.UnknownFieldSet = _root_.scalapb.UnknownFieldSet.empty
) extends scalapb.GeneratedMessage with scalapb.lenses.Updatable[Lock] {
@transient
private[this] var __serializedSizeMemoized: _root_.scala.Int = 0
private[this] def __computeSerializedSize(): _root_.scala.Int = {
var __size = 0
if (value.predicate.isDefined) {
val __value = value.predicate.get
__size += 1 + _root_.com.google.protobuf.CodedOutputStream.computeUInt32SizeNoTag(__value.serializedSize) + __value.serializedSize
};
if (value.image.isDefined) {
val __value = value.image.get
__size += 1 + _root_.com.google.protobuf.CodedOutputStream.computeUInt32SizeNoTag(__value.serializedSize) + __value.serializedSize
};
if (value.commitment.isDefined) {
val __value = value.commitment.get
__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 = {
value.predicate.foreach { __v =>
val __m = __v
_output__.writeTag(1, 2)
_output__.writeUInt32NoTag(__m.serializedSize)
__m.writeTo(_output__)
};
value.image.foreach { __v =>
val __m = __v
_output__.writeTag(2, 2)
_output__.writeUInt32NoTag(__m.serializedSize)
__m.writeTo(_output__)
};
value.commitment.foreach { __v =>
val __m = __v
_output__.writeTag(3, 2)
_output__.writeUInt32NoTag(__m.serializedSize)
__m.writeTo(_output__)
};
unknownFields.writeTo(_output__)
}
def getPredicate: xyz.stratalab.sdk.models.box.Lock.Predicate = value.predicate.getOrElse(xyz.stratalab.sdk.models.box.Lock.Predicate.defaultInstance)
def withPredicate(__v: xyz.stratalab.sdk.models.box.Lock.Predicate): Lock = copy(value = xyz.stratalab.sdk.models.box.Lock.Value.Predicate(__v))
def getImage: xyz.stratalab.sdk.models.box.Lock.Image = value.image.getOrElse(xyz.stratalab.sdk.models.box.Lock.Image.defaultInstance)
def withImage(__v: xyz.stratalab.sdk.models.box.Lock.Image): Lock = copy(value = xyz.stratalab.sdk.models.box.Lock.Value.Image(__v))
def getCommitment: xyz.stratalab.sdk.models.box.Lock.Commitment = value.commitment.getOrElse(xyz.stratalab.sdk.models.box.Lock.Commitment.defaultInstance)
def withCommitment(__v: xyz.stratalab.sdk.models.box.Lock.Commitment): Lock = copy(value = xyz.stratalab.sdk.models.box.Lock.Value.Commitment(__v))
def clearValue: Lock = copy(value = xyz.stratalab.sdk.models.box.Lock.Value.Empty)
def withValue(__v: xyz.stratalab.sdk.models.box.Lock.Value): Lock = 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 => value.predicate.orNull
case 2 => value.image.orNull
case 3 => value.commitment.orNull
}
}
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 => value.predicate.map(_.toPMessage).getOrElse(_root_.scalapb.descriptors.PEmpty)
case 2 => value.image.map(_.toPMessage).getOrElse(_root_.scalapb.descriptors.PEmpty)
case 3 => value.commitment.map(_.toPMessage).getOrElse(_root_.scalapb.descriptors.PEmpty)
}
}
def toProtoString: _root_.scala.Predef.String = _root_.scalapb.TextFormat.printToUnicodeString(this)
def companion: xyz.stratalab.sdk.models.box.Lock.type = xyz.stratalab.sdk.models.box.Lock
_root_.scalapb.validate.Validator.assertValid(this)(xyz.stratalab.sdk.models.box.LockValidator)
// @@protoc_insertion_point(GeneratedMessage[xyz.stratalab.sdk.models.box.Lock])
}
object Lock extends scalapb.GeneratedMessageCompanion[xyz.stratalab.sdk.models.box.Lock] {
implicit def messageCompanion: scalapb.GeneratedMessageCompanion[xyz.stratalab.sdk.models.box.Lock] = this
def parseFrom(`_input__`: _root_.com.google.protobuf.CodedInputStream): xyz.stratalab.sdk.models.box.Lock = {
var __value: xyz.stratalab.sdk.models.box.Lock.Value = xyz.stratalab.sdk.models.box.Lock.Value.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 =>
__value = xyz.stratalab.sdk.models.box.Lock.Value.Predicate(__value.predicate.fold(_root_.scalapb.LiteParser.readMessage[xyz.stratalab.sdk.models.box.Lock.Predicate](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _)))
case 18 =>
__value = xyz.stratalab.sdk.models.box.Lock.Value.Image(__value.image.fold(_root_.scalapb.LiteParser.readMessage[xyz.stratalab.sdk.models.box.Lock.Image](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _)))
case 26 =>
__value = xyz.stratalab.sdk.models.box.Lock.Value.Commitment(__value.commitment.fold(_root_.scalapb.LiteParser.readMessage[xyz.stratalab.sdk.models.box.Lock.Commitment](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _)))
case tag =>
if (_unknownFields__ == null) {
_unknownFields__ = new _root_.scalapb.UnknownFieldSet.Builder()
}
_unknownFields__.parseField(tag, _input__)
}
}
xyz.stratalab.sdk.models.box.Lock(
value = __value,
unknownFields = if (_unknownFields__ == null) _root_.scalapb.UnknownFieldSet.empty else _unknownFields__.result()
)
}
implicit def messageReads: _root_.scalapb.descriptors.Reads[xyz.stratalab.sdk.models.box.Lock] = _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.")
xyz.stratalab.sdk.models.box.Lock(
value = __fieldsMap.get(scalaDescriptor.findFieldByNumber(1).get).flatMap(_.as[_root_.scala.Option[xyz.stratalab.sdk.models.box.Lock.Predicate]]).map(xyz.stratalab.sdk.models.box.Lock.Value.Predicate(_))
.orElse[xyz.stratalab.sdk.models.box.Lock.Value](__fieldsMap.get(scalaDescriptor.findFieldByNumber(2).get).flatMap(_.as[_root_.scala.Option[xyz.stratalab.sdk.models.box.Lock.Image]]).map(xyz.stratalab.sdk.models.box.Lock.Value.Image(_)))
.orElse[xyz.stratalab.sdk.models.box.Lock.Value](__fieldsMap.get(scalaDescriptor.findFieldByNumber(3).get).flatMap(_.as[_root_.scala.Option[xyz.stratalab.sdk.models.box.Lock.Commitment]]).map(xyz.stratalab.sdk.models.box.Lock.Value.Commitment(_)))
.getOrElse(xyz.stratalab.sdk.models.box.Lock.Value.Empty)
)
case _ => throw new RuntimeException("Expected PMessage")
}
def javaDescriptor: _root_.com.google.protobuf.Descriptors.Descriptor = LockProto.javaDescriptor.getMessageTypes().get(0)
def scalaDescriptor: _root_.scalapb.descriptors.Descriptor = LockProto.scalaDescriptor.messages(0)
def messageCompanionForFieldNumber(__number: _root_.scala.Int): _root_.scalapb.GeneratedMessageCompanion[_] = {
var __out: _root_.scalapb.GeneratedMessageCompanion[_] = null
(__number: @_root_.scala.unchecked) match {
case 1 => __out = xyz.stratalab.sdk.models.box.Lock.Predicate
case 2 => __out = xyz.stratalab.sdk.models.box.Lock.Image
case 3 => __out = xyz.stratalab.sdk.models.box.Lock.Commitment
}
__out
}
lazy val nestedMessagesCompanions: Seq[_root_.scalapb.GeneratedMessageCompanion[_ <: _root_.scalapb.GeneratedMessage]] =
Seq[_root_.scalapb.GeneratedMessageCompanion[_ <: _root_.scalapb.GeneratedMessage]](
_root_.xyz.stratalab.sdk.models.box.Lock.Predicate,
_root_.xyz.stratalab.sdk.models.box.Lock.Image,
_root_.xyz.stratalab.sdk.models.box.Lock.Commitment
)
def enumCompanionForFieldNumber(__fieldNumber: _root_.scala.Int): _root_.scalapb.GeneratedEnumCompanion[_] = throw new MatchError(__fieldNumber)
lazy val defaultInstance = xyz.stratalab.sdk.models.box.Lock(
value = xyz.stratalab.sdk.models.box.Lock.Value.Empty
)
sealed trait Value extends _root_.scalapb.GeneratedOneof {
def isEmpty: _root_.scala.Boolean = false
def isDefined: _root_.scala.Boolean = true
def isPredicate: _root_.scala.Boolean = false
def isImage: _root_.scala.Boolean = false
def isCommitment: _root_.scala.Boolean = false
def predicate: _root_.scala.Option[xyz.stratalab.sdk.models.box.Lock.Predicate] = _root_.scala.None
def image: _root_.scala.Option[xyz.stratalab.sdk.models.box.Lock.Image] = _root_.scala.None
def commitment: _root_.scala.Option[xyz.stratalab.sdk.models.box.Lock.Commitment] = _root_.scala.None
}
object Value {
@SerialVersionUID(0L)
case object Empty extends xyz.stratalab.sdk.models.box.Lock.Value {
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 Predicate(value: xyz.stratalab.sdk.models.box.Lock.Predicate) extends xyz.stratalab.sdk.models.box.Lock.Value {
type ValueType = xyz.stratalab.sdk.models.box.Lock.Predicate
override def isPredicate: _root_.scala.Boolean = true
override def predicate: _root_.scala.Option[xyz.stratalab.sdk.models.box.Lock.Predicate] = Some(value)
override def number: _root_.scala.Int = 1
}
@SerialVersionUID(0L)
final case class Image(value: xyz.stratalab.sdk.models.box.Lock.Image) extends xyz.stratalab.sdk.models.box.Lock.Value {
type ValueType = xyz.stratalab.sdk.models.box.Lock.Image
override def isImage: _root_.scala.Boolean = true
override def image: _root_.scala.Option[xyz.stratalab.sdk.models.box.Lock.Image] = Some(value)
override def number: _root_.scala.Int = 2
}
@SerialVersionUID(0L)
final case class Commitment(value: xyz.stratalab.sdk.models.box.Lock.Commitment) extends xyz.stratalab.sdk.models.box.Lock.Value {
type ValueType = xyz.stratalab.sdk.models.box.Lock.Commitment
override def isCommitment: _root_.scala.Boolean = true
override def commitment: _root_.scala.Option[xyz.stratalab.sdk.models.box.Lock.Commitment] = Some(value)
override def number: _root_.scala.Int = 3
}
}
/** Private information
* a Predicate is a type of lock that will be satisfied if at least the threshold number of the contained proposition are satisfied
*
* @param challenges
* this should probably be a non-empty chain
*/
@SerialVersionUID(0L)
final case class Predicate(
challenges: _root_.scala.Seq[xyz.stratalab.sdk.models.box.Challenge] = _root_.scala.Seq.empty,
threshold: _root_.scala.Int = 0,
unknownFields: _root_.scalapb.UnknownFieldSet = _root_.scalapb.UnknownFieldSet.empty
) extends scalapb.GeneratedMessage with scalapb.lenses.Updatable[Predicate] {
@transient
private[this] var __serializedSizeMemoized: _root_.scala.Int = 0
private[this] def __computeSerializedSize(): _root_.scala.Int = {
var __size = 0
challenges.foreach { __item =>
val __value = __item
__size += 1 + _root_.com.google.protobuf.CodedOutputStream.computeUInt32SizeNoTag(__value.serializedSize) + __value.serializedSize
}
{
val __value = threshold
if (__value != 0) {
__size += _root_.com.google.protobuf.CodedOutputStream.computeUInt32Size(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 = {
challenges.foreach { __v =>
val __m = __v
_output__.writeTag(1, 2)
_output__.writeUInt32NoTag(__m.serializedSize)
__m.writeTo(_output__)
};
{
val __v = threshold
if (__v != 0) {
_output__.writeUInt32(2, __v)
}
};
unknownFields.writeTo(_output__)
}
def clearChallenges = copy(challenges = _root_.scala.Seq.empty)
def addChallenges(__vs: xyz.stratalab.sdk.models.box.Challenge *): Predicate = addAllChallenges(__vs)
def addAllChallenges(__vs: Iterable[xyz.stratalab.sdk.models.box.Challenge]): Predicate = copy(challenges = challenges ++ __vs)
def withChallenges(__v: _root_.scala.Seq[xyz.stratalab.sdk.models.box.Challenge]): Predicate = copy(challenges = __v)
def withThreshold(__v: _root_.scala.Int): Predicate = copy(threshold = __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 => challenges
case 2 => {
val __t = threshold
if (__t != 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 => _root_.scalapb.descriptors.PRepeated(challenges.iterator.map(_.toPMessage).toVector)
case 2 => _root_.scalapb.descriptors.PInt(threshold)
}
}
def toProtoString: _root_.scala.Predef.String = _root_.scalapb.TextFormat.printToUnicodeString(this)
def companion: xyz.stratalab.sdk.models.box.Lock.Predicate.type = xyz.stratalab.sdk.models.box.Lock.Predicate
// @@protoc_insertion_point(GeneratedMessage[xyz.stratalab.sdk.models.box.Lock.Predicate])
}
object Predicate extends scalapb.GeneratedMessageCompanion[xyz.stratalab.sdk.models.box.Lock.Predicate] {
implicit def messageCompanion: scalapb.GeneratedMessageCompanion[xyz.stratalab.sdk.models.box.Lock.Predicate] = this
def parseFrom(`_input__`: _root_.com.google.protobuf.CodedInputStream): xyz.stratalab.sdk.models.box.Lock.Predicate = {
val __challenges: _root_.scala.collection.immutable.VectorBuilder[xyz.stratalab.sdk.models.box.Challenge] = new _root_.scala.collection.immutable.VectorBuilder[xyz.stratalab.sdk.models.box.Challenge]
var __threshold: _root_.scala.Int = 0
var `_unknownFields__`: _root_.scalapb.UnknownFieldSet.Builder = null
var _done__ = false
while (!_done__) {
val _tag__ = _input__.readTag()
_tag__ match {
case 0 => _done__ = true
case 10 =>
__challenges += _root_.scalapb.LiteParser.readMessage[xyz.stratalab.sdk.models.box.Challenge](_input__)
case 16 =>
__threshold = _input__.readUInt32()
case tag =>
if (_unknownFields__ == null) {
_unknownFields__ = new _root_.scalapb.UnknownFieldSet.Builder()
}
_unknownFields__.parseField(tag, _input__)
}
}
xyz.stratalab.sdk.models.box.Lock.Predicate(
challenges = __challenges.result(),
threshold = __threshold,
unknownFields = if (_unknownFields__ == null) _root_.scalapb.UnknownFieldSet.empty else _unknownFields__.result()
)
}
implicit def messageReads: _root_.scalapb.descriptors.Reads[xyz.stratalab.sdk.models.box.Lock.Predicate] = _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.")
xyz.stratalab.sdk.models.box.Lock.Predicate(
challenges = __fieldsMap.get(scalaDescriptor.findFieldByNumber(1).get).map(_.as[_root_.scala.Seq[xyz.stratalab.sdk.models.box.Challenge]]).getOrElse(_root_.scala.Seq.empty),
threshold = __fieldsMap.get(scalaDescriptor.findFieldByNumber(2).get).map(_.as[_root_.scala.Int]).getOrElse(0)
)
case _ => throw new RuntimeException("Expected PMessage")
}
def javaDescriptor: _root_.com.google.protobuf.Descriptors.Descriptor = xyz.stratalab.sdk.models.box.Lock.javaDescriptor.getNestedTypes().get(0)
def scalaDescriptor: _root_.scalapb.descriptors.Descriptor = xyz.stratalab.sdk.models.box.Lock.scalaDescriptor.nestedMessages(0)
def messageCompanionForFieldNumber(__number: _root_.scala.Int): _root_.scalapb.GeneratedMessageCompanion[_] = {
var __out: _root_.scalapb.GeneratedMessageCompanion[_] = null
(__number: @_root_.scala.unchecked) match {
case 1 => __out = xyz.stratalab.sdk.models.box.Challenge
}
__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 = xyz.stratalab.sdk.models.box.Lock.Predicate(
challenges = _root_.scala.Seq.empty,
threshold = 0
)
implicit class PredicateLens[UpperPB](_l: _root_.scalapb.lenses.Lens[UpperPB, xyz.stratalab.sdk.models.box.Lock.Predicate]) extends _root_.scalapb.lenses.ObjectLens[UpperPB, xyz.stratalab.sdk.models.box.Lock.Predicate](_l) {
def challenges: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Seq[xyz.stratalab.sdk.models.box.Challenge]] = field(_.challenges)((c_, f_) => c_.copy(challenges = f_))
def threshold: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Int] = field(_.threshold)((c_, f_) => c_.copy(threshold = f_))
}
final val CHALLENGES_FIELD_NUMBER = 1
final val THRESHOLD_FIELD_NUMBER = 2
def of(
challenges: _root_.scala.Seq[xyz.stratalab.sdk.models.box.Challenge],
threshold: _root_.scala.Int
): _root_.xyz.stratalab.sdk.models.box.Lock.Predicate = _root_.xyz.stratalab.sdk.models.box.Lock.Predicate(
challenges,
threshold
)
// @@protoc_insertion_point(GeneratedMessageCompanion[xyz.stratalab.sdk.models.box.Lock.Predicate])
}
/** Semi-public information
* The most commonly shared construction between parties
*/
@SerialVersionUID(0L)
final case class Image(
leaves: _root_.scala.Seq[xyz.stratalab.sdk.models.LockId] = _root_.scala.Seq.empty,
threshold: _root_.scala.Int = 0,
unknownFields: _root_.scalapb.UnknownFieldSet = _root_.scalapb.UnknownFieldSet.empty
) extends scalapb.GeneratedMessage with scalapb.lenses.Updatable[Image] {
@transient
private[this] var __serializedSizeMemoized: _root_.scala.Int = 0
private[this] def __computeSerializedSize(): _root_.scala.Int = {
var __size = 0
leaves.foreach { __item =>
val __value = __item
__size += 1 + _root_.com.google.protobuf.CodedOutputStream.computeUInt32SizeNoTag(__value.serializedSize) + __value.serializedSize
}
{
val __value = threshold
if (__value != 0) {
__size += _root_.com.google.protobuf.CodedOutputStream.computeUInt32Size(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 = {
leaves.foreach { __v =>
val __m = __v
_output__.writeTag(1, 2)
_output__.writeUInt32NoTag(__m.serializedSize)
__m.writeTo(_output__)
};
{
val __v = threshold
if (__v != 0) {
_output__.writeUInt32(2, __v)
}
};
unknownFields.writeTo(_output__)
}
def clearLeaves = copy(leaves = _root_.scala.Seq.empty)
def addLeaves(__vs: xyz.stratalab.sdk.models.LockId *): Image = addAllLeaves(__vs)
def addAllLeaves(__vs: Iterable[xyz.stratalab.sdk.models.LockId]): Image = copy(leaves = leaves ++ __vs)
def withLeaves(__v: _root_.scala.Seq[xyz.stratalab.sdk.models.LockId]): Image = copy(leaves = __v)
def withThreshold(__v: _root_.scala.Int): Image = copy(threshold = __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 => leaves
case 2 => {
val __t = threshold
if (__t != 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 => _root_.scalapb.descriptors.PRepeated(leaves.iterator.map(_.toPMessage).toVector)
case 2 => _root_.scalapb.descriptors.PInt(threshold)
}
}
def toProtoString: _root_.scala.Predef.String = _root_.scalapb.TextFormat.printToUnicodeString(this)
def companion: xyz.stratalab.sdk.models.box.Lock.Image.type = xyz.stratalab.sdk.models.box.Lock.Image
// @@protoc_insertion_point(GeneratedMessage[xyz.stratalab.sdk.models.box.Lock.Image])
}
object Image extends scalapb.GeneratedMessageCompanion[xyz.stratalab.sdk.models.box.Lock.Image] {
implicit def messageCompanion: scalapb.GeneratedMessageCompanion[xyz.stratalab.sdk.models.box.Lock.Image] = this
def parseFrom(`_input__`: _root_.com.google.protobuf.CodedInputStream): xyz.stratalab.sdk.models.box.Lock.Image = {
val __leaves: _root_.scala.collection.immutable.VectorBuilder[xyz.stratalab.sdk.models.LockId] = new _root_.scala.collection.immutable.VectorBuilder[xyz.stratalab.sdk.models.LockId]
var __threshold: _root_.scala.Int = 0
var `_unknownFields__`: _root_.scalapb.UnknownFieldSet.Builder = null
var _done__ = false
while (!_done__) {
val _tag__ = _input__.readTag()
_tag__ match {
case 0 => _done__ = true
case 10 =>
__leaves += _root_.scalapb.LiteParser.readMessage[xyz.stratalab.sdk.models.LockId](_input__)
case 16 =>
__threshold = _input__.readUInt32()
case tag =>
if (_unknownFields__ == null) {
_unknownFields__ = new _root_.scalapb.UnknownFieldSet.Builder()
}
_unknownFields__.parseField(tag, _input__)
}
}
xyz.stratalab.sdk.models.box.Lock.Image(
leaves = __leaves.result(),
threshold = __threshold,
unknownFields = if (_unknownFields__ == null) _root_.scalapb.UnknownFieldSet.empty else _unknownFields__.result()
)
}
implicit def messageReads: _root_.scalapb.descriptors.Reads[xyz.stratalab.sdk.models.box.Lock.Image] = _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.")
xyz.stratalab.sdk.models.box.Lock.Image(
leaves = __fieldsMap.get(scalaDescriptor.findFieldByNumber(1).get).map(_.as[_root_.scala.Seq[xyz.stratalab.sdk.models.LockId]]).getOrElse(_root_.scala.Seq.empty),
threshold = __fieldsMap.get(scalaDescriptor.findFieldByNumber(2).get).map(_.as[_root_.scala.Int]).getOrElse(0)
)
case _ => throw new RuntimeException("Expected PMessage")
}
def javaDescriptor: _root_.com.google.protobuf.Descriptors.Descriptor = xyz.stratalab.sdk.models.box.Lock.javaDescriptor.getNestedTypes().get(1)
def scalaDescriptor: _root_.scalapb.descriptors.Descriptor = xyz.stratalab.sdk.models.box.Lock.scalaDescriptor.nestedMessages(1)
def messageCompanionForFieldNumber(__number: _root_.scala.Int): _root_.scalapb.GeneratedMessageCompanion[_] = {
var __out: _root_.scalapb.GeneratedMessageCompanion[_] = null
(__number: @_root_.scala.unchecked) match {
case 1 => __out = xyz.stratalab.sdk.models.LockId
}
__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 = xyz.stratalab.sdk.models.box.Lock.Image(
leaves = _root_.scala.Seq.empty,
threshold = 0
)
implicit class ImageLens[UpperPB](_l: _root_.scalapb.lenses.Lens[UpperPB, xyz.stratalab.sdk.models.box.Lock.Image]) extends _root_.scalapb.lenses.ObjectLens[UpperPB, xyz.stratalab.sdk.models.box.Lock.Image](_l) {
def leaves: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Seq[xyz.stratalab.sdk.models.LockId]] = field(_.leaves)((c_, f_) => c_.copy(leaves = f_))
def threshold: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Int] = field(_.threshold)((c_, f_) => c_.copy(threshold = f_))
}
final val LEAVES_FIELD_NUMBER = 1
final val THRESHOLD_FIELD_NUMBER = 2
def of(
leaves: _root_.scala.Seq[xyz.stratalab.sdk.models.LockId],
threshold: _root_.scala.Int
): _root_.xyz.stratalab.sdk.models.box.Lock.Image = _root_.xyz.stratalab.sdk.models.box.Lock.Image(
leaves,
threshold
)
// @@protoc_insertion_point(GeneratedMessageCompanion[xyz.stratalab.sdk.models.box.Lock.Image])
}
/** todo: jaa - should disable ot figure out how to provide the needed witness in the attestation
* Public information
* Predicate Commitments are used to encumber boxes
* use a Root here so we can provide a membership proof of the conditions
*/
@SerialVersionUID(0L)
final case class Commitment(
root: _root_.scala.Option[xyz.stratalab.sdk.models.AccumulatorRootId] = _root_.scala.None,
threshold: _root_.scala.Int = 0,
unknownFields: _root_.scalapb.UnknownFieldSet = _root_.scalapb.UnknownFieldSet.empty
) extends scalapb.GeneratedMessage with scalapb.lenses.Updatable[Commitment] {
@transient
private[this] var __serializedSizeMemoized: _root_.scala.Int = 0
private[this] def __computeSerializedSize(): _root_.scala.Int = {
var __size = 0
if (root.isDefined) {
val __value = root.get
__size += 1 + _root_.com.google.protobuf.CodedOutputStream.computeUInt32SizeNoTag(__value.serializedSize) + __value.serializedSize
};
{
val __value = threshold
if (__value != 0) {
__size += _root_.com.google.protobuf.CodedOutputStream.computeUInt32Size(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 = {
root.foreach { __v =>
val __m = __v
_output__.writeTag(1, 2)
_output__.writeUInt32NoTag(__m.serializedSize)
__m.writeTo(_output__)
};
{
val __v = threshold
if (__v != 0) {
_output__.writeUInt32(2, __v)
}
};
unknownFields.writeTo(_output__)
}
def getRoot: xyz.stratalab.sdk.models.AccumulatorRootId = root.getOrElse(xyz.stratalab.sdk.models.AccumulatorRootId.defaultInstance)
def clearRoot: Commitment = copy(root = _root_.scala.None)
def withRoot(__v: xyz.stratalab.sdk.models.AccumulatorRootId): Commitment = copy(root = Option(__v))
def withThreshold(__v: _root_.scala.Int): Commitment = copy(threshold = __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 => root.orNull
case 2 => {
val __t = threshold
if (__t != 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 => root.map(_.toPMessage).getOrElse(_root_.scalapb.descriptors.PEmpty)
case 2 => _root_.scalapb.descriptors.PInt(threshold)
}
}
def toProtoString: _root_.scala.Predef.String = _root_.scalapb.TextFormat.printToUnicodeString(this)
def companion: xyz.stratalab.sdk.models.box.Lock.Commitment.type = xyz.stratalab.sdk.models.box.Lock.Commitment
// @@protoc_insertion_point(GeneratedMessage[xyz.stratalab.sdk.models.box.Lock.Commitment])
}
object Commitment extends scalapb.GeneratedMessageCompanion[xyz.stratalab.sdk.models.box.Lock.Commitment] {
implicit def messageCompanion: scalapb.GeneratedMessageCompanion[xyz.stratalab.sdk.models.box.Lock.Commitment] = this
def parseFrom(`_input__`: _root_.com.google.protobuf.CodedInputStream): xyz.stratalab.sdk.models.box.Lock.Commitment = {
var __root: _root_.scala.Option[xyz.stratalab.sdk.models.AccumulatorRootId] = _root_.scala.None
var __threshold: _root_.scala.Int = 0
var `_unknownFields__`: _root_.scalapb.UnknownFieldSet.Builder = null
var _done__ = false
while (!_done__) {
val _tag__ = _input__.readTag()
_tag__ match {
case 0 => _done__ = true
case 10 =>
__root = _root_.scala.Option(__root.fold(_root_.scalapb.LiteParser.readMessage[xyz.stratalab.sdk.models.AccumulatorRootId](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _)))
case 16 =>
__threshold = _input__.readUInt32()
case tag =>
if (_unknownFields__ == null) {
_unknownFields__ = new _root_.scalapb.UnknownFieldSet.Builder()
}
_unknownFields__.parseField(tag, _input__)
}
}
xyz.stratalab.sdk.models.box.Lock.Commitment(
root = __root,
threshold = __threshold,
unknownFields = if (_unknownFields__ == null) _root_.scalapb.UnknownFieldSet.empty else _unknownFields__.result()
)
}
implicit def messageReads: _root_.scalapb.descriptors.Reads[xyz.stratalab.sdk.models.box.Lock.Commitment] = _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.")
xyz.stratalab.sdk.models.box.Lock.Commitment(
root = __fieldsMap.get(scalaDescriptor.findFieldByNumber(1).get).flatMap(_.as[_root_.scala.Option[xyz.stratalab.sdk.models.AccumulatorRootId]]),
threshold = __fieldsMap.get(scalaDescriptor.findFieldByNumber(2).get).map(_.as[_root_.scala.Int]).getOrElse(0)
)
case _ => throw new RuntimeException("Expected PMessage")
}
def javaDescriptor: _root_.com.google.protobuf.Descriptors.Descriptor = xyz.stratalab.sdk.models.box.Lock.javaDescriptor.getNestedTypes().get(2)
def scalaDescriptor: _root_.scalapb.descriptors.Descriptor = xyz.stratalab.sdk.models.box.Lock.scalaDescriptor.nestedMessages(2)
def messageCompanionForFieldNumber(__number: _root_.scala.Int): _root_.scalapb.GeneratedMessageCompanion[_] = {
var __out: _root_.scalapb.GeneratedMessageCompanion[_] = null
(__number: @_root_.scala.unchecked) match {
case 1 => __out = xyz.stratalab.sdk.models.AccumulatorRootId
}
__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 = xyz.stratalab.sdk.models.box.Lock.Commitment(
root = _root_.scala.None,
threshold = 0
)
implicit class CommitmentLens[UpperPB](_l: _root_.scalapb.lenses.Lens[UpperPB, xyz.stratalab.sdk.models.box.Lock.Commitment]) extends _root_.scalapb.lenses.ObjectLens[UpperPB, xyz.stratalab.sdk.models.box.Lock.Commitment](_l) {
def root: _root_.scalapb.lenses.Lens[UpperPB, xyz.stratalab.sdk.models.AccumulatorRootId] = field(_.getRoot)((c_, f_) => c_.copy(root = _root_.scala.Option(f_)))
def optionalRoot: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Option[xyz.stratalab.sdk.models.AccumulatorRootId]] = field(_.root)((c_, f_) => c_.copy(root = f_))
def threshold: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Int] = field(_.threshold)((c_, f_) => c_.copy(threshold = f_))
}
final val ROOT_FIELD_NUMBER = 1
final val THRESHOLD_FIELD_NUMBER = 2
def of(
root: _root_.scala.Option[xyz.stratalab.sdk.models.AccumulatorRootId],
threshold: _root_.scala.Int
): _root_.xyz.stratalab.sdk.models.box.Lock.Commitment = _root_.xyz.stratalab.sdk.models.box.Lock.Commitment(
root,
threshold
)
// @@protoc_insertion_point(GeneratedMessageCompanion[xyz.stratalab.sdk.models.box.Lock.Commitment])
}
implicit class LockLens[UpperPB](_l: _root_.scalapb.lenses.Lens[UpperPB, xyz.stratalab.sdk.models.box.Lock]) extends _root_.scalapb.lenses.ObjectLens[UpperPB, xyz.stratalab.sdk.models.box.Lock](_l) {
def predicate: _root_.scalapb.lenses.Lens[UpperPB, xyz.stratalab.sdk.models.box.Lock.Predicate] = field(_.getPredicate)((c_, f_) => c_.copy(value = xyz.stratalab.sdk.models.box.Lock.Value.Predicate(f_)))
def image: _root_.scalapb.lenses.Lens[UpperPB, xyz.stratalab.sdk.models.box.Lock.Image] = field(_.getImage)((c_, f_) => c_.copy(value = xyz.stratalab.sdk.models.box.Lock.Value.Image(f_)))
def commitment: _root_.scalapb.lenses.Lens[UpperPB, xyz.stratalab.sdk.models.box.Lock.Commitment] = field(_.getCommitment)((c_, f_) => c_.copy(value = xyz.stratalab.sdk.models.box.Lock.Value.Commitment(f_)))
def value: _root_.scalapb.lenses.Lens[UpperPB, xyz.stratalab.sdk.models.box.Lock.Value] = field(_.value)((c_, f_) => c_.copy(value = f_))
}
final val PREDICATE_FIELD_NUMBER = 1
final val IMAGE_FIELD_NUMBER = 2
final val COMMITMENT_FIELD_NUMBER = 3
def of(
value: xyz.stratalab.sdk.models.box.Lock.Value
): _root_.xyz.stratalab.sdk.models.box.Lock = _root_.xyz.stratalab.sdk.models.box.Lock(
value
)
implicit def validator: scalapb.validate.Validator[xyz.stratalab.sdk.models.box.Lock] = xyz.stratalab.sdk.models.box.LockValidator
// @@protoc_insertion_point(GeneratedMessageCompanion[xyz.stratalab.sdk.models.box.Lock])
}