From 4be4fa0b47d0c55d013440f5fd02e84ad4bb098c Mon Sep 17 00:00:00 2001 From: Alexis Hernandez Date: Wed, 14 Mar 2018 23:00:55 -0600 Subject: [PATCH] server: Add AddressDetails model --- .../xsn/explorer/models/AddressDetails.scala | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 server/app/com/xsn/explorer/models/AddressDetails.scala diff --git a/server/app/com/xsn/explorer/models/AddressDetails.scala b/server/app/com/xsn/explorer/models/AddressDetails.scala new file mode 100644 index 0000000..4e56f79 --- /dev/null +++ b/server/app/com/xsn/explorer/models/AddressDetails.scala @@ -0,0 +1,17 @@ +package com.xsn.explorer.models + +import play.api.libs.json._ + +case class AddressDetails(balance: AddressBalance, transactionCount: Int) + +object AddressDetails { + + implicit val writes: Writes[AddressDetails] = Writes { obj => + val values = Map( + "balance" -> JsNumber(BigDecimal(obj.balance.balance)), + "received" -> JsNumber(BigDecimal(obj.balance.received)), + "transactionCount" -> JsNumber(obj.transactionCount)) + + JsObject.apply(values) + } +}