mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-06-27 02:12:35 +00:00
nem: make a clearer flow for create_sign_tx
This commit is contained in:
parent
3d3e9b67b4
commit
f05f9a2b37
@ -145,17 +145,7 @@ def create_importance_transfer(transaction):
|
|||||||
return msg
|
return msg
|
||||||
|
|
||||||
|
|
||||||
def create_sign_tx(transaction):
|
def fill_transaction_by_type(msg, transaction):
|
||||||
msg = proto.NEMSignTx()
|
|
||||||
msg.transaction = create_transaction_common(transaction)
|
|
||||||
msg.cosigning = transaction["type"] == TYPE_MULTISIG_SIGNATURE
|
|
||||||
|
|
||||||
if transaction["type"] in (TYPE_MULTISIG_SIGNATURE, TYPE_MULTISIG):
|
|
||||||
transaction = transaction["otherTrans"]
|
|
||||||
msg.multisig = create_transaction_common(transaction)
|
|
||||||
elif "otherTrans" in transaction:
|
|
||||||
raise ValueError("Transaction does not support inner transaction")
|
|
||||||
|
|
||||||
if transaction["type"] == TYPE_TRANSACTION_TRANSFER:
|
if transaction["type"] == TYPE_TRANSACTION_TRANSFER:
|
||||||
msg.transfer = create_transfer(transaction)
|
msg.transfer = create_transfer(transaction)
|
||||||
elif transaction["type"] == TYPE_AGGREGATE_MODIFICATION:
|
elif transaction["type"] == TYPE_AGGREGATE_MODIFICATION:
|
||||||
@ -171,6 +161,21 @@ def create_sign_tx(transaction):
|
|||||||
else:
|
else:
|
||||||
raise ValueError("Unknown transaction type")
|
raise ValueError("Unknown transaction type")
|
||||||
|
|
||||||
|
|
||||||
|
def create_sign_tx(transaction):
|
||||||
|
msg = proto.NEMSignTx()
|
||||||
|
msg.transaction = create_transaction_common(transaction)
|
||||||
|
msg.cosigning = transaction["type"] == TYPE_MULTISIG_SIGNATURE
|
||||||
|
|
||||||
|
if transaction["type"] in (TYPE_MULTISIG_SIGNATURE, TYPE_MULTISIG):
|
||||||
|
other_trans = transaction["otherTrans"]
|
||||||
|
msg.multisig = create_transaction_common(other_trans)
|
||||||
|
fill_transaction_by_type(msg, other_trans)
|
||||||
|
elif "otherTrans" in transaction:
|
||||||
|
raise ValueError("Transaction does not support inner transaction")
|
||||||
|
else:
|
||||||
|
fill_transaction_by_type(msg, transaction)
|
||||||
|
|
||||||
return msg
|
return msg
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user