Normalize explorer URLs

This commit is contained in:
ligi 2022-01-14 21:12:06 +01:00
parent b5997f796c
commit 12d2c2f878
No known key found for this signature in database
GPG Key ID: 8E81894010ABF23D
48 changed files with 68 additions and 63 deletions

View File

@ -16,7 +16,7 @@
"networkId": 1028, "networkId": 1028,
"explorers": [{ "explorers": [{
"name": "testbttcscan", "name": "testbttcscan",
"url": "https://testscan.bittorrentchain.io/", "url": "https://testscan.bittorrentchain.io",
"standard": "none" "standard": "none"
}] }]
} }

View File

@ -15,7 +15,7 @@
"explorers": [ "explorers": [
{ {
"name": "blockscout", "name": "blockscout",
"url": "https://andromeda-explorer.metis.io/", "url": "https://andromeda-explorer.metis.io",
"standard": "EIP3091" "standard": "EIP3091"
} }
], ],

View File

@ -17,7 +17,7 @@
"networkId": 1280, "networkId": 1280,
"explorers": [{ "explorers": [{
"name": "HALOexplorer", "name": "HALOexplorer",
"url": "https://browser.halo.land/", "url": "https://browser.halo.land",
"standard": "none" "standard": "none"
}] }]
} }

View File

@ -18,12 +18,12 @@
"explorers": [ "explorers": [
{ {
"name": "blockscout", "name": "blockscout",
"url": "https://blockscout.moonbeam.network/", "url": "https://blockscout.moonbeam.network",
"standard": "none" "standard": "none"
}, },
{ {
"name": "moonscan", "name": "moonscan",
"url": "https://moonbeam.moonscan.io/", "url": "https://moonbeam.moonscan.io",
"standard": "none" "standard": "none"
} }
] ]

View File

@ -18,7 +18,7 @@
"explorers": [ "explorers": [
{ {
"name": "moonscan", "name": "moonscan",
"url": "https://moonriver.moonscan.io/", "url": "https://moonriver.moonscan.io",
"standard": "none" "standard": "none"
} }
] ]

View File

@ -18,7 +18,7 @@
"explorers": [ "explorers": [
{ {
"name": "moonscan", "name": "moonscan",
"url": "https://moonbase.moonscan.io/", "url": "https://moonbase.moonscan.io",
"standard": "none" "standard": "none"
} }
] ]

View File

@ -20,7 +20,7 @@
"networkId": 1337702, "networkId": 1337702,
"explorers": [{ "explorers": [{
"name": "kintsugi explorer", "name": "kintsugi explorer",
"url": "https://explorer.kintsugi.themerge.dev/", "url": "https://explorer.kintsugi.themerge.dev",
"standard": "EIP3091" "standard": "EIP3091"
}] }]
} }

View File

@ -22,7 +22,7 @@
"slip44": 966, "slip44": 966,
"explorers": [{ "explorers": [{
"name": "polygonscan", "name": "polygonscan",
"url": "https://polygonscan.com/", "url": "https://polygonscan.com",
"standard": "EIP3091" "standard": "EIP3091"
}] }]
} }

View File

@ -16,7 +16,7 @@
"networkId": 186, "networkId": 186,
"explorers": [{ "explorers": [{
"name": "seeleview", "name": "seeleview",
"url": "https://seeleview.net/", "url": "https://seeleview.net",
"standard": "none" "standard": "none"
}] }]
} }

View File

@ -16,7 +16,7 @@
"networkId": 188, "networkId": 188,
"explorers": [{ "explorers": [{
"name": "Blockmeta", "name": "Blockmeta",
"url": "https://bmc.blockmeta.com/", "url": "https://bmc.blockmeta.com",
"standard": "none" "standard": "none"
}] }]
} }

View File

@ -16,7 +16,7 @@
"networkId": 189, "networkId": 189,
"explorers": [{ "explorers": [{
"name": "Blockmeta", "name": "Blockmeta",
"url": "https://bmc.blockmeta.com/", "url": "https://bmc.blockmeta.com",
"standard": "none" "standard": "none"
}] }]
} }

View File

@ -16,7 +16,7 @@
"networkId": 192837465, "networkId": 192837465,
"explorers": [{ "explorers": [{
"name": "Blockscout", "name": "Blockscout",
"url": "https://explorer.gather.network/", "url": "https://explorer.gather.network",
"standard": "none" "standard": "none"
}] }]
} }

View File

@ -16,7 +16,7 @@
"networkId": 199, "networkId": 199,
"explorers": [{ "explorers": [{
"name": "bttcscan", "name": "bttcscan",
"url": "https://scan.bittorrentchain.io/", "url": "https://scan.bittorrentchain.io",
"standard": "none" "standard": "none"
}] }]
} }

View File

@ -19,7 +19,7 @@
"explorers": [ "explorers": [
{ {
"name": "alaya explorer", "name": "alaya explorer",
"url": "https://scan.alaya.network/", "url": "https://scan.alaya.network",
"standard": "none" "standard": "none"
} }
] ]

View File

@ -16,7 +16,7 @@
"networkId": 2100, "networkId": 2100,
"explorers": [{ "explorers": [{
"name": "Ecoball Explorer", "name": "Ecoball Explorer",
"url": "https://scan.ecoball.org/", "url": "https://scan.ecoball.org",
"standard": "EIP3091" "standard": "EIP3091"
}] }]
} }

View File

@ -16,7 +16,7 @@
"networkId": 2101, "networkId": 2101,
"explorers": [{ "explorers": [{
"name": "Ecoball Testnet Explorer", "name": "Ecoball Testnet Explorer",
"url": "https://espuma-scan.ecoball.org/", "url": "https://espuma-scan.ecoball.org",
"standard": "EIP3091" "standard": "EIP3091"
}] }]
} }

View File

@ -21,7 +21,7 @@
"explorers": [ "explorers": [
{ {
"name": "PlatON explorer", "name": "PlatON explorer",
"url": "https://devnetscan.platon.network/", "url": "https://devnetscan.platon.network",
"standard": "none" "standard": "none"
} }
] ]

View File

@ -16,7 +16,7 @@
"networkId": 26, "networkId": 26,
"explorers": [{ "explorers": [{
"name": "Genesis L1 testnet explorer", "name": "Genesis L1 testnet explorer",
"url": "https://testnet.genesisl1.org/", "url": "https://testnet.genesisl1.org",
"standard": "none" "standard": "none"
}] }]
} }

View File

@ -17,7 +17,7 @@
"icon": "SUR", "icon": "SUR",
"explorers": [{ "explorers": [{
"name": "Surnet Explorer", "name": "Surnet Explorer",
"url": "https://explorer.surnet.org/", "url": "https://explorer.surnet.org",
"icon": "SUR", "icon": "SUR",
"standard": "EIP3091" "standard": "EIP3091"
}] }]

View File

@ -20,7 +20,7 @@
"slip44": 269, "slip44": 269,
"explorers": [{ "explorers": [{
"name": "hscan", "name": "hscan",
"url": "https://hscan.org/", "url": "https://hscan.org",
"standard": "EIP3091" "standard": "EIP3091"
}] }]

View File

@ -16,7 +16,7 @@
"networkId": 27, "networkId": 27,
"explorers": [{ "explorers": [{
"name": "Shiba Explorer", "name": "Shiba Explorer",
"url": "https://exp.shibachain.net/", "url": "https://exp.shibachain.net",
"standard": "none" "standard": "none"
}] }]
} }

View File

@ -15,7 +15,7 @@
"explorers": [{ "explorers": [{
"name": "Blockscout", "name": "Blockscout",
"url": "https://blockexplorer.rinkeby.boba.network/", "url": "https://blockexplorer.rinkeby.boba.network",
"standard": "none" "standard": "none"
}], }],
"parent": { "parent": {

View File

@ -15,7 +15,7 @@
"explorers": [{ "explorers": [{
"name": "Blockscout", "name": "Blockscout",
"url": "https://blockexplorer.boba.network/", "url": "https://blockexplorer.boba.network",
"standard": "none" "standard": "none"
}], }],
"parent": { "parent": {

View File

@ -16,7 +16,7 @@
"networkId": 29, "networkId": 29,
"explorers": [{ "explorers": [{
"name": "Genesis L1 blockchain explorer", "name": "Genesis L1 blockchain explorer",
"url": "https://explorer.genesisl1.org/", "url": "https://explorer.genesisl1.org",
"standard": "none" "standard": "none"
}] }]
} }

View File

@ -16,7 +16,7 @@
"networkId": 356256156, "networkId": 356256156,
"explorers": [{ "explorers": [{
"name": "Blockscout", "name": "Blockscout",
"url": "https://testnet-explorer.gather.network/", "url": "https://testnet-explorer.gather.network",
"standard": "none" "standard": "none"
}] }]
} }

View File

@ -17,7 +17,7 @@
"explorers": [ "explorers": [
{ {
"name": "ftmscan", "name": "ftmscan",
"url": "https://testnet.ftmscan.com/", "url": "https://testnet.ftmscan.com",
"icon": "ftmscan", "icon": "ftmscan",
"standard": "EIP3091" "standard": "EIP3091"
} }

View File

@ -18,7 +18,7 @@
"networkId": 42261, "networkId": 42261,
"explorers": [{ "explorers": [{
"name": "Emerald Paratime Testnet Explorer", "name": "Emerald Paratime Testnet Explorer",
"url": "https://testnet.explorer.emerald.oasis.dev/", "url": "https://testnet.explorer.emerald.oasis.dev",
"standard": "EIP3091" "standard": "EIP3091"
}] }]
} }

View File

@ -18,7 +18,7 @@
"networkId": 42262, "networkId": 42262,
"explorers": [{ "explorers": [{
"name": "Emerald Paratime Mainnet Explorer", "name": "Emerald Paratime Mainnet Explorer",
"url": "https://explorer.emerald.oasis.dev/", "url": "https://explorer.emerald.oasis.dev",
"standard": "EIP3091" "standard": "EIP3091"
}] }]
} }

View File

@ -19,7 +19,7 @@
"explorers": [ "explorers": [
{ {
"name": "snowtrace", "name": "snowtrace",
"url": "https://testnet.snowtrace.io/", "url": "https://testnet.snowtrace.io",
"standard": "EIP3091" "standard": "EIP3091"
} }
] ]

View File

@ -18,7 +18,7 @@
"explorers": [ "explorers": [
{ {
"name": "snowtrace", "name": "snowtrace",
"url": "https://snowtrace.io/", "url": "https://snowtrace.io",
"standard": "EIP3091" "standard": "EIP3091"
} }
] ]

View File

@ -17,7 +17,7 @@
"networkId": 47805, "networkId": 47805,
"explorers": [{ "explorers": [{
"name": "rei-scan", "name": "rei-scan",
"url": "https://scan.rei.network/", "url": "https://scan.rei.network",
"standard": "none" "standard": "none"
}] }]
} }

View File

@ -16,7 +16,7 @@
"networkId": 486217935, "networkId": 486217935,
"explorers": [{ "explorers": [{
"name": "Blockscout", "name": "Blockscout",
"url": "https://devnet-explorer.gather.network/", "url": "https://devnet-explorer.gather.network",
"standard": "none" "standard": "none"
}] }]
} }

View File

@ -16,7 +16,7 @@
"networkId": 52, "networkId": 52,
"explorers": [{ "explorers": [{
"name": "coinexscan", "name": "coinexscan",
"url": "https://www.coinex.net/", "url": "https://www.coinex.net",
"standard": "none" "standard": "none"
}] }]
} }

View File

@ -16,7 +16,7 @@
"networkId": 53, "networkId": 53,
"explorers": [{ "explorers": [{
"name": "coinexscan", "name": "coinexscan",
"url": "https://testnet.coinex.net/", "url": "https://testnet.coinex.net",
"standard": "none" "standard": "none"
}] }]
} }

View File

@ -21,7 +21,7 @@
"networkId": 55, "networkId": 55,
"explorers": [{ "explorers": [{
"name": "zyxscan", "name": "zyxscan",
"url": "https://zyxscan.com/", "url": "https://zyxscan.com",
"standard": "none" "standard": "none"
}] }]
} }

View File

@ -20,7 +20,7 @@
"networkId": 58, "networkId": 58,
"explorers": [{ "explorers": [{
"name": "explorer", "name": "explorer",
"url": "https://explorer.ont.io/", "url": "https://explorer.ont.io",
"standard": "EIP3091" "standard": "EIP3091"
}] }]
} }

View File

@ -15,7 +15,7 @@
"explorers": [ "explorers": [
{ {
"name": "blockscout", "name": "blockscout",
"url": "https://stardust-explorer.metis.io/", "url": "https://stardust-explorer.metis.io",
"standard": "EIP3091" "standard": "EIP3091"
} }
], ],

View File

@ -18,7 +18,7 @@
"networkId": 60000, "networkId": 60000,
"explorers": [{ "explorers": [{
"name": "thinkiumscan", "name": "thinkiumscan",
"url": "https://test0.thinkiumscan.net/", "url": "https://test0.thinkiumscan.net",
"standard": "EIP3091" "standard": "EIP3091"
}] }]
} }

View File

@ -18,7 +18,7 @@
"networkId": 60001, "networkId": 60001,
"explorers": [{ "explorers": [{
"name": "thinkiumscan", "name": "thinkiumscan",
"url": "https://test1.thinkiumscan.net/", "url": "https://test1.thinkiumscan.net",
"standard": "EIP3091" "standard": "EIP3091"
}] }]
} }

View File

@ -18,7 +18,7 @@
"networkId": 60002, "networkId": 60002,
"explorers": [{ "explorers": [{
"name": "thinkiumscan", "name": "thinkiumscan",
"url": "https://test2.thinkiumscan.net/", "url": "https://test2.thinkiumscan.net",
"standard": "EIP3091" "standard": "EIP3091"
}] }]
} }

View File

@ -16,7 +16,7 @@
"networkId": 70000, "networkId": 70000,
"explorers": [{ "explorers": [{
"name": "thinkiumscan", "name": "thinkiumscan",
"url": "https://chain0.thinkiumscan.net/", "url": "https://chain0.thinkiumscan.net",
"standard": "EIP3091" "standard": "EIP3091"
}] }]
} }

View File

@ -16,7 +16,7 @@
"networkId": 70001, "networkId": 70001,
"explorers": [{ "explorers": [{
"name": "thinkiumscan", "name": "thinkiumscan",
"url": "https://chain1.thinkiumscan.net/", "url": "https://chain1.thinkiumscan.net",
"standard": "EIP3091" "standard": "EIP3091"
}] }]
} }

View File

@ -16,7 +16,7 @@
"networkId": 70002, "networkId": 70002,
"explorers": [{ "explorers": [{
"name": "thinkiumscan", "name": "thinkiumscan",
"url": "https://chain2.thinkiumscan.net/", "url": "https://chain2.thinkiumscan.net",
"standard": "EIP3091" "standard": "EIP3091"
}] }]
} }

View File

@ -16,7 +16,7 @@
"networkId": 70103, "networkId": 70103,
"explorers": [{ "explorers": [{
"name": "thinkiumscan", "name": "thinkiumscan",
"url": "https://chain103.thinkiumscan.net/", "url": "https://chain103.thinkiumscan.net",
"standard": "EIP3091" "standard": "EIP3091"
}] }]
} }

View File

@ -20,7 +20,7 @@
"networkId": 80001, "networkId": 80001,
"explorers": [{ "explorers": [{
"name": "polygonscan", "name": "polygonscan",
"url": "https://mumbai.polygonscan.com/", "url": "https://mumbai.polygonscan.com",
"standard": "EIP3091" "standard": "EIP3091"
}] }]
} }

View File

@ -189,7 +189,11 @@ fun checkChain(chainFile: File, connectRPC: Boolean) {
val url = explorer["url"] val url = explorer["url"]
if (url == null || url !is String || !url.startsWith("https://")) { if (url == null || url !is String || !url.startsWith("https://")) {
throw(ExplorerInvalidUrl()) throw(ExplorerMustWithHttps())
}
if (url.endsWith("/")) {
throw(ExplorerCannotEndInSlash())
} }
if (explorer["standard"] != "EIP3091" && explorer["standard"] != "none") { if (explorer["standard"] != "EIP3091" && explorer["standard"] != "none") {

View File

@ -15,7 +15,8 @@ class ShortNameMustNotBeStar: Exception("short name must not be '*'")
class UnsupportedNamespace: Exception("So far only the EIP155 namespace is supported") 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 ExplorerMustWithHttps: Exception("Explorer have url starting with https://")
class ExplorerCannotEndInSlash: Exception("Explorer cannot have a slash on the end")
class ExplorerStandardMustBeEIP3091OrNone: Exception("explorer standard must be 'none' or 'EIP3091'") 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")

View File

@ -211,12 +211,12 @@ class TheChainChecker {
checkChain(getFile("invalid/explorernoname/eip155-1.json"), false) checkChain(getFile("invalid/explorernoname/eip155-1.json"), false)
} }
@Test(expected = ExplorerInvalidUrl::class) @Test(expected = ExplorerMustWithHttps::class)
fun shouldFailOnInvalidUrl() { fun shouldFailOnInvalidUrl() {
checkChain(getFile("invalid/explorerinvalidurl/eip155-1.json"), false) checkChain(getFile("invalid/explorerinvalidurl/eip155-1.json"), false)
} }
@Test(expected = ExplorerInvalidUrl::class) @Test(expected = ExplorerMustWithHttps::class)
fun shouldFailOnMissingURL() { fun shouldFailOnMissingURL() {
checkChain(getFile("invalid/explorermissingurl/eip155-1.json"), false) checkChain(getFile("invalid/explorermissingurl/eip155-1.json"), false)
} }
@ -227,6 +227,6 @@ class TheChainChecker {
checkChain(getFile("valid/eip155-5.json"), false) checkChain(getFile("valid/eip155-5.json"), false)
} }
private fun getFile(s: String) = File(javaClass.classLoader.getResource("test_chains/$s").file) private fun getFile(s: String) = File(javaClass.classLoader.getResource("test_chains/$s")!!.file)
} }