mirror of
https://github.com/Instadapp/chains.git
synced 2024-07-29 22:37:19 +00:00
Improve faucet checks
This commit is contained in:
parent
8d321eedb5
commit
275fe11351
|
@ -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()
|
||||
|
|
|
@ -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'")
|
||||
|
|
Loading…
Reference in New Issue
Block a user