Merge branch 'master' of https://github.com/ethereum-lists/chains into master

This commit is contained in:
Zombieliu 2021-04-26 00:35:31 +08:00
commit 98fbf94734
40 changed files with 571 additions and 41 deletions

View File

@ -69,4 +69,4 @@ DEPENDENCIES
tzinfo-data tzinfo-data
BUNDLED WITH BUNDLED WITH
1.16.3 2.1.4

View File

@ -1,8 +1,6 @@
# EVM-based Chains # EVM-based Chains
Listed by chainId according to EIP-155 The source data is in _data/chains. Each chain has its own file with the filename being the [CAIP-2](https://github.com/ChainAgnostic/CAIPs/blob/master/CAIPs/caip-2.md) representation as name and `.json` ans extension.
Data source available on `_data/chains.json`
## Example ## Example
@ -24,14 +22,48 @@ Data source available on `_data/chains.json`
"infoURL": "https://ethereum.org", "infoURL": "https://ethereum.org",
"shortName": "eth", "shortName": "eth",
"chainId": 1, "chainId": 1,
"networkId": 1 "networkId": 1,
"icon": "ethereum",
"explorers": [{
"name": "etherscan",
"url": "https://etherscan.io",
"icon": "etherscan",
"standard": "EIP3091"
}]
} }
``` ```
when an icon is used in either the network or a explorer there must be a json in _data/icons with the name used (e.g. in the above example there must be a `ethereum.json` and a `etherscan.json` in there) - the icon jsons look like this:
```json
[
{
"url": "ipfs://QmdwQDr6vmBtXmK2TmknkEuZNoaDqTasFdZdu3DRw8b2wt",
"width": 1000,
"height": 1628,
"format": "png"
}
]
```
where:
* the URL must be a IPFS url that is publicly resolveable
* width and height are optional - but when one is there then the other must be there also
* format is either "png", "jpg" or "svg"
## Aggregation
There are also aggregated json files with all chains automatically assembled:
* https://chainid.network/chains.json
* https://chainid.network/chains_mini.json (miniaturized - fewer fields for smaller filesize)
## Usages ## Usages
* [chainlist.org](https://chainlist.org) * [chainlist.org](https://chainlist.org) or [networklist-org.vercel.app](https://networklist-org.vercel.app) as a staging version with a more up-to-date list
* [chainid.network](https://chainid.network) * [chainid.network](https://chainid.network)
* [WallETH](https://walleth.org) * [WallETH](https://walleth.org)
* [TREZOR](https://trezor.io) * [TREZOR](https://trezor.io)
* [networks.vercel.app](https://networks.vercel.app)
* Your project - contact us to add it here! * Your project - contact us to add it here!

View File

@ -2,6 +2,7 @@
"name": "Ethereum Mainnet", "name": "Ethereum Mainnet",
"chain": "ETH", "chain": "ETH",
"network": "mainnet", "network": "mainnet",
"icon": "ethereum",
"rpc": [ "rpc": [
"https://mainnet.infura.io/v3/${INFURA_API_KEY}", "https://mainnet.infura.io/v3/${INFURA_API_KEY}",
"wss://mainnet.infura.io/ws/v3/${INFURA_API_KEY}", "wss://mainnet.infura.io/ws/v3/${INFURA_API_KEY}",
@ -21,5 +22,10 @@
"slip44": 60, "slip44": 60,
"ens": { "ens": {
"registry":"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e" "registry":"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"
} },
"explorers": [{
"name": "etherscan",
"url": "https://etherscan.io",
"standard": "EIP3091"
}]
} }

View File

@ -2,7 +2,11 @@
"name": "Clover Mainnet", "name": "Clover Mainnet",
"chain": "Clover", "chain": "Clover",
"network": "clover mainnet", "network": "clover mainnet",
"rpc": [], "rpc": [
"https://rpc-ivy.clover.finance",
"https://rpc-ivy-2.clover.finance",
"https://rpc-ivy-3.clover.finance"
],
"faucets": [], "faucets": [],
"nativeCurrency": { "nativeCurrency": {
"name": "Clover", "name": "Clover",
@ -13,4 +17,4 @@
"shortName": "clv", "shortName": "clv",
"chainId": 1024, "chainId": 1024,
"networkId": 1024 "networkId": 1024
} }

View File

@ -9,7 +9,7 @@
"symbol": "MATH", "symbol": "MATH",
"decimals": 18 "decimals": 18
}, },
"infoURL": "https://mathwallet.org", "infoURL": "https://mathchain.org",
"shortName": "MATH", "shortName": "MATH",
"chainId": 1139, "chainId": 1139,
"networkId": 1139 "networkId": 1139

View File

@ -2,14 +2,18 @@
"name": "MathChain Testnet", "name": "MathChain Testnet",
"chain": "MATH", "chain": "MATH",
"network": "testnet", "network": "testnet",
"rpc": [], "rpc": [
"faucets": [], "https://galois-hk.maiziqianbao.net/rpc"
],
"faucets": [
"https://scan.boka.network/#/Galois/faucet"
],
"nativeCurrency": { "nativeCurrency": {
"name": "MathChain", "name": "MathChain",
"symbol": "MATH", "symbol": "MATH",
"decimals": 18 "decimals": 18
}, },
"infoURL": "https://mathwallet.org/", "infoURL": "https://mathchain.org",
"shortName": "tMATH", "shortName": "tMATH",
"chainId": 1140, "chainId": 1140,
"networkId": 1140 "networkId": 1140

View File

@ -12,7 +12,7 @@
"symbol": "HT", "symbol": "HT",
"decimals": 18 "decimals": 18
}, },
"infoURL": "https://www.hecochain.com", "infoURL": "https://hecoinfo.com",
"shortName": "heco", "shortName": "heco",
"chainId": 128, "chainId": 128,
"networkId": 128 "networkId": 128

View File

@ -3,7 +3,7 @@
"chain": "Harmony", "chain": "Harmony",
"network": "mainnet", "network": "mainnet",
"rpc": [ "rpc": [
"https://rpc.s0.t.hmny.io" "https://api.harmony.one"
], ],
"faucets": [ "faucets": [
], ],

View File

@ -3,7 +3,7 @@
"chain": "Harmony", "chain": "Harmony",
"network": "mainnet", "network": "mainnet",
"rpc": [ "rpc": [
"https://rpc.s1.t.hmny.io" "https://s1.api.harmony.one"
], ],
"faucets": [ "faucets": [
], ],

View File

@ -3,7 +3,7 @@
"chain": "Harmony", "chain": "Harmony",
"network": "mainnet", "network": "mainnet",
"rpc": [ "rpc": [
"https://rpc.s2.t.hmny.io" "https://s2.api.harmony.one"
], ],
"faucets": [ "faucets": [
], ],

View File

@ -3,7 +3,7 @@
"chain": "Harmony", "chain": "Harmony",
"network": "mainnet", "network": "mainnet",
"rpc": [ "rpc": [
"https://rpc.s3.t.hmny.io" "https://s3.api.harmony.one"
], ],
"faucets": [ "faucets": [
], ],

View File

@ -0,0 +1,20 @@
{
"name": "Harmony Testnet Shard 0",
"chain": "Harmony",
"network": "testnet",
"rpc": [
"https://api.s0.b.hmny.io"
],
"faucets": [
],
"nativeCurrency": {
"name": "ONE",
"symbol": "ONE",
"decimals": 18
},
"infoURL": "https://www.harmony.one/",
"shortName": "hmy-b-s0",
"chainId": 1666700000,
"networkId": 1666700000
}

View File

@ -0,0 +1,20 @@
{
"name": "Harmony Testnet Shard 1",
"chain": "Harmony",
"network": "testnet",
"rpc": [
"https://api.s1.b.hmny.io"
],
"faucets": [
],
"nativeCurrency": {
"name": "ONE",
"symbol": "ONE",
"decimals": 18
},
"infoURL": "https://www.harmony.one/",
"shortName": "hmy-b-s1",
"chainId": 1666700001,
"networkId": 1666700001
}

View File

@ -0,0 +1,20 @@
{
"name": "Harmony Testnet Shard 2",
"chain": "Harmony",
"network": "testnet",
"rpc": [
"https://api.s2.b.hmny.io"
],
"faucets": [
],
"nativeCurrency": {
"name": "ONE",
"symbol": "ONE",
"decimals": 18
},
"infoURL": "https://www.harmony.one/",
"shortName": "hmy-b-s2",
"chainId": 1666700002,
"networkId": 1666700002
}

View File

@ -0,0 +1,20 @@
{
"name": "Harmony Testnet Shard 3",
"chain": "Harmony",
"network": "testnet",
"rpc": [
"https://api.s3.b.hmny.io"
],
"faucets": [
],
"nativeCurrency": {
"name": "ONE",
"symbol": "ONE",
"decimals": 18
},
"infoURL": "https://www.harmony.one/",
"shortName": "hmy-b-s3",
"chainId": 1666700003,
"networkId": 1666700003
}

View File

@ -0,0 +1,16 @@
{
"name": "ELA-DID-Sidechain Mainnet",
"chain": "ETH",
"network": "mainnet",
"rpc": [],
"faucets": [],
"nativeCurrency": {
"name": "Elastos",
"symbol": "ELA",
"decimals": 18
},
"infoURL": "https://www.elastos.org/",
"shortName": "eladid",
"chainId": 22,
"networkId": 22
}

View File

@ -0,0 +1,16 @@
{
"name": "ELA-DID-Sidechain Testnet",
"chain": "ETH",
"network": "testnet",
"rpc": [],
"faucets": [],
"nativeCurrency": {
"name": "Elastos",
"symbol": "tELA",
"decimals": 18
},
"infoURL": "https://elaeth.io/",
"shortName": "eladidt",
"chainId": 23,
"networkId": 23
}

View File

@ -0,0 +1,18 @@
{
"name": "MintMe.com Coin",
"chain": "MINTME",
"network": "mainnet",
"rpc": [
"https://node1.mintme.com"
],
"faucets": [],
"nativeCurrency": {
"name": "MintMe.com Coin",
"symbol": "MINTME",
"decimals": 18
},
"infoURL": "https://www.mintme.com",
"shortName": "mintme",
"chainId": 24734,
"networkId": 37480
}

View File

@ -14,7 +14,7 @@
"symbol": "htt", "symbol": "htt",
"decimals": 18 "decimals": 18
}, },
"infoURL": "https://www.hecochain.com", "infoURL": "https://testnet.hecoinfo.com",
"shortName": "hecot", "shortName": "hecot",
"chainId": 256, "chainId": 256,
"networkId": 256 "networkId": 256

View File

@ -3,7 +3,7 @@
"chain": "HPB", "chain": "HPB",
"network": "mainnet", "network": "mainnet",
"rpc": [ "rpc": [
"https://node.hpb.blue" "https://hpb.app"
], ],
"faucets": [], "faucets": [],
"nativeCurrency": { "nativeCurrency": {
@ -11,7 +11,7 @@
"symbol": "HPB", "symbol": "HPB",
"decimals": 18 "decimals": 18
}, },
"infoURL": "https://hpb.io", "infoURL": "https://hpbscan.org/",
"shortName": "hpb", "shortName": "hpb",
"chainId": 269, "chainId": 269,
"networkId": 100, "networkId": 100,

View File

@ -0,0 +1,16 @@
{
"name": "Darwinia Crab Network",
"chain": "crab",
"network": "Crab network",
"rpc": [],
"faucets": [],
"nativeCurrency": {
"name": "Crab Token",
"symbol": "CRING",
"decimals": 9
},
"infoURL": "https://crab.network/",
"shortName": "crab",
"chainId": 44,
"networkId": 44
}

View File

@ -0,0 +1,19 @@
{
"name": "IoTeX Network Mainnet",
"chain": "IOTX",
"network": "mainnet",
"rpc": [
"https://babel-api.mainnet.iotex.one"
],
"faucets": [
],
"nativeCurrency": {
"name": "IoTeX",
"symbol": "IOTX",
"decimals": 18
},
"infoURL": "https://iotex.io",
"shortName": "iotex-mainnet",
"chainId": 4689,
"networkId": 4689
}

View File

@ -0,0 +1,19 @@
{
"name": "IoTeX Network Testnet",
"chain": "IOTX",
"network": "testnet",
"rpc": [
"https://babel-api.testnet.iotex.one"
],
"faucets": [
],
"nativeCurrency": {
"name": "IoTeX",
"symbol": "IOTX",
"decimals": 18
},
"infoURL": "https://iotex.io",
"shortName": "iotex-testnet",
"chainId": 4690,
"networkId": 4690
}

View File

@ -3,7 +3,7 @@
"chain": "okexchain", "chain": "okexchain",
"network": "testnet", "network": "testnet",
"rpc": [ "rpc": [
"https://exchaintest.okexcn.com" "https://exchaintestrpc.okex.org"
], ],
"faucets": ["https://www.okex.com/drawdex"], "faucets": ["https://www.okex.com/drawdex"],
"nativeCurrency": { "nativeCurrency": {
@ -15,4 +15,4 @@
"shortName": "tokt", "shortName": "tokt",
"chainId": 65, "chainId": 65,
"networkId": 65 "networkId": 65
} }

View File

@ -3,7 +3,7 @@
"chain": "okexchain", "chain": "okexchain",
"network": "mainnet", "network": "mainnet",
"rpc": [ "rpc": [
"https://exchain.okexcn.com" "https://exchainrpc.okex.org"
], ],
"faucets": [], "faucets": [],
"nativeCurrency": { "nativeCurrency": {
@ -15,4 +15,4 @@
"shortName": "okt", "shortName": "okt",
"chainId": 66, "chainId": 66,
"networkId": 66 "networkId": 66
} }

View File

@ -0,0 +1,18 @@
{
"name": "MDGL Testnet",
"chain": "MDGL",
"network": "testnet",
"rpc": [
"https://testnet.mdgl.io"
],
"faucets": [],
"nativeCurrency": {
"name": "MDGL Token",
"symbol": "MDGLT",
"decimals": 18
},
"infoURL": "https://mdgl.io",
"shortName": "mdgl",
"chainId": 8029,
"networkId": 8029
}

View File

@ -0,0 +1,19 @@
{
"name": "KorthoTest",
"chain": "Kortho",
"network": "Test",
"rpc": [
"https://www.krotho-test.net"
],
"faucets": [
],
"nativeCurrency": {
"name": "Kortho Test",
"symbol": "KTO",
"decimals": 11
},
"infoURL": "https://www.kortho.io/",
"shortName": "Kortho",
"chainId": 8285,
"networkId": 8285
}

View File

@ -0,0 +1,8 @@
[
{
"url":"ipfs://QmdwQDr6vmBtXmK2TmknkEuZNoaDqTasFdZdu3DRw8b2wt",
"width":1000,
"height":1628,
"format":"png"
}
]

View File

@ -1,7 +1,7 @@
buildscript { buildscript {
ext { ext {
KOTLIN_VERSION = "1.4.31" KOTLIN_VERSION = "1.4.32"
KETHEREUM_VERSION = "0.83.4" KETHEREUM_VERSION = "0.83.6"
} }
repositories { repositories {
@ -35,7 +35,7 @@ dependencies {
implementation "com.github.komputing.kethereum:crypto_impl_bouncycastle:${KETHEREUM_VERSION}" implementation "com.github.komputing.kethereum:crypto_impl_bouncycastle:${KETHEREUM_VERSION}"
implementation 'com.beust:klaxon:5.4' implementation 'com.beust:klaxon:5.4'
implementation 'com.squareup.moshi:moshi-kotlin:1.11.0' implementation 'com.squareup.moshi:moshi-kotlin:1.12.0'
implementation 'com.squareup.okhttp3:okhttp:4.7.2' implementation 'com.squareup.okhttp3:okhttp:4.7.2'
testImplementation "org.jetbrains.kotlin:kotlin-test" testImplementation "org.jetbrains.kotlin:kotlin-test"

View File

@ -13,6 +13,7 @@ permalink: chains.json
"nativeCurrency": {"name":"{{chain.nativeCurrency["name"]}}","symbol":"{{chain.nativeCurrency["symbol"]}}","decimals":{{chain.nativeCurrency["decimals"]}}}, "nativeCurrency": {"name":"{{chain.nativeCurrency["name"]}}","symbol":"{{chain.nativeCurrency["symbol"]}}","decimals":{{chain.nativeCurrency["decimals"]}}},
"rpc": [{% for rpc in chain.rpc %}"{{ rpc }}"{% unless forloop.last %},{% endunless %}{%endfor%}], "rpc": [{% for rpc in chain.rpc %}"{{ rpc }}"{% unless forloop.last %},{% endunless %}{%endfor%}],
"faucets": [{% for faucet in chain.faucets %}"{{ faucet }}"{% unless forloop.last %},{% endunless %}{%endfor%}], "faucets": [{% for faucet in chain.faucets %}"{{ faucet }}"{% unless forloop.last %},{% endunless %}{%endfor%}],
"explorers": [{% for explorer in chain.explorers %}{"name":"{{explorer.name}}","url":"{{explorer.url}}"{% if explorer.icon != null %},"icon":"{{explorer.icon}}"{% endif %},"standard":"{{explorer.standard}}"}{% unless forloop.last %},{% endunless %}{%endfor%}],
"infoURL": "{{ chain.infoURL }}" "infoURL": "{{ chain.infoURL }}"
}{% unless forloop.last %},{% endunless %}{% endif %}{% endfor %} }{% unless forloop.last %},{% endunless %}{% endif %}{% endfor %}
] ]

View File

@ -19,7 +19,9 @@ val mandatory_fields = listOf(
) )
val optionalFields = listOf( val optionalFields = listOf(
"slip44", "slip44",
"ens" "ens",
"icon",
"explorers"
) )
val moshi: Moshi = Moshi.Builder().add(KotlinJsonAdapterFactory()).build() val moshi: Moshi = Moshi.Builder().add(KotlinJsonAdapterFactory()).build()

View File

@ -1,5 +1,6 @@
package org.ethereum.lists.chains package org.ethereum.lists.chains
import com.beust.klaxon.JsonArray
import java.io.File import java.io.File
import com.beust.klaxon.JsonObject import com.beust.klaxon.JsonObject
import com.beust.klaxon.Klaxon import com.beust.klaxon.Klaxon
@ -8,16 +9,23 @@ import org.kethereum.erc55.isValid
import org.kethereum.model.Address import org.kethereum.model.Address
import org.kethereum.rpc.HttpEthereumRPC import org.kethereum.rpc.HttpEthereumRPC
val parsedShortNames= mutableSetOf<String>() val parsedShortNames = mutableSetOf<String>()
val parsedNames= mutableSetOf<String>() val parsedNames = mutableSetOf<String>()
val iconsPath = File("_data/icons")
fun main(args: Array<String>) { fun main(args: Array<String>) {
val allFiles = File("_data/chains").listFiles()?:return val allFiles = File("_data/chains").listFiles() ?: return
allFiles.filter { !it.isDirectory }.forEach { allFiles.filter { !it.isDirectory }.forEach {
checkChain(it, args.contains("rpcConnect")) checkChain(it, args.contains("rpcConnect"))
} }
val allIcons = iconsPath.listFiles() ?: return
allIcons.forEach {
checkIcon(it)
}
allFiles.filter { it.isDirectory }.forEach { allFiles.filter { it.isDirectory }.forEach {
if (it.name != "deprecated") { if (it.name != "deprecated") {
error("the only directory allowed is 'deprecated'") error("the only directory allowed is 'deprecated'")
@ -25,23 +33,60 @@ fun main(args: Array<String>) {
} }
} }
fun checkChain(it: File, connectRPC: Boolean) { fun checkIcon(icon: File) {
println("processing $it") println("checking Icon " + icon.name)
val obj: JsonArray<*> = Klaxon().parseJsonArray(icon.reader())
println("found variants " + obj.size)
obj.forEach { it ->
if (it !is JsonObject) {
error("Icon variant must be an object")
}
parseWithMoshi(it) val url = it["url"] ?: error("Icon must have a URL")
val jsonObject = Klaxon().parseJsonObject(it.reader()) if (url !is String || !url.startsWith("ipfs://")) {
error("url must start with ipfs://")
}
val width = it["width"]
val height = it["height"]
if (width != null || height != null) {
if (height == null || width == null) {
error("If icon has width or height it needs to have both")
}
if (width !is Int) {
error("Icon width must be Int")
}
if (height !is Int) {
error("Icon height must be Int")
}
}
val format = it["format"]
if (format !is String || (format != "png" && format != "svg")) {
error("Icon format must be a png or svg but was $format")
}
}
}
fun checkChain(chainFile: File, connectRPC: Boolean) {
println("processing $chainFile")
parseWithMoshi(chainFile)
val jsonObject = Klaxon().parseJsonObject(chainFile.reader())
val chainAsLong = getNumber(jsonObject, "chainId") val chainAsLong = getNumber(jsonObject, "chainId")
if (it.nameWithoutExtension.startsWith("eip155-")) { if (chainFile.nameWithoutExtension.startsWith("eip155-")) {
if (chainAsLong != it.nameWithoutExtension.replace("eip155-","").toLongOrNull()) { if (chainAsLong != chainFile.nameWithoutExtension.replace("eip155-", "").toLongOrNull()) {
throw(FileNameMustMatchChainId()) throw(FileNameMustMatchChainId())
} }
} else { } else {
throw(UnsupportedNamespace()) throw(UnsupportedNamespace())
} }
if (it.extension != "json") { if (chainFile.extension != "json") {
throw(ExtensionMustBeJSON()) throw(ExtensionMustBeJSON())
} }
@ -57,6 +102,36 @@ fun checkChain(it: File, connectRPC: Boolean) {
throw ShouldHaveNoMissingFields(missingFields) throw ShouldHaveNoMissingFields(missingFields)
} }
jsonObject["icon"]?.let {
if (!File(iconsPath, "$it.json").exists()) {
error("The Icon $it does not exist - was used in ${chainFile.name}")
}
}
jsonObject["explorers"]?.let {
if (it !is JsonArray<*>) {
throw (ExplorersMustBeArray())
}
it.forEach { explorer ->
if (explorer !is JsonObject) {
error("explorer must be object")
}
if (explorer["name"] == null) {
throw(ExplorerMustHaveName())
}
val url = explorer["url"]
if (url == null || url !is String || !url.startsWith("https://")) {
throw(ExplorerInvalidUrl())
}
if (explorer["standard"] != "EIP3091") {
throw(ExplorerStandardMustBeEIP3091())
}
}
}
jsonObject["ens"]?.let { jsonObject["ens"]?.let {
if (it !is JsonObject) { if (it !is JsonObject) {
throw ENSMustBeObject() throw ENSMustBeObject()

View File

@ -11,4 +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 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 ExplorerStandardMustBeEIP3091: Exception("explorer standard must be EIP3091 - currently the only one supported")

View File

@ -1,5 +1,6 @@
package org.ethereum.lists.chains
import com.squareup.moshi.JsonEncodingException import com.squareup.moshi.JsonEncodingException
import org.ethereum.lists.chains.*
import org.ethereum.lists.chains.model.* import org.ethereum.lists.chains.model.*
import org.junit.Before import org.junit.Before
import org.junit.Test import org.junit.Test
@ -20,6 +21,13 @@ class TheChainChecker {
checkChain(file, false) checkChain(file, false)
} }
@Test
fun shouldPassForValidChainWithExplorers() {
val file = getFile("valid/withexplorer/eip155-1.json")
checkChain(file, false)
}
@Test(expected = FileNameMustMatchChainId::class) @Test(expected = FileNameMustMatchChainId::class)
fun shouldFailForInvalidFilename() { fun shouldFailForInvalidFilename() {
val file = getFile("invalid/eip155-invalid_filename.json") val file = getFile("invalid/eip155-invalid_filename.json")
@ -103,6 +111,31 @@ class TheChainChecker {
checkChain(getFile("invalid/sameshortname/eip155-1.json"), false) checkChain(getFile("invalid/sameshortname/eip155-1.json"), false)
} }
@Test(expected = ExplorersMustBeArray::class)
fun shouldFailWhenExplorerIsNotArray() {
checkChain(getFile("invalid/explorersnotarray/eip155-1.json"), false)
}
@Test(expected = ExplorerStandardMustBeEIP3091::class)
fun shouldFailOnWrongExplorerStandard() {
checkChain(getFile("invalid/wrongexplorerstandard/eip155-1.json"), false)
}
@Test(expected = ExplorerMustHaveName::class)
fun shouldFailOnNoExplorerName() {
checkChain(getFile("invalid/explorernoname/eip155-1.json"), false)
}
@Test(expected = ExplorerInvalidUrl::class)
fun shouldFailOnInvalidUrl() {
checkChain(getFile("invalid/explorerinvalidurl/eip155-1.json"), false)
}
@Test(expected = ExplorerInvalidUrl::class)
fun shouldFailOnMissingURL() {
checkChain(getFile("invalid/explorermissingurl/eip155-1.json"), false)
}
@Test @Test
fun canParse2chains() { fun canParse2chains() {
checkChain(getFile("valid/eip155-1.json"), false) checkChain(getFile("valid/eip155-1.json"), false)

View File

@ -0,0 +1,24 @@
{
"name": "Ethereum Mainnet",
"shortName": "eth",
"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": [{
"name": "yolo",
"url": "failme",
"standard": "EIP3091"
}]
}

View File

@ -0,0 +1,23 @@
{
"name": "Ethereum Mainnet",
"shortName": "eth",
"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": [{
"name": "yolo",
"standard": "EIP3091"
}]
}

View File

@ -0,0 +1,23 @@
{
"name": "Ethereum Mainnet",
"shortName": "eth",
"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": [{
"url": "https://etherscan.io",
"standard": "EIP3091"
}]
}

View File

@ -0,0 +1,20 @@
{
"name": "Ethereum Mainnet",
"shortName": "eth",
"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": "should_fail"
}

View File

@ -0,0 +1,24 @@
{
"name": "Ethereum Mainnet",
"shortName": "eth",
"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": [{
"name": "etherscan",
"url": "https://etherscan.io",
"standard": "failme"
}]
}

View File

@ -0,0 +1,26 @@
{
"name": "Ethereum Mainnet",
"shortName": "eth",
"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": [
{
"name": "etherscan",
"url": "https://etherscan.io",
"standard": "EIP3091"
}
]
}