Remove extra bitcoin unspent fields (#593)
This commit is contained in:
@@ -15,12 +15,8 @@
|
||||
*/
|
||||
package io.emeraldpay.dshackle.upstream.bitcoin.data
|
||||
|
||||
import java.time.Instant
|
||||
|
||||
data class EsploraUnspent(
|
||||
val txid: String,
|
||||
val vout: Int,
|
||||
val value: Long,
|
||||
val timestamp: Instant,
|
||||
val height: Long,
|
||||
)
|
||||
|
||||
@@ -19,18 +19,14 @@ import com.fasterxml.jackson.core.JsonParser
|
||||
import com.fasterxml.jackson.databind.DeserializationContext
|
||||
import com.fasterxml.jackson.databind.JsonDeserializer
|
||||
import com.fasterxml.jackson.databind.JsonNode
|
||||
import java.time.Instant
|
||||
|
||||
class EsploraUnspentDeserializer : JsonDeserializer<EsploraUnspent>() {
|
||||
override fun deserialize(jp: JsonParser, ctxt: DeserializationContext): EsploraUnspent {
|
||||
val node: JsonNode = jp.readValueAsTree()
|
||||
val status = node.get("status")
|
||||
return EsploraUnspent(
|
||||
node.get("txid").asText(),
|
||||
node.get("vout").asInt(),
|
||||
node.get("value").asLong(),
|
||||
Instant.ofEpochSecond(status.get("block_time").asLong()),
|
||||
status.get("block_height").asLong(),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user