mirror of
https://github.com/Instadapp/chains.git
synced 2024-07-29 22:37:19 +00:00
Allow 'none' as value for explorer standard
This commit is contained in:
parent
67af6867fd
commit
341ae07c03
|
@ -191,8 +191,8 @@ fun checkChain(chainFile: File, connectRPC: Boolean) {
|
||||||
throw(ExplorerInvalidUrl())
|
throw(ExplorerInvalidUrl())
|
||||||
}
|
}
|
||||||
|
|
||||||
if (explorer["standard"] != "EIP3091") {
|
if (explorer["standard"] != "EIP3091" && explorer["standard"] != "none") {
|
||||||
throw(ExplorerStandardMustBeEIP3091())
|
throw(ExplorerStandardMustBeEIP3091OrNone())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,7 @@ class UnsupportedNamespace(): Exception("So far only the EIP155 namespace is sup
|
||||||
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://")
|
||||||
class ExplorerStandardMustBeEIP3091: Exception("explorer standard must be EIP3091 - currently the only one supported")
|
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 ParentHasInvalidType(type: String?): Exception("Parent has invalid type $type - only L2 or shard allowed")
|
||||||
class ParentMustBeObject: Exception("parent must be an object")
|
class ParentMustBeObject: Exception("parent must be an object")
|
||||||
class ParentMustHaveChainAndType: Exception("parent must have fields 'chain' and 'type'")
|
class ParentMustHaveChainAndType: Exception("parent must have fields 'chain' and 'type'")
|
||||||
|
|
|
@ -28,6 +28,14 @@ class TheChainChecker {
|
||||||
checkChain(file, false)
|
checkChain(file, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun shouldPassForValidChainWithExplorersNoStandard() {
|
||||||
|
val file = getFile("valid/withexplorer/eip155-2.json")
|
||||||
|
|
||||||
|
checkChain(file, false)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun shouldPassForValidChainWithParent() {
|
fun shouldPassForValidChainWithParent() {
|
||||||
val file = getFile("valid/withparent/eip155-2.json")
|
val file = getFile("valid/withparent/eip155-2.json")
|
||||||
|
@ -186,7 +194,7 @@ class TheChainChecker {
|
||||||
checkChain(getFile("invalid/explorersnotarray/eip155-1.json"), false)
|
checkChain(getFile("invalid/explorersnotarray/eip155-1.json"), false)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected = ExplorerStandardMustBeEIP3091::class)
|
@Test(expected = ExplorerStandardMustBeEIP3091OrNone::class)
|
||||||
fun shouldFailOnWrongExplorerStandard() {
|
fun shouldFailOnWrongExplorerStandard() {
|
||||||
checkChain(getFile("invalid/wrongexplorerstandard/eip155-1.json"), false)
|
checkChain(getFile("invalid/wrongexplorerstandard/eip155-1.json"), false)
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,26 @@
|
||||||
|
{
|
||||||
|
"name": "Ethereum Mainnet",
|
||||||
|
"shortName": "eth",
|
||||||
|
"chain": "ETH",
|
||||||
|
"network": "mainnet",
|
||||||
|
"chainId": 2,
|
||||||
|
"networkId": 2,
|
||||||
|
"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": [
|
||||||
|
{
|
||||||
|
"name": "some",
|
||||||
|
"url": "https://etherscan.io",
|
||||||
|
"standard": "none"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user