mirror of
https://github.com/Instadapp/chains.git
synced 2024-07-29 22:37:19 +00:00
parent
c2c676aaf9
commit
fde00b7d1a
|
@ -284,6 +284,11 @@ private fun parseWithMoshi(fileToParse: File) {
|
||||||
if (parsedShortNames.contains(parsedChain.shortName)) {
|
if (parsedShortNames.contains(parsedChain.shortName)) {
|
||||||
throw ShortNameMustBeUnique(parsedChain.shortName)
|
throw ShortNameMustBeUnique(parsedChain.shortName)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (parsedChain.shortName == "*") {
|
||||||
|
throw ShortNameMustNotBeStar()
|
||||||
|
}
|
||||||
|
|
||||||
parsedShortNames.add(parsedChain.shortName)
|
parsedShortNames.add(parsedChain.shortName)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,8 @@ class ENSMustHaveOnlyRegistry: Exception("ens can only have a registry currently
|
||||||
class ENSRegistryAddressMustBeValid: Exception("ens registry must have valid address")
|
class ENSRegistryAddressMustBeValid: Exception("ens registry must have valid address")
|
||||||
class NameMustBeUnique(dup: String): Exception(" name must be unique - but found `$dup` more than once")
|
class NameMustBeUnique(dup: String): Exception(" name must be unique - but found `$dup` more than once")
|
||||||
class ShortNameMustBeUnique(dup: String): Exception("short name must be unique - but found `$dup` more than once")
|
class ShortNameMustBeUnique(dup: String): Exception("short name must be unique - but found `$dup` more than once")
|
||||||
class UnsupportedNamespace(): Exception("So far only the EIP155 namespace is supported")
|
class ShortNameMustNotBeStar: Exception("short name must not be '*'")
|
||||||
|
class UnsupportedNamespace: Exception("So far only the EIP155 namespace is supported")
|
||||||
class ExplorersMustBeArray: Exception("explorers must be an array")
|
class ExplorersMustBeArray: Exception("explorers must be an array")
|
||||||
class ExplorerMustHaveName: Exception("Explorer must have name")
|
class ExplorerMustHaveName: Exception("Explorer must have name")
|
||||||
class ExplorerInvalidUrl: Exception("Explorer have url starting with https://")
|
class ExplorerInvalidUrl: Exception("Explorer have url starting with https://")
|
||||||
|
|
|
@ -177,6 +177,13 @@ class TheChainChecker {
|
||||||
checkChain(file, false)
|
checkChain(file, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test(expected = ShortNameMustNotBeStar::class)
|
||||||
|
fun shouldFailForStarShortName() {
|
||||||
|
val file = getFile("invalid/shortNameMustNotBeStar/eip155-1.json")
|
||||||
|
|
||||||
|
checkChain(file, false)
|
||||||
|
}
|
||||||
|
|
||||||
@Test(expected = NameMustBeUnique::class)
|
@Test(expected = NameMustBeUnique::class)
|
||||||
fun shouldFailOnNonUniqueName() {
|
fun shouldFailOnNonUniqueName() {
|
||||||
checkChain(getFile("valid/eip155-1.json"), false)
|
checkChain(getFile("valid/eip155-1.json"), false)
|
||||||
|
|
|
@ -0,0 +1,20 @@
|
||||||
|
{
|
||||||
|
"name": "Ethereum Mainnet",
|
||||||
|
"shortName": "*",
|
||||||
|
"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": []
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user