diff --git a/processor/src/main/kotlin/org/ethereum/lists/chains/Main.kt b/processor/src/main/kotlin/org/ethereum/lists/chains/Main.kt index 061b3082..dc91087d 100644 --- a/processor/src/main/kotlin/org/ethereum/lists/chains/Main.kt +++ b/processor/src/main/kotlin/org/ethereum/lists/chains/Main.kt @@ -315,7 +315,7 @@ fun checkChain(chainFile: File, connectRPC: Boolean, verbose: Boolean = false) { } val url = explorer["url"] - if (url == null || url !is String || httpPrefixes.none { prefix -> url.startsWith(prefix) } ) { + if (url == null || url !is String || httpPrefixes.none { prefix -> url.startsWith(prefix) }) { throw (ExplorerMustWithHttpsOrHttp()) } @@ -350,6 +350,23 @@ fun checkChain(chainFile: File, connectRPC: Boolean, verbose: Boolean = false) { } } + jsonObject["faucets"]?.let { faucets -> + if (faucets !is List<*>) { + throw FaucetsMustBeArray() + } + + faucets.forEach { + if (it !is String) { + throw FaucetMustBeString() + } + + if (it.isBlank()) { + throw FaucetMustBeString() + } + } + + } + jsonObject["redFlags"]?.let { redFlags -> if (redFlags !is List<*>) { throw RedFlagsMustBeArray() diff --git a/processor/src/main/kotlin/org/ethereum/lists/chains/model/Exceptions.kt b/processor/src/main/kotlin/org/ethereum/lists/chains/model/Exceptions.kt index 1cb507a4..997cef19 100644 --- a/processor/src/main/kotlin/org/ethereum/lists/chains/model/Exceptions.kt +++ b/processor/src/main/kotlin/org/ethereum/lists/chains/model/Exceptions.kt @@ -25,7 +25,10 @@ class ExplorerCannotEndInSlash: Exception("Explorer cannot have a slash on the e class ExplorerStandardMustBeEIP3091OrNone: Exception("explorer standard must be 'none' or 'EIP3091'") class ParentHasInvalidType(type: String?): Exception("Parent has invalid type $type - only L2 or shard allowed") class RedFlagsMustBeArray: Exception("redFlags not an array") +class FaucetsMustBeArray: Exception("faucets not an array") class RedFlagMustBeString: Exception("redFlag not an string") +class FaucetMustBeString: Exception("faucet not an string") +class FaucetCannotBeBlank: Exception("faucet cannot be blank") class InvalidRedFlags(flag: String): Exception("redFlags invalid $flag") class ParentMustBeObject: Exception("parent must be an object") class ParentMustHaveChainAndType: Exception("parent must have fields 'chain' and 'type'")