mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-12-18 20:38:10 +00:00
python: Add get_ownership_id() and get_ownership_proof() to trezorlib.
This commit is contained in:
parent
64d9350de2
commit
a973c3bc6e
@ -91,6 +91,51 @@ def get_address(
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@expect(messages.OwnershipId, field="ownership_id")
|
||||||
|
def get_ownership_id(
|
||||||
|
client,
|
||||||
|
coin_name,
|
||||||
|
n,
|
||||||
|
multisig=None,
|
||||||
|
script_type=messages.InputScriptType.SPENDADDRESS,
|
||||||
|
):
|
||||||
|
return client.call(
|
||||||
|
messages.GetOwnershipId(
|
||||||
|
address_n=n,
|
||||||
|
coin_name=coin_name,
|
||||||
|
multisig=multisig,
|
||||||
|
script_type=script_type,
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def get_ownership_proof(
|
||||||
|
client,
|
||||||
|
coin_name,
|
||||||
|
n,
|
||||||
|
multisig=None,
|
||||||
|
script_type=messages.InputScriptType.SPENDADDRESS,
|
||||||
|
user_confirmation=False,
|
||||||
|
ownership_ids=None,
|
||||||
|
commitment_data=None,
|
||||||
|
):
|
||||||
|
res = client.call(
|
||||||
|
messages.GetOwnershipProof(
|
||||||
|
address_n=n,
|
||||||
|
coin_name=coin_name,
|
||||||
|
script_type=script_type,
|
||||||
|
multisig=multisig,
|
||||||
|
user_confirmation=user_confirmation,
|
||||||
|
ownership_ids=ownership_ids,
|
||||||
|
commitment_data=commitment_data,
|
||||||
|
)
|
||||||
|
)
|
||||||
|
if not isinstance(res, messages.OwnershipProof):
|
||||||
|
raise exceptions.TrezorException("Unexpected message")
|
||||||
|
|
||||||
|
return res.ownership_proof, res.signature
|
||||||
|
|
||||||
|
|
||||||
@expect(messages.MessageSignature)
|
@expect(messages.MessageSignature)
|
||||||
def sign_message(
|
def sign_message(
|
||||||
client, coin_name, n, message, script_type=messages.InputScriptType.SPENDADDRESS
|
client, coin_name, n, message, script_type=messages.InputScriptType.SPENDADDRESS
|
||||||
|
Loading…
Reference in New Issue
Block a user