Browse Source

server: Add the script to the LightWalletTransaction.Output

develop
Alexis Hernandez 6 years ago
parent
commit
41ebfec542
  1. 4
      server/app/com/xsn/explorer/models/LightWalletTransaction.scala
  2. 9
      server/app/controllers/BlocksController.scala

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

@ -1,6 +1,6 @@
package com.xsn.explorer.models
import com.xsn.explorer.models.values.{Address, Blockhash, Size, TransactionId}
import com.xsn.explorer.models.values.{Address, Blockhash, HexString, Size, TransactionId}
case class LightWalletTransaction(
id: TransactionId,
@ -13,6 +13,6 @@ case class LightWalletTransaction(
object LightWalletTransaction {
case class Input(txid: TransactionId, index: Int, value: BigDecimal)
case class Output(index: Int, value: BigDecimal, addresses: List[Address])
case class Output(index: Int, value: BigDecimal, addresses: List[Address], script: HexString)
}

9
server/app/controllers/BlocksController.scala

@ -75,7 +75,14 @@ object BlocksController {
)
}
implicit val outputWrites: Writes[LightWalletTransaction.Output] = Json.writes[LightWalletTransaction.Output]
implicit val outputWrites: Writes[LightWalletTransaction.Output] = (obj: LightWalletTransaction.Output) => {
Json.obj(
"index" -> obj.index,
"value" -> obj.value,
"addresses" -> obj.addresses,
"script" -> obj.script.string
)
}
implicit val lightWalletTransactionWrites: Writes[LightWalletTransaction] = (obj: LightWalletTransaction) => {
Json.obj(
"id" -> obj.id,

Loading…
Cancel
Save