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

vendor: update trezor-common

This commit is contained in:
Pavol Rusnak 2018-05-30 11:17:27 +02:00
parent d4b17c5b36
commit 61f5bbca91
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D
6 changed files with 10 additions and 62 deletions

View File

@ -34,13 +34,16 @@ class PrebuildCommand(Command):
def run(self):
# check for existence of the submodule directory
coins_json = os.path.join(self.TREZOR_COMMON, 'coins.json')
if not os.path.exists(coins_json):
common_defs = os.path.join(self.TREZOR_COMMON, 'defs')
if not os.path.exists(common_defs):
raise Exception('trezor-common submodule seems to be missing.\n' +
'Use "git submodule update --init" to retrieve it.')
# copy coins.json to the tree
shutil.copy(coins_json, 'trezorlib')
# generate and copy coins.json to the tree
coin_defs = os.path.join('vendor', 'trezor-common', 'defs', 'coins')
subprocess.check_call([os.path.join(coin_defs, 'tools', 'build_coins.py')])
shutil.move('coins.json', 'trezorlib')
# regenerate messages
try:

View File

@ -15,8 +15,7 @@ def _load_coins_json():
# and install coins.json with:
# $ python setup.py prebuild
with open(COINS_JSON) as coins_json:
coins_list = json.load(coins_json)
return {coin['coin_name']: coin for coin in coins_list}
return json.load(coins_json)
def _insight_for_coin(coin):
@ -36,7 +35,7 @@ try:
except Exception as e:
raise ImportError("Failed to load coins.json. Check your installation.") from e
slip44 = {name: coin['bip44'] for name, coin in by_name.items()}
slip44 = {name: coin['slip44'] for name, coin in by_name.items()}
tx_api = {name: _insight_for_coin(coin)
for name, coin in by_name.items()
if coin["bitcore"]}

View File

@ -1,44 +0,0 @@
# Automatically generated by pb2py
from .. import protobuf as p
class CoinType(p.MessageType):
FIELDS = {
1: ('coin_name', p.UnicodeType, 0),
2: ('coin_shortcut', p.UnicodeType, 0),
3: ('address_type', p.UVarintType, 0), # default=0
4: ('maxfee_kb', p.UVarintType, 0),
5: ('address_type_p2sh', p.UVarintType, 0), # default=5
8: ('signed_message_header', p.UnicodeType, 0),
9: ('xpub_magic', p.UVarintType, 0), # default=76067358
10: ('xprv_magic', p.UVarintType, 0), # default=76066276
11: ('segwit', p.BoolType, 0),
12: ('forkid', p.UVarintType, 0),
13: ('force_bip143', p.BoolType, 0),
}
def __init__(
self,
coin_name: str = None,
coin_shortcut: str = None,
address_type: int = None,
maxfee_kb: int = None,
address_type_p2sh: int = None,
signed_message_header: str = None,
xpub_magic: int = None,
xprv_magic: int = None,
segwit: bool = None,
forkid: int = None,
force_bip143: bool = None
) -> None:
self.coin_name = coin_name
self.coin_shortcut = coin_shortcut
self.address_type = address_type
self.maxfee_kb = maxfee_kb
self.address_type_p2sh = address_type_p2sh
self.signed_message_header = signed_message_header
self.xpub_magic = xpub_magic
self.xprv_magic = xprv_magic
self.segwit = segwit
self.forkid = forkid
self.force_bip143 = force_bip143

View File

@ -1,11 +1,5 @@
# Automatically generated by pb2py
from .. import protobuf as p
if __debug__:
try:
from typing import List
except ImportError:
List = None
from .CoinType import CoinType
class Features(p.MessageType):
@ -21,7 +15,6 @@ class Features(p.MessageType):
8: ('passphrase_protection', p.BoolType, 0),
9: ('language', p.UnicodeType, 0),
10: ('label', p.UnicodeType, 0),
11: ('coins', CoinType, p.FLAG_REPEATED),
12: ('initialized', p.BoolType, 0),
13: ('revision', p.BytesType, 0),
14: ('bootloader_hash', p.BytesType, 0),
@ -52,7 +45,6 @@ class Features(p.MessageType):
passphrase_protection: bool = None,
language: str = None,
label: str = None,
coins: List[CoinType] = None,
initialized: bool = None,
revision: bytes = None,
bootloader_hash: bytes = None,
@ -80,7 +72,6 @@ class Features(p.MessageType):
self.passphrase_protection = passphrase_protection
self.language = language
self.label = label
self.coins = coins if coins is not None else []
self.initialized = initialized
self.revision = revision
self.bootloader_hash = bootloader_hash

View File

@ -1,6 +1,5 @@
# Automatically generated by pb2py
from .CoinType import CoinType
from .HDNodePathType import HDNodePathType
from .HDNodeType import HDNodeType
from .IdentityType import IdentityType

@ -1 +1 @@
Subproject commit 8fc001154e49c2c1747957c4a9a1ab92dcc86edb
Subproject commit 714c33b1427c0921c5d8259a93f354628180014f