2016-10-20 14:40:46 +00:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
import json
|
2016-11-09 13:52:43 +00:00
|
|
|
|
|
|
|
fields = [
|
2018-07-31 09:35:09 +00:00
|
|
|
"coin_name",
|
|
|
|
"coin_shortcut",
|
|
|
|
"address_type",
|
|
|
|
"address_type_p2sh",
|
|
|
|
"maxfee_kb",
|
|
|
|
"signed_message_header",
|
|
|
|
"xpub_magic",
|
|
|
|
"bech32_prefix",
|
|
|
|
"cashaddr_prefix",
|
|
|
|
"slip44",
|
|
|
|
"segwit",
|
|
|
|
"fork_id",
|
|
|
|
"force_bip143",
|
|
|
|
"version_group_id",
|
|
|
|
"bip115",
|
|
|
|
"curve_name",
|
2016-11-09 13:52:43 +00:00
|
|
|
]
|
2016-10-20 14:40:46 +00:00
|
|
|
|
2018-07-31 09:35:09 +00:00
|
|
|
support = json.load(open("../../vendor/trezor-common/defs/support.json", "r"))
|
|
|
|
coins = support["trezor2"].keys()
|
2016-10-20 14:40:46 +00:00
|
|
|
|
2018-07-31 09:35:09 +00:00
|
|
|
print("COINS = [")
|
2018-05-28 15:43:29 +00:00
|
|
|
|
2016-10-20 14:40:46 +00:00
|
|
|
for c in coins:
|
2018-07-31 09:35:09 +00:00
|
|
|
print(" CoinInfo(")
|
|
|
|
name = c.replace(" ", "_").lower()
|
|
|
|
if name == "testnet":
|
|
|
|
name = "bitcoin_testnet"
|
|
|
|
data = json.load(open("../../vendor/trezor-common/defs/coins/%s.json" % name, "r"))
|
2016-11-09 13:52:43 +00:00
|
|
|
for n in fields:
|
2018-07-31 09:35:09 +00:00
|
|
|
if n in ["xpub_magic", "version_group_id"]:
|
|
|
|
v = "0x%08x" % data[n] if data[n] is not None else "None"
|
2017-04-24 13:59:30 +00:00
|
|
|
else:
|
2018-06-05 14:04:23 +00:00
|
|
|
v = repr(data[n])
|
2018-07-31 09:35:09 +00:00
|
|
|
if n == "curve_name":
|
|
|
|
v = v.replace("_", "-")
|
|
|
|
print(" %s=%s," % (n, v))
|
|
|
|
print(" ),")
|
2018-05-28 15:43:29 +00:00
|
|
|
|
2018-07-31 09:35:09 +00:00
|
|
|
print("]")
|