From 684d82580ee230a1a5afc49e8ea6e9bcbcdd8abd Mon Sep 17 00:00:00 2001 From: ligi Date: Wed, 4 Aug 2021 23:16:05 +0200 Subject: [PATCH] Create a json file mapping shortName -> CAIP-2 (#360) closes #359 --- src/main/kotlin/org/ethereum/lists/chains/Main.kt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/kotlin/org/ethereum/lists/chains/Main.kt b/src/main/kotlin/org/ethereum/lists/chains/Main.kt index 81deedf8..31aee4e1 100644 --- a/src/main/kotlin/org/ethereum/lists/chains/Main.kt +++ b/src/main/kotlin/org/ethereum/lists/chains/Main.kt @@ -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() val miniChainJSONArray = JsonArray() + 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( """