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,
"explorers": [{
"name": "testbttcscan",
"url": "https://testscan.bittorrentchain.io/",
"url": "https://testscan.bittorrentchain.io",
"standard": "none"
}]
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -189,7 +189,11 @@ fun checkChain(chainFile: File, connectRPC: Boolean) {
val url = explorer["url"]
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") {

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 ExplorersMustBeArray: Exception("explorers must be an array")
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 ParentHasInvalidType(type: String?): Exception("Parent has invalid type $type - only L2 or shard allowed")
class ParentMustBeObject: Exception("parent must be an object")

View File

@ -211,12 +211,12 @@ class TheChainChecker {
checkChain(getFile("invalid/explorernoname/eip155-1.json"), false)
}
@Test(expected = ExplorerInvalidUrl::class)
@Test(expected = ExplorerMustWithHttps::class)
fun shouldFailOnInvalidUrl() {
checkChain(getFile("invalid/explorerinvalidurl/eip155-1.json"), false)
}
@Test(expected = ExplorerInvalidUrl::class)
@Test(expected = ExplorerMustWithHttps::class)
fun shouldFailOnMissingURL() {
checkChain(getFile("invalid/explorermissingurl/eip155-1.json"), false)
}
@ -227,6 +227,6 @@ class TheChainChecker {
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)
}