mirror of
https://github.com/Instadapp/chains.git
synced 2024-07-29 22:37:19 +00:00
Use CAIP-2 prefixing for filename - closes #130
Note: so far CI wise only EIP155 is accepted as namespace - will be extended when chains from other namespaces are PRed in
This commit is contained in:
parent
1ba1ed6b95
commit
7056fdcfbc
|
@ -1,18 +0,0 @@
|
|||
{
|
||||
"name": "Newton Testnet",
|
||||
"chain": "NEW",
|
||||
"network": "testnet",
|
||||
"rpc": [
|
||||
"https://rpc1.newchain.newtonproject.org"
|
||||
],
|
||||
"faucets": [],
|
||||
"nativeCurrency": {
|
||||
"name": "Newton",
|
||||
"symbol": "NEW",
|
||||
"decimals": 18
|
||||
},
|
||||
"infoURL": "https://www.newtonproject.org/",
|
||||
"shortName": "tnew",
|
||||
"chainId": 1007,
|
||||
"networkId": 1007
|
||||
}
|
|
@ -1,18 +0,0 @@
|
|||
{
|
||||
"name": "Newton",
|
||||
"chain": "NEW",
|
||||
"network": "mainnet",
|
||||
"rpc": [
|
||||
"https://global.rpc.mainnet.newtonproject.org"
|
||||
],
|
||||
"faucets": [],
|
||||
"nativeCurrency": {
|
||||
"name": "Newton",
|
||||
"symbol": "NEW",
|
||||
"decimals": 18
|
||||
},
|
||||
"infoURL": "https://www.newtonproject.org/",
|
||||
"shortName": "new",
|
||||
"chainId": 1012,
|
||||
"networkId": 1012
|
||||
}
|
|
@ -1,16 +0,0 @@
|
|||
{
|
||||
"name": "MathChain",
|
||||
"chain": "MATH",
|
||||
"network": "mainnet",
|
||||
"rpc": [],
|
||||
"faucets": [],
|
||||
"nativeCurrency": {
|
||||
"name": "MathChain",
|
||||
"symbol": "MATH",
|
||||
"decimals": 18
|
||||
},
|
||||
"infoURL": "https://mathwallet.org",
|
||||
"shortName": "MATH",
|
||||
"chainId": 1139,
|
||||
"networkId": 1139
|
||||
}
|
|
@ -1,16 +0,0 @@
|
|||
{
|
||||
"name": "MathChain Testnet",
|
||||
"chain": "MATH",
|
||||
"network": "testnet",
|
||||
"rpc": [],
|
||||
"faucets": [],
|
||||
"nativeCurrency": {
|
||||
"name": "MathChain",
|
||||
"symbol": "MATH",
|
||||
"decimals": 18
|
||||
},
|
||||
"infoURL": "https://mathwallet.org/",
|
||||
"shortName": "tMATH",
|
||||
"chainId": 1140,
|
||||
"networkId": 1140
|
||||
}
|
|
@ -1,19 +0,0 @@
|
|||
{
|
||||
"name": "Flare Mainnet",
|
||||
"chain": "FLR",
|
||||
"network": "flare",
|
||||
"rpc": [
|
||||
],
|
||||
"faucets": [
|
||||
],
|
||||
"nativeCurrency": {
|
||||
"name": "Spark",
|
||||
"symbol": "FLR",
|
||||
"decimals": 18
|
||||
},
|
||||
"infoURL": "https://flare.xyz",
|
||||
"shortName": "flr",
|
||||
"chainId": 14,
|
||||
"networkId": 14,
|
||||
"slip44": 554
|
||||
}
|
|
@ -1,18 +0,0 @@
|
|||
{
|
||||
"name": "Flare Testnet Coston",
|
||||
"chain": "FLR",
|
||||
"network": "coston",
|
||||
"rpc": [
|
||||
],
|
||||
"faucets": [
|
||||
],
|
||||
"nativeCurrency": {
|
||||
"name": "Coston Spark",
|
||||
"symbol": "CFLR",
|
||||
"decimals": 18
|
||||
},
|
||||
"infoURL": "https://github.com/flare-eng/coston",
|
||||
"shortName": "cflr",
|
||||
"chainId": 16,
|
||||
"networkId": 16
|
||||
}
|
|
@ -1,16 +0,0 @@
|
|||
{
|
||||
"name": "420coin",
|
||||
"chain": "420",
|
||||
"network": "mainnet",
|
||||
"rpc": [],
|
||||
"faucets": [],
|
||||
"nativeCurrency": {
|
||||
"name": "Fourtwenty",
|
||||
"symbol": "420",
|
||||
"decimals": 18
|
||||
},
|
||||
"infoURL": "https://420integrated.com",
|
||||
"shortName": "420",
|
||||
"chainId": 2020,
|
||||
"networkId": 2020
|
||||
}
|
|
@ -1,17 +0,0 @@
|
|||
{
|
||||
"name": "Rupaya",
|
||||
"chain": "RUPX",
|
||||
"network": "mainnet",
|
||||
"rpc": [],
|
||||
"faucets": [],
|
||||
"nativeCurrency": {
|
||||
"name": "Rupaya",
|
||||
"symbol": "RUPX",
|
||||
"decimals": 18
|
||||
},
|
||||
"infoURL": "https://www.rupx.io",
|
||||
"shortName": "rupx",
|
||||
"chainId": 499,
|
||||
"networkId": 499,
|
||||
"slip44": 499
|
||||
}
|
|
@ -1,18 +0,0 @@
|
|||
{
|
||||
"name": "XinFin Network Mainnet",
|
||||
"chain": "XDC",
|
||||
"network": "mainnet",
|
||||
"rpc": [
|
||||
"https://rpc.xinfin.network"
|
||||
],
|
||||
"faucets": [],
|
||||
"nativeCurrency": {
|
||||
"name": "XinFin",
|
||||
"symbol": "XDC",
|
||||
"decimals": 18
|
||||
},
|
||||
"infoURL": "https://xinfin.org",
|
||||
"shortName": "xdc",
|
||||
"chainId": 50,
|
||||
"networkId": 50
|
||||
}
|
|
@ -1,18 +0,0 @@
|
|||
{
|
||||
"name": "XinFin Apothem Testnet",
|
||||
"chain": "TXDC",
|
||||
"network": "testnet",
|
||||
"rpc": [
|
||||
"https://rpc.apothem.network"
|
||||
],
|
||||
"faucets": [],
|
||||
"nativeCurrency": {
|
||||
"name": "XinFinTest",
|
||||
"symbol": "TXDC",
|
||||
"decimals": 18
|
||||
},
|
||||
"infoURL": "https://xinfin.org",
|
||||
"shortName": "TXDC",
|
||||
"chainId": 51,
|
||||
"networkId": 51
|
||||
}
|
|
@ -27,8 +27,12 @@ fun checkChain(it: File, connectRPC: Boolean) {
|
|||
val jsonObject = Klaxon().parseJsonObject(it.reader())
|
||||
val chainAsLong = getNumber(jsonObject, "chainId")
|
||||
|
||||
if (chainAsLong != it.nameWithoutExtension.toLongOrNull()) {
|
||||
throw(FileNameMustMatchChainId())
|
||||
if (it.nameWithoutExtension.startsWith("eip155-")) {
|
||||
if (chainAsLong != it.nameWithoutExtension.replace("eip155-","").toLongOrNull()) {
|
||||
throw(FileNameMustMatchChainId())
|
||||
}
|
||||
} else {
|
||||
throw(UnsupportedNamespace())
|
||||
}
|
||||
|
||||
if (it.extension != "json") {
|
||||
|
|
|
@ -10,4 +10,5 @@ class ENSMustBeObject: Exception("ens must be an object")
|
|||
class ENSMustHaveOnlyRegistry: Exception("ens can only have a registry currently")
|
||||
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 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")
|
|
@ -15,35 +15,35 @@ class TheChainChecker {
|
|||
|
||||
@Test
|
||||
fun shouldPassForValidChain() {
|
||||
val file = getFile("valid/1.json")
|
||||
val file = getFile("valid/eip155-1.json")
|
||||
|
||||
checkChain(file, false)
|
||||
}
|
||||
|
||||
@Test(expected = FileNameMustMatchChainId::class)
|
||||
fun shouldFailForInvalidFilename() {
|
||||
val file = getFile("invalid/invalid_filename.json")
|
||||
val file = getFile("invalid/eip155-invalid_filename.json")
|
||||
|
||||
checkChain(file, false)
|
||||
}
|
||||
|
||||
@Test(expected = FileNameMustMatchChainId::class)
|
||||
fun shouldFailForChainNotMatchingFilename() {
|
||||
val file = getFile("invalid/3.json")
|
||||
val file = getFile("invalid/eip155-3.json")
|
||||
|
||||
checkChain(file, false)
|
||||
}
|
||||
|
||||
@Test(expected = ShouldHaveNoExtraFields::class)
|
||||
fun shouldFailForExtraField() {
|
||||
val file = getFile("invalid/1.json")
|
||||
val file = getFile("invalid/eip155-1.json")
|
||||
|
||||
checkChain(file, false)
|
||||
}
|
||||
|
||||
@Test(expected = ShouldHaveNoMissingFields::class)
|
||||
fun shouldFailForMissingField() {
|
||||
val file = getFile("invalid/4.json")
|
||||
val file = getFile("invalid/eip155-4.json")
|
||||
|
||||
checkChain(file, false)
|
||||
}
|
||||
|
@ -51,62 +51,62 @@ class TheChainChecker {
|
|||
|
||||
@Test(expected = ENSRegistryAddressMustBeValid::class)
|
||||
fun shouldFailForInvalidENSAddress() {
|
||||
val file = getFile("invalid/99.json")
|
||||
val file = getFile("invalid/eip155-99.json")
|
||||
|
||||
checkChain(file, false)
|
||||
}
|
||||
|
||||
@Test(expected = ENSMustHaveOnlyRegistry::class)
|
||||
fun shouldFailForExtraENSFields() {
|
||||
val file = getFile("invalid/100.json")
|
||||
val file = getFile("invalid/eip155-100.json")
|
||||
|
||||
checkChain(file, false)
|
||||
}
|
||||
|
||||
@Test(expected = ENSMustHaveOnlyRegistry::class)
|
||||
fun shouldFailForNoRegistryField() {
|
||||
val file = getFile("invalid/101.json")
|
||||
val file = getFile("invalid/eip155-101.json")
|
||||
|
||||
checkChain(file, false)
|
||||
}
|
||||
|
||||
@Test(expected = ENSMustBeObject::class)
|
||||
fun shouldFailForENSISNotObject() {
|
||||
val file = getFile("invalid/102.json")
|
||||
val file = getFile("invalid/eip155-102.json")
|
||||
|
||||
checkChain(file, false)
|
||||
}
|
||||
|
||||
@Test(expected = ExtensionMustBeJSON::class)
|
||||
fun shouldFailForNonJSON() {
|
||||
val file = getFile("invalid/1.nojson")
|
||||
val file = getFile("invalid/eip155-1.nojson")
|
||||
|
||||
checkChain(file, false)
|
||||
}
|
||||
|
||||
@Test(expected = JsonEncodingException::class)
|
||||
fun shouldFailForExtraComma() {
|
||||
val file = getFile("invalid/extracomma.json")
|
||||
val file = getFile("invalid/eip155-extracomma.json")
|
||||
|
||||
checkChain(file, false)
|
||||
}
|
||||
|
||||
@Test(expected = NameMustBeUnique::class)
|
||||
fun shouldFailOnNonUniqueName() {
|
||||
checkChain(getFile("valid/1.json"), false)
|
||||
checkChain(getFile("valid/1.json"), false)
|
||||
checkChain(getFile("valid/eip155-1.json"), false)
|
||||
checkChain(getFile("valid/eip155-1.json"), false)
|
||||
}
|
||||
|
||||
@Test(expected = ShortNameMustBeUnique::class)
|
||||
fun shouldFailOnNonUniqueShortName() {
|
||||
checkChain(getFile("invalid/sameshortname/5.json"), false)
|
||||
checkChain(getFile("invalid/sameshortname/1.json"), false)
|
||||
checkChain(getFile("invalid/sameshortname/eip155-5.json"), false)
|
||||
checkChain(getFile("invalid/sameshortname/eip155-1.json"), false)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun canParse2chains() {
|
||||
checkChain(getFile("valid/1.json"), false)
|
||||
checkChain(getFile("valid/5.json"), false)
|
||||
checkChain(getFile("valid/eip155-1.json"), false)
|
||||
checkChain(getFile("valid/eip155-5.json"), false)
|
||||
}
|
||||
|
||||
private fun getFile(s: String) = File(javaClass.classLoader.getResource("test_chains/$s").file)
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user