Monero
Loading...
Searching...
No Matches
coin_info Namespace Reference

Classes

class  CoinsInfo

Functions

 load_json (*path)
 check_type (val, types, nullable=False, empty=False, regex=None, choice=None)
 check_key (key, types, optional=False, **kwargs)
 validate_btc (coin)
 _load_btc_coins ()
 _load_ethereum_networks ()
 _load_erc20_tokens ()
 _load_nem_mosaics ()
 _load_misc ()
 _load_fido_apps ()
 get_support_data ()
 latest_releases ()
 is_token (coin)
 support_info_single (support_data, coin)
 support_info (coins)
 _ensure_mandatory_values (coins)
 symbol_from_shortcut (shortcut)
 mark_duplicate_shortcuts (coins)
 deduplicate_erc20 (buckets, networks)
 deduplicate_keys (all_coins)
 _btc_sort_key (coin)
 collect_coin_info ()
 sort_coin_infos (all_coins)
 coin_info_with_duplicates ()
 coin_info ()
 fido_info ()
 search (coins, keyword)

Variables

 requests = None
 log = logging.getLogger(__name__)
 DEFS_DIR
list BTC_CHECKS
str RELEASES_URL = "https://beta-wallet.trezor.io/data/firmware/{}/releases.json"
tuple MISSING_SUPPORT_MEANS_NO = ("connect", "webwallet")
tuple VERSIONED_SUPPORT_INFO = ("trezor1", "trezor2")

Function Documentation

◆ _btc_sort_key()

coin_info._btc_sort_key ( coin)
protected

◆ _ensure_mandatory_values()

coin_info._ensure_mandatory_values ( coins)
protected
Checks that every coin has the mandatory fields: name, shortcut, key

◆ _load_btc_coins()

coin_info._load_btc_coins ( )
protected
Load btc-like coins from `bitcoin/*.json`

◆ _load_erc20_tokens()

coin_info._load_erc20_tokens ( )
protected
Load ERC20 tokens from `ethereum/tokens` submodule.

◆ _load_ethereum_networks()

coin_info._load_ethereum_networks ( )
protected
Load ethereum networks from `ethereum/networks.json`

◆ _load_fido_apps()

coin_info._load_fido_apps ( )
protected
Load FIDO apps from `fido/*.json`

◆ _load_misc()

coin_info._load_misc ( )
protected
Loads miscellaneous networks from `misc/misc.json`

◆ _load_nem_mosaics()

coin_info._load_nem_mosaics ( )
protected
Loads NEM mosaics from `nem/nem_mosaics.json`

◆ check_key()

coin_info.check_key ( key,
types,
optional = False,
** kwargs )

◆ check_type()

coin_info.check_type ( val,
types,
nullable = False,
empty = False,
regex = None,
choice = None )

◆ coin_info()

coin_info.coin_info ( )
Collects coin info, fills out support info and returns the result.

Does not auto-delete duplicates. This should now be based on support info.

◆ coin_info_with_duplicates()

coin_info.coin_info_with_duplicates ( )
Collects coin info, detects duplicates but does not remove them.

Returns the CoinsInfo object and duplicate buckets.

◆ collect_coin_info()

coin_info.collect_coin_info ( )
Returns all definition as dict organized by coin type.
`coins` for btc-like coins,
`eth` for ethereum networks,
`erc20` for ERC20 tokens,
`nem` for NEM mosaics,
`misc` for other networks.

◆ deduplicate_erc20()

coin_info.deduplicate_erc20 ( buckets,
networks )
Apply further processing to ERC20 duplicate buckets.

This function works on results of `mark_duplicate_shortcuts`.

Buckets that contain at least one non-token are ignored - symbol collisions
with non-tokens always apply.

Otherwise the following rules are applied:

1. If _all tokens_ in the bucket have shortcuts with distinct suffixes, e.g.,
`CAT (BitClave)` and `CAT (Blockcat)`, the bucket is cleared - all are considered
non-duplicate.

(If even one token in the bucket _does not_ have a distinct suffix, e.g.,
`MIT` and `MIT (Mychatcoin)`, this rule does not apply and ALL tokens in the bucket
are still considered duplicate.)

2. If there is only one "main" token in the bucket, the bucket is cleared.
That means that all other tokens must either be on testnets, or they must be marked
as deprecated, with a deprecation pointing to the "main" token.

◆ deduplicate_keys()

coin_info.deduplicate_keys ( all_coins)

◆ fido_info()

coin_info.fido_info ( )
Returns info about known FIDO/U2F apps.

◆ get_support_data()

coin_info.get_support_data ( )
Get raw support data from `support.json`.

◆ is_token()

coin_info.is_token ( coin)

◆ latest_releases()

coin_info.latest_releases ( )
Get latest released firmware versions for Trezor 1 and 2

◆ load_json()

coin_info.load_json ( * path)
Convenience function to load a JSON file from DEFS_DIR.

◆ mark_duplicate_shortcuts()

coin_info.mark_duplicate_shortcuts ( coins)
Finds coins with identical symbols and sets their `duplicate` field.

"Symbol" here means the first part of `shortcut` (separated by space),
so, e.g., "BTL (Battle)" and "BTL (Bitlle)" have the same symbol "BTL".

The result of this function is a dictionary of _buckets_, each of which is
indexed by the duplicated symbol, or `_override`. The `_override` bucket will
contain all coins that are set to `true` in `duplicity_overrides.json`.

Each coin in every bucket will have its "duplicate" property set to True, unless
it's explicitly marked as `false` in `duplicity_overrides.json`.

◆ search()

coin_info.search ( coins,
keyword )

◆ sort_coin_infos()

coin_info.sort_coin_infos ( all_coins)

◆ support_info()

coin_info.support_info ( coins)
Generate Trezor support information.

Takes a collection of coins and generates a support-info entry for each.
The support-info is a dict with keys based on `support.json` keys.
These are usually: "trezor1", "trezor2", "connect" and "webwallet".

The `coins` argument can be a `CoinsInfo` object, a list or a dict of
coin items.

Support information is taken from `support.json`.

◆ support_info_single()

coin_info.support_info_single ( support_data,
coin )
Extract a support dict from `support.json` data.

Returns a dict of support values for each "device", i.e., `support.json`
top-level key.

The support value for each device is determined in order of priority:
* if the coin is a duplicate ERC20 token, all support values are `None`
* if the coin has an entry in `unsupported`, its support is `None`
* if the coin has an entry in `supported` its support is that entry
  (usually a version string, or `True` for connect/webwallet)
* otherwise support is presumed "soon"

◆ symbol_from_shortcut()

coin_info.symbol_from_shortcut ( shortcut)

◆ validate_btc()

coin_info.validate_btc ( coin)

Variable Documentation

◆ BTC_CHECKS

list coin_info.BTC_CHECKS

◆ DEFS_DIR

coin_info.DEFS_DIR
Initial value:
1= os.path.abspath(
2 os.environ.get("DEFS_DIR") or os.path.join(os.path.dirname(__file__), "..", "defs")
3)

◆ log

coin_info.log = logging.getLogger(__name__)

◆ MISSING_SUPPORT_MEANS_NO

tuple coin_info.MISSING_SUPPORT_MEANS_NO = ("connect", "webwallet")

◆ RELEASES_URL

str coin_info.RELEASES_URL = "https://beta-wallet.trezor.io/data/firmware/{}/releases.json"

◆ requests

coin_info.requests = None

◆ VERSIONED_SUPPORT_INFO

tuple coin_info.VERSIONED_SUPPORT_INFO = ("trezor1", "trezor2")