1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-01-03 12:00:59 +00:00

coins_details: hide testnet and deprecated tokens

This commit is contained in:
matejcik 2018-11-29 16:39:31 +01:00
parent 5f59b5100b
commit 2f198f0b46
2 changed files with 12 additions and 2 deletions

View File

@ -223,10 +223,18 @@ def update_bitcoin(coins, support_info):
def update_erc20(coins, networks, support_info):
# TODO skip disabled networks?
network_support = {n["chain"]: support_info.get(n["key"]) for n in networks}
network_testnets = {n["chain"] for n in networks if "Testnet" in n["name"]}
res = update_simple(coins, support_info, "erc20")
for coin in coins:
key = coin["key"]
chain = coin["chain"]
hidden = False
if chain in network_testnets:
hidden = True
if "deprecation" in coin:
hidden = True
if network_support.get(chain, {}).get("webwallet"):
wallets = WALLETS_ETH_NATIVE
else:
@ -239,6 +247,8 @@ def update_erc20(coins, networks, support_info):
links={},
wallet=wallets,
)
if hidden:
details["hidden"] = True
if coin.get("website"):
details["links"]["Homepage"] = coin["website"]
if coin.get("social", {}).get("github"):
@ -325,7 +335,7 @@ def check_missing_data(coins):
hidden_coins = [k for k, coin in coins.items() if coin.get("hidden")]
for key in hidden_coins:
del coins[key]
LOG.debug(f"{k}: Coin is hidden")
LOG.debug(f"{key}: Coin is hidden")
def apply_overrides(coins):

View File

@ -24,7 +24,7 @@ def diffize_file(coins_details, tmp):
for link in links:
links[link] = links[link].rstrip("/")
for wallet in wallets:
wallets[wallet] = wallets[wallet].rstrip("/")
wallet["url"] = wallet["url"].rstrip("/")
if not coin.get("wallet"):
coin.pop("wallet", None)