|
|
|
@ -114,7 +114,21 @@ def get_public_node(
|
|
|
|
|
coin_name: Optional[str] = None,
|
|
|
|
|
script_type: messages.InputScriptType = messages.InputScriptType.SPENDADDRESS,
|
|
|
|
|
ignore_xpub_magic: bool = False,
|
|
|
|
|
preauthorized: bool = False,
|
|
|
|
|
unlock_path: Optional[List[int]] = None,
|
|
|
|
|
unlock_path_mac: Optional[bytes] = None,
|
|
|
|
|
) -> "MessageType":
|
|
|
|
|
if unlock_path:
|
|
|
|
|
res = client.call(
|
|
|
|
|
messages.UnlockPath(address_n=unlock_path, mac=unlock_path_mac)
|
|
|
|
|
)
|
|
|
|
|
if not isinstance(res, messages.UnlockedPathRequest):
|
|
|
|
|
raise exceptions.TrezorException("Unexpected message")
|
|
|
|
|
elif preauthorized:
|
|
|
|
|
res = client.call(messages.DoPreauthorized())
|
|
|
|
|
if not isinstance(res, messages.PreauthorizedRequest):
|
|
|
|
|
raise exceptions.TrezorException("Unexpected message")
|
|
|
|
|
|
|
|
|
|
return client.call(
|
|
|
|
|
messages.GetPublicKey(
|
|
|
|
|
address_n=n,
|
|
|
|
@ -141,7 +155,21 @@ def get_authenticated_address(
|
|
|
|
|
multisig: Optional[messages.MultisigRedeemScriptType] = None,
|
|
|
|
|
script_type: messages.InputScriptType = messages.InputScriptType.SPENDADDRESS,
|
|
|
|
|
ignore_xpub_magic: bool = False,
|
|
|
|
|
preauthorized: bool = False,
|
|
|
|
|
unlock_path: Optional[List[int]] = None,
|
|
|
|
|
unlock_path_mac: Optional[bytes] = None,
|
|
|
|
|
) -> "MessageType":
|
|
|
|
|
if unlock_path:
|
|
|
|
|
res = client.call(
|
|
|
|
|
messages.UnlockPath(address_n=unlock_path, mac=unlock_path_mac)
|
|
|
|
|
)
|
|
|
|
|
if not isinstance(res, messages.UnlockedPathRequest):
|
|
|
|
|
raise exceptions.TrezorException("Unexpected message")
|
|
|
|
|
elif preauthorized:
|
|
|
|
|
res = client.call(messages.DoPreauthorized())
|
|
|
|
|
if not isinstance(res, messages.PreauthorizedRequest):
|
|
|
|
|
raise exceptions.TrezorException("Unexpected message")
|
|
|
|
|
|
|
|
|
|
return client.call(
|
|
|
|
|
messages.GetAddress(
|
|
|
|
|
address_n=n,
|
|
|
|
@ -257,6 +285,8 @@ def sign_tx(
|
|
|
|
|
prev_txes: Optional["TxCacheType"] = None,
|
|
|
|
|
payment_reqs: Sequence[messages.TxAckPaymentRequest] = (),
|
|
|
|
|
preauthorized: bool = False,
|
|
|
|
|
unlock_path: Optional[List[int]] = None,
|
|
|
|
|
unlock_path_mac: Optional[bytes] = None,
|
|
|
|
|
**kwargs: Any,
|
|
|
|
|
) -> Tuple[Sequence[Optional[bytes]], bytes]:
|
|
|
|
|
"""Sign a Bitcoin-like transaction.
|
|
|
|
@ -294,7 +324,13 @@ def sign_tx(
|
|
|
|
|
if hasattr(signtx, name):
|
|
|
|
|
setattr(signtx, name, value)
|
|
|
|
|
|
|
|
|
|
if preauthorized:
|
|
|
|
|
if unlock_path:
|
|
|
|
|
res = client.call(
|
|
|
|
|
messages.UnlockPath(address_n=unlock_path, mac=unlock_path_mac)
|
|
|
|
|
)
|
|
|
|
|
if not isinstance(res, messages.UnlockedPathRequest):
|
|
|
|
|
raise exceptions.TrezorException("Unexpected message")
|
|
|
|
|
elif preauthorized:
|
|
|
|
|
res = client.call(messages.DoPreauthorized())
|
|
|
|
|
if not isinstance(res, messages.PreauthorizedRequest):
|
|
|
|
|
raise exceptions.TrezorException("Unexpected message")
|
|
|
|
|