Create a json file mapping shortName -> CAIP-2 (#360)

closes #359
This commit is contained in:
ligi 2021-08-04 23:16:05 +02:00 committed by GitHub
parent 973e090f5c
commit 684d82580e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -34,9 +34,11 @@ private fun createOutputFiles() {
val prettyJSONFile = File(buildPath, "chains_pretty.json")
val miniJSONFile = File(buildPath, "chains_mini.json")
val prettyMiniJSONFile = File(buildPath, "chains_mini_pretty.json")
val shortNameMappingJSONFIle = File(buildPath, "shortNameMapping.json")
val chainJSONArray = JsonArray<JsonObject>()
val miniChainJSONArray = JsonArray<JsonObject>()
val shortNameMapping = JsonObject()
allChainFiles
.map { Klaxon().parseJsonObject(it.reader()) }
@ -54,10 +56,12 @@ private fun createOutputFiles() {
}
miniChainJSONArray.add(miniJSON)
shortNameMapping[jsonObject["shortName"] as String] = "eip155:" + jsonObject["chainId"]
miniJSONFile.writeText(miniChainJSONArray.toJsonString())
prettyMiniJSONFile.writeText(miniChainJSONArray.toJsonString(prettyPrint = true))
}
shortNameMappingJSONFIle.writeText(shortNameMapping.toJsonString(prettyPrint = true))
File(buildPath, "index.html").writeText(
"""
<!DOCTYPE HTML>