mirror of
https://github.com/Instadapp/chains.git
synced 2024-07-29 22:37:19 +00:00
parent
5a7564fe61
commit
da94738893
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"name": "Moonrock",
|
"name": "Moonrock old",
|
||||||
"chain": "MOON",
|
"chain": "MOON",
|
||||||
"rpc": [],
|
"rpc": [],
|
||||||
"faucets": [],
|
"faucets": [],
|
||||||
|
@ -9,7 +9,8 @@
|
||||||
"decimals": 18
|
"decimals": 18
|
||||||
},
|
},
|
||||||
"infoURL": "",
|
"infoURL": "",
|
||||||
"shortName": "mrock",
|
"shortName": "mrock-old",
|
||||||
"chainId": 1286,
|
"chainId": 1286,
|
||||||
"networkId": 1286
|
"networkId": 1286,
|
||||||
}
|
"deprecated": true
|
||||||
|
}
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"name": "SoterOne Mainnet",
|
"name": "SoterOne Mainnet old",
|
||||||
"chain": "SOTER",
|
"chain": "SOTER",
|
||||||
"rpc": [
|
"rpc": [
|
||||||
"https://rpc.soter.one"
|
"https://rpc.soter.one"
|
||||||
|
@ -12,7 +12,8 @@
|
||||||
"decimals": 18
|
"decimals": 18
|
||||||
},
|
},
|
||||||
"infoURL": "https://www.soterone.com",
|
"infoURL": "https://www.soterone.com",
|
||||||
"shortName": "SO1",
|
"shortName": "SO1-old",
|
||||||
"chainId": 218,
|
"chainId": 218,
|
||||||
"networkId": 218
|
"networkId": 218,
|
||||||
|
"deprecated": true
|
||||||
}
|
}
|
|
@ -22,7 +22,8 @@ val optionalFields = listOf(
|
||||||
"explorers",
|
"explorers",
|
||||||
"title",
|
"title",
|
||||||
"network",
|
"network",
|
||||||
"parent"
|
"parent",
|
||||||
|
"deprecated"
|
||||||
)
|
)
|
||||||
|
|
||||||
val moshi: Moshi = Moshi.Builder().build()
|
val moshi: Moshi = Moshi.Builder().build()
|
||||||
|
|
|
@ -93,10 +93,8 @@ private fun doChecks(doRPCConnect: Boolean) {
|
||||||
checkIcon(it)
|
checkIcon(it)
|
||||||
}
|
}
|
||||||
|
|
||||||
allFiles.filter { it.isDirectory }.forEach {
|
allFiles.filter { it.isDirectory }.forEach { _ ->
|
||||||
if (it.name != "deprecated") {
|
error("should not contain a directory")
|
||||||
error("the only directory allowed is 'deprecated'")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -214,7 +212,11 @@ fun checkChain(chainFile: File, connectRPC: Boolean) {
|
||||||
throw ENSRegistryAddressMustBeValid()
|
throw ENSRegistryAddressMustBeValid()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
jsonObject["deprecated"]?.let {
|
||||||
|
if (it !is Boolean) {
|
||||||
|
throw DeprecatedMustBeBoolean()
|
||||||
|
}
|
||||||
|
}
|
||||||
jsonObject["parent"]?.let {
|
jsonObject["parent"]?.let {
|
||||||
if (it !is JsonObject) {
|
if (it !is JsonObject) {
|
||||||
throw ParentMustBeObject()
|
throw ParentMustBeObject()
|
||||||
|
|
|
@ -25,4 +25,5 @@ class ParentHasExtraFields(fields: Set<String>): Exception("parent has extra fie
|
||||||
class ParentBridgeNoArray: Exception("parent bridge must be array")
|
class ParentBridgeNoArray: Exception("parent bridge must be array")
|
||||||
class BridgeNoObject: Exception("parent bridges must be array consisting of json objects")
|
class BridgeNoObject: Exception("parent bridges must be array consisting of json objects")
|
||||||
class BridgeOnlyURL: Exception("parent bridge only contain an URL")
|
class BridgeOnlyURL: Exception("parent bridge only contain an URL")
|
||||||
class ParentChainDoesNotExist(chain: String): Exception("Referenced parent chain ($chain) does not exist")
|
class ParentChainDoesNotExist(chain: String): Exception("Referenced parent chain ($chain) does not exist")
|
||||||
|
class DeprecatedMustBeBoolean: Exception("deprecated must be boolean")
|
|
@ -221,6 +221,11 @@ class TheChainChecker {
|
||||||
checkChain(getFile("invalid/explorermissingurl/eip155-1.json"), false)
|
checkChain(getFile("invalid/explorermissingurl/eip155-1.json"), false)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test(expected = DeprecatedMustBeBoolean::class)
|
||||||
|
fun shouldFailOnInvalidDeprecation() {
|
||||||
|
checkChain(getFile("invalid/invalid_deprecation/eip155-1.json"), false)
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun canParse2chains() {
|
fun canParse2chains() {
|
||||||
checkChain(getFile("valid/eip155-1.json"), false)
|
checkChain(getFile("valid/eip155-1.json"), false)
|
||||||
|
|
|
@ -0,0 +1,21 @@
|
||||||
|
{
|
||||||
|
"name": "Ethereum Mainnet",
|
||||||
|
"shortName": "eth",
|
||||||
|
"chain": "ETH",
|
||||||
|
"network": "mainnet",
|
||||||
|
"chainId": 1,
|
||||||
|
"networkId": 1,
|
||||||
|
"rpc": [
|
||||||
|
"https://mainnet.infura.io/v3/${INFURA_API_KEY}",
|
||||||
|
"https://api.mycryptoapi.com/eth"
|
||||||
|
],
|
||||||
|
"faucets": [],
|
||||||
|
"infoURL": "https://ethereum.org",
|
||||||
|
"nativeCurrency": {
|
||||||
|
"name": "Ether",
|
||||||
|
"symbol": "ETH",
|
||||||
|
"decimals": 18
|
||||||
|
},
|
||||||
|
"explorers": [],
|
||||||
|
"deprecated": "yolo"
|
||||||
|
}
|
|
@ -15,5 +15,6 @@
|
||||||
"name": "Ether",
|
"name": "Ether",
|
||||||
"symbol": "ETH",
|
"symbol": "ETH",
|
||||||
"decimals": 18
|
"decimals": 18
|
||||||
}
|
},
|
||||||
|
"deprecated": true
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user