1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-07-14 18:48:10 +00:00
trezor-firmware/python/src/trezorlib/messages/TxInputType.py
matejcik 67b879ac07 python: restructure package
This deserves some explanation.

* tests were moved to separate python/tests subdir
* trezorlib was moved to python/src, so that it does not exist on
PYTHONPATH by default
(see https://blog.ionelmc.ro/2014/05/25/python-packaging/ for details)
* everything was updated to understand the new structure
* trezorctl was changed from a top-level executable script to a module
`trezorlib.cli.trezorctl` and is installed via the entry_points
mechanism.
This should make it work normally on Windows!

The package should be installable as normal through pip and pipenv, no
changes are needed on that side.

The source package from pypi will include unit tests. (Device tests were
completely moved out). Wheel will exclude them, because users don't need
them.
That shrinks the .whl from 520 kB to 270 - nice!

python: reorganize remaining unit tests
2019-08-12 12:57:25 +02:00

63 lines
2.3 KiB
Python

# Automatically generated by pb2py
# fmt: off
from .. import protobuf as p
from .MultisigRedeemScriptType import MultisigRedeemScriptType
if __debug__:
try:
from typing import Dict, List, Optional
from typing_extensions import Literal # noqa: F401
EnumTypeInputScriptType = Literal[0, 1, 2, 3, 4]
except ImportError:
Dict, List, Optional = None, None, None # type: ignore
EnumTypeInputScriptType = None # type: ignore
class TxInputType(p.MessageType):
def __init__(
self,
address_n: List[int] = None,
prev_hash: bytes = None,
prev_index: int = None,
script_sig: bytes = None,
sequence: int = None,
script_type: EnumTypeInputScriptType = None,
multisig: MultisigRedeemScriptType = None,
amount: int = None,
decred_tree: int = None,
decred_script_version: int = None,
prev_block_hash_bip115: bytes = None,
prev_block_height_bip115: int = None,
) -> None:
self.address_n = address_n if address_n is not None else []
self.prev_hash = prev_hash
self.prev_index = prev_index
self.script_sig = script_sig
self.sequence = sequence
self.script_type = script_type
self.multisig = multisig
self.amount = amount
self.decred_tree = decred_tree
self.decred_script_version = decred_script_version
self.prev_block_hash_bip115 = prev_block_hash_bip115
self.prev_block_height_bip115 = prev_block_height_bip115
@classmethod
def get_fields(cls) -> Dict:
return {
1: ('address_n', p.UVarintType, p.FLAG_REPEATED),
2: ('prev_hash', p.BytesType, 0), # required
3: ('prev_index', p.UVarintType, 0), # required
4: ('script_sig', p.BytesType, 0),
5: ('sequence', p.UVarintType, 0), # default=4294967295
6: ('script_type', p.EnumType("InputScriptType", (0, 1, 2, 3, 4)), 0), # default=SPENDADDRESS
7: ('multisig', MultisigRedeemScriptType, 0),
8: ('amount', p.UVarintType, 0),
9: ('decred_tree', p.UVarintType, 0),
10: ('decred_script_version', p.UVarintType, 0),
11: ('prev_block_hash_bip115', p.BytesType, 0),
12: ('prev_block_height_bip115', p.UVarintType, 0),
}