1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-07-15 02:58:12 +00:00

src: remove CoinType usage, usage internal CoinInfo instead

This commit is contained in:
Pavol Rusnak 2018-05-24 15:18:05 +02:00
parent 7bafad494d
commit ffc2bf30b8
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D
19 changed files with 92 additions and 244 deletions

View File

@ -47,7 +47,6 @@ message Features {
// optional bool passphrase_protection = 8; // is node/mnemonic encrypted using passphrase? // optional bool passphrase_protection = 8; // is node/mnemonic encrypted using passphrase?
optional string language = 9; // device language optional string language = 9; // device language
optional string label = 10; // device description label optional string label = 10; // device description label
// repeated CoinType coins = 11; // supported coins
optional bool initialized = 12; // does device contain seed? optional bool initialized = 12; // does device contain seed?
optional bytes revision = 13; // SCM revision of firmware optional bytes revision = 13; // SCM revision of firmware
// optional bytes bootloader_hash = 14; // hash of the bootloader // optional bytes bootloader_hash = 14; // hash of the bootloader

View File

@ -1,228 +1,257 @@
from trezor.messages.CoinType import CoinType class CoinInfo:
def __init__(
self,
coin_name: str,
coin_shortcut: str,
address_type: int,
address_type_p2sh: int,
maxfee_kb: int,
signed_message_header: str,
xpub_magic: int,
bech32_prefix: str,
cashaddr_prefix: str,
segwit: bool,
forkid: int,
force_bip143: bool
):
self.coin_name = coin_name
self.coin_shortcut = coin_shortcut
self.address_type = address_type
self.address_type_p2sh = address_type_p2sh
self.maxfee_kb = maxfee_kb
self.signed_message_header = signed_message_header
self.xpub_magic = xpub_magic
self.bech32_prefix = bech32_prefix
self.cashaddr_prefix = cashaddr_prefix
self.segwit = segwit
self.forkid = forkid
self.force_bip143 = force_bip143
# the following list is generated using tools/codegen/gen_coins.py # the following list is generated using tools/codegen/gen_coins.py
# do not edit manually! # do not edit manually!
COINS = [ COINS = [
CoinType( CoinInfo(
coin_name='Bitcoin', coin_name='Bitcoin',
coin_shortcut='BTC', coin_shortcut='BTC',
coin_label='Bitcoin',
address_type=0, address_type=0,
address_type_p2sh=5, address_type_p2sh=5,
maxfee_kb=2000000, maxfee_kb=2000000,
signed_message_header='Bitcoin Signed Message:\n', signed_message_header='Bitcoin Signed Message:\n',
xpub_magic=0x0488b21e, xpub_magic=0x0488b21e,
bech32_prefix='bc', bech32_prefix='bc',
cashaddr_prefix=None,
segwit=True, segwit=True,
forkid=None, forkid=None,
force_bip143=False, force_bip143=False,
), ),
CoinType( CoinInfo(
coin_name='Testnet', coin_name='Testnet',
coin_shortcut='TEST', coin_shortcut='TEST',
coin_label='Testnet',
address_type=111, address_type=111,
address_type_p2sh=196, address_type_p2sh=196,
maxfee_kb=10000000, maxfee_kb=10000000,
signed_message_header='Bitcoin Signed Message:\n', signed_message_header='Bitcoin Signed Message:\n',
xpub_magic=0x043587cf, xpub_magic=0x043587cf,
bech32_prefix='tb', bech32_prefix='tb',
cashaddr_prefix=None,
segwit=True, segwit=True,
forkid=None, forkid=None,
force_bip143=False, force_bip143=False,
), ),
CoinType( CoinInfo(
coin_name='Bcash', coin_name='Bcash',
coin_shortcut='BCH', coin_shortcut='BCH',
coin_label='Bitcoin Cash',
address_type=0, address_type=0,
address_type_p2sh=5, address_type_p2sh=5,
maxfee_kb=500000, maxfee_kb=500000,
signed_message_header='Bitcoin Signed Message:\n', signed_message_header='Bitcoin Signed Message:\n',
xpub_magic=0x0488b21e, xpub_magic=0x0488b21e,
bech32_prefix=None, bech32_prefix=None,
cashaddr_prefix='bitcoincash',
segwit=False, segwit=False,
forkid=0, forkid=0,
force_bip143=True, force_bip143=True,
), ),
CoinType( CoinInfo(
coin_name='Bcash Testnet', coin_name='Bcash Testnet',
coin_shortcut='TBCH', coin_shortcut='TBCH',
coin_label='Bitcoin Cash Testnet',
address_type=111, address_type=111,
address_type_p2sh=196, address_type_p2sh=196,
maxfee_kb=10000000, maxfee_kb=10000000,
signed_message_header='Bitcoin Signed Message:\n', signed_message_header='Bitcoin Signed Message:\n',
xpub_magic=0x043587cf, xpub_magic=0x043587cf,
bech32_prefix=None, bech32_prefix=None,
cashaddr_prefix='bchtest',
segwit=False, segwit=False,
forkid=0, forkid=0,
force_bip143=True, force_bip143=True,
), ),
CoinType( CoinInfo(
coin_name='Namecoin', coin_name='Namecoin',
coin_shortcut='NMC', coin_shortcut='NMC',
coin_label='Namecoin',
address_type=52, address_type=52,
address_type_p2sh=5, address_type_p2sh=5,
maxfee_kb=10000000, maxfee_kb=10000000,
signed_message_header='Namecoin Signed Message:\n', signed_message_header='Namecoin Signed Message:\n',
xpub_magic=0x019da462, xpub_magic=0x019da462,
bech32_prefix=None, bech32_prefix=None,
cashaddr_prefix=None,
segwit=False, segwit=False,
forkid=None, forkid=None,
force_bip143=False, force_bip143=False,
), ),
CoinType( CoinInfo(
coin_name='Litecoin', coin_name='Litecoin',
coin_shortcut='LTC', coin_shortcut='LTC',
coin_label='Litecoin',
address_type=48, address_type=48,
address_type_p2sh=50, address_type_p2sh=50,
maxfee_kb=40000000, maxfee_kb=40000000,
signed_message_header='Litecoin Signed Message:\n', signed_message_header='Litecoin Signed Message:\n',
xpub_magic=0x019da462, xpub_magic=0x019da462,
bech32_prefix='ltc', bech32_prefix='ltc',
cashaddr_prefix=None,
segwit=True, segwit=True,
forkid=None, forkid=None,
force_bip143=False, force_bip143=False,
), ),
CoinType( CoinInfo(
coin_name='Dogecoin', coin_name='Dogecoin',
coin_shortcut='DOGE', coin_shortcut='DOGE',
coin_label='Dogecoin',
address_type=30, address_type=30,
address_type_p2sh=22, address_type_p2sh=22,
maxfee_kb=1000000000, maxfee_kb=1000000000,
signed_message_header='Dogecoin Signed Message:\n', signed_message_header='Dogecoin Signed Message:\n',
xpub_magic=0x02facafd, xpub_magic=0x02facafd,
bech32_prefix=None, bech32_prefix=None,
cashaddr_prefix=None,
segwit=False, segwit=False,
forkid=None, forkid=None,
force_bip143=False, force_bip143=False,
), ),
CoinType( CoinInfo(
coin_name='Dash', coin_name='Dash',
coin_shortcut='DASH', coin_shortcut='DASH',
coin_label='Dash',
address_type=76, address_type=76,
address_type_p2sh=16, address_type_p2sh=16,
maxfee_kb=100000, maxfee_kb=100000,
signed_message_header='DarkCoin Signed Message:\n', signed_message_header='DarkCoin Signed Message:\n',
xpub_magic=0x02fe52cc, xpub_magic=0x02fe52cc,
bech32_prefix=None, bech32_prefix=None,
cashaddr_prefix=None,
segwit=False, segwit=False,
forkid=None, forkid=None,
force_bip143=False, force_bip143=False,
), ),
CoinType( CoinInfo(
coin_name='Zcash', coin_name='Zcash',
coin_shortcut='ZEC', coin_shortcut='ZEC',
coin_label='Zcash',
address_type=7352, address_type=7352,
address_type_p2sh=7357, address_type_p2sh=7357,
maxfee_kb=1000000, maxfee_kb=1000000,
signed_message_header='Zcash Signed Message:\n', signed_message_header='Zcash Signed Message:\n',
xpub_magic=0x0488b21e, xpub_magic=0x0488b21e,
bech32_prefix=None, bech32_prefix=None,
cashaddr_prefix=None,
segwit=False, segwit=False,
forkid=None, forkid=None,
force_bip143=False, force_bip143=False,
), ),
CoinType( CoinInfo(
coin_name='Zcash Testnet', coin_name='Zcash Testnet',
coin_shortcut='TAZ', coin_shortcut='TAZ',
coin_label='Zcash Testnet',
address_type=7461, address_type=7461,
address_type_p2sh=7354, address_type_p2sh=7354,
maxfee_kb=10000000, maxfee_kb=10000000,
signed_message_header='Zcash Signed Message:\n', signed_message_header='Zcash Signed Message:\n',
xpub_magic=0x043587cf, xpub_magic=0x043587cf,
bech32_prefix=None, bech32_prefix=None,
cashaddr_prefix=None,
segwit=False, segwit=False,
forkid=None, forkid=None,
force_bip143=False, force_bip143=False,
), ),
CoinType( CoinInfo(
coin_name='Bitcoin Gold', coin_name='Bitcoin Gold',
coin_shortcut='BTG', coin_shortcut='BTG',
coin_label='Bitcoin Gold',
address_type=38, address_type=38,
address_type_p2sh=23, address_type_p2sh=23,
maxfee_kb=500000, maxfee_kb=500000,
signed_message_header='Bitcoin Gold Signed Message:\n', signed_message_header='Bitcoin Gold Signed Message:\n',
xpub_magic=0x0488b21e, xpub_magic=0x0488b21e,
bech32_prefix='btg', bech32_prefix='btg',
cashaddr_prefix=None,
segwit=True, segwit=True,
forkid=79, forkid=79,
force_bip143=True, force_bip143=True,
), ),
CoinType( CoinInfo(
coin_name='DigiByte', coin_name='DigiByte',
coin_shortcut='DGB', coin_shortcut='DGB',
coin_label='DigiByte',
address_type=30, address_type=30,
address_type_p2sh=5, address_type_p2sh=63,
maxfee_kb=500000, maxfee_kb=500000,
signed_message_header='DigiByte Signed Message:\n', signed_message_header='DigiByte Signed Message:\n',
xpub_magic=0x0488b21e, xpub_magic=0x0488b21e,
bech32_prefix='dgb', bech32_prefix='dgb',
cashaddr_prefix=None,
segwit=True, segwit=True,
forkid=None, forkid=None,
force_bip143=False, force_bip143=False,
), ),
CoinType( CoinInfo(
coin_name='Monacoin', coin_name='Monacoin',
coin_shortcut='MONA', coin_shortcut='MONA',
coin_label='Monacoin',
address_type=50, address_type=50,
address_type_p2sh=55, address_type_p2sh=55,
maxfee_kb=5000000, maxfee_kb=5000000,
signed_message_header='Monacoin Signed Message:\n', signed_message_header='Monacoin Signed Message:\n',
xpub_magic=0x0488b21e, xpub_magic=0x0488b21e,
bech32_prefix='mona', bech32_prefix='mona',
cashaddr_prefix=None,
segwit=True, segwit=True,
forkid=None, forkid=None,
force_bip143=False, force_bip143=False,
), ),
CoinType( CoinInfo(
coin_name='Fujicoin', coin_name='Fujicoin',
coin_shortcut='FJC', coin_shortcut='FJC',
coin_label='Fujicoin',
address_type=36, address_type=36,
address_type_p2sh=16, address_type_p2sh=16,
maxfee_kb=1000000, maxfee_kb=1000000,
signed_message_header='FujiCoin Signed Message:\n', signed_message_header='FujiCoin Signed Message:\n',
xpub_magic=0x0488b21e, xpub_magic=0x0488b21e,
bech32_prefix=None, bech32_prefix='fc',
segwit=False, cashaddr_prefix=None,
segwit=True,
forkid=None, forkid=None,
force_bip143=False, force_bip143=False,
), ),
CoinType( CoinInfo(
coin_name='Vertcoin', coin_name='Vertcoin',
coin_shortcut='VTC', coin_shortcut='VTC',
coin_label='Vertcoin',
address_type=71, address_type=71,
address_type_p2sh=5, address_type_p2sh=5,
maxfee_kb=40000000, maxfee_kb=40000000,
signed_message_header='Vertcoin Signed Message:\n', signed_message_header='Vertcoin Signed Message:\n',
xpub_magic=0x0488b21e, xpub_magic=0x0488b21e,
bech32_prefix='vtc', bech32_prefix='vtc',
cashaddr_prefix=None,
segwit=True, segwit=True,
forkid=None, forkid=None,
force_bip143=False, force_bip143=False,
), ),
CoinType( CoinInfo(
coin_name='Decred Testnet', coin_name='Decred Testnet',
coin_shortcut='TDCR', coin_shortcut='TDCR',
coin_label='Testnet',
address_type=3873, address_type=3873,
address_type_p2sh=3836, address_type_p2sh=3836,
maxfee_kb=10000000, maxfee_kb=10000000,
signed_message_header='Decred Signed Message:\n', signed_message_header='Decred Signed Message:\n',
xpub_magic=0x043587d1, xpub_magic=0x043587d1,
bech32_prefix=None, bech32_prefix=None,
cashaddr_prefix=None,
segwit=False, segwit=False,
forkid=None, forkid=None,
force_bip143=False, force_bip143=False,
@ -244,8 +273,8 @@ def by_name(name):
raise ValueError('Unknown coin name "%s"' % name) raise ValueError('Unknown coin name "%s"' % name)
def by_address_type(version): def by_address_type(address_type):
for c in COINS: for c in COINS:
if c.address_type == version: if c.address_type == address_type:
return c return c
raise ValueError('Unknown coin address type %d' % version) raise ValueError('Unknown coin address type %d' % version)

View File

@ -4,10 +4,10 @@ from trezor.crypto.hashlib import sha256, ripemd160
from trezor.crypto import base58, bech32 from trezor.crypto import base58, bech32
from trezor.utils import ensure from trezor.utils import ensure
from trezor.messages.CoinType import CoinType
from trezor.messages import FailureType from trezor.messages import FailureType
from trezor.messages import InputScriptType from trezor.messages import InputScriptType
from apps.common.coins import CoinInfo
from apps.common.address_type import addrtype_bytes from apps.common.address_type import addrtype_bytes
from apps.wallet.sign_tx.scripts import * from apps.wallet.sign_tx.scripts import *
from apps.wallet.sign_tx.multisig import * from apps.wallet.sign_tx.multisig import *
@ -20,7 +20,7 @@ class AddressError(Exception):
pass pass
def get_address(script_type: InputScriptType, coin: CoinType, node, multisig=None) -> str: def get_address(script_type: InputScriptType, coin: CoinInfo, node, multisig=None) -> str:
if script_type == InputScriptType.SPENDADDRESS or script_type == InputScriptType.SPENDMULTISIG: if script_type == InputScriptType.SPENDADDRESS or script_type == InputScriptType.SPENDMULTISIG:
if multisig: # p2sh multisig if multisig: # p2sh multisig

View File

@ -1,4 +1,3 @@
from trezor.messages.CoinType import CoinType
from trezor.messages.TxOutputType import TxOutputType from trezor.messages.TxOutputType import TxOutputType
from trezor.messages.TxOutputBinType import TxOutputBinType from trezor.messages.TxOutputBinType import TxOutputBinType
from trezor.messages.TxInputType import TxInputType from trezor.messages.TxInputType import TxInputType
@ -8,20 +7,22 @@ from trezor.messages.TransactionType import TransactionType
from trezor.messages.RequestType import TXINPUT, TXOUTPUT, TXMETA, TXEXTRADATA, TXFINISHED from trezor.messages.RequestType import TXINPUT, TXOUTPUT, TXMETA, TXEXTRADATA, TXFINISHED
from trezor.messages import InputScriptType from trezor.messages import InputScriptType
from apps.common.coins import CoinInfo
# Machine instructions # Machine instructions
# === # ===
class UiConfirmOutput: class UiConfirmOutput:
def __init__(self, output: TxOutputType, coin: CoinType): def __init__(self, output: TxOutputType, coin: CoinInfo):
self.output = output self.output = output
self.coin = coin self.coin = coin
class UiConfirmTotal: class UiConfirmTotal:
def __init__(self, spending: int, fee: int, coin: CoinType): def __init__(self, spending: int, fee: int, coin: CoinInfo):
self.spending = spending self.spending = spending
self.fee = fee self.fee = fee
self.coin = coin self.coin = coin
@ -29,20 +30,20 @@ class UiConfirmTotal:
class UiConfirmFeeOverThreshold: class UiConfirmFeeOverThreshold:
def __init__(self, fee: int, coin: CoinType): def __init__(self, fee: int, coin: CoinInfo):
self.fee = fee self.fee = fee
self.coin = coin self.coin = coin
def confirm_output(output: TxOutputType, coin: CoinType): def confirm_output(output: TxOutputType, coin: CoinInfo):
return (yield UiConfirmOutput(output, coin)) return (yield UiConfirmOutput(output, coin))
def confirm_total(spending: int, fee: int, coin: CoinType): def confirm_total(spending: int, fee: int, coin: CoinInfo):
return (yield UiConfirmTotal(spending, fee, coin)) return (yield UiConfirmTotal(spending, fee, coin))
def confirm_feeoverthreshold(fee: int, coin: CoinType): def confirm_feeoverthreshold(fee: int, coin: CoinInfo):
return (yield UiConfirmFeeOverThreshold(fee, coin)) return (yield UiConfirmFeeOverThreshold(fee, coin))

View File

@ -10,6 +10,7 @@ from trezor.messages.TxRequestDetailsType import TxRequestDetailsType
from trezor.messages.TxRequestSerializedType import TxRequestSerializedType from trezor.messages.TxRequestSerializedType import TxRequestSerializedType
from apps.common import address_type, coins from apps.common import address_type, coins
from apps.common.coins import CoinInfo
from apps.wallet.sign_tx.addresses import * from apps.wallet.sign_tx.addresses import *
from apps.wallet.sign_tx.helpers import * from apps.wallet.sign_tx.helpers import *
from apps.wallet.sign_tx.scripts import * from apps.wallet.sign_tx.scripts import *
@ -418,7 +419,7 @@ async def get_prevtx_output_value(tx_req: TxRequest, prev_hash: bytes, prev_inde
# === # ===
def get_hash_type(coin: CoinType) -> int: def get_hash_type(coin: CoinInfo) -> int:
SIGHASH_FORKID = const(0x40) SIGHASH_FORKID = const(0x40)
SIGHASH_ALL = const(0x01) SIGHASH_ALL = const(0x01)
hashtype = SIGHASH_ALL hashtype = SIGHASH_ALL
@ -441,7 +442,7 @@ def get_tx_header(tx: SignTx, segwit: bool = False):
# === # ===
def output_derive_script(o: TxOutputType, coin: CoinType, root: bip32.HDNode) -> bytes: def output_derive_script(o: TxOutputType, coin: CoinInfo, root: bip32.HDNode) -> bytes:
if o.script_type == OutputScriptType.PAYTOOPRETURN: if o.script_type == OutputScriptType.PAYTOOPRETURN:
# op_return output # op_return output
@ -479,7 +480,7 @@ def output_derive_script(o: TxOutputType, coin: CoinType, root: bip32.HDNode) ->
raise SigningError(FailureType.DataError, 'Invalid address type') raise SigningError(FailureType.DataError, 'Invalid address type')
def get_address_for_change(o: TxOutputType, coin: CoinType, root: bip32.HDNode): def get_address_for_change(o: TxOutputType, coin: CoinInfo, root: bip32.HDNode):
if o.script_type == OutputScriptType.PAYTOADDRESS: if o.script_type == OutputScriptType.PAYTOADDRESS:
input_script_type = InputScriptType.SPENDADDRESS input_script_type = InputScriptType.SPENDADDRESS
elif o.script_type == OutputScriptType.PAYTOMULTISIG: elif o.script_type == OutputScriptType.PAYTOMULTISIG:
@ -511,7 +512,7 @@ def output_is_change(o: TxOutputType, wallet_path: list, segwit_in: int) -> bool
# === # ===
def input_derive_script(coin: CoinType, i: TxInputType, pubkey: bytes, signature: bytes=None) -> bytes: def input_derive_script(coin: CoinInfo, i: TxInputType, pubkey: bytes, signature: bytes=None) -> bytes:
if i.script_type == InputScriptType.SPENDADDRESS: if i.script_type == InputScriptType.SPENDADDRESS:
# p2pkh or p2sh # p2pkh or p2sh
return input_script_p2pkh_or_p2sh( return input_script_p2pkh_or_p2sh(

View File

@ -1,46 +0,0 @@
# Automatically generated by pb2py
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,
**kwargs,
):
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
p.MessageType.__init__(self, **kwargs)

View File

@ -1,6 +1,5 @@
# Automatically generated by pb2py # Automatically generated by pb2py
import protobuf as p import protobuf as p
from .CoinType import CoinType
class Features(p.MessageType): class Features(p.MessageType):
@ -15,7 +14,6 @@ class Features(p.MessageType):
8: ('passphrase_protection', p.BoolType, 0), 8: ('passphrase_protection', p.BoolType, 0),
9: ('language', p.UnicodeType, 0), 9: ('language', p.UnicodeType, 0),
10: ('label', p.UnicodeType, 0), 10: ('label', p.UnicodeType, 0),
11: ('coins', CoinType, p.FLAG_REPEATED),
12: ('initialized', p.BoolType, 0), 12: ('initialized', p.BoolType, 0),
13: ('revision', p.BytesType, 0), 13: ('revision', p.BytesType, 0),
14: ('bootloader_hash', p.BytesType, 0), 14: ('bootloader_hash', p.BytesType, 0),
@ -47,7 +45,6 @@ class Features(p.MessageType):
passphrase_protection: bool = None, passphrase_protection: bool = None,
language: str = None, language: str = None,
label: str = None, label: str = None,
coins: list = None,
initialized: bool = None, initialized: bool = None,
revision: bytes = None, revision: bytes = None,
bootloader_hash: bytes = None, bootloader_hash: bytes = None,
@ -76,7 +73,6 @@ class Features(p.MessageType):
self.passphrase_protection = passphrase_protection self.passphrase_protection = passphrase_protection
self.language = language self.language = language
self.label = label self.label = label
self.coins = [] if coins is None else coins
self.initialized = initialized self.initialized = initialized
self.revision = revision self.revision = revision
self.bootloader_hash = bootloader_hash self.bootloader_hash = bootloader_hash

View File

@ -5,13 +5,16 @@ import protobuf as p
class Initialize(p.MessageType): class Initialize(p.MessageType):
FIELDS = { FIELDS = {
1: ('state', p.BytesType, 0), 1: ('state', p.BytesType, 0),
2: ('skip_passphrase', p.BoolType, 0),
} }
MESSAGE_WIRE_TYPE = 0 MESSAGE_WIRE_TYPE = 0
def __init__( def __init__(
self, self,
state: bytes = None, state: bytes = None,
skip_passphrase: bool = None,
**kwargs, **kwargs,
): ):
self.state = state self.state = state
self.skip_passphrase = skip_passphrase
p.MessageType.__init__(self, **kwargs) p.MessageType.__init__(self, **kwargs)

View File

@ -1,20 +0,0 @@
# Automatically generated by pb2py
import protobuf as p
class LiskMessageSignature(p.MessageType):
FIELDS = {
1: ('address', p.UnicodeType, 0),
2: ('signature', p.BytesType, 0),
}
MESSAGE_WIRE_TYPE = 119
def __init__(
self,
address: str = None,
signature: bytes = None,
**kwargs,
):
self.address = address
self.signature = signature
p.MessageType.__init__(self, **kwargs)

View File

@ -1,20 +0,0 @@
# Automatically generated by pb2py
import protobuf as p
class LiskSignMessage(p.MessageType):
FIELDS = {
1: ('address_n', p.UVarintType, p.FLAG_REPEATED),
2: ('message', p.BytesType, 0),
}
MESSAGE_WIRE_TYPE = 118
def __init__(
self,
address_n: list = None,
message: bytes = None,
**kwargs,
):
self.address_n = [] if address_n is None else address_n
self.message = message
p.MessageType.__init__(self, **kwargs)

View File

@ -1,23 +0,0 @@
# Automatically generated by pb2py
import protobuf as p
class LiskVerifyMessage(p.MessageType):
FIELDS = {
1: ('signature', p.BytesType, 0),
2: ('public_key', p.BytesType, 0),
3: ('message', p.BytesType, 0),
}
MESSAGE_WIRE_TYPE = 120
def __init__(
self,
signature: bytes = None,
public_key: bytes = None,
message: bytes = None,
**kwargs,
):
self.signature = signature
self.public_key = public_key
self.message = message
p.MessageType.__init__(self, **kwargs)

View File

@ -90,18 +90,12 @@ LiskGetAddress = const(114)
LiskAddress = const(115) LiskAddress = const(115)
LiskSignTx = const(116) LiskSignTx = const(116)
LiskSignedTx = const(117) LiskSignedTx = const(117)
LiskSignMessage = const(118)
LiskMessageSignature = const(119)
LiskVerifyMessage = const(120)
LiskGetPublicKey = const(121) LiskGetPublicKey = const(121)
LiskPublicKey = const(122) LiskPublicKey = const(122)
StellarGetPublicKey = const(200) StellarGetPublicKey = const(200)
StellarPublicKey = const(201) StellarPublicKey = const(201)
StellarSignTx = const(202) StellarSignTx = const(202)
StellarTxOpRequest = const(203) StellarTxOpRequest = const(203)
StellarSignMessage = const(204)
StellarMessageSignature = const(205)
StellarVerifyMessage = const(206)
StellarCreateAccountOp = const(210) StellarCreateAccountOp = const(210)
StellarPaymentOp = const(211) StellarPaymentOp = const(211)
StellarPathPaymentOp = const(212) StellarPathPaymentOp = const(212)

View File

@ -1,20 +0,0 @@
# Automatically generated by pb2py
import protobuf as p
class StellarMessageSignature(p.MessageType):
FIELDS = {
1: ('public_key', p.BytesType, 0),
2: ('signature', p.BytesType, 0),
}
MESSAGE_WIRE_TYPE = 205
def __init__(
self,
public_key: bytes = None,
signature: bytes = None,
**kwargs,
):
self.public_key = public_key
self.signature = signature
p.MessageType.__init__(self, **kwargs)

View File

@ -1,20 +0,0 @@
# Automatically generated by pb2py
import protobuf as p
class StellarSignMessage(p.MessageType):
FIELDS = {
1: ('address_n', p.UVarintType, p.FLAG_REPEATED),
2: ('message', p.UnicodeType, 0),
}
MESSAGE_WIRE_TYPE = 204
def __init__(
self,
address_n: list = None,
message: str = None,
**kwargs,
):
self.address_n = [] if address_n is None else address_n
self.message = message
p.MessageType.__init__(self, **kwargs)

View File

@ -1,23 +0,0 @@
# Automatically generated by pb2py
import protobuf as p
class StellarVerifyMessage(p.MessageType):
FIELDS = {
1: ('public_key', p.BytesType, 0),
2: ('message', p.BytesType, 0),
3: ('signature', p.BytesType, 0),
}
MESSAGE_WIRE_TYPE = 206
def __init__(
self,
public_key: bytes = None,
message: bytes = None,
signature: bytes = None,
**kwargs,
):
self.public_key = public_key
self.message = message
self.signature = signature
p.MessageType.__init__(self, **kwargs)

View File

@ -17,6 +17,7 @@ class TransactionType(p.MessageType):
8: ('extra_data', p.BytesType, 0), 8: ('extra_data', p.BytesType, 0),
9: ('extra_data_len', p.UVarintType, 0), 9: ('extra_data_len', p.UVarintType, 0),
10: ('decred_expiry', p.UVarintType, 0), 10: ('decred_expiry', p.UVarintType, 0),
11: ('overwintered', p.BoolType, 0),
} }
def __init__( def __init__(
@ -31,6 +32,7 @@ class TransactionType(p.MessageType):
extra_data: bytes = None, extra_data: bytes = None,
extra_data_len: int = None, extra_data_len: int = None,
decred_expiry: int = None, decred_expiry: int = None,
overwintered: bool = None,
**kwargs, **kwargs,
): ):
self.version = version self.version = version
@ -43,4 +45,5 @@ class TransactionType(p.MessageType):
self.extra_data = extra_data self.extra_data = extra_data
self.extra_data_len = extra_data_len self.extra_data_len = extra_data_len
self.decred_expiry = decred_expiry self.decred_expiry = decred_expiry
self.overwintered = overwintered
p.MessageType.__init__(self, **kwargs) p.MessageType.__init__(self, **kwargs)

View File

@ -56,12 +56,9 @@ Initialize = const(0)
LiskAddress = const(115) LiskAddress = const(115)
LiskGetAddress = const(114) LiskGetAddress = const(114)
LiskGetPublicKey = const(121) LiskGetPublicKey = const(121)
LiskMessageSignature = const(119)
LiskPublicKey = const(122) LiskPublicKey = const(122)
LiskSignMessage = const(118)
LiskSignTx = const(116) LiskSignTx = const(116)
LiskSignedTx = const(117) LiskSignedTx = const(117)
LiskVerifyMessage = const(120)
LoadDevice = const(13) LoadDevice = const(13)
MessageSignature = const(40) MessageSignature = const(40)
NEMAddress = const(68) NEMAddress = const(68)
@ -96,16 +93,13 @@ StellarCreatePassiveOfferOp = const(214)
StellarGetPublicKey = const(200) StellarGetPublicKey = const(200)
StellarManageDataOp = const(220) StellarManageDataOp = const(220)
StellarManageOfferOp = const(213) StellarManageOfferOp = const(213)
StellarMessageSignature = const(205)
StellarPathPaymentOp = const(212) StellarPathPaymentOp = const(212)
StellarPaymentOp = const(211) StellarPaymentOp = const(211)
StellarPublicKey = const(201) StellarPublicKey = const(201)
StellarSetOptionsOp = const(215) StellarSetOptionsOp = const(215)
StellarSignMessage = const(204)
StellarSignTx = const(202) StellarSignTx = const(202)
StellarSignedTx = const(230) StellarSignedTx = const(230)
StellarTxOpRequest = const(203) StellarTxOpRequest = const(203)
StellarVerifyMessage = const(206)
Success = const(2) Success = const(2)
TxAck = const(22) TxAck = const(22)
TxRequest = const(21) TxRequest = const(21)

View File

@ -4,13 +4,13 @@ import json
fields = [ fields = [
'coin_name', 'coin_name',
'coin_shortcut', 'coin_shortcut',
'coin_label',
'address_type', 'address_type',
'address_type_p2sh', 'address_type_p2sh',
'maxfee_kb', 'maxfee_kb',
'signed_message_header', 'signed_message_header',
'xpub_magic', 'xpub_magic',
'bech32_prefix', 'bech32_prefix',
'cashaddr_prefix',
'segwit', 'segwit',
'forkid', 'forkid',
'force_bip143', 'force_bip143',
@ -20,9 +20,9 @@ coins = json.load(open('../../vendor/trezor-common/coins.json', 'r'))
print('COINS = [') print('COINS = [')
for c in coins: for c in coins:
print(' CoinType(') print(' CoinInfo(')
for n in fields: for n in fields:
if n in ['xpub_magic', 'xprv_magic']: if n == 'xpub_magic':
print(' %s=0x%s,' % (n, c[n])) print(' %s=0x%s,' % (n, c[n]))
else: else:
print(' %s=%s,' % (n, repr(c[n]))) print(' %s=%s,' % (n, repr(c[n])))

@ -1 +1 @@
Subproject commit 9abe3a7c69000cc7ee3cda2ec940193fa9d62e6c Subproject commit 0c9d67954c871553a7d44575a7a9198cba83df88