Support slip44 and initial backfill (#76)

This commit is contained in:
ligi 2019-10-18 18:35:10 +09:00 committed by GitHub
parent 07b62b9258
commit b1c93db236
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 27 additions and 14 deletions

View File

@ -15,5 +15,6 @@
"infoURL": "https://ethereum.org",
"shortName": "eth",
"chainId": 1,
"networkId": 1
"networkId": 1,
"slip44": 60
}

View File

@ -14,5 +14,6 @@
"infoURL": "https://forum.poa.network/c/xdai-chain",
"shortName": "xdai",
"chainId": 100,
"networkId": 100
}
"networkId": 100,
"slip44": 700
}

View File

@ -14,5 +14,6 @@
"infoURL": "https://einc.io",
"shortName": "eti",
"chainId": 101,
"networkId": 1
"networkId": 1,
"slip44": 464
}

View File

@ -14,5 +14,6 @@
"infoURL": "https://metadium.com",
"shortName": "meta",
"chainId": 11,
"networkId": 11
"networkId": 11,
"slip44": 961
}

View File

@ -14,5 +14,6 @@
"infoURL": "https://ether1.org",
"shortName": "etho",
"chainId": 1313114,
"networkId": 1313114
"networkId": 1313114,
"slip44": 1313114
}

View File

@ -14,5 +14,6 @@
"infoURL": "https://atheios.com",
"shortName": "ath",
"chainId": 1620,
"networkId": 11235813
"networkId": 11235813,
"slip44": 1620
}

View File

@ -14,5 +14,6 @@
"infoURL": "https://egem.io",
"shortName": "egem",
"chainId": 1987,
"networkId": 1987
"networkId": 1987,
"slip44": 1987
}

View File

@ -14,5 +14,6 @@
"infoURL": "https://expanse.tech",
"shortName": "exp",
"chainId": 2,
"networkId": 1
"networkId": 1,
"slip44": 40
}

View File

@ -14,5 +14,6 @@
"infoURL": "https://ethereumclassic.org",
"shortName": "etc",
"chainId": 61,
"networkId": 1
"networkId": 1,
"slip44": 61
}

View File

@ -17,5 +17,6 @@
"infoURL": "https://aquachain.github.io",
"shortName": "aqua",
"chainId": 61717561,
"networkId": 61717561
"networkId": 61717561,
"slip44": 61717561
}

View File

@ -6,7 +6,7 @@ import org.kethereum.rpc.HttpEthereumRPC
import java.io.File
import java.math.BigInteger
val all_fields = listOf(
val mandatory_fields = listOf(
"name",
"shortName",
"chain",
@ -18,6 +18,9 @@ val all_fields = listOf(
"infoURL",
"nativeCurrency"
)
val optionalFields = listOf(
"slip44"
)
class FileNameMustMatchChainId : Exception("chainId must match the filename")
class ExtensionMustBeJSON : Exception("filename extension must be json")
@ -41,12 +44,12 @@ fun checkChain(it: File, connectRPC: Boolean) {
getNumber(jsonObject, "networkId")
val extraFields = jsonObject.map.keys.subtract(all_fields)
val extraFields = jsonObject.map.keys.subtract(mandatory_fields).subtract(optionalFields)
if (extraFields.isNotEmpty()) {
throw ShouldHaveNoExtraFields(extraFields)
}
val missingFields = all_fields.subtract(jsonObject.map.keys)
val missingFields = mandatory_fields.subtract(jsonObject.map.keys)
if (missingFields.isNotEmpty()) {
throw ShouldHaveNoMissingFields(missingFields)
}