Browse Source

server: Add the value to the LightWalletTransaction.Input

prometheus-integration
Alexis Hernandez 6 years ago
parent
commit
38ab0e1803
  1. 2
      server/app/com/xsn/explorer/models/LightWalletTransaction.scala
  2. 6
      server/app/com/xsn/explorer/services/TransactionService.scala

2
server/app/com/xsn/explorer/models/LightWalletTransaction.scala

@ -12,7 +12,7 @@ case class LightWalletTransaction(
object LightWalletTransaction {
case class Input(txid: TransactionId, index: Int)
case class Input(txid: TransactionId, index: Int, value: BigDecimal)
case class Output(index: Int, value: BigDecimal)
implicit val inputWrites: Writes[Input] = Json.writes[Input]

6
server/app/com/xsn/explorer/services/TransactionService.scala

@ -157,8 +157,10 @@ class TransactionService @Inject() (
vin <- getTransactionVIN(plain.vin).toFutureOr
} yield {
val inputs = vin
.filter(_.address contains address)
.map { _.into[LightWalletTransaction.Input].withFieldRenamed(_.voutIndex, _.index).transform }
.collect {
case TransactionVIN(txid, index, Some(value), Some(a)) if a == address =>
LightWalletTransaction.Input(txid, index, value)
}
val outputs = plain
.vout

Loading…
Cancel
Save