You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

20 lines
453 B

package com.xsn.explorer.helpers
import com.xsn.explorer.models.rpc.Transaction
import play.api.libs.json.{JsValue, Json}
object TransactionLoader {
private val BasePath = "transactions"
def get(txid: String): Transaction = {
json(txid).as[Transaction]
}
def json(txid: String): JsValue = {
val resource = s"$BasePath/$txid"
val json = scala.io.Source.fromResource(resource).getLines().mkString("\n")
Json.parse(json)
}
}