Alexis Hernandez
6 years ago
5 changed files with 20 additions and 24 deletions
@ -0,0 +1,14 @@ |
|||
package com.xsn.explorer.models |
|||
|
|||
import enumeratum._ |
|||
|
|||
sealed abstract class BlockExtractionMethod(override val entryName: String) extends EnumEntry |
|||
|
|||
object BlockExtractionMethod extends Enum[BlockExtractionMethod] { |
|||
|
|||
val values = findValues |
|||
|
|||
final case object ProofOfWork extends BlockExtractionMethod("PoW") |
|||
final case object ProofOfStake extends BlockExtractionMethod("PoS") |
|||
final case object TrustlessProofOfStake extends BlockExtractionMethod("TPoS") |
|||
} |
@ -1,16 +1,12 @@ |
|||
package com.xsn.explorer.helpers |
|||
|
|||
import com.xsn.explorer.models._ |
|||
import io.scalaland.chimney.dsl._ |
|||
|
|||
import scala.language.implicitConversions |
|||
|
|||
object Converters { |
|||
|
|||
implicit def toPersistedBlock(rpcBlock: rpc.Block): persisted.Block = { |
|||
rpcBlock |
|||
.into[persisted.Block] |
|||
.withFieldConst(_.extractionMethod, persisted.Block.ExtractionMethod.ProofOfWork) // TODO: Detect method |
|||
.transform |
|||
transformers.toPersistedBlock(rpcBlock) |
|||
} |
|||
} |
|||
|
Loading…
Reference in new issue