1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-18 12:28:09 +00:00

chore(common): drop wallets.json

the wallet info is not used by firmware or consumers of trezor-common
and so it moves to the definitions repo
at https://github.com/trezor/definitions
This commit is contained in:
matejcik 2024-03-28 15:22:08 +01:00 committed by matejcik
parent adc86a7878
commit 67c0cb0bd4
4 changed files with 0 additions and 231 deletions

View File

@ -78,11 +78,6 @@ Duplicate keys are not allowed and coins that would result in duplicate keys can
added to the dataset. added to the dataset.
## Wallet URLs
If you want to add a **wallet link**, modify the file [`wallets.json`](wallets.json).
# Support Information # Support Information
We keep track of support status of each built-in coin over our devices. That is We keep track of support status of each built-in coin over our devices. That is

View File

@ -1,124 +0,0 @@
{
"bitcoin:ACM": {
"Actilectrum": "https://actilectrum.org"
},
"bitcoin:AXE": {
"Electrum-AXE": "https://github.com/AXErunners/electrum-axe"
},
"bitcoin:BCH": {
"Electron Cash": "https://electroncash.org",
"Exodus": "https://www.exodus.io"
},
"bitcoin:BTC": {
"Electrum": "https://electrum.org",
"Exodus": "https://www.exodus.io"
},
"bitcoin:BTCP": {
"BTCP Electrum": "https://github.com/BTCPrivate/electrum-btcp"
},
"bitcoin:BTG": {
"ElectrumG": "https://github.com/BTCGPU/electrum",
"Exodus": "https://www.exodus.io"
},
"bitcoin:BTX": {
"Electrum-BTX": "https://github.com/LIMXTEC/electrum-btx"
},
"bitcoin:CPU": {
"Electrum-CPU": "https://cpuchain.org/download-page.html"
},
"bitcoin:CRW": {
"Crown-Electrum": "https://github.com/Crowndev/crown-electrum"
},
"bitcoin:DASH": {
"Dash Electrum": "https://electrum.dash.org",
"DMT": "https://github.com/Bertrand256/dash-masternode-tool",
"Exodus": "https://www.exodus.io"
},
"bitcoin:DCR": {
"Exodus": "https://www.exodus.io"
},
"bitcoin:DGB": {
"Exodus": "https://www.exodus.io"
},
"bitcoin:DOGE": {
"Exodus": "https://www.exodus.io"
},
"bitcoin:FJC": {
"Electrum-FJC": "http://www.fujicoin.org/downloads.php"
},
"bitcoin:FLO": {
"Chaintek": "https://wallet.chaintek.net/"
},
"bitcoin:FTC": {
"Electrum-FTC": "https://github.com/Feathercoin-Foundation/electrum-ftc"
},
"bitcoin:GRS": {
"Electrum-GRS": "https://www.groestlcoin.org/groestlcoin-electrum-wallet"
},
"bitcoin:KMD": {
"AtomicDEX": "https://app.atomicdex.io/"
},
"bitcoin:KOTO": {
"Electrum-KOTO": "https://electrum.kotocoin.info"
},
"bitcoin:LTC": {
"Electrum-LTC": "https://electrum-ltc.org",
"Exodus": "https://www.exodus.io"
},
"bitcoin:MONA": {
"Electrum-MONA": "https://electrum-mona.org"
},
"bitcoin:NMC": {
"Electrum-NMC": "https://github.com/namecoin/electrum-nmc"
},
"bitcoin:PART": {
"Particl Core": "https://github.com/particl/particl-core/releases"
},
"bitcoin:QTUM": {
"Qtum-Electrum": "https://github.com/qtumproject/qtum-electrum"
},
"bitcoin:RITO": {
"Chaintek": "https://wallet.chaintek.net/"
},
"bitcoin:RVN": {
"Chaintek": "https://wallet.chaintek.net/",
"Electrum-RVN": "https://github.com/traysi/electrum-raven"
},
"bitcoin:SMART": {
"Electrum-SMART": "https://github.com/smartcash/electrum-smart"
},
"bitcoin:SYS": {
"Electrum-SYS": "https://github.com/syscoin/electrum"
},
"bitcoin:UNO": {
"Electrum-UNO": "https://github.com/flurbos/electrum-uno"
},
"bitcoin:VIA": {
"Vialectrum": "https://vialectrum.org"
},
"bitcoin:VIPS": {
"Electrum-VIPS": "https://electrum-vips.info"
},
"bitcoin:XPM": {
"Electrum-XPM": "https://github.com/justjamesdev/electrum-xpm"
},
"bitcoin:XRC": {
"Electrum-XRC": "https://electrum.xrhodium.org"
},
"bitcoin:XSN": {
"Stakenet": "https://xsnexplorer.io/trezor"
},
"bitcoin:XVG": {
"Electrum": "https://github.com/vergecurrency/electrum/releases"
},
"bitcoin:FIRO": {
"Electrum-FIRO": "https://github.com/firoorg/electrum-firo",
"Znode Tool": "https://github.com/firoorg/znode-tool-evo"
},
"bitcoin:ZEC": {
"Exodus": "https://www.exodus.io"
},
"bitcoin:ZCR": {
"Electrum-ZCR": "https://github.com/zcore-coin/electrum-wallet/"
}
}

View File

@ -54,9 +54,6 @@ class SupportInfoItem(TypedDict):
SupportInfo = Dict[str, SupportInfoItem] SupportInfo = Dict[str, SupportInfoItem]
WalletItems = Dict[str, str]
WalletInfo = Dict[str, WalletItems]
class Coin(TypedDict): class Coin(TypedDict):
# Necessary fields for BTC - from BTC_CHECKS # Necessary fields for BTC - from BTC_CHECKS
@ -93,7 +90,6 @@ class Coin(TypedDict):
# Other fields optionally coming from JSON # Other fields optionally coming from JSON
links: dict[str, str] links: dict[str, str]
wallet: WalletItems
curve: str curve: str
decimals: int decimals: int
@ -529,92 +525,6 @@ def support_info(coins: Iterable[Coin] | CoinsInfo | dict[str, Coin]) -> Support
return support return support
# ====== wallet info ======
WALLET_SUITE = {"Trezor Suite": "https://suite.trezor.io"}
WALLET_NEM = {"Nano Wallet": "https://nemplatform.com/wallets/#desktop"}
def get_wallet_data() -> WalletInfo:
"""Get wallet data from `wallets.json`."""
return load_json("wallets.json")
def _suite_support(coin: Coin, support: SupportInfoItem) -> bool:
"""Check the "suite" support property.
If set, check that at least one of the backends run on trezor.io.
If yes, assume we support the coin in our wallet.
Otherwise it's probably working with a custom backend, which means don't
link to our wallet.
"""
if not support["suite"]:
return False
return any(".trezor.io" in url for url in coin["blockbook"])
def wallet_info_single(
support_data: SupportInfo,
wallet_data: WalletInfo,
coin: Coin,
) -> WalletItems:
"""Adds together a dict of all wallets for a coin."""
wallets: WalletItems = {}
key = coin["key"]
# Add wallets from the coin itself
# (usually not there, only for the `misc` category)
wallets.update(coin.get("wallet", {}))
# Each coin category has different further logic
if key.startswith("bitcoin:"):
if _suite_support(coin, support_data[key]):
wallets.update(WALLET_SUITE)
elif key.startswith("nem:"):
wallets.update(WALLET_NEM)
elif key.startswith(("eth:", "erc20:", "misc:")):
pass # no special logic here
else:
raise ValueError(f"Unknown coin category: {key}")
# Add wallets from `wallets.json`
# This must come last as it offers the ability to override existing wallets
# (for example with `"Trezor Suite": null` we delete the "Trezor Suite" from the coin)
wallets.update(wallet_data.get(key, {}))
# Removing potentially disabled wallets from the last step
wallets = {name: url for name, url in wallets.items() if url}
return wallets
def wallet_info(coins: Iterable[Coin] | CoinsInfo | dict[str, Coin]) -> WalletInfo:
"""Generate Trezor wallet information.
Takes a collection of coins and generates a WalletItems entry for each.
The WalletItems is a dict with keys being the names of the wallets and
values being the URLs to those - same format as in `wallets.json`.
The `coins` argument can be a `CoinsInfo` object, a list or a dict of
coin items.
Wallet information is taken from `wallets.json`.
"""
if isinstance(coins, CoinsInfo):
coins = coins.as_list()
elif isinstance(coins, dict):
coins = coins.values()
support_data = support_info(coins)
wallet_data = get_wallet_data()
wallet: WalletInfo = {}
for coin in coins:
wallet[coin["key"]] = wallet_info_single(support_data, wallet_data, coin)
return wallet
# ====== data cleanup functions ====== # ====== data cleanup functions ======

View File

@ -695,7 +695,6 @@ device_choice = click.Choice(["connect", "suite", "T1B1", "T2T1", "T2B1"])
# fmt: off # fmt: off
@click.option("-o", "--outfile", type=click.File(mode="w"), default="-") @click.option("-o", "--outfile", type=click.File(mode="w"), default="-")
@click.option("-s/-S", "--support/--no-support", default=True, help="Include support data for each coin") @click.option("-s/-S", "--support/--no-support", default=True, help="Include support data for each coin")
@click.option("-w/-W", "--wallet/--no-wallet", default=True, help="Include wallet data for each coin")
@click.option("-p", "--pretty", is_flag=True, help="Generate nicely formatted JSON") @click.option("-p", "--pretty", is_flag=True, help="Generate nicely formatted JSON")
@click.option("-l", "--list", "flat_list", is_flag=True, help="Output a flat list of coins") @click.option("-l", "--list", "flat_list", is_flag=True, help="Output a flat list of coins")
@click.option("-i", "--include", metavar="FIELD", multiple=True, help="Include only these fields (-i shortcut -i name)") @click.option("-i", "--include", metavar="FIELD", multiple=True, help="Include only these fields (-i shortcut -i name)")
@ -711,7 +710,6 @@ device_choice = click.Choice(["connect", "suite", "T1B1", "T2T1", "T2B1"])
def dump( def dump(
outfile: TextIO, outfile: TextIO,
support: bool, support: bool,
wallet: bool,
pretty: bool, pretty: bool,
flat_list: bool, flat_list: bool,
include: tuple[str, ...], include: tuple[str, ...],
@ -756,9 +754,6 @@ def dump(
Also devices can be used as filters. For example to find out which coins are Also devices can be used as filters. For example to find out which coins are
supported in Suite and connect but not on Trezor 1, it is possible to say supported in Suite and connect but not on Trezor 1, it is possible to say
'-d suite -d connect -D T1B1'. '-d suite -d connect -D T1B1'.
Includes even the wallet data, unless turned off by '-W'.
These can be filtered by using '-f', for example `-f 'wallet=*exodus*'` (* are necessary)
""" """
if exclude_tokens: if exclude_tokens:
exclude_type += ("erc20",) exclude_type += ("erc20",)
@ -775,7 +770,6 @@ def dump(
# getting initial info # getting initial info
coins = coin_info.coin_info() coins = coin_info.coin_info()
support_info = coin_info.support_info(coins.as_list()) support_info = coin_info.support_info(coins.as_list())
wallet_info = coin_info.wallet_info(coins)
# optionally adding support info # optionally adding support info
if support: if support:
@ -783,12 +777,6 @@ def dump(
for coin in category: for coin in category:
coin["support"] = support_info[coin["key"]] coin["support"] = support_info[coin["key"]]
# optionally adding wallet info
if wallet:
for category in coins.values():
for coin in category:
coin["wallet"] = wallet_info[coin["key"]]
# filter types # filter types
if include_type: if include_type:
coins_dict = {k: v for k, v in coins.items() if k in include_type} coins_dict = {k: v for k, v in coins.items() if k in include_type}