diff --git a/python/src/trezorlib/binance.py b/python/src/trezorlib/binance.py index ae7aa300d..d8ac31480 100644 --- a/python/src/trezorlib/binance.py +++ b/python/src/trezorlib/binance.py @@ -49,9 +49,10 @@ def sign_tx( client: "TrezorClient", address_n: "Address", tx_json: dict ) -> messages.BinanceSignedTx: msg = tx_json["msgs"][0] - envelope = dict_to_proto(messages.BinanceSignTx, tx_json) - envelope.msg_count = 1 - envelope.address_n = address_n + tx_msg = tx_json.copy() + tx_msg["msg_count"] = 1 + tx_msg["address_n"] = address_n + envelope = dict_to_proto(messages.BinanceSignTx, tx_msg) response = client.call(envelope) diff --git a/python/src/trezorlib/cli/__init__.py b/python/src/trezorlib/cli/__init__.py index 2d27d6480..6213be026 100644 --- a/python/src/trezorlib/cli/__init__.py +++ b/python/src/trezorlib/cli/__init__.py @@ -133,4 +133,6 @@ def with_client(func: "Callable[Concatenate[TrezorClient, P], R]") -> "Callable[ except Exception: pass - return trezorctl_command_with_client + # the return type of @click.pass_obj is improperly specified and pyright doesn't + # understand that it converts f(obj, *args, **kwargs) to f(*args, **kwargs) + return trezorctl_command_with_client # type: ignore diff --git a/python/src/trezorlib/cli/firmware.py b/python/src/trezorlib/cli/firmware.py index 3dfb07156..dfbba0cd4 100644 --- a/python/src/trezorlib/cli/firmware.py +++ b/python/src/trezorlib/cli/firmware.py @@ -283,6 +283,8 @@ def find_best_firmware_version( if closest_version > want_version: # stop at first that is higher than the requested break + else: + raise click.ClickException("No versions were found!") # if there was no break, the newest is used click.echo(f"Closest available version: {version_str(closest_version)}") if not beta and want_version > highest_version: diff --git a/python/src/trezorlib/eos.py b/python/src/trezorlib/eos.py index b23fa7842..7be0e5674 100644 --- a/python/src/trezorlib/eos.py +++ b/python/src/trezorlib/eos.py @@ -258,11 +258,9 @@ def parse_unknown(data: str) -> messages.EosActionUnknown: def parse_action(action: dict) -> messages.EosTxActionAck: - tx_action = messages.EosTxActionAck() + tx_action = messages.EosTxActionAck(common=parse_common(action)) + data = action["data"] - - tx_action.common = parse_common(action) - if action["account"] == "eosio": if action["name"] == "voteproducer": tx_action.vote_producer = parse_vote_producer(data) @@ -337,11 +335,12 @@ def sign_tx( ) -> messages.EosSignedTx: header, actions = parse_transaction_json(transaction) - msg = messages.EosSignTx() - msg.address_n = address - msg.chain_id = bytes.fromhex(chain_id) - msg.header = header - msg.num_actions = len(actions) + msg = messages.EosSignTx( + address_n=address, + chain_id=bytes.fromhex(chain_id), + header=header, + num_actions=len(actions), + ) response = client.call(msg) diff --git a/python/src/trezorlib/messages.py b/python/src/trezorlib/messages.py index 3b1fa20be..9548b0a32 100644 --- a/python/src/trezorlib/messages.py +++ b/python/src/trezorlib/messages.py @@ -590,32 +590,32 @@ class BinanceSignTx(protobuf.MessageType): MESSAGE_WIRE_TYPE = 704 FIELDS = { 1: protobuf.Field("address_n", "uint32", repeated=True, required=False), - 2: protobuf.Field("msg_count", "uint32", repeated=False, required=False), - 3: protobuf.Field("account_number", "sint64", repeated=False, required=False), + 2: protobuf.Field("msg_count", "uint32", repeated=False, required=True), + 3: protobuf.Field("account_number", "sint64", repeated=False, required=True), 4: protobuf.Field("chain_id", "string", repeated=False, required=False), 5: protobuf.Field("memo", "string", repeated=False, required=False), - 6: protobuf.Field("sequence", "sint64", repeated=False, required=False), - 7: protobuf.Field("source", "sint64", repeated=False, required=False), + 6: protobuf.Field("sequence", "sint64", repeated=False, required=True), + 7: protobuf.Field("source", "sint64", repeated=False, required=True), } def __init__( self, *, + msg_count: "int", + account_number: "int", + sequence: "int", + source: "int", address_n: Optional[Sequence["int"]] = None, - msg_count: Optional["int"] = None, - account_number: Optional["int"] = None, chain_id: Optional["str"] = None, memo: Optional["str"] = None, - sequence: Optional["int"] = None, - source: Optional["int"] = None, ) -> None: self.address_n: Sequence["int"] = address_n if address_n is not None else [] self.msg_count = msg_count self.account_number = account_number - self.chain_id = chain_id - self.memo = memo self.sequence = sequence self.source = source + self.chain_id = chain_id + self.memo = memo class BinanceTxRequest(protobuf.MessageType): @@ -643,35 +643,35 @@ class BinanceOrderMsg(protobuf.MessageType): MESSAGE_WIRE_TYPE = 707 FIELDS = { 1: protobuf.Field("id", "string", repeated=False, required=False), - 2: protobuf.Field("ordertype", "BinanceOrderType", repeated=False, required=False), - 3: protobuf.Field("price", "sint64", repeated=False, required=False), - 4: protobuf.Field("quantity", "sint64", repeated=False, required=False), + 2: protobuf.Field("ordertype", "BinanceOrderType", repeated=False, required=True), + 3: protobuf.Field("price", "sint64", repeated=False, required=True), + 4: protobuf.Field("quantity", "sint64", repeated=False, required=True), 5: protobuf.Field("sender", "string", repeated=False, required=False), - 6: protobuf.Field("side", "BinanceOrderSide", repeated=False, required=False), + 6: protobuf.Field("side", "BinanceOrderSide", repeated=False, required=True), 7: protobuf.Field("symbol", "string", repeated=False, required=False), - 8: protobuf.Field("timeinforce", "BinanceTimeInForce", repeated=False, required=False), + 8: protobuf.Field("timeinforce", "BinanceTimeInForce", repeated=False, required=True), } def __init__( self, *, + ordertype: "BinanceOrderType", + price: "int", + quantity: "int", + side: "BinanceOrderSide", + timeinforce: "BinanceTimeInForce", id: Optional["str"] = None, - ordertype: Optional["BinanceOrderType"] = None, - price: Optional["int"] = None, - quantity: Optional["int"] = None, sender: Optional["str"] = None, - side: Optional["BinanceOrderSide"] = None, symbol: Optional["str"] = None, - timeinforce: Optional["BinanceTimeInForce"] = None, ) -> None: - self.id = id self.ordertype = ordertype self.price = price self.quantity = quantity - self.sender = sender self.side = side - self.symbol = symbol self.timeinforce = timeinforce + self.id = id + self.sender = sender + self.symbol = symbol class BinanceCancelMsg(protobuf.MessageType): @@ -714,15 +714,15 @@ class BinanceSignedTx(protobuf.MessageType): class BinanceInputOutput(protobuf.MessageType): MESSAGE_WIRE_TYPE = None FIELDS = { - 1: protobuf.Field("address", "string", repeated=False, required=False), + 1: protobuf.Field("address", "string", repeated=False, required=True), 2: protobuf.Field("coins", "BinanceCoin", repeated=True, required=False), } def __init__( self, *, + address: "str", coins: Optional[Sequence["BinanceCoin"]] = None, - address: Optional["str"] = None, ) -> None: self.coins: Sequence["BinanceCoin"] = coins if coins is not None else [] self.address = address @@ -731,15 +731,15 @@ class BinanceInputOutput(protobuf.MessageType): class BinanceCoin(protobuf.MessageType): MESSAGE_WIRE_TYPE = None FIELDS = { - 1: protobuf.Field("amount", "sint64", repeated=False, required=False), - 2: protobuf.Field("denom", "string", repeated=False, required=False), + 1: protobuf.Field("amount", "sint64", repeated=False, required=True), + 2: protobuf.Field("denom", "string", repeated=False, required=True), } def __init__( self, *, - amount: Optional["int"] = None, - denom: Optional["str"] = None, + amount: "int", + denom: "str", ) -> None: self.amount = amount self.denom = denom @@ -3825,18 +3825,18 @@ class EosSignTx(protobuf.MessageType): MESSAGE_WIRE_TYPE = 602 FIELDS = { 1: protobuf.Field("address_n", "uint32", repeated=True, required=False), - 2: protobuf.Field("chain_id", "bytes", repeated=False, required=False), - 3: protobuf.Field("header", "EosTxHeader", repeated=False, required=False), - 4: protobuf.Field("num_actions", "uint32", repeated=False, required=False), + 2: protobuf.Field("chain_id", "bytes", repeated=False, required=True), + 3: protobuf.Field("header", "EosTxHeader", repeated=False, required=True), + 4: protobuf.Field("num_actions", "uint32", repeated=False, required=True), } def __init__( self, *, + chain_id: "bytes", + header: "EosTxHeader", + num_actions: "int", address_n: Optional[Sequence["int"]] = None, - chain_id: Optional["bytes"] = None, - header: Optional["EosTxHeader"] = None, - num_actions: Optional["int"] = None, ) -> None: self.address_n: Sequence["int"] = address_n if address_n is not None else [] self.chain_id = chain_id @@ -3861,7 +3861,7 @@ class EosTxActionRequest(protobuf.MessageType): class EosTxActionAck(protobuf.MessageType): MESSAGE_WIRE_TYPE = 604 FIELDS = { - 1: protobuf.Field("common", "EosActionCommon", repeated=False, required=False), + 1: protobuf.Field("common", "EosActionCommon", repeated=False, required=True), 2: protobuf.Field("transfer", "EosActionTransfer", repeated=False, required=False), 3: protobuf.Field("delegate", "EosActionDelegate", repeated=False, required=False), 4: protobuf.Field("undelegate", "EosActionUndelegate", repeated=False, required=False), @@ -3881,7 +3881,7 @@ class EosTxActionAck(protobuf.MessageType): def __init__( self, *, - common: Optional["EosActionCommon"] = None, + common: "EosActionCommon", transfer: Optional["EosActionTransfer"] = None, delegate: Optional["EosActionDelegate"] = None, undelegate: Optional["EosActionUndelegate"] = None, @@ -3960,15 +3960,15 @@ class EosTxHeader(protobuf.MessageType): class EosAsset(protobuf.MessageType): MESSAGE_WIRE_TYPE = None FIELDS = { - 1: protobuf.Field("amount", "sint64", repeated=False, required=False), - 2: protobuf.Field("symbol", "uint64", repeated=False, required=False), + 1: protobuf.Field("amount", "sint64", repeated=False, required=True), + 2: protobuf.Field("symbol", "uint64", repeated=False, required=True), } def __init__( self, *, - amount: Optional["int"] = None, - symbol: Optional["int"] = None, + amount: "int", + symbol: "int", ) -> None: self.amount = amount self.symbol = symbol @@ -3977,15 +3977,15 @@ class EosAsset(protobuf.MessageType): class EosPermissionLevel(protobuf.MessageType): MESSAGE_WIRE_TYPE = None FIELDS = { - 1: protobuf.Field("actor", "uint64", repeated=False, required=False), - 2: protobuf.Field("permission", "uint64", repeated=False, required=False), + 1: protobuf.Field("actor", "uint64", repeated=False, required=True), + 2: protobuf.Field("permission", "uint64", repeated=False, required=True), } def __init__( self, *, - actor: Optional["int"] = None, - permission: Optional["int"] = None, + actor: "int", + permission: "int", ) -> None: self.actor = actor self.permission = permission @@ -4017,15 +4017,15 @@ class EosAuthorizationKey(protobuf.MessageType): class EosAuthorizationAccount(protobuf.MessageType): MESSAGE_WIRE_TYPE = None FIELDS = { - 1: protobuf.Field("account", "EosPermissionLevel", repeated=False, required=False), - 2: protobuf.Field("weight", "uint32", repeated=False, required=False), + 1: protobuf.Field("account", "EosPermissionLevel", repeated=False, required=True), + 2: protobuf.Field("weight", "uint32", repeated=False, required=True), } def __init__( self, *, - account: Optional["EosPermissionLevel"] = None, - weight: Optional["int"] = None, + account: "EosPermissionLevel", + weight: "int", ) -> None: self.account = account self.weight = weight @@ -4034,15 +4034,15 @@ class EosAuthorizationAccount(protobuf.MessageType): class EosAuthorizationWait(protobuf.MessageType): MESSAGE_WIRE_TYPE = None FIELDS = { - 1: protobuf.Field("wait_sec", "uint32", repeated=False, required=False), - 2: protobuf.Field("weight", "uint32", repeated=False, required=False), + 1: protobuf.Field("wait_sec", "uint32", repeated=False, required=True), + 2: protobuf.Field("weight", "uint32", repeated=False, required=True), } def __init__( self, *, - wait_sec: Optional["int"] = None, - weight: Optional["int"] = None, + wait_sec: "int", + weight: "int", ) -> None: self.wait_sec = wait_sec self.weight = weight @@ -4051,7 +4051,7 @@ class EosAuthorizationWait(protobuf.MessageType): class EosAuthorization(protobuf.MessageType): MESSAGE_WIRE_TYPE = None FIELDS = { - 1: protobuf.Field("threshold", "uint32", repeated=False, required=False), + 1: protobuf.Field("threshold", "uint32", repeated=False, required=True), 2: protobuf.Field("keys", "EosAuthorizationKey", repeated=True, required=False), 3: protobuf.Field("accounts", "EosAuthorizationAccount", repeated=True, required=False), 4: protobuf.Field("waits", "EosAuthorizationWait", repeated=True, required=False), @@ -4060,10 +4060,10 @@ class EosAuthorization(protobuf.MessageType): def __init__( self, *, + threshold: "int", keys: Optional[Sequence["EosAuthorizationKey"]] = None, accounts: Optional[Sequence["EosAuthorizationAccount"]] = None, waits: Optional[Sequence["EosAuthorizationWait"]] = None, - threshold: Optional["int"] = None, ) -> None: self.keys: Sequence["EosAuthorizationKey"] = keys if keys is not None else [] self.accounts: Sequence["EosAuthorizationAccount"] = accounts if accounts is not None else [] @@ -4074,17 +4074,17 @@ class EosAuthorization(protobuf.MessageType): class EosActionCommon(protobuf.MessageType): MESSAGE_WIRE_TYPE = None FIELDS = { - 1: protobuf.Field("account", "uint64", repeated=False, required=False), - 2: protobuf.Field("name", "uint64", repeated=False, required=False), + 1: protobuf.Field("account", "uint64", repeated=False, required=True), + 2: protobuf.Field("name", "uint64", repeated=False, required=True), 3: protobuf.Field("authorization", "EosPermissionLevel", repeated=True, required=False), } def __init__( self, *, + account: "int", + name: "int", authorization: Optional[Sequence["EosPermissionLevel"]] = None, - account: Optional["int"] = None, - name: Optional["int"] = None, ) -> None: self.authorization: Sequence["EosPermissionLevel"] = authorization if authorization is not None else [] self.account = account @@ -4094,19 +4094,19 @@ class EosActionCommon(protobuf.MessageType): class EosActionTransfer(protobuf.MessageType): MESSAGE_WIRE_TYPE = None FIELDS = { - 1: protobuf.Field("sender", "uint64", repeated=False, required=False), - 2: protobuf.Field("receiver", "uint64", repeated=False, required=False), - 3: protobuf.Field("quantity", "EosAsset", repeated=False, required=False), - 4: protobuf.Field("memo", "string", repeated=False, required=False), + 1: protobuf.Field("sender", "uint64", repeated=False, required=True), + 2: protobuf.Field("receiver", "uint64", repeated=False, required=True), + 3: protobuf.Field("quantity", "EosAsset", repeated=False, required=True), + 4: protobuf.Field("memo", "string", repeated=False, required=True), } def __init__( self, *, - sender: Optional["int"] = None, - receiver: Optional["int"] = None, - quantity: Optional["EosAsset"] = None, - memo: Optional["str"] = None, + sender: "int", + receiver: "int", + quantity: "EosAsset", + memo: "str", ) -> None: self.sender = sender self.receiver = receiver @@ -4117,21 +4117,21 @@ class EosActionTransfer(protobuf.MessageType): class EosActionDelegate(protobuf.MessageType): MESSAGE_WIRE_TYPE = None FIELDS = { - 1: protobuf.Field("sender", "uint64", repeated=False, required=False), - 2: protobuf.Field("receiver", "uint64", repeated=False, required=False), - 3: protobuf.Field("net_quantity", "EosAsset", repeated=False, required=False), - 4: protobuf.Field("cpu_quantity", "EosAsset", repeated=False, required=False), - 5: protobuf.Field("transfer", "bool", repeated=False, required=False), + 1: protobuf.Field("sender", "uint64", repeated=False, required=True), + 2: protobuf.Field("receiver", "uint64", repeated=False, required=True), + 3: protobuf.Field("net_quantity", "EosAsset", repeated=False, required=True), + 4: protobuf.Field("cpu_quantity", "EosAsset", repeated=False, required=True), + 5: protobuf.Field("transfer", "bool", repeated=False, required=True), } def __init__( self, *, - sender: Optional["int"] = None, - receiver: Optional["int"] = None, - net_quantity: Optional["EosAsset"] = None, - cpu_quantity: Optional["EosAsset"] = None, - transfer: Optional["bool"] = None, + sender: "int", + receiver: "int", + net_quantity: "EosAsset", + cpu_quantity: "EosAsset", + transfer: "bool", ) -> None: self.sender = sender self.receiver = receiver @@ -4143,19 +4143,19 @@ class EosActionDelegate(protobuf.MessageType): class EosActionUndelegate(protobuf.MessageType): MESSAGE_WIRE_TYPE = None FIELDS = { - 1: protobuf.Field("sender", "uint64", repeated=False, required=False), - 2: protobuf.Field("receiver", "uint64", repeated=False, required=False), - 3: protobuf.Field("net_quantity", "EosAsset", repeated=False, required=False), - 4: protobuf.Field("cpu_quantity", "EosAsset", repeated=False, required=False), + 1: protobuf.Field("sender", "uint64", repeated=False, required=True), + 2: protobuf.Field("receiver", "uint64", repeated=False, required=True), + 3: protobuf.Field("net_quantity", "EosAsset", repeated=False, required=True), + 4: protobuf.Field("cpu_quantity", "EosAsset", repeated=False, required=True), } def __init__( self, *, - sender: Optional["int"] = None, - receiver: Optional["int"] = None, - net_quantity: Optional["EosAsset"] = None, - cpu_quantity: Optional["EosAsset"] = None, + sender: "int", + receiver: "int", + net_quantity: "EosAsset", + cpu_quantity: "EosAsset", ) -> None: self.sender = sender self.receiver = receiver @@ -4166,13 +4166,13 @@ class EosActionUndelegate(protobuf.MessageType): class EosActionRefund(protobuf.MessageType): MESSAGE_WIRE_TYPE = None FIELDS = { - 1: protobuf.Field("owner", "uint64", repeated=False, required=False), + 1: protobuf.Field("owner", "uint64", repeated=False, required=True), } def __init__( self, *, - owner: Optional["int"] = None, + owner: "int", ) -> None: self.owner = owner @@ -4180,17 +4180,17 @@ class EosActionRefund(protobuf.MessageType): class EosActionBuyRam(protobuf.MessageType): MESSAGE_WIRE_TYPE = None FIELDS = { - 1: protobuf.Field("payer", "uint64", repeated=False, required=False), - 2: protobuf.Field("receiver", "uint64", repeated=False, required=False), - 3: protobuf.Field("quantity", "EosAsset", repeated=False, required=False), + 1: protobuf.Field("payer", "uint64", repeated=False, required=True), + 2: protobuf.Field("receiver", "uint64", repeated=False, required=True), + 3: protobuf.Field("quantity", "EosAsset", repeated=False, required=True), } def __init__( self, *, - payer: Optional["int"] = None, - receiver: Optional["int"] = None, - quantity: Optional["EosAsset"] = None, + payer: "int", + receiver: "int", + quantity: "EosAsset", ) -> None: self.payer = payer self.receiver = receiver @@ -4200,17 +4200,17 @@ class EosActionBuyRam(protobuf.MessageType): class EosActionBuyRamBytes(protobuf.MessageType): MESSAGE_WIRE_TYPE = None FIELDS = { - 1: protobuf.Field("payer", "uint64", repeated=False, required=False), - 2: protobuf.Field("receiver", "uint64", repeated=False, required=False), - 3: protobuf.Field("bytes", "uint32", repeated=False, required=False), + 1: protobuf.Field("payer", "uint64", repeated=False, required=True), + 2: protobuf.Field("receiver", "uint64", repeated=False, required=True), + 3: protobuf.Field("bytes", "uint32", repeated=False, required=True), } def __init__( self, *, - payer: Optional["int"] = None, - receiver: Optional["int"] = None, - bytes: Optional["int"] = None, + payer: "int", + receiver: "int", + bytes: "int", ) -> None: self.payer = payer self.receiver = receiver @@ -4220,15 +4220,15 @@ class EosActionBuyRamBytes(protobuf.MessageType): class EosActionSellRam(protobuf.MessageType): MESSAGE_WIRE_TYPE = None FIELDS = { - 1: protobuf.Field("account", "uint64", repeated=False, required=False), - 2: protobuf.Field("bytes", "uint64", repeated=False, required=False), + 1: protobuf.Field("account", "uint64", repeated=False, required=True), + 2: protobuf.Field("bytes", "uint64", repeated=False, required=True), } def __init__( self, *, - account: Optional["int"] = None, - bytes: Optional["int"] = None, + account: "int", + bytes: "int", ) -> None: self.account = account self.bytes = bytes @@ -4237,17 +4237,17 @@ class EosActionSellRam(protobuf.MessageType): class EosActionVoteProducer(protobuf.MessageType): MESSAGE_WIRE_TYPE = None FIELDS = { - 1: protobuf.Field("voter", "uint64", repeated=False, required=False), - 2: protobuf.Field("proxy", "uint64", repeated=False, required=False), + 1: protobuf.Field("voter", "uint64", repeated=False, required=True), + 2: protobuf.Field("proxy", "uint64", repeated=False, required=True), 3: protobuf.Field("producers", "uint64", repeated=True, required=False), } def __init__( self, *, + voter: "int", + proxy: "int", producers: Optional[Sequence["int"]] = None, - voter: Optional["int"] = None, - proxy: Optional["int"] = None, ) -> None: self.producers: Sequence["int"] = producers if producers is not None else [] self.voter = voter @@ -4257,19 +4257,19 @@ class EosActionVoteProducer(protobuf.MessageType): class EosActionUpdateAuth(protobuf.MessageType): MESSAGE_WIRE_TYPE = None FIELDS = { - 1: protobuf.Field("account", "uint64", repeated=False, required=False), - 2: protobuf.Field("permission", "uint64", repeated=False, required=False), - 3: protobuf.Field("parent", "uint64", repeated=False, required=False), - 4: protobuf.Field("auth", "EosAuthorization", repeated=False, required=False), + 1: protobuf.Field("account", "uint64", repeated=False, required=True), + 2: protobuf.Field("permission", "uint64", repeated=False, required=True), + 3: protobuf.Field("parent", "uint64", repeated=False, required=True), + 4: protobuf.Field("auth", "EosAuthorization", repeated=False, required=True), } def __init__( self, *, - account: Optional["int"] = None, - permission: Optional["int"] = None, - parent: Optional["int"] = None, - auth: Optional["EosAuthorization"] = None, + account: "int", + permission: "int", + parent: "int", + auth: "EosAuthorization", ) -> None: self.account = account self.permission = permission @@ -4280,15 +4280,15 @@ class EosActionUpdateAuth(protobuf.MessageType): class EosActionDeleteAuth(protobuf.MessageType): MESSAGE_WIRE_TYPE = None FIELDS = { - 1: protobuf.Field("account", "uint64", repeated=False, required=False), - 2: protobuf.Field("permission", "uint64", repeated=False, required=False), + 1: protobuf.Field("account", "uint64", repeated=False, required=True), + 2: protobuf.Field("permission", "uint64", repeated=False, required=True), } def __init__( self, *, - account: Optional["int"] = None, - permission: Optional["int"] = None, + account: "int", + permission: "int", ) -> None: self.account = account self.permission = permission @@ -4297,19 +4297,19 @@ class EosActionDeleteAuth(protobuf.MessageType): class EosActionLinkAuth(protobuf.MessageType): MESSAGE_WIRE_TYPE = None FIELDS = { - 1: protobuf.Field("account", "uint64", repeated=False, required=False), - 2: protobuf.Field("code", "uint64", repeated=False, required=False), - 3: protobuf.Field("type", "uint64", repeated=False, required=False), - 4: protobuf.Field("requirement", "uint64", repeated=False, required=False), + 1: protobuf.Field("account", "uint64", repeated=False, required=True), + 2: protobuf.Field("code", "uint64", repeated=False, required=True), + 3: protobuf.Field("type", "uint64", repeated=False, required=True), + 4: protobuf.Field("requirement", "uint64", repeated=False, required=True), } def __init__( self, *, - account: Optional["int"] = None, - code: Optional["int"] = None, - type: Optional["int"] = None, - requirement: Optional["int"] = None, + account: "int", + code: "int", + type: "int", + requirement: "int", ) -> None: self.account = account self.code = code @@ -4320,17 +4320,17 @@ class EosActionLinkAuth(protobuf.MessageType): class EosActionUnlinkAuth(protobuf.MessageType): MESSAGE_WIRE_TYPE = None FIELDS = { - 1: protobuf.Field("account", "uint64", repeated=False, required=False), - 2: protobuf.Field("code", "uint64", repeated=False, required=False), - 3: protobuf.Field("type", "uint64", repeated=False, required=False), + 1: protobuf.Field("account", "uint64", repeated=False, required=True), + 2: protobuf.Field("code", "uint64", repeated=False, required=True), + 3: protobuf.Field("type", "uint64", repeated=False, required=True), } def __init__( self, *, - account: Optional["int"] = None, - code: Optional["int"] = None, - type: Optional["int"] = None, + account: "int", + code: "int", + type: "int", ) -> None: self.account = account self.code = code @@ -4340,19 +4340,19 @@ class EosActionUnlinkAuth(protobuf.MessageType): class EosActionNewAccount(protobuf.MessageType): MESSAGE_WIRE_TYPE = None FIELDS = { - 1: protobuf.Field("creator", "uint64", repeated=False, required=False), - 2: protobuf.Field("name", "uint64", repeated=False, required=False), - 3: protobuf.Field("owner", "EosAuthorization", repeated=False, required=False), - 4: protobuf.Field("active", "EosAuthorization", repeated=False, required=False), + 1: protobuf.Field("creator", "uint64", repeated=False, required=True), + 2: protobuf.Field("name", "uint64", repeated=False, required=True), + 3: protobuf.Field("owner", "EosAuthorization", repeated=False, required=True), + 4: protobuf.Field("active", "EosAuthorization", repeated=False, required=True), } def __init__( self, *, - creator: Optional["int"] = None, - name: Optional["int"] = None, - owner: Optional["EosAuthorization"] = None, - active: Optional["EosAuthorization"] = None, + creator: "int", + name: "int", + owner: "EosAuthorization", + active: "EosAuthorization", ) -> None: self.creator = creator self.name = name @@ -4364,14 +4364,14 @@ class EosActionUnknown(protobuf.MessageType): MESSAGE_WIRE_TYPE = None FIELDS = { 1: protobuf.Field("data_size", "uint32", repeated=False, required=True), - 2: protobuf.Field("data_chunk", "bytes", repeated=False, required=False), + 2: protobuf.Field("data_chunk", "bytes", repeated=False, required=True), } def __init__( self, *, data_size: "int", - data_chunk: Optional["bytes"] = None, + data_chunk: "bytes", ) -> None: self.data_size = data_size self.data_chunk = data_chunk @@ -5773,7 +5773,7 @@ class NEMGetAddress(protobuf.MessageType): self, *, address_n: Optional[Sequence["int"]] = None, - network: Optional["int"] = None, + network: Optional["int"] = 104, show_display: Optional["bool"] = None, ) -> None: self.address_n: Sequence["int"] = address_n if address_n is not None else [] @@ -5798,7 +5798,7 @@ class NEMAddress(protobuf.MessageType): class NEMSignTx(protobuf.MessageType): MESSAGE_WIRE_TYPE = 69 FIELDS = { - 1: protobuf.Field("transaction", "NEMTransactionCommon", repeated=False, required=False), + 1: protobuf.Field("transaction", "NEMTransactionCommon", repeated=False, required=True), 2: protobuf.Field("multisig", "NEMTransactionCommon", repeated=False, required=False), 3: protobuf.Field("transfer", "NEMTransfer", repeated=False, required=False), 4: protobuf.Field("cosigning", "bool", repeated=False, required=False), @@ -5812,7 +5812,7 @@ class NEMSignTx(protobuf.MessageType): def __init__( self, *, - transaction: Optional["NEMTransactionCommon"] = None, + transaction: "NEMTransactionCommon", multisig: Optional["NEMTransactionCommon"] = None, transfer: Optional["NEMTransfer"] = None, cosigning: Optional["bool"] = None, @@ -5892,35 +5892,35 @@ class NEMTransactionCommon(protobuf.MessageType): FIELDS = { 1: protobuf.Field("address_n", "uint32", repeated=True, required=False), 2: protobuf.Field("network", "uint32", repeated=False, required=False), - 3: protobuf.Field("timestamp", "uint32", repeated=False, required=False), - 4: protobuf.Field("fee", "uint64", repeated=False, required=False), - 5: protobuf.Field("deadline", "uint32", repeated=False, required=False), + 3: protobuf.Field("timestamp", "uint32", repeated=False, required=True), + 4: protobuf.Field("fee", "uint64", repeated=False, required=True), + 5: protobuf.Field("deadline", "uint32", repeated=False, required=True), 6: protobuf.Field("signer", "bytes", repeated=False, required=False), } def __init__( self, *, + timestamp: "int", + fee: "int", + deadline: "int", address_n: Optional[Sequence["int"]] = None, - network: Optional["int"] = None, - timestamp: Optional["int"] = None, - fee: Optional["int"] = None, - deadline: Optional["int"] = None, + network: Optional["int"] = 104, signer: Optional["bytes"] = None, ) -> None: self.address_n: Sequence["int"] = address_n if address_n is not None else [] - self.network = network self.timestamp = timestamp self.fee = fee self.deadline = deadline + self.network = network self.signer = signer class NEMTransfer(protobuf.MessageType): MESSAGE_WIRE_TYPE = None FIELDS = { - 1: protobuf.Field("recipient", "string", repeated=False, required=False), - 2: protobuf.Field("amount", "uint64", repeated=False, required=False), + 1: protobuf.Field("recipient", "string", repeated=False, required=True), + 2: protobuf.Field("amount", "uint64", repeated=False, required=True), 3: protobuf.Field("payload", "bytes", repeated=False, required=False), 4: protobuf.Field("public_key", "bytes", repeated=False, required=False), 5: protobuf.Field("mosaics", "NEMMosaic", repeated=True, required=False), @@ -5929,10 +5929,10 @@ class NEMTransfer(protobuf.MessageType): def __init__( self, *, + recipient: "str", + amount: "int", mosaics: Optional[Sequence["NEMMosaic"]] = None, - recipient: Optional["str"] = None, - amount: Optional["int"] = None, - payload: Optional["bytes"] = None, + payload: Optional["bytes"] = b'', public_key: Optional["bytes"] = None, ) -> None: self.mosaics: Sequence["NEMMosaic"] = mosaics if mosaics is not None else [] @@ -5945,40 +5945,40 @@ class NEMTransfer(protobuf.MessageType): class NEMProvisionNamespace(protobuf.MessageType): MESSAGE_WIRE_TYPE = None FIELDS = { - 1: protobuf.Field("namespace", "string", repeated=False, required=False), + 1: protobuf.Field("namespace", "string", repeated=False, required=True), 2: protobuf.Field("parent", "string", repeated=False, required=False), - 3: protobuf.Field("sink", "string", repeated=False, required=False), - 4: protobuf.Field("fee", "uint64", repeated=False, required=False), + 3: protobuf.Field("sink", "string", repeated=False, required=True), + 4: protobuf.Field("fee", "uint64", repeated=False, required=True), } def __init__( self, *, - namespace: Optional["str"] = None, + namespace: "str", + sink: "str", + fee: "int", parent: Optional["str"] = None, - sink: Optional["str"] = None, - fee: Optional["int"] = None, ) -> None: self.namespace = namespace - self.parent = parent self.sink = sink self.fee = fee + self.parent = parent class NEMMosaicCreation(protobuf.MessageType): MESSAGE_WIRE_TYPE = None FIELDS = { - 1: protobuf.Field("definition", "NEMMosaicDefinition", repeated=False, required=False), - 2: protobuf.Field("sink", "string", repeated=False, required=False), - 3: protobuf.Field("fee", "uint64", repeated=False, required=False), + 1: protobuf.Field("definition", "NEMMosaicDefinition", repeated=False, required=True), + 2: protobuf.Field("sink", "string", repeated=False, required=True), + 3: protobuf.Field("fee", "uint64", repeated=False, required=True), } def __init__( self, *, - definition: Optional["NEMMosaicDefinition"] = None, - sink: Optional["str"] = None, - fee: Optional["int"] = None, + definition: "NEMMosaicDefinition", + sink: "str", + fee: "int", ) -> None: self.definition = definition self.sink = sink @@ -5988,19 +5988,19 @@ class NEMMosaicCreation(protobuf.MessageType): class NEMMosaicSupplyChange(protobuf.MessageType): MESSAGE_WIRE_TYPE = None FIELDS = { - 1: protobuf.Field("namespace", "string", repeated=False, required=False), - 2: protobuf.Field("mosaic", "string", repeated=False, required=False), - 3: protobuf.Field("type", "NEMSupplyChangeType", repeated=False, required=False), - 4: protobuf.Field("delta", "uint64", repeated=False, required=False), + 1: protobuf.Field("namespace", "string", repeated=False, required=True), + 2: protobuf.Field("mosaic", "string", repeated=False, required=True), + 3: protobuf.Field("type", "NEMSupplyChangeType", repeated=False, required=True), + 4: protobuf.Field("delta", "uint64", repeated=False, required=True), } def __init__( self, *, - namespace: Optional["str"] = None, - mosaic: Optional["str"] = None, - type: Optional["NEMSupplyChangeType"] = None, - delta: Optional["int"] = None, + namespace: "str", + mosaic: "str", + type: "NEMSupplyChangeType", + delta: "int", ) -> None: self.namespace = namespace self.mosaic = mosaic @@ -6028,15 +6028,15 @@ class NEMAggregateModification(protobuf.MessageType): class NEMImportanceTransfer(protobuf.MessageType): MESSAGE_WIRE_TYPE = None FIELDS = { - 1: protobuf.Field("mode", "NEMImportanceTransferMode", repeated=False, required=False), - 2: protobuf.Field("public_key", "bytes", repeated=False, required=False), + 1: protobuf.Field("mode", "NEMImportanceTransferMode", repeated=False, required=True), + 2: protobuf.Field("public_key", "bytes", repeated=False, required=True), } def __init__( self, *, - mode: Optional["NEMImportanceTransferMode"] = None, - public_key: Optional["bytes"] = None, + mode: "NEMImportanceTransferMode", + public_key: "bytes", ) -> None: self.mode = mode self.public_key = public_key @@ -6045,17 +6045,17 @@ class NEMImportanceTransfer(protobuf.MessageType): class NEMMosaic(protobuf.MessageType): MESSAGE_WIRE_TYPE = None FIELDS = { - 1: protobuf.Field("namespace", "string", repeated=False, required=False), - 2: protobuf.Field("mosaic", "string", repeated=False, required=False), - 3: protobuf.Field("quantity", "uint64", repeated=False, required=False), + 1: protobuf.Field("namespace", "string", repeated=False, required=True), + 2: protobuf.Field("mosaic", "string", repeated=False, required=True), + 3: protobuf.Field("quantity", "uint64", repeated=False, required=True), } def __init__( self, *, - namespace: Optional["str"] = None, - mosaic: Optional["str"] = None, - quantity: Optional["int"] = None, + namespace: "str", + mosaic: "str", + quantity: "int", ) -> None: self.namespace = namespace self.mosaic = mosaic @@ -6067,8 +6067,8 @@ class NEMMosaicDefinition(protobuf.MessageType): FIELDS = { 1: protobuf.Field("name", "string", repeated=False, required=False), 2: protobuf.Field("ticker", "string", repeated=False, required=False), - 3: protobuf.Field("namespace", "string", repeated=False, required=False), - 4: protobuf.Field("mosaic", "string", repeated=False, required=False), + 3: protobuf.Field("namespace", "string", repeated=False, required=True), + 4: protobuf.Field("mosaic", "string", repeated=False, required=True), 5: protobuf.Field("divisibility", "uint32", repeated=False, required=False), 6: protobuf.Field("levy", "NEMMosaicLevy", repeated=False, required=False), 7: protobuf.Field("fee", "uint64", repeated=False, required=False), @@ -6078,18 +6078,19 @@ class NEMMosaicDefinition(protobuf.MessageType): 11: protobuf.Field("supply", "uint64", repeated=False, required=False), 12: protobuf.Field("mutable_supply", "bool", repeated=False, required=False), 13: protobuf.Field("transferable", "bool", repeated=False, required=False), - 14: protobuf.Field("description", "string", repeated=False, required=False), + 14: protobuf.Field("description", "string", repeated=False, required=True), 15: protobuf.Field("networks", "uint32", repeated=True, required=False), } def __init__( self, *, + namespace: "str", + mosaic: "str", + description: "str", networks: Optional[Sequence["int"]] = None, name: Optional["str"] = None, ticker: Optional["str"] = None, - namespace: Optional["str"] = None, - mosaic: Optional["str"] = None, divisibility: Optional["int"] = None, levy: Optional["NEMMosaicLevy"] = None, fee: Optional["int"] = None, @@ -6099,13 +6100,13 @@ class NEMMosaicDefinition(protobuf.MessageType): supply: Optional["int"] = None, mutable_supply: Optional["bool"] = None, transferable: Optional["bool"] = None, - description: Optional["str"] = None, ) -> None: self.networks: Sequence["int"] = networks if networks is not None else [] - self.name = name - self.ticker = ticker self.namespace = namespace self.mosaic = mosaic + self.description = description + self.name = name + self.ticker = ticker self.divisibility = divisibility self.levy = levy self.fee = fee @@ -6115,21 +6116,20 @@ class NEMMosaicDefinition(protobuf.MessageType): self.supply = supply self.mutable_supply = mutable_supply self.transferable = transferable - self.description = description class NEMCosignatoryModification(protobuf.MessageType): MESSAGE_WIRE_TYPE = None FIELDS = { - 1: protobuf.Field("type", "NEMModificationType", repeated=False, required=False), - 2: protobuf.Field("public_key", "bytes", repeated=False, required=False), + 1: protobuf.Field("type", "NEMModificationType", repeated=False, required=True), + 2: protobuf.Field("public_key", "bytes", repeated=False, required=True), } def __init__( self, *, - type: Optional["NEMModificationType"] = None, - public_key: Optional["bytes"] = None, + type: "NEMModificationType", + public_key: "bytes", ) -> None: self.type = type self.public_key = public_key @@ -6170,29 +6170,29 @@ class RippleSignTx(protobuf.MessageType): MESSAGE_WIRE_TYPE = 402 FIELDS = { 1: protobuf.Field("address_n", "uint32", repeated=True, required=False), - 2: protobuf.Field("fee", "uint64", repeated=False, required=False), + 2: protobuf.Field("fee", "uint64", repeated=False, required=True), 3: protobuf.Field("flags", "uint32", repeated=False, required=False), - 4: protobuf.Field("sequence", "uint32", repeated=False, required=False), + 4: protobuf.Field("sequence", "uint32", repeated=False, required=True), 5: protobuf.Field("last_ledger_sequence", "uint32", repeated=False, required=False), - 6: protobuf.Field("payment", "RipplePayment", repeated=False, required=False), + 6: protobuf.Field("payment", "RipplePayment", repeated=False, required=True), } def __init__( self, *, + fee: "int", + sequence: "int", + payment: "RipplePayment", address_n: Optional[Sequence["int"]] = None, - fee: Optional["int"] = None, - flags: Optional["int"] = None, - sequence: Optional["int"] = None, + flags: Optional["int"] = 0, last_ledger_sequence: Optional["int"] = None, - payment: Optional["RipplePayment"] = None, ) -> None: self.address_n: Sequence["int"] = address_n if address_n is not None else [] self.fee = fee - self.flags = flags self.sequence = sequence - self.last_ledger_sequence = last_ledger_sequence self.payment = payment + self.flags = flags + self.last_ledger_sequence = last_ledger_sequence class RippleSignedTx(protobuf.MessageType): @@ -6975,17 +6975,17 @@ class TezosDelegationOp(protobuf.MessageType): class TezosProposalOp(protobuf.MessageType): MESSAGE_WIRE_TYPE = None FIELDS = { - 1: protobuf.Field("source", "bytes", repeated=False, required=False), - 2: protobuf.Field("period", "uint64", repeated=False, required=False), + 1: protobuf.Field("source", "bytes", repeated=False, required=True), + 2: protobuf.Field("period", "uint64", repeated=False, required=True), 4: protobuf.Field("proposals", "bytes", repeated=True, required=False), } def __init__( self, *, + source: "bytes", + period: "int", proposals: Optional[Sequence["bytes"]] = None, - source: Optional["bytes"] = None, - period: Optional["int"] = None, ) -> None: self.proposals: Sequence["bytes"] = proposals if proposals is not None else [] self.source = source @@ -6995,19 +6995,19 @@ class TezosProposalOp(protobuf.MessageType): class TezosBallotOp(protobuf.MessageType): MESSAGE_WIRE_TYPE = None FIELDS = { - 1: protobuf.Field("source", "bytes", repeated=False, required=False), - 2: protobuf.Field("period", "uint64", repeated=False, required=False), - 3: protobuf.Field("proposal", "bytes", repeated=False, required=False), - 4: protobuf.Field("ballot", "TezosBallotType", repeated=False, required=False), + 1: protobuf.Field("source", "bytes", repeated=False, required=True), + 2: protobuf.Field("period", "uint64", repeated=False, required=True), + 3: protobuf.Field("proposal", "bytes", repeated=False, required=True), + 4: protobuf.Field("ballot", "TezosBallotType", repeated=False, required=True), } def __init__( self, *, - source: Optional["bytes"] = None, - period: Optional["int"] = None, - proposal: Optional["bytes"] = None, - ballot: Optional["TezosBallotType"] = None, + source: "bytes", + period: "int", + proposal: "bytes", + ballot: "TezosBallotType", ) -> None: self.source = source self.period = period @@ -7038,15 +7038,15 @@ class TezosParametersManager(protobuf.MessageType): class TezosManagerTransfer(protobuf.MessageType): MESSAGE_WIRE_TYPE = None FIELDS = { - 1: protobuf.Field("destination", "TezosContractID", repeated=False, required=False), - 2: protobuf.Field("amount", "uint64", repeated=False, required=False), + 1: protobuf.Field("destination", "TezosContractID", repeated=False, required=True), + 2: protobuf.Field("amount", "uint64", repeated=False, required=True), } def __init__( self, *, - destination: Optional["TezosContractID"] = None, - amount: Optional["int"] = None, + destination: "TezosContractID", + amount: "int", ) -> None: self.destination = destination self.amount = amount diff --git a/python/src/trezorlib/nem.py b/python/src/trezorlib/nem.py index 63442066a..4d3e06261 100644 --- a/python/src/trezorlib/nem.py +++ b/python/src/trezorlib/nem.py @@ -36,11 +36,12 @@ TYPE_MOSAIC_SUPPLY_CHANGE = 0x4002 def create_transaction_common(transaction: dict) -> messages.NEMTransactionCommon: - msg = messages.NEMTransactionCommon() - msg.network = (transaction["version"] >> 24) & 0xFF - msg.timestamp = transaction["timeStamp"] - msg.fee = transaction["fee"] - msg.deadline = transaction["deadline"] + msg = messages.NEMTransactionCommon( + network=(transaction["version"] >> 24) & 0xFF, + timestamp=transaction["timeStamp"], + fee=transaction["fee"], + deadline=transaction["deadline"], + ) if "signer" in transaction: msg.signer = bytes.fromhex(transaction["signer"]) @@ -49,9 +50,9 @@ def create_transaction_common(transaction: dict) -> messages.NEMTransactionCommo def create_transfer(transaction: dict) -> messages.NEMTransfer: - msg = messages.NEMTransfer() - msg.recipient = transaction["recipient"] - msg.amount = transaction["amount"] + msg = messages.NEMTransfer( + recipient=transaction["recipient"], amount=transaction["amount"] + ) if "payload" in transaction["message"]: msg.payload = bytes.fromhex(transaction["message"]["payload"]) @@ -75,14 +76,15 @@ def create_transfer(transaction: dict) -> messages.NEMTransfer: def create_aggregate_modification( transaction: dict, ) -> messages.NEMAggregateModification: - msg = messages.NEMAggregateModification() - msg.modifications = [ - messages.NEMCosignatoryModification( - type=modification["modificationType"], - public_key=bytes.fromhex(modification["cosignatoryAccount"]), - ) - for modification in transaction["modifications"] - ] + msg = messages.NEMAggregateModification( + modifications=[ + messages.NEMCosignatoryModification( + type=modification["modificationType"], + public_key=bytes.fromhex(modification["cosignatoryAccount"]), + ) + for modification in transaction["modifications"] + ] + ) if "minCosignatories" in transaction: msg.relative_change = transaction["minCosignatories"]["relativeChange"] @@ -91,65 +93,68 @@ def create_aggregate_modification( def create_provision_namespace(transaction: dict) -> messages.NEMProvisionNamespace: - msg = messages.NEMProvisionNamespace() - msg.namespace = transaction["newPart"] + msg = messages.NEMProvisionNamespace( + sink=transaction["rentalFeeSink"], + fee=transaction["rentalFee"], + namespace=transaction["newPart"], + ) if transaction["parent"]: msg.parent = transaction["parent"] - msg.sink = transaction["rentalFeeSink"] - msg.fee = transaction["rentalFee"] return msg def create_mosaic_creation(transaction: dict) -> messages.NEMMosaicCreation: - definition = transaction["mosaicDefinition"] - msg = messages.NEMMosaicCreation() - msg.definition = messages.NEMMosaicDefinition() - msg.definition.namespace = definition["id"]["namespaceId"] - msg.definition.mosaic = definition["id"]["name"] + definition_dict = transaction["mosaicDefinition"] - if definition["levy"]: - msg.definition.levy = definition["levy"]["type"] - msg.definition.fee = definition["levy"]["fee"] - msg.definition.levy_address = definition["levy"]["recipient"] - msg.definition.levy_namespace = definition["levy"]["mosaicId"]["namespaceId"] - msg.definition.levy_mosaic = definition["levy"]["mosaicId"]["name"] + definition = messages.NEMMosaicDefinition( + namespace=definition_dict["id"]["namespaceId"], + mosaic=definition_dict["id"]["name"], + description=definition_dict["description"], + ) - msg.definition.description = definition["description"] + if definition_dict["levy"]: + definition.levy = definition_dict["levy"]["type"] + definition.fee = definition_dict["levy"]["fee"] + definition.levy_address = definition_dict["levy"]["recipient"] + definition.levy_namespace = definition_dict["levy"]["mosaicId"]["namespaceId"] + definition.levy_mosaic = definition_dict["levy"]["mosaicId"]["name"] - for property in definition["properties"]: + for property in definition_dict["properties"]: name = property["name"] value = json.loads(property["value"]) if name == "divisibility": - msg.definition.divisibility = value + definition.divisibility = value elif name == "initialSupply": - msg.definition.supply = value + definition.supply = value elif name == "supplyMutable": - msg.definition.mutable_supply = value + definition.mutable_supply = value elif name == "transferable": - msg.definition.transferable = value + definition.transferable = value - msg.sink = transaction["creationFeeSink"] - msg.fee = transaction["creationFee"] - return msg + return messages.NEMMosaicCreation( + definition=definition, + sink=transaction["creationFeeSink"], + fee=transaction["creationFee"], + ) def create_supply_change(transaction: dict) -> messages.NEMMosaicSupplyChange: - msg = messages.NEMMosaicSupplyChange() - msg.namespace = transaction["mosaicId"]["namespaceId"] - msg.mosaic = transaction["mosaicId"]["name"] - msg.type = transaction["supplyType"] - msg.delta = transaction["delta"] - return msg + return messages.NEMMosaicSupplyChange( + namespace=transaction["mosaicId"]["namespaceId"], + mosaic=transaction["mosaicId"]["name"], + type=transaction["supplyType"], + delta=transaction["delta"], + ) def create_importance_transfer(transaction: dict) -> messages.NEMImportanceTransfer: - msg = messages.NEMImportanceTransfer() - msg.mode = transaction["importanceTransfer"]["mode"] - msg.public_key = bytes.fromhex(transaction["importanceTransfer"]["publicKey"]) - return msg + return messages.NEMImportanceTransfer( + mode=transaction["importanceTransfer"]["mode"], + public_key=bytes.fromhex(transaction["importanceTransfer"]["publicKey"]), + ) def fill_transaction_by_type(msg: messages.NEMSignTx, transaction: dict) -> None: @@ -170,9 +175,10 @@ def fill_transaction_by_type(msg: messages.NEMSignTx, transaction: dict) -> None def create_sign_tx(transaction: dict) -> messages.NEMSignTx: - msg = messages.NEMSignTx() - msg.transaction = create_transaction_common(transaction) - msg.cosigning = transaction["type"] == TYPE_MULTISIG_SIGNATURE + msg = messages.NEMSignTx( + transaction=create_transaction_common(transaction), + cosigning=transaction["type"] == TYPE_MULTISIG_SIGNATURE, + ) if transaction["type"] in (TYPE_MULTISIG_SIGNATURE, TYPE_MULTISIG): other_trans = transaction["otherTrans"]