1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-22 22:38:08 +00:00

support: add ETH and ETC as supported in webwallet

also use this information when generating coins_details.json
This commit is contained in:
matejcik 2018-11-20 18:00:38 +01:00
parent 88fa3c7381
commit a1265b48d1
2 changed files with 10 additions and 10 deletions

View File

@ -72,8 +72,8 @@
"bitcoin:GRS": "1.6.2", "bitcoin:GRS": "1.6.2",
"bitcoin:KOTO": "1.7.1", "bitcoin:KOTO": "1.7.1",
"bitcoin:LTC": "1.5.2", "bitcoin:LTC": "1.5.2",
"bitcoin:MONA": "1.6.0",
"bitcoin:MEC": "1.7.2", "bitcoin:MEC": "1.7.2",
"bitcoin:MONA": "1.6.0",
"bitcoin:MUE": "1.7.1", "bitcoin:MUE": "1.7.1",
"bitcoin:NMC": "1.5.2", "bitcoin:NMC": "1.5.2",
"bitcoin:PTC": "1.7.1", "bitcoin:PTC": "1.7.1",
@ -995,8 +995,8 @@
"bitcoin:GRS": "2.0.8", "bitcoin:GRS": "2.0.8",
"bitcoin:KOTO": "2.0.8", "bitcoin:KOTO": "2.0.8",
"bitcoin:LTC": "2.0.5", "bitcoin:LTC": "2.0.5",
"bitcoin:MONA": "2.0.5",
"bitcoin:MEC": "2.0.10", "bitcoin:MEC": "2.0.10",
"bitcoin:MONA": "2.0.5",
"bitcoin:MUE": "2.0.8", "bitcoin:MUE": "2.0.8",
"bitcoin:NMC": "2.0.5", "bitcoin:NMC": "2.0.5",
"bitcoin:PTC": "2.0.8", "bitcoin:PTC": "2.0.8",
@ -1921,7 +1921,9 @@
"bitcoin:VTC": true, "bitcoin:VTC": true,
"bitcoin:XZC": true, "bitcoin:XZC": true,
"bitcoin:ZEC": true, "bitcoin:ZEC": true,
"bitcoin:tGRS": true "bitcoin:tGRS": true,
"eth:ETC": true,
"eth:ETH": true
}, },
"unsupported": {} "unsupported": {}
} }

View File

@ -43,9 +43,6 @@ TREZORIO_KNOWN_URLS = (
"https://trezor.io/stellar/", "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): def coinmarketcap_call(endpoint, api_key, params=None):
url = COINMARKETCAP_API_BASE + endpoint url = COINMARKETCAP_API_BASE + endpoint
@ -223,13 +220,14 @@ def update_bitcoin(coins, support_info):
return res return res
def update_erc20(coins, support_info): def update_erc20(coins, networks, support_info):
# TODO skip disabled networks? # TODO skip disabled networks?
network_support = {n["chain"]: support_info.get(n["key"]) for n in networks}
res = update_simple(coins, support_info, "erc20") res = update_simple(coins, support_info, "erc20")
for coin in coins: for coin in coins:
key = coin["key"] key = coin["key"]
chain = coin["chain"] chain = coin["chain"]
if chain in TREZOR_NEXT_ETH_NETWORKS: if network_support.get(chain, {}).get("webwallet"):
wallets = WALLETS_ETH_NATIVE wallets = WALLETS_ETH_NATIVE
else: else:
wallets = WALLETS_ETH_3RDPARTY wallets = WALLETS_ETH_3RDPARTY
@ -255,7 +253,7 @@ def update_ethereum_networks(coins, support_info):
res = update_simple(coins, support_info, "coin") res = update_simple(coins, support_info, "coin")
for coin in coins: for coin in coins:
key = coin["key"] key = coin["key"]
if coin["chain"] in TREZOR_NEXT_ETH_NETWORKS: if support_info[key].get("webwallet"):
wallets = WALLETS_ETH_NATIVE wallets = WALLETS_ETH_NATIVE
else: else:
wallets = WALLETS_ETH_3RDPARTY wallets = WALLETS_ETH_3RDPARTY
@ -377,7 +375,7 @@ def main(refresh, api_key, verbose):
coins = {} coins = {}
coins.update(update_bitcoin(defs.bitcoin, support_info)) coins.update(update_bitcoin(defs.bitcoin, support_info))
coins.update(update_erc20(defs.erc20, support_info)) coins.update(update_erc20(defs.erc20, defs.eth, support_info))
coins.update(update_ethereum_networks(defs.eth, support_info)) coins.update(update_ethereum_networks(defs.eth, support_info))
coins.update(update_nem_mosaics(defs.nem, support_info)) coins.update(update_nem_mosaics(defs.nem, support_info))
coins.update(update_simple(defs.misc, support_info, "coin")) coins.update(update_simple(defs.misc, support_info, "coin"))