Browse Source

add typing hints

master
Adam Gibson 3 years ago
parent
commit
6250d243df
No known key found for this signature in database
GPG Key ID: 141001A1AF77F20B
  1. 5
      jmbitcoin/jmbitcoin/secp256k1_transaction.py
  2. 2
      jmclient/jmclient/taker_utils.py

5
jmbitcoin/jmbitcoin/secp256k1_transaction.py

@ -1,6 +1,7 @@
# note, only used for non-cryptographic randomness:
import random
import json
from typing import List, Union, Tuple
# needed for single sha256 evaluation, which is used
# in bitcoin (p2wsh) but not exposed in python-bitcointx:
import hashlib
@ -106,7 +107,7 @@ def human_readable_output(txoutput):
pass # non standard script
return outdict
def there_is_one_segwit_input(input_types):
def there_is_one_segwit_input(input_types: List[str]) -> bool:
# note that we need separate input types for
# any distinct types of scripthash inputs supported,
# since each may have a different size of witness; in
@ -114,7 +115,7 @@ def there_is_one_segwit_input(input_types):
# will need updating.
return any(y in ["p2sh-p2wpkh", "p2wpkh", "p2wsh"] for y in input_types)
def estimate_tx_size(ins, outs):
def estimate_tx_size(ins: List[str], outs: List[str]) -> Union[int, Tuple[int]]:
'''Estimate transaction size.
Both arguments `ins` and `outs` must be lists of script types,
and they must be present in the keys of the dicts `inmults`,

2
jmclient/jmclient/taker_utils.py

@ -21,7 +21,7 @@ Utility functions for tumbler-style takers;
Currently re-used by CLI script tumbler.py and joinmarket-qt
"""
def get_utxo_scripts(wallet: BaseWallet, utxos):
def get_utxo_scripts(wallet: BaseWallet, utxos: dict) -> list:
# given a Joinmarket wallet and a set of utxos
# as passed from `get_utxos_by_mixdepth` at one mixdepth,
# return the list of script types for each utxo

Loading…
Cancel
Save