1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-03-25 04:25:42 +00:00

improve wallet lists

- move bitcoin wallet links from coins_details.override.json to a separate
wallets.json file
- drop NanoWallet links from nem nem_mosaics.json, auto-add them in
coins_details.py instead
- move misc wallet links to misc.json
- clean out override file
- change wallet format in coins_details.json:
  - they're now list instead of dict, so that we can specify ordering
- add Trezor Beta wallet link to ETH/ETC and their tokens
- somewhat stricter checking of trezor.io wallet data
This commit is contained in:
matejcik 2018-11-20 17:20:40 +01:00
parent beb8bb6dec
commit 56fbd816c9
6 changed files with 10059 additions and 3224 deletions

File diff suppressed because it is too large Load Diff

View File

@ -2,9 +2,6 @@
"nem:DIMTOK": {
"coinmarketcap_alias": "dimcoin"
},
"erc20:eth:GNT": {
"coinmarketcap_alias": "golem-network-tokens"
},
"erc20:eth:VEN": {
"links": {
"Homepage": "https://www.vechain.com"
@ -13,91 +10,5 @@
"erc20:eth:YUPIE": {
"hidden": 1,
"notes": "Replaced by YUP"
},
"bitcoin:BCH": {
"wallet": {
"Electron Cash": "https://electroncash.org"
}
},
"bitcoin:BTC": {
"wallet": {
"Electrum": "https://electrum.org"
}
},
"bitcoin:BTCP": {
"wallet": {
"BTCP Electrum": "https://github.com/BTCPrivate/electrum-btcp"
}
},
"bitcoin:BTG": {
"wallet": {
"ElectrumG": "https://github.com/BTCGPU/electrum"
}
},
"bitcoin:DASH": {
"wallet": {
"Dash Electrum": "https://electrum.dash.org"
}
},
"bitcoin:FJC": {
"wallet": {
"Electrum-FJC": "http://www.fujicoin.org/downloads.php"
}
},
"bitcoin:GAME": {
"wallet": {
"Electrum-GAME": "https://electrum-game.org"
}
},
"bitcoin:GRS": {
"wallet": {
"Electrum-GRS": "https://www.groestlcoin.org/groestlcoin-electrum-wallet"
}
},
"bitcoin:KOTO": {
"wallet": {
"Electrum-KOTO": "https://electrum.kotocoin.info"
}
},
"bitcoin:LTC": {
"wallet": {
"Electrum-LTC": "https://electrum-ltc.org"
}
},
"bitcoin:MONA": {
"wallet": {
"Electrum-MONA": "https://electrum-mona.org"
}
},
"bitcoin:NMC": {
"wallet": {
"Electrum-NMC": "https://github.com/namecoin/electrum-nmc"
}
},
"bitcoin:VIA": {
"wallet": {
"Vialectrum": "https://vialectrum.org"
}
},
"bitcoin:XZC": {
"wallet": {
"Electrum-XZC": "https://github.com/zcoinofficial/electrum-xzc",
"Znode Tool": "https://github.com/yura-pakhuchiy/znode-tool"
}
},
"misc:ADA": {
"wallet": {
"AdaLite": "https://adalite.io/app"
}
},
"misc:XLM": {
"wallet": {
"Account Viewer": "https://trezor.io/stellar/"
}
},
"misc:XTZ": {
"wallet": {
"SimpleStaking": "https://simplestaking.com"
}
}
}

View File

@ -17,6 +17,9 @@
"links": {
"Homepage": "https://www.stellar.org",
"Github": "https://github.com/stellar/stellar-core"
},
"wallet": {
"Account Viewer": "https://trezor.io/stellar/"
}
},
{
@ -47,6 +50,9 @@
"links": {
"Homepage": "https://www.cardano.org",
"Github": "https://github.com/input-output-hk/cardano-sl"
},
"wallet": {
"AdaLite": "https://adalite.io/app"
}
},
{
@ -57,6 +63,9 @@
"links": {
"Homepage": "https://tezos.com",
"Github": "https://github.com/tezos/tezos"
},
"wallet": {
"SimpleStaking": "https://simplestaking.com"
}
},
{

View File

@ -7,9 +7,6 @@
"divisibility": 6,
"links": {
"Homepage": "https://nem.io"
},
"wallet": {
"Nano Wallet": "https://nem.io/downloads/"
}
},
{
@ -27,9 +24,6 @@
],
"links": {
"Homepage": "https://www.dimcoin.io"
},
"wallet": {
"Nano Wallet": "https://nem.io/downloads/"
}
},
{
@ -43,9 +37,6 @@
],
"links": {
"Homepage": "https://www.dimcoin.io"
},
"wallet": {
"Nano Wallet": "https://nem.io/downloads/"
}
},
{
@ -59,9 +50,6 @@
],
"links": {
"Homepage": "https://breeze.chat"
},
"wallet": {
"Nano Wallet": "https://nem.io/downloads/"
}
},
{
@ -75,9 +63,6 @@
],
"links": {
"Homepage": "https://pacnem.com"
},
"wallet": {
"Nano Wallet": "https://nem.io/downloads/"
}
},
{
@ -95,9 +80,6 @@
],
"links": {
"Homepage": "https://pacnem.com"
},
"wallet": {
"Nano Wallet": "https://nem.io/downloads/"
}
}
]

45
defs/wallets.json Normal file
View File

@ -0,0 +1,45 @@
{
"bitcoin:BCH": {
"Electron Cash": "https://electroncash.org"
},
"bitcoin:BTC": {
"Electrum": "https://electrum.org"
},
"bitcoin:BTCP": {
"BTCP Electrum": "https://github.com/BTCPrivate/electrum-btcp"
},
"bitcoin:BTG": {
"ElectrumG": "https://github.com/BTCGPU/electrum"
},
"bitcoin:DASH": {
"Dash Electrum": "https://electrum.dash.org"
},
"bitcoin:FJC": {
"Electrum-FJC": "http://www.fujicoin.org/downloads.php"
},
"bitcoin:GAME": {
"Electrum-GAME": "https://electrum-game.org"
},
"bitcoin:GRS": {
"Electrum-GRS": "https://www.groestlcoin.org/groestlcoin-electrum-wallet"
},
"bitcoin:KOTO": {
"Electrum-KOTO": "https://electrum.kotocoin.info"
},
"bitcoin:LTC": {
"Electrum-LTC": "https://electrum-ltc.org"
},
"bitcoin:MONA": {
"Electrum-MONA": "https://electrum-mona.org"
},
"bitcoin:NMC": {
"Electrum-NMC": "https://github.com/namecoin/electrum-nmc"
},
"bitcoin:VIA": {
"Vialectrum": "https://vialectrum.org"
},
"bitcoin:XZC": {
"Electrum-XZC": "https://github.com/zcoinofficial/electrum-xzc",
"Znode Tool": "https://github.com/yura-pakhuchiy/znode-tool"
}
}

View File

@ -15,6 +15,7 @@ LOG = logging.getLogger(__name__)
OPTIONAL_KEYS = ("links", "notes", "wallet")
ALLOWED_SUPPORT_STATUS = ("yes", "no", "planned", "soon")
WALLETS = coin_info.load_json("wallets.json")
OVERRIDES = coin_info.load_json("coins_details.override.json")
VERSIONS = coin_info.latest_releases()
@ -23,6 +24,28 @@ COINMARKETCAP_API_BASE = "https://pro-api.coinmarketcap.com/v1/"
MARKET_CAPS = {}
# automatic wallet entries
WALLET_TREZOR = {"Trezor": "https://wallet.trezor.io"}
WALLET_TREZOR_NEXT = {"Trezor Beta": "https://beta-wallet.trezor.io/next/"}
WALLET_NEM = {"Nano Wallet": "https://nem.io/downloads/"}
WALLETS_ETH_3RDPARTY = {
"MyEtherWallet": "https://www.myetherwallet.com",
"MyCrypto": "https://mycrypto.com",
}
WALLETS_ETH_NATIVE = WALLETS_ETH_3RDPARTY.copy()
WALLETS_ETH_NATIVE.update(WALLET_TREZOR_NEXT)
TREZORIO_KNOWN_URLS = (
"https://wallet.trezor.io",
"https://beta-wallet.trezor.io/next/",
"https://trezor.io/stellar/",
)
# TODO: we should read this from support.json
TREZOR_NEXT_ETH_NETWORKS = ("eth", "etc")
def coinmarketcap_call(endpoint, api_key, params=None):
url = COINMARKETCAP_API_BASE + endpoint
@ -151,6 +174,15 @@ def _webwallet_support(coin, support):
return any(".trezor.io" in url for url in coin["blockbook"] + coin["bitcore"])
def dict_merge(orig, new):
if isinstance(new, dict) and isinstance(orig, dict):
for k, v in new.items():
orig[k] = dict_merge(orig.get(k), v)
return orig
else:
return new
def update_simple(coins, support_info, type):
res = {}
for coin in coins:
@ -163,11 +195,14 @@ def update_simple(coins, support_info, type):
type=type,
t1_enabled=_is_supported(support, "trezor1"),
t2_enabled=_is_supported(support, "trezor2"),
wallet={},
)
for k in OPTIONAL_KEYS:
if k in coin:
details[k] = coin[k]
details["wallet"].update(WALLETS.get(key, {}))
res[key] = details
return res
@ -181,12 +216,9 @@ def update_bitcoin(coins, support_info):
details = dict(
name=coin["coin_label"],
links=dict(Homepage=coin["website"], Github=coin["github"]),
wallet={},
wallet=WALLET_TREZOR if _webwallet_support(coin, support) else {},
)
if _webwallet_support(coin, support):
details["wallet"]["Trezor"] = "https://wallet.trezor.io"
res[key].update(details)
dict_merge(res[key], details)
return res
@ -196,22 +228,25 @@ def update_erc20(coins, support_info):
res = update_simple(coins, support_info, "erc20")
for coin in coins:
key = coin["key"]
chain = coin["chain"]
if chain in TREZOR_NEXT_ETH_NETWORKS:
wallets = WALLETS_ETH_NATIVE
else:
wallets = WALLETS_ETH_3RDPARTY
details = dict(
network=coin["chain"],
network=chain,
address=coin["address"],
shortcut=coin["shortcut"],
links={},
wallet=dict(
MyCrypto="https://mycrypto.com",
MyEtherWallet="https://www.myetherwallet.com",
),
wallet=wallets,
)
if coin.get("website"):
details["links"]["Homepage"] = coin["website"]
if coin.get("social", {}).get("github"):
details["links"]["Github"] = coin["social"]["github"]
res[key].update(details)
dict_merge(res[key], details)
return res
@ -220,14 +255,22 @@ def update_ethereum_networks(coins, support_info):
res = update_simple(coins, support_info, "coin")
for coin in coins:
key = coin["key"]
details = dict(
wallet=dict(
MyCrypto="https://mycrypto.com",
MyEtherWallet="https://www.myetherwallet.com",
),
links=dict(Homepage=coin.get("url")),
)
res[key].update(details)
if coin["chain"] in TREZOR_NEXT_ETH_NETWORKS:
wallets = WALLETS_ETH_NATIVE
else:
wallets = WALLETS_ETH_3RDPARTY
details = dict(links=dict(Homepage=coin.get("url")), wallet=wallets)
dict_merge(res[key], details)
return res
def update_nem_mosaics(coins, support_info):
res = update_simple(coins, support_info, "mosaic")
for coin in coins:
key = coin["key"]
details = dict(wallet=WALLET_NEM)
dict_merge(res[key], details)
return res
@ -248,18 +291,26 @@ def check_missing_data(coins):
if coin["t2_enabled"] not in ALLOWED_SUPPORT_STATUS:
LOG.warning(f"{k}: Unknown t2_enabled")
hide = True
if (
"Trezor" in coin.get("wallet", {})
and coin["wallet"]["Trezor"] != "https://wallet.trezor.io"
):
LOG.warning(f"{k}: Strange URL for Trezor Wallet")
hide = True
# check wallets
for wallet in coin["wallet"]:
name = wallet.get("name")
url = wallet.get("url")
if not name or not url:
LOG.warning(f"{k}: Bad wallet entry")
hide = True
continue
if "trezor" in name.lower() and url not in TREZORIO_KNOWN_URLS:
LOG.warning(f"{k}: Strange URL for Trezor Wallet")
hide = True
if "trezor.io" in url.lower() and url not in TREZORIO_KNOWN_URLS:
LOG.warning(f"{k}: Unexpected trezor.io URL: {url}")
if coin["t1_enabled"] == "no" and coin["t2_enabled"] == "no":
LOG.info(f"{k}: Coin not enabled on either device")
hide = True
if len(coin.get("wallet", {})) == 0:
if len(coin.get("wallet", [])) == 0:
LOG.debug(f"{k}: Missing wallet")
if "Testnet" in coin["name"]:
@ -285,16 +336,22 @@ def apply_overrides(coins):
LOG.warning(f"override without coin: {key}")
continue
def recursive_update(orig, new):
if isinstance(new, dict) and isinstance(orig, dict):
for k, v in new.items():
orig[k] = recursive_update(orig.get(k), v)
return orig
else:
return new
dict_merge(coins[key], override)
coin = coins[key]
recursive_update(coin, override)
def finalize_wallets(coins):
def sort_key(w):
if "trezor.io" in w["url"]:
return 0, w["name"]
else:
return 1, w["name"]
for coin in coins.values():
wallets_list = [
dict(name=name, url=url) for name, url in coin["wallet"].items()
]
wallets_list.sort(key=sort_key)
coin["wallet"] = wallets_list
@click.command()
@ -322,11 +379,13 @@ def main(refresh, api_key, verbose):
coins.update(update_bitcoin(defs.bitcoin, support_info))
coins.update(update_erc20(defs.erc20, support_info))
coins.update(update_ethereum_networks(defs.eth, support_info))
coins.update(update_simple(defs.nem, support_info, "mosaic"))
coins.update(update_nem_mosaics(defs.nem, support_info))
coins.update(update_simple(defs.misc, support_info, "coin"))
apply_overrides(coins)
finalize_wallets(coins)
update_marketcaps(coins)
check_missing_data(coins)
info = summary(coins, api_key)