mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-06-15 20:48:45 +00:00
style(python/btc): better specification of type of prev_txes
[no changelog]
This commit is contained in:
parent
7f061949f2
commit
8b2e2112bc
@ -17,10 +17,10 @@
|
|||||||
import warnings
|
import warnings
|
||||||
from copy import copy
|
from copy import copy
|
||||||
from decimal import Decimal
|
from decimal import Decimal
|
||||||
from typing import TYPE_CHECKING, Any, AnyStr, Dict, List, Optional, Sequence, Tuple
|
from typing import TYPE_CHECKING, Any, AnyStr, List, Optional, Sequence, Tuple
|
||||||
|
|
||||||
# TypedDict is not available in typing for python < 3.8
|
# TypedDict is not available in typing for python < 3.8
|
||||||
from typing_extensions import TypedDict
|
from typing_extensions import Protocol, TypedDict
|
||||||
|
|
||||||
from . import exceptions, messages
|
from . import exceptions, messages
|
||||||
from .tools import expect, normalize_nfc, session
|
from .tools import expect, normalize_nfc, session
|
||||||
@ -65,6 +65,13 @@ if TYPE_CHECKING:
|
|||||||
vin: List[Vin]
|
vin: List[Vin]
|
||||||
vout: List[Vout]
|
vout: List[Vout]
|
||||||
|
|
||||||
|
class TxCacheType(Protocol):
|
||||||
|
def __getitem__(self, __key: bytes) -> messages.TransactionType:
|
||||||
|
...
|
||||||
|
|
||||||
|
def __contains__(self, __key: bytes) -> bool:
|
||||||
|
...
|
||||||
|
|
||||||
|
|
||||||
def from_json(json_dict: "Transaction") -> messages.TransactionType:
|
def from_json(json_dict: "Transaction") -> messages.TransactionType:
|
||||||
def make_input(vin: "Vin") -> messages.TxInputType:
|
def make_input(vin: "Vin") -> messages.TxInputType:
|
||||||
@ -242,7 +249,7 @@ def sign_tx(
|
|||||||
inputs: Sequence[messages.TxInputType],
|
inputs: Sequence[messages.TxInputType],
|
||||||
outputs: Sequence[messages.TxOutputType],
|
outputs: Sequence[messages.TxOutputType],
|
||||||
details: Optional[messages.SignTx] = None,
|
details: Optional[messages.SignTx] = None,
|
||||||
prev_txes: Optional[Dict[bytes, messages.TransactionType]] = None,
|
prev_txes: Optional["TxCacheType"] = None,
|
||||||
preauthorized: bool = False,
|
preauthorized: bool = False,
|
||||||
**kwargs: Any,
|
**kwargs: Any,
|
||||||
) -> Tuple[Sequence[Optional[bytes]], bytes]:
|
) -> Tuple[Sequence[Optional[bytes]], bytes]:
|
||||||
|
Loading…
Reference in New Issue
Block a user