1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-01-03 03:50:58 +00:00

style(python): fix typecheck issues

[no changelog]
This commit is contained in:
matejcik 2022-01-05 13:58:28 +01:00 committed by matejcik
parent 228c4db646
commit dfab3efb86
6 changed files with 304 additions and 294 deletions

View File

@ -49,9 +49,10 @@ def sign_tx(
client: "TrezorClient", address_n: "Address", tx_json: dict client: "TrezorClient", address_n: "Address", tx_json: dict
) -> messages.BinanceSignedTx: ) -> messages.BinanceSignedTx:
msg = tx_json["msgs"][0] msg = tx_json["msgs"][0]
envelope = dict_to_proto(messages.BinanceSignTx, tx_json) tx_msg = tx_json.copy()
envelope.msg_count = 1 tx_msg["msg_count"] = 1
envelope.address_n = address_n tx_msg["address_n"] = address_n
envelope = dict_to_proto(messages.BinanceSignTx, tx_msg)
response = client.call(envelope) response = client.call(envelope)

View File

@ -133,4 +133,6 @@ def with_client(func: "Callable[Concatenate[TrezorClient, P], R]") -> "Callable[
except Exception: except Exception:
pass 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

View File

@ -283,6 +283,8 @@ def find_best_firmware_version(
if closest_version > want_version: if closest_version > want_version:
# stop at first that is higher than the requested # stop at first that is higher than the requested
break break
else:
raise click.ClickException("No versions were found!")
# if there was no break, the newest is used # if there was no break, the newest is used
click.echo(f"Closest available version: {version_str(closest_version)}") click.echo(f"Closest available version: {version_str(closest_version)}")
if not beta and want_version > highest_version: if not beta and want_version > highest_version:

View File

@ -258,11 +258,9 @@ def parse_unknown(data: str) -> messages.EosActionUnknown:
def parse_action(action: dict) -> messages.EosTxActionAck: def parse_action(action: dict) -> messages.EosTxActionAck:
tx_action = messages.EosTxActionAck() tx_action = messages.EosTxActionAck(common=parse_common(action))
data = action["data"] data = action["data"]
tx_action.common = parse_common(action)
if action["account"] == "eosio": if action["account"] == "eosio":
if action["name"] == "voteproducer": if action["name"] == "voteproducer":
tx_action.vote_producer = parse_vote_producer(data) tx_action.vote_producer = parse_vote_producer(data)
@ -337,11 +335,12 @@ def sign_tx(
) -> messages.EosSignedTx: ) -> messages.EosSignedTx:
header, actions = parse_transaction_json(transaction) header, actions = parse_transaction_json(transaction)
msg = messages.EosSignTx() msg = messages.EosSignTx(
msg.address_n = address address_n=address,
msg.chain_id = bytes.fromhex(chain_id) chain_id=bytes.fromhex(chain_id),
msg.header = header header=header,
msg.num_actions = len(actions) num_actions=len(actions),
)
response = client.call(msg) response = client.call(msg)

View File

@ -590,32 +590,32 @@ class BinanceSignTx(protobuf.MessageType):
MESSAGE_WIRE_TYPE = 704 MESSAGE_WIRE_TYPE = 704
FIELDS = { FIELDS = {
1: protobuf.Field("address_n", "uint32", repeated=True, required=False), 1: protobuf.Field("address_n", "uint32", repeated=True, required=False),
2: protobuf.Field("msg_count", "uint32", repeated=False, required=False), 2: protobuf.Field("msg_count", "uint32", repeated=False, required=True),
3: protobuf.Field("account_number", "sint64", repeated=False, required=False), 3: protobuf.Field("account_number", "sint64", repeated=False, required=True),
4: protobuf.Field("chain_id", "string", repeated=False, required=False), 4: protobuf.Field("chain_id", "string", repeated=False, required=False),
5: protobuf.Field("memo", "string", repeated=False, required=False), 5: protobuf.Field("memo", "string", repeated=False, required=False),
6: protobuf.Field("sequence", "sint64", repeated=False, required=False), 6: protobuf.Field("sequence", "sint64", repeated=False, required=True),
7: protobuf.Field("source", "sint64", repeated=False, required=False), 7: protobuf.Field("source", "sint64", repeated=False, required=True),
} }
def __init__( def __init__(
self, self,
*, *,
msg_count: "int",
account_number: "int",
sequence: "int",
source: "int",
address_n: Optional[Sequence["int"]] = None, address_n: Optional[Sequence["int"]] = None,
msg_count: Optional["int"] = None,
account_number: Optional["int"] = None,
chain_id: Optional["str"] = None, chain_id: Optional["str"] = None,
memo: Optional["str"] = None, memo: Optional["str"] = None,
sequence: Optional["int"] = None,
source: Optional["int"] = None,
) -> None: ) -> None:
self.address_n: Sequence["int"] = address_n if address_n is not None else [] self.address_n: Sequence["int"] = address_n if address_n is not None else []
self.msg_count = msg_count self.msg_count = msg_count
self.account_number = account_number self.account_number = account_number
self.chain_id = chain_id
self.memo = memo
self.sequence = sequence self.sequence = sequence
self.source = source self.source = source
self.chain_id = chain_id
self.memo = memo
class BinanceTxRequest(protobuf.MessageType): class BinanceTxRequest(protobuf.MessageType):
@ -643,35 +643,35 @@ class BinanceOrderMsg(protobuf.MessageType):
MESSAGE_WIRE_TYPE = 707 MESSAGE_WIRE_TYPE = 707
FIELDS = { FIELDS = {
1: protobuf.Field("id", "string", repeated=False, required=False), 1: protobuf.Field("id", "string", repeated=False, required=False),
2: protobuf.Field("ordertype", "BinanceOrderType", repeated=False, required=False), 2: protobuf.Field("ordertype", "BinanceOrderType", repeated=False, required=True),
3: protobuf.Field("price", "sint64", repeated=False, required=False), 3: protobuf.Field("price", "sint64", repeated=False, required=True),
4: protobuf.Field("quantity", "sint64", repeated=False, required=False), 4: protobuf.Field("quantity", "sint64", repeated=False, required=True),
5: protobuf.Field("sender", "string", repeated=False, required=False), 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), 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__( def __init__(
self, self,
*, *,
ordertype: "BinanceOrderType",
price: "int",
quantity: "int",
side: "BinanceOrderSide",
timeinforce: "BinanceTimeInForce",
id: Optional["str"] = None, id: Optional["str"] = None,
ordertype: Optional["BinanceOrderType"] = None,
price: Optional["int"] = None,
quantity: Optional["int"] = None,
sender: Optional["str"] = None, sender: Optional["str"] = None,
side: Optional["BinanceOrderSide"] = None,
symbol: Optional["str"] = None, symbol: Optional["str"] = None,
timeinforce: Optional["BinanceTimeInForce"] = None,
) -> None: ) -> None:
self.id = id
self.ordertype = ordertype self.ordertype = ordertype
self.price = price self.price = price
self.quantity = quantity self.quantity = quantity
self.sender = sender
self.side = side self.side = side
self.symbol = symbol
self.timeinforce = timeinforce self.timeinforce = timeinforce
self.id = id
self.sender = sender
self.symbol = symbol
class BinanceCancelMsg(protobuf.MessageType): class BinanceCancelMsg(protobuf.MessageType):
@ -714,15 +714,15 @@ class BinanceSignedTx(protobuf.MessageType):
class BinanceInputOutput(protobuf.MessageType): class BinanceInputOutput(protobuf.MessageType):
MESSAGE_WIRE_TYPE = None MESSAGE_WIRE_TYPE = None
FIELDS = { 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), 2: protobuf.Field("coins", "BinanceCoin", repeated=True, required=False),
} }
def __init__( def __init__(
self, self,
*, *,
address: "str",
coins: Optional[Sequence["BinanceCoin"]] = None, coins: Optional[Sequence["BinanceCoin"]] = None,
address: Optional["str"] = None,
) -> None: ) -> None:
self.coins: Sequence["BinanceCoin"] = coins if coins is not None else [] self.coins: Sequence["BinanceCoin"] = coins if coins is not None else []
self.address = address self.address = address
@ -731,15 +731,15 @@ class BinanceInputOutput(protobuf.MessageType):
class BinanceCoin(protobuf.MessageType): class BinanceCoin(protobuf.MessageType):
MESSAGE_WIRE_TYPE = None MESSAGE_WIRE_TYPE = None
FIELDS = { FIELDS = {
1: protobuf.Field("amount", "sint64", repeated=False, required=False), 1: protobuf.Field("amount", "sint64", repeated=False, required=True),
2: protobuf.Field("denom", "string", repeated=False, required=False), 2: protobuf.Field("denom", "string", repeated=False, required=True),
} }
def __init__( def __init__(
self, self,
*, *,
amount: Optional["int"] = None, amount: "int",
denom: Optional["str"] = None, denom: "str",
) -> None: ) -> None:
self.amount = amount self.amount = amount
self.denom = denom self.denom = denom
@ -3825,18 +3825,18 @@ class EosSignTx(protobuf.MessageType):
MESSAGE_WIRE_TYPE = 602 MESSAGE_WIRE_TYPE = 602
FIELDS = { FIELDS = {
1: protobuf.Field("address_n", "uint32", repeated=True, required=False), 1: protobuf.Field("address_n", "uint32", repeated=True, required=False),
2: protobuf.Field("chain_id", "bytes", repeated=False, required=False), 2: protobuf.Field("chain_id", "bytes", repeated=False, required=True),
3: protobuf.Field("header", "EosTxHeader", repeated=False, required=False), 3: protobuf.Field("header", "EosTxHeader", repeated=False, required=True),
4: protobuf.Field("num_actions", "uint32", repeated=False, required=False), 4: protobuf.Field("num_actions", "uint32", repeated=False, required=True),
} }
def __init__( def __init__(
self, self,
*, *,
chain_id: "bytes",
header: "EosTxHeader",
num_actions: "int",
address_n: Optional[Sequence["int"]] = None, address_n: Optional[Sequence["int"]] = None,
chain_id: Optional["bytes"] = None,
header: Optional["EosTxHeader"] = None,
num_actions: Optional["int"] = None,
) -> None: ) -> None:
self.address_n: Sequence["int"] = address_n if address_n is not None else [] self.address_n: Sequence["int"] = address_n if address_n is not None else []
self.chain_id = chain_id self.chain_id = chain_id
@ -3861,7 +3861,7 @@ class EosTxActionRequest(protobuf.MessageType):
class EosTxActionAck(protobuf.MessageType): class EosTxActionAck(protobuf.MessageType):
MESSAGE_WIRE_TYPE = 604 MESSAGE_WIRE_TYPE = 604
FIELDS = { 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), 2: protobuf.Field("transfer", "EosActionTransfer", repeated=False, required=False),
3: protobuf.Field("delegate", "EosActionDelegate", repeated=False, required=False), 3: protobuf.Field("delegate", "EosActionDelegate", repeated=False, required=False),
4: protobuf.Field("undelegate", "EosActionUndelegate", repeated=False, required=False), 4: protobuf.Field("undelegate", "EosActionUndelegate", repeated=False, required=False),
@ -3881,7 +3881,7 @@ class EosTxActionAck(protobuf.MessageType):
def __init__( def __init__(
self, self,
*, *,
common: Optional["EosActionCommon"] = None, common: "EosActionCommon",
transfer: Optional["EosActionTransfer"] = None, transfer: Optional["EosActionTransfer"] = None,
delegate: Optional["EosActionDelegate"] = None, delegate: Optional["EosActionDelegate"] = None,
undelegate: Optional["EosActionUndelegate"] = None, undelegate: Optional["EosActionUndelegate"] = None,
@ -3960,15 +3960,15 @@ class EosTxHeader(protobuf.MessageType):
class EosAsset(protobuf.MessageType): class EosAsset(protobuf.MessageType):
MESSAGE_WIRE_TYPE = None MESSAGE_WIRE_TYPE = None
FIELDS = { FIELDS = {
1: protobuf.Field("amount", "sint64", repeated=False, required=False), 1: protobuf.Field("amount", "sint64", repeated=False, required=True),
2: protobuf.Field("symbol", "uint64", repeated=False, required=False), 2: protobuf.Field("symbol", "uint64", repeated=False, required=True),
} }
def __init__( def __init__(
self, self,
*, *,
amount: Optional["int"] = None, amount: "int",
symbol: Optional["int"] = None, symbol: "int",
) -> None: ) -> None:
self.amount = amount self.amount = amount
self.symbol = symbol self.symbol = symbol
@ -3977,15 +3977,15 @@ class EosAsset(protobuf.MessageType):
class EosPermissionLevel(protobuf.MessageType): class EosPermissionLevel(protobuf.MessageType):
MESSAGE_WIRE_TYPE = None MESSAGE_WIRE_TYPE = None
FIELDS = { FIELDS = {
1: protobuf.Field("actor", "uint64", repeated=False, required=False), 1: protobuf.Field("actor", "uint64", repeated=False, required=True),
2: protobuf.Field("permission", "uint64", repeated=False, required=False), 2: protobuf.Field("permission", "uint64", repeated=False, required=True),
} }
def __init__( def __init__(
self, self,
*, *,
actor: Optional["int"] = None, actor: "int",
permission: Optional["int"] = None, permission: "int",
) -> None: ) -> None:
self.actor = actor self.actor = actor
self.permission = permission self.permission = permission
@ -4017,15 +4017,15 @@ class EosAuthorizationKey(protobuf.MessageType):
class EosAuthorizationAccount(protobuf.MessageType): class EosAuthorizationAccount(protobuf.MessageType):
MESSAGE_WIRE_TYPE = None MESSAGE_WIRE_TYPE = None
FIELDS = { FIELDS = {
1: protobuf.Field("account", "EosPermissionLevel", repeated=False, required=False), 1: protobuf.Field("account", "EosPermissionLevel", repeated=False, required=True),
2: protobuf.Field("weight", "uint32", repeated=False, required=False), 2: protobuf.Field("weight", "uint32", repeated=False, required=True),
} }
def __init__( def __init__(
self, self,
*, *,
account: Optional["EosPermissionLevel"] = None, account: "EosPermissionLevel",
weight: Optional["int"] = None, weight: "int",
) -> None: ) -> None:
self.account = account self.account = account
self.weight = weight self.weight = weight
@ -4034,15 +4034,15 @@ class EosAuthorizationAccount(protobuf.MessageType):
class EosAuthorizationWait(protobuf.MessageType): class EosAuthorizationWait(protobuf.MessageType):
MESSAGE_WIRE_TYPE = None MESSAGE_WIRE_TYPE = None
FIELDS = { FIELDS = {
1: protobuf.Field("wait_sec", "uint32", repeated=False, required=False), 1: protobuf.Field("wait_sec", "uint32", repeated=False, required=True),
2: protobuf.Field("weight", "uint32", repeated=False, required=False), 2: protobuf.Field("weight", "uint32", repeated=False, required=True),
} }
def __init__( def __init__(
self, self,
*, *,
wait_sec: Optional["int"] = None, wait_sec: "int",
weight: Optional["int"] = None, weight: "int",
) -> None: ) -> None:
self.wait_sec = wait_sec self.wait_sec = wait_sec
self.weight = weight self.weight = weight
@ -4051,7 +4051,7 @@ class EosAuthorizationWait(protobuf.MessageType):
class EosAuthorization(protobuf.MessageType): class EosAuthorization(protobuf.MessageType):
MESSAGE_WIRE_TYPE = None MESSAGE_WIRE_TYPE = None
FIELDS = { 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), 2: protobuf.Field("keys", "EosAuthorizationKey", repeated=True, required=False),
3: protobuf.Field("accounts", "EosAuthorizationAccount", repeated=True, required=False), 3: protobuf.Field("accounts", "EosAuthorizationAccount", repeated=True, required=False),
4: protobuf.Field("waits", "EosAuthorizationWait", repeated=True, required=False), 4: protobuf.Field("waits", "EosAuthorizationWait", repeated=True, required=False),
@ -4060,10 +4060,10 @@ class EosAuthorization(protobuf.MessageType):
def __init__( def __init__(
self, self,
*, *,
threshold: "int",
keys: Optional[Sequence["EosAuthorizationKey"]] = None, keys: Optional[Sequence["EosAuthorizationKey"]] = None,
accounts: Optional[Sequence["EosAuthorizationAccount"]] = None, accounts: Optional[Sequence["EosAuthorizationAccount"]] = None,
waits: Optional[Sequence["EosAuthorizationWait"]] = None, waits: Optional[Sequence["EosAuthorizationWait"]] = None,
threshold: Optional["int"] = None,
) -> None: ) -> None:
self.keys: Sequence["EosAuthorizationKey"] = keys if keys is not None else [] self.keys: Sequence["EosAuthorizationKey"] = keys if keys is not None else []
self.accounts: Sequence["EosAuthorizationAccount"] = accounts if accounts 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): class EosActionCommon(protobuf.MessageType):
MESSAGE_WIRE_TYPE = None MESSAGE_WIRE_TYPE = None
FIELDS = { FIELDS = {
1: protobuf.Field("account", "uint64", repeated=False, required=False), 1: protobuf.Field("account", "uint64", repeated=False, required=True),
2: protobuf.Field("name", "uint64", repeated=False, required=False), 2: protobuf.Field("name", "uint64", repeated=False, required=True),
3: protobuf.Field("authorization", "EosPermissionLevel", repeated=True, required=False), 3: protobuf.Field("authorization", "EosPermissionLevel", repeated=True, required=False),
} }
def __init__( def __init__(
self, self,
*, *,
account: "int",
name: "int",
authorization: Optional[Sequence["EosPermissionLevel"]] = None, authorization: Optional[Sequence["EosPermissionLevel"]] = None,
account: Optional["int"] = None,
name: Optional["int"] = None,
) -> None: ) -> None:
self.authorization: Sequence["EosPermissionLevel"] = authorization if authorization is not None else [] self.authorization: Sequence["EosPermissionLevel"] = authorization if authorization is not None else []
self.account = account self.account = account
@ -4094,19 +4094,19 @@ class EosActionCommon(protobuf.MessageType):
class EosActionTransfer(protobuf.MessageType): class EosActionTransfer(protobuf.MessageType):
MESSAGE_WIRE_TYPE = None MESSAGE_WIRE_TYPE = None
FIELDS = { FIELDS = {
1: protobuf.Field("sender", "uint64", repeated=False, required=False), 1: protobuf.Field("sender", "uint64", repeated=False, required=True),
2: protobuf.Field("receiver", "uint64", repeated=False, required=False), 2: protobuf.Field("receiver", "uint64", repeated=False, required=True),
3: protobuf.Field("quantity", "EosAsset", repeated=False, required=False), 3: protobuf.Field("quantity", "EosAsset", repeated=False, required=True),
4: protobuf.Field("memo", "string", repeated=False, required=False), 4: protobuf.Field("memo", "string", repeated=False, required=True),
} }
def __init__( def __init__(
self, self,
*, *,
sender: Optional["int"] = None, sender: "int",
receiver: Optional["int"] = None, receiver: "int",
quantity: Optional["EosAsset"] = None, quantity: "EosAsset",
memo: Optional["str"] = None, memo: "str",
) -> None: ) -> None:
self.sender = sender self.sender = sender
self.receiver = receiver self.receiver = receiver
@ -4117,21 +4117,21 @@ class EosActionTransfer(protobuf.MessageType):
class EosActionDelegate(protobuf.MessageType): class EosActionDelegate(protobuf.MessageType):
MESSAGE_WIRE_TYPE = None MESSAGE_WIRE_TYPE = None
FIELDS = { FIELDS = {
1: protobuf.Field("sender", "uint64", repeated=False, required=False), 1: protobuf.Field("sender", "uint64", repeated=False, required=True),
2: protobuf.Field("receiver", "uint64", repeated=False, required=False), 2: protobuf.Field("receiver", "uint64", repeated=False, required=True),
3: protobuf.Field("net_quantity", "EosAsset", repeated=False, required=False), 3: protobuf.Field("net_quantity", "EosAsset", repeated=False, required=True),
4: protobuf.Field("cpu_quantity", "EosAsset", repeated=False, required=False), 4: protobuf.Field("cpu_quantity", "EosAsset", repeated=False, required=True),
5: protobuf.Field("transfer", "bool", repeated=False, required=False), 5: protobuf.Field("transfer", "bool", repeated=False, required=True),
} }
def __init__( def __init__(
self, self,
*, *,
sender: Optional["int"] = None, sender: "int",
receiver: Optional["int"] = None, receiver: "int",
net_quantity: Optional["EosAsset"] = None, net_quantity: "EosAsset",
cpu_quantity: Optional["EosAsset"] = None, cpu_quantity: "EosAsset",
transfer: Optional["bool"] = None, transfer: "bool",
) -> None: ) -> None:
self.sender = sender self.sender = sender
self.receiver = receiver self.receiver = receiver
@ -4143,19 +4143,19 @@ class EosActionDelegate(protobuf.MessageType):
class EosActionUndelegate(protobuf.MessageType): class EosActionUndelegate(protobuf.MessageType):
MESSAGE_WIRE_TYPE = None MESSAGE_WIRE_TYPE = None
FIELDS = { FIELDS = {
1: protobuf.Field("sender", "uint64", repeated=False, required=False), 1: protobuf.Field("sender", "uint64", repeated=False, required=True),
2: protobuf.Field("receiver", "uint64", repeated=False, required=False), 2: protobuf.Field("receiver", "uint64", repeated=False, required=True),
3: protobuf.Field("net_quantity", "EosAsset", repeated=False, required=False), 3: protobuf.Field("net_quantity", "EosAsset", repeated=False, required=True),
4: protobuf.Field("cpu_quantity", "EosAsset", repeated=False, required=False), 4: protobuf.Field("cpu_quantity", "EosAsset", repeated=False, required=True),
} }
def __init__( def __init__(
self, self,
*, *,
sender: Optional["int"] = None, sender: "int",
receiver: Optional["int"] = None, receiver: "int",
net_quantity: Optional["EosAsset"] = None, net_quantity: "EosAsset",
cpu_quantity: Optional["EosAsset"] = None, cpu_quantity: "EosAsset",
) -> None: ) -> None:
self.sender = sender self.sender = sender
self.receiver = receiver self.receiver = receiver
@ -4166,13 +4166,13 @@ class EosActionUndelegate(protobuf.MessageType):
class EosActionRefund(protobuf.MessageType): class EosActionRefund(protobuf.MessageType):
MESSAGE_WIRE_TYPE = None MESSAGE_WIRE_TYPE = None
FIELDS = { FIELDS = {
1: protobuf.Field("owner", "uint64", repeated=False, required=False), 1: protobuf.Field("owner", "uint64", repeated=False, required=True),
} }
def __init__( def __init__(
self, self,
*, *,
owner: Optional["int"] = None, owner: "int",
) -> None: ) -> None:
self.owner = owner self.owner = owner
@ -4180,17 +4180,17 @@ class EosActionRefund(protobuf.MessageType):
class EosActionBuyRam(protobuf.MessageType): class EosActionBuyRam(protobuf.MessageType):
MESSAGE_WIRE_TYPE = None MESSAGE_WIRE_TYPE = None
FIELDS = { FIELDS = {
1: protobuf.Field("payer", "uint64", repeated=False, required=False), 1: protobuf.Field("payer", "uint64", repeated=False, required=True),
2: protobuf.Field("receiver", "uint64", repeated=False, required=False), 2: protobuf.Field("receiver", "uint64", repeated=False, required=True),
3: protobuf.Field("quantity", "EosAsset", repeated=False, required=False), 3: protobuf.Field("quantity", "EosAsset", repeated=False, required=True),
} }
def __init__( def __init__(
self, self,
*, *,
payer: Optional["int"] = None, payer: "int",
receiver: Optional["int"] = None, receiver: "int",
quantity: Optional["EosAsset"] = None, quantity: "EosAsset",
) -> None: ) -> None:
self.payer = payer self.payer = payer
self.receiver = receiver self.receiver = receiver
@ -4200,17 +4200,17 @@ class EosActionBuyRam(protobuf.MessageType):
class EosActionBuyRamBytes(protobuf.MessageType): class EosActionBuyRamBytes(protobuf.MessageType):
MESSAGE_WIRE_TYPE = None MESSAGE_WIRE_TYPE = None
FIELDS = { FIELDS = {
1: protobuf.Field("payer", "uint64", repeated=False, required=False), 1: protobuf.Field("payer", "uint64", repeated=False, required=True),
2: protobuf.Field("receiver", "uint64", repeated=False, required=False), 2: protobuf.Field("receiver", "uint64", repeated=False, required=True),
3: protobuf.Field("bytes", "uint32", repeated=False, required=False), 3: protobuf.Field("bytes", "uint32", repeated=False, required=True),
} }
def __init__( def __init__(
self, self,
*, *,
payer: Optional["int"] = None, payer: "int",
receiver: Optional["int"] = None, receiver: "int",
bytes: Optional["int"] = None, bytes: "int",
) -> None: ) -> None:
self.payer = payer self.payer = payer
self.receiver = receiver self.receiver = receiver
@ -4220,15 +4220,15 @@ class EosActionBuyRamBytes(protobuf.MessageType):
class EosActionSellRam(protobuf.MessageType): class EosActionSellRam(protobuf.MessageType):
MESSAGE_WIRE_TYPE = None MESSAGE_WIRE_TYPE = None
FIELDS = { FIELDS = {
1: protobuf.Field("account", "uint64", repeated=False, required=False), 1: protobuf.Field("account", "uint64", repeated=False, required=True),
2: protobuf.Field("bytes", "uint64", repeated=False, required=False), 2: protobuf.Field("bytes", "uint64", repeated=False, required=True),
} }
def __init__( def __init__(
self, self,
*, *,
account: Optional["int"] = None, account: "int",
bytes: Optional["int"] = None, bytes: "int",
) -> None: ) -> None:
self.account = account self.account = account
self.bytes = bytes self.bytes = bytes
@ -4237,17 +4237,17 @@ class EosActionSellRam(protobuf.MessageType):
class EosActionVoteProducer(protobuf.MessageType): class EosActionVoteProducer(protobuf.MessageType):
MESSAGE_WIRE_TYPE = None MESSAGE_WIRE_TYPE = None
FIELDS = { FIELDS = {
1: protobuf.Field("voter", "uint64", repeated=False, required=False), 1: protobuf.Field("voter", "uint64", repeated=False, required=True),
2: protobuf.Field("proxy", "uint64", repeated=False, required=False), 2: protobuf.Field("proxy", "uint64", repeated=False, required=True),
3: protobuf.Field("producers", "uint64", repeated=True, required=False), 3: protobuf.Field("producers", "uint64", repeated=True, required=False),
} }
def __init__( def __init__(
self, self,
*, *,
voter: "int",
proxy: "int",
producers: Optional[Sequence["int"]] = None, producers: Optional[Sequence["int"]] = None,
voter: Optional["int"] = None,
proxy: Optional["int"] = None,
) -> None: ) -> None:
self.producers: Sequence["int"] = producers if producers is not None else [] self.producers: Sequence["int"] = producers if producers is not None else []
self.voter = voter self.voter = voter
@ -4257,19 +4257,19 @@ class EosActionVoteProducer(protobuf.MessageType):
class EosActionUpdateAuth(protobuf.MessageType): class EosActionUpdateAuth(protobuf.MessageType):
MESSAGE_WIRE_TYPE = None MESSAGE_WIRE_TYPE = None
FIELDS = { FIELDS = {
1: protobuf.Field("account", "uint64", repeated=False, required=False), 1: protobuf.Field("account", "uint64", repeated=False, required=True),
2: protobuf.Field("permission", "uint64", repeated=False, required=False), 2: protobuf.Field("permission", "uint64", repeated=False, required=True),
3: protobuf.Field("parent", "uint64", repeated=False, required=False), 3: protobuf.Field("parent", "uint64", repeated=False, required=True),
4: protobuf.Field("auth", "EosAuthorization", repeated=False, required=False), 4: protobuf.Field("auth", "EosAuthorization", repeated=False, required=True),
} }
def __init__( def __init__(
self, self,
*, *,
account: Optional["int"] = None, account: "int",
permission: Optional["int"] = None, permission: "int",
parent: Optional["int"] = None, parent: "int",
auth: Optional["EosAuthorization"] = None, auth: "EosAuthorization",
) -> None: ) -> None:
self.account = account self.account = account
self.permission = permission self.permission = permission
@ -4280,15 +4280,15 @@ class EosActionUpdateAuth(protobuf.MessageType):
class EosActionDeleteAuth(protobuf.MessageType): class EosActionDeleteAuth(protobuf.MessageType):
MESSAGE_WIRE_TYPE = None MESSAGE_WIRE_TYPE = None
FIELDS = { FIELDS = {
1: protobuf.Field("account", "uint64", repeated=False, required=False), 1: protobuf.Field("account", "uint64", repeated=False, required=True),
2: protobuf.Field("permission", "uint64", repeated=False, required=False), 2: protobuf.Field("permission", "uint64", repeated=False, required=True),
} }
def __init__( def __init__(
self, self,
*, *,
account: Optional["int"] = None, account: "int",
permission: Optional["int"] = None, permission: "int",
) -> None: ) -> None:
self.account = account self.account = account
self.permission = permission self.permission = permission
@ -4297,19 +4297,19 @@ class EosActionDeleteAuth(protobuf.MessageType):
class EosActionLinkAuth(protobuf.MessageType): class EosActionLinkAuth(protobuf.MessageType):
MESSAGE_WIRE_TYPE = None MESSAGE_WIRE_TYPE = None
FIELDS = { FIELDS = {
1: protobuf.Field("account", "uint64", repeated=False, required=False), 1: protobuf.Field("account", "uint64", repeated=False, required=True),
2: protobuf.Field("code", "uint64", repeated=False, required=False), 2: protobuf.Field("code", "uint64", repeated=False, required=True),
3: protobuf.Field("type", "uint64", repeated=False, required=False), 3: protobuf.Field("type", "uint64", repeated=False, required=True),
4: protobuf.Field("requirement", "uint64", repeated=False, required=False), 4: protobuf.Field("requirement", "uint64", repeated=False, required=True),
} }
def __init__( def __init__(
self, self,
*, *,
account: Optional["int"] = None, account: "int",
code: Optional["int"] = None, code: "int",
type: Optional["int"] = None, type: "int",
requirement: Optional["int"] = None, requirement: "int",
) -> None: ) -> None:
self.account = account self.account = account
self.code = code self.code = code
@ -4320,17 +4320,17 @@ class EosActionLinkAuth(protobuf.MessageType):
class EosActionUnlinkAuth(protobuf.MessageType): class EosActionUnlinkAuth(protobuf.MessageType):
MESSAGE_WIRE_TYPE = None MESSAGE_WIRE_TYPE = None
FIELDS = { FIELDS = {
1: protobuf.Field("account", "uint64", repeated=False, required=False), 1: protobuf.Field("account", "uint64", repeated=False, required=True),
2: protobuf.Field("code", "uint64", repeated=False, required=False), 2: protobuf.Field("code", "uint64", repeated=False, required=True),
3: protobuf.Field("type", "uint64", repeated=False, required=False), 3: protobuf.Field("type", "uint64", repeated=False, required=True),
} }
def __init__( def __init__(
self, self,
*, *,
account: Optional["int"] = None, account: "int",
code: Optional["int"] = None, code: "int",
type: Optional["int"] = None, type: "int",
) -> None: ) -> None:
self.account = account self.account = account
self.code = code self.code = code
@ -4340,19 +4340,19 @@ class EosActionUnlinkAuth(protobuf.MessageType):
class EosActionNewAccount(protobuf.MessageType): class EosActionNewAccount(protobuf.MessageType):
MESSAGE_WIRE_TYPE = None MESSAGE_WIRE_TYPE = None
FIELDS = { FIELDS = {
1: protobuf.Field("creator", "uint64", repeated=False, required=False), 1: protobuf.Field("creator", "uint64", repeated=False, required=True),
2: protobuf.Field("name", "uint64", repeated=False, required=False), 2: protobuf.Field("name", "uint64", repeated=False, required=True),
3: protobuf.Field("owner", "EosAuthorization", repeated=False, required=False), 3: protobuf.Field("owner", "EosAuthorization", repeated=False, required=True),
4: protobuf.Field("active", "EosAuthorization", repeated=False, required=False), 4: protobuf.Field("active", "EosAuthorization", repeated=False, required=True),
} }
def __init__( def __init__(
self, self,
*, *,
creator: Optional["int"] = None, creator: "int",
name: Optional["int"] = None, name: "int",
owner: Optional["EosAuthorization"] = None, owner: "EosAuthorization",
active: Optional["EosAuthorization"] = None, active: "EosAuthorization",
) -> None: ) -> None:
self.creator = creator self.creator = creator
self.name = name self.name = name
@ -4364,14 +4364,14 @@ class EosActionUnknown(protobuf.MessageType):
MESSAGE_WIRE_TYPE = None MESSAGE_WIRE_TYPE = None
FIELDS = { FIELDS = {
1: protobuf.Field("data_size", "uint32", repeated=False, required=True), 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__( def __init__(
self, self,
*, *,
data_size: "int", data_size: "int",
data_chunk: Optional["bytes"] = None, data_chunk: "bytes",
) -> None: ) -> None:
self.data_size = data_size self.data_size = data_size
self.data_chunk = data_chunk self.data_chunk = data_chunk
@ -5773,7 +5773,7 @@ class NEMGetAddress(protobuf.MessageType):
self, self,
*, *,
address_n: Optional[Sequence["int"]] = None, address_n: Optional[Sequence["int"]] = None,
network: Optional["int"] = None, network: Optional["int"] = 104,
show_display: Optional["bool"] = None, show_display: Optional["bool"] = None,
) -> None: ) -> None:
self.address_n: Sequence["int"] = address_n if address_n is not None else [] 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): class NEMSignTx(protobuf.MessageType):
MESSAGE_WIRE_TYPE = 69 MESSAGE_WIRE_TYPE = 69
FIELDS = { 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), 2: protobuf.Field("multisig", "NEMTransactionCommon", repeated=False, required=False),
3: protobuf.Field("transfer", "NEMTransfer", repeated=False, required=False), 3: protobuf.Field("transfer", "NEMTransfer", repeated=False, required=False),
4: protobuf.Field("cosigning", "bool", repeated=False, required=False), 4: protobuf.Field("cosigning", "bool", repeated=False, required=False),
@ -5812,7 +5812,7 @@ class NEMSignTx(protobuf.MessageType):
def __init__( def __init__(
self, self,
*, *,
transaction: Optional["NEMTransactionCommon"] = None, transaction: "NEMTransactionCommon",
multisig: Optional["NEMTransactionCommon"] = None, multisig: Optional["NEMTransactionCommon"] = None,
transfer: Optional["NEMTransfer"] = None, transfer: Optional["NEMTransfer"] = None,
cosigning: Optional["bool"] = None, cosigning: Optional["bool"] = None,
@ -5892,35 +5892,35 @@ class NEMTransactionCommon(protobuf.MessageType):
FIELDS = { FIELDS = {
1: protobuf.Field("address_n", "uint32", repeated=True, required=False), 1: protobuf.Field("address_n", "uint32", repeated=True, required=False),
2: protobuf.Field("network", "uint32", repeated=False, required=False), 2: protobuf.Field("network", "uint32", repeated=False, required=False),
3: protobuf.Field("timestamp", "uint32", repeated=False, required=False), 3: protobuf.Field("timestamp", "uint32", repeated=False, required=True),
4: protobuf.Field("fee", "uint64", repeated=False, required=False), 4: protobuf.Field("fee", "uint64", repeated=False, required=True),
5: protobuf.Field("deadline", "uint32", repeated=False, required=False), 5: protobuf.Field("deadline", "uint32", repeated=False, required=True),
6: protobuf.Field("signer", "bytes", repeated=False, required=False), 6: protobuf.Field("signer", "bytes", repeated=False, required=False),
} }
def __init__( def __init__(
self, self,
*, *,
timestamp: "int",
fee: "int",
deadline: "int",
address_n: Optional[Sequence["int"]] = None, address_n: Optional[Sequence["int"]] = None,
network: Optional["int"] = None, network: Optional["int"] = 104,
timestamp: Optional["int"] = None,
fee: Optional["int"] = None,
deadline: Optional["int"] = None,
signer: Optional["bytes"] = None, signer: Optional["bytes"] = None,
) -> None: ) -> None:
self.address_n: Sequence["int"] = address_n if address_n is not None else [] self.address_n: Sequence["int"] = address_n if address_n is not None else []
self.network = network
self.timestamp = timestamp self.timestamp = timestamp
self.fee = fee self.fee = fee
self.deadline = deadline self.deadline = deadline
self.network = network
self.signer = signer self.signer = signer
class NEMTransfer(protobuf.MessageType): class NEMTransfer(protobuf.MessageType):
MESSAGE_WIRE_TYPE = None MESSAGE_WIRE_TYPE = None
FIELDS = { FIELDS = {
1: protobuf.Field("recipient", "string", repeated=False, required=False), 1: protobuf.Field("recipient", "string", repeated=False, required=True),
2: protobuf.Field("amount", "uint64", repeated=False, required=False), 2: protobuf.Field("amount", "uint64", repeated=False, required=True),
3: protobuf.Field("payload", "bytes", repeated=False, required=False), 3: protobuf.Field("payload", "bytes", repeated=False, required=False),
4: protobuf.Field("public_key", "bytes", repeated=False, required=False), 4: protobuf.Field("public_key", "bytes", repeated=False, required=False),
5: protobuf.Field("mosaics", "NEMMosaic", repeated=True, required=False), 5: protobuf.Field("mosaics", "NEMMosaic", repeated=True, required=False),
@ -5929,10 +5929,10 @@ class NEMTransfer(protobuf.MessageType):
def __init__( def __init__(
self, self,
*, *,
recipient: "str",
amount: "int",
mosaics: Optional[Sequence["NEMMosaic"]] = None, mosaics: Optional[Sequence["NEMMosaic"]] = None,
recipient: Optional["str"] = None, payload: Optional["bytes"] = b'',
amount: Optional["int"] = None,
payload: Optional["bytes"] = None,
public_key: Optional["bytes"] = None, public_key: Optional["bytes"] = None,
) -> None: ) -> None:
self.mosaics: Sequence["NEMMosaic"] = mosaics if mosaics is not None else [] self.mosaics: Sequence["NEMMosaic"] = mosaics if mosaics is not None else []
@ -5945,40 +5945,40 @@ class NEMTransfer(protobuf.MessageType):
class NEMProvisionNamespace(protobuf.MessageType): class NEMProvisionNamespace(protobuf.MessageType):
MESSAGE_WIRE_TYPE = None MESSAGE_WIRE_TYPE = None
FIELDS = { 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), 2: protobuf.Field("parent", "string", repeated=False, required=False),
3: protobuf.Field("sink", "string", repeated=False, required=False), 3: protobuf.Field("sink", "string", repeated=False, required=True),
4: protobuf.Field("fee", "uint64", repeated=False, required=False), 4: protobuf.Field("fee", "uint64", repeated=False, required=True),
} }
def __init__( def __init__(
self, self,
*, *,
namespace: Optional["str"] = None, namespace: "str",
sink: "str",
fee: "int",
parent: Optional["str"] = None, parent: Optional["str"] = None,
sink: Optional["str"] = None,
fee: Optional["int"] = None,
) -> None: ) -> None:
self.namespace = namespace self.namespace = namespace
self.parent = parent
self.sink = sink self.sink = sink
self.fee = fee self.fee = fee
self.parent = parent
class NEMMosaicCreation(protobuf.MessageType): class NEMMosaicCreation(protobuf.MessageType):
MESSAGE_WIRE_TYPE = None MESSAGE_WIRE_TYPE = None
FIELDS = { FIELDS = {
1: protobuf.Field("definition", "NEMMosaicDefinition", repeated=False, required=False), 1: protobuf.Field("definition", "NEMMosaicDefinition", repeated=False, required=True),
2: protobuf.Field("sink", "string", repeated=False, required=False), 2: protobuf.Field("sink", "string", repeated=False, required=True),
3: protobuf.Field("fee", "uint64", repeated=False, required=False), 3: protobuf.Field("fee", "uint64", repeated=False, required=True),
} }
def __init__( def __init__(
self, self,
*, *,
definition: Optional["NEMMosaicDefinition"] = None, definition: "NEMMosaicDefinition",
sink: Optional["str"] = None, sink: "str",
fee: Optional["int"] = None, fee: "int",
) -> None: ) -> None:
self.definition = definition self.definition = definition
self.sink = sink self.sink = sink
@ -5988,19 +5988,19 @@ class NEMMosaicCreation(protobuf.MessageType):
class NEMMosaicSupplyChange(protobuf.MessageType): class NEMMosaicSupplyChange(protobuf.MessageType):
MESSAGE_WIRE_TYPE = None MESSAGE_WIRE_TYPE = None
FIELDS = { FIELDS = {
1: protobuf.Field("namespace", "string", repeated=False, required=False), 1: protobuf.Field("namespace", "string", repeated=False, required=True),
2: protobuf.Field("mosaic", "string", repeated=False, required=False), 2: protobuf.Field("mosaic", "string", repeated=False, required=True),
3: protobuf.Field("type", "NEMSupplyChangeType", repeated=False, required=False), 3: protobuf.Field("type", "NEMSupplyChangeType", repeated=False, required=True),
4: protobuf.Field("delta", "uint64", repeated=False, required=False), 4: protobuf.Field("delta", "uint64", repeated=False, required=True),
} }
def __init__( def __init__(
self, self,
*, *,
namespace: Optional["str"] = None, namespace: "str",
mosaic: Optional["str"] = None, mosaic: "str",
type: Optional["NEMSupplyChangeType"] = None, type: "NEMSupplyChangeType",
delta: Optional["int"] = None, delta: "int",
) -> None: ) -> None:
self.namespace = namespace self.namespace = namespace
self.mosaic = mosaic self.mosaic = mosaic
@ -6028,15 +6028,15 @@ class NEMAggregateModification(protobuf.MessageType):
class NEMImportanceTransfer(protobuf.MessageType): class NEMImportanceTransfer(protobuf.MessageType):
MESSAGE_WIRE_TYPE = None MESSAGE_WIRE_TYPE = None
FIELDS = { FIELDS = {
1: protobuf.Field("mode", "NEMImportanceTransferMode", repeated=False, required=False), 1: protobuf.Field("mode", "NEMImportanceTransferMode", repeated=False, required=True),
2: protobuf.Field("public_key", "bytes", repeated=False, required=False), 2: protobuf.Field("public_key", "bytes", repeated=False, required=True),
} }
def __init__( def __init__(
self, self,
*, *,
mode: Optional["NEMImportanceTransferMode"] = None, mode: "NEMImportanceTransferMode",
public_key: Optional["bytes"] = None, public_key: "bytes",
) -> None: ) -> None:
self.mode = mode self.mode = mode
self.public_key = public_key self.public_key = public_key
@ -6045,17 +6045,17 @@ class NEMImportanceTransfer(protobuf.MessageType):
class NEMMosaic(protobuf.MessageType): class NEMMosaic(protobuf.MessageType):
MESSAGE_WIRE_TYPE = None MESSAGE_WIRE_TYPE = None
FIELDS = { FIELDS = {
1: protobuf.Field("namespace", "string", repeated=False, required=False), 1: protobuf.Field("namespace", "string", repeated=False, required=True),
2: protobuf.Field("mosaic", "string", repeated=False, required=False), 2: protobuf.Field("mosaic", "string", repeated=False, required=True),
3: protobuf.Field("quantity", "uint64", repeated=False, required=False), 3: protobuf.Field("quantity", "uint64", repeated=False, required=True),
} }
def __init__( def __init__(
self, self,
*, *,
namespace: Optional["str"] = None, namespace: "str",
mosaic: Optional["str"] = None, mosaic: "str",
quantity: Optional["int"] = None, quantity: "int",
) -> None: ) -> None:
self.namespace = namespace self.namespace = namespace
self.mosaic = mosaic self.mosaic = mosaic
@ -6067,8 +6067,8 @@ class NEMMosaicDefinition(protobuf.MessageType):
FIELDS = { FIELDS = {
1: protobuf.Field("name", "string", repeated=False, required=False), 1: protobuf.Field("name", "string", repeated=False, required=False),
2: protobuf.Field("ticker", "string", repeated=False, required=False), 2: protobuf.Field("ticker", "string", repeated=False, required=False),
3: protobuf.Field("namespace", "string", repeated=False, required=False), 3: protobuf.Field("namespace", "string", repeated=False, required=True),
4: protobuf.Field("mosaic", "string", repeated=False, required=False), 4: protobuf.Field("mosaic", "string", repeated=False, required=True),
5: protobuf.Field("divisibility", "uint32", repeated=False, required=False), 5: protobuf.Field("divisibility", "uint32", repeated=False, required=False),
6: protobuf.Field("levy", "NEMMosaicLevy", repeated=False, required=False), 6: protobuf.Field("levy", "NEMMosaicLevy", repeated=False, required=False),
7: protobuf.Field("fee", "uint64", 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), 11: protobuf.Field("supply", "uint64", repeated=False, required=False),
12: protobuf.Field("mutable_supply", "bool", repeated=False, required=False), 12: protobuf.Field("mutable_supply", "bool", repeated=False, required=False),
13: protobuf.Field("transferable", "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), 15: protobuf.Field("networks", "uint32", repeated=True, required=False),
} }
def __init__( def __init__(
self, self,
*, *,
namespace: "str",
mosaic: "str",
description: "str",
networks: Optional[Sequence["int"]] = None, networks: Optional[Sequence["int"]] = None,
name: Optional["str"] = None, name: Optional["str"] = None,
ticker: Optional["str"] = None, ticker: Optional["str"] = None,
namespace: Optional["str"] = None,
mosaic: Optional["str"] = None,
divisibility: Optional["int"] = None, divisibility: Optional["int"] = None,
levy: Optional["NEMMosaicLevy"] = None, levy: Optional["NEMMosaicLevy"] = None,
fee: Optional["int"] = None, fee: Optional["int"] = None,
@ -6099,13 +6100,13 @@ class NEMMosaicDefinition(protobuf.MessageType):
supply: Optional["int"] = None, supply: Optional["int"] = None,
mutable_supply: Optional["bool"] = None, mutable_supply: Optional["bool"] = None,
transferable: Optional["bool"] = None, transferable: Optional["bool"] = None,
description: Optional["str"] = None,
) -> None: ) -> None:
self.networks: Sequence["int"] = networks if networks is not None else [] self.networks: Sequence["int"] = networks if networks is not None else []
self.name = name
self.ticker = ticker
self.namespace = namespace self.namespace = namespace
self.mosaic = mosaic self.mosaic = mosaic
self.description = description
self.name = name
self.ticker = ticker
self.divisibility = divisibility self.divisibility = divisibility
self.levy = levy self.levy = levy
self.fee = fee self.fee = fee
@ -6115,21 +6116,20 @@ class NEMMosaicDefinition(protobuf.MessageType):
self.supply = supply self.supply = supply
self.mutable_supply = mutable_supply self.mutable_supply = mutable_supply
self.transferable = transferable self.transferable = transferable
self.description = description
class NEMCosignatoryModification(protobuf.MessageType): class NEMCosignatoryModification(protobuf.MessageType):
MESSAGE_WIRE_TYPE = None MESSAGE_WIRE_TYPE = None
FIELDS = { FIELDS = {
1: protobuf.Field("type", "NEMModificationType", repeated=False, required=False), 1: protobuf.Field("type", "NEMModificationType", repeated=False, required=True),
2: protobuf.Field("public_key", "bytes", repeated=False, required=False), 2: protobuf.Field("public_key", "bytes", repeated=False, required=True),
} }
def __init__( def __init__(
self, self,
*, *,
type: Optional["NEMModificationType"] = None, type: "NEMModificationType",
public_key: Optional["bytes"] = None, public_key: "bytes",
) -> None: ) -> None:
self.type = type self.type = type
self.public_key = public_key self.public_key = public_key
@ -6170,29 +6170,29 @@ class RippleSignTx(protobuf.MessageType):
MESSAGE_WIRE_TYPE = 402 MESSAGE_WIRE_TYPE = 402
FIELDS = { FIELDS = {
1: protobuf.Field("address_n", "uint32", repeated=True, required=False), 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), 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), 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__( def __init__(
self, self,
*, *,
fee: "int",
sequence: "int",
payment: "RipplePayment",
address_n: Optional[Sequence["int"]] = None, address_n: Optional[Sequence["int"]] = None,
fee: Optional["int"] = None, flags: Optional["int"] = 0,
flags: Optional["int"] = None,
sequence: Optional["int"] = None,
last_ledger_sequence: Optional["int"] = None, last_ledger_sequence: Optional["int"] = None,
payment: Optional["RipplePayment"] = None,
) -> None: ) -> None:
self.address_n: Sequence["int"] = address_n if address_n is not None else [] self.address_n: Sequence["int"] = address_n if address_n is not None else []
self.fee = fee self.fee = fee
self.flags = flags
self.sequence = sequence self.sequence = sequence
self.last_ledger_sequence = last_ledger_sequence
self.payment = payment self.payment = payment
self.flags = flags
self.last_ledger_sequence = last_ledger_sequence
class RippleSignedTx(protobuf.MessageType): class RippleSignedTx(protobuf.MessageType):
@ -6975,17 +6975,17 @@ class TezosDelegationOp(protobuf.MessageType):
class TezosProposalOp(protobuf.MessageType): class TezosProposalOp(protobuf.MessageType):
MESSAGE_WIRE_TYPE = None MESSAGE_WIRE_TYPE = None
FIELDS = { FIELDS = {
1: protobuf.Field("source", "bytes", repeated=False, required=False), 1: protobuf.Field("source", "bytes", repeated=False, required=True),
2: protobuf.Field("period", "uint64", repeated=False, required=False), 2: protobuf.Field("period", "uint64", repeated=False, required=True),
4: protobuf.Field("proposals", "bytes", repeated=True, required=False), 4: protobuf.Field("proposals", "bytes", repeated=True, required=False),
} }
def __init__( def __init__(
self, self,
*, *,
source: "bytes",
period: "int",
proposals: Optional[Sequence["bytes"]] = None, proposals: Optional[Sequence["bytes"]] = None,
source: Optional["bytes"] = None,
period: Optional["int"] = None,
) -> None: ) -> None:
self.proposals: Sequence["bytes"] = proposals if proposals is not None else [] self.proposals: Sequence["bytes"] = proposals if proposals is not None else []
self.source = source self.source = source
@ -6995,19 +6995,19 @@ class TezosProposalOp(protobuf.MessageType):
class TezosBallotOp(protobuf.MessageType): class TezosBallotOp(protobuf.MessageType):
MESSAGE_WIRE_TYPE = None MESSAGE_WIRE_TYPE = None
FIELDS = { FIELDS = {
1: protobuf.Field("source", "bytes", repeated=False, required=False), 1: protobuf.Field("source", "bytes", repeated=False, required=True),
2: protobuf.Field("period", "uint64", repeated=False, required=False), 2: protobuf.Field("period", "uint64", repeated=False, required=True),
3: protobuf.Field("proposal", "bytes", repeated=False, required=False), 3: protobuf.Field("proposal", "bytes", repeated=False, required=True),
4: protobuf.Field("ballot", "TezosBallotType", repeated=False, required=False), 4: protobuf.Field("ballot", "TezosBallotType", repeated=False, required=True),
} }
def __init__( def __init__(
self, self,
*, *,
source: Optional["bytes"] = None, source: "bytes",
period: Optional["int"] = None, period: "int",
proposal: Optional["bytes"] = None, proposal: "bytes",
ballot: Optional["TezosBallotType"] = None, ballot: "TezosBallotType",
) -> None: ) -> None:
self.source = source self.source = source
self.period = period self.period = period
@ -7038,15 +7038,15 @@ class TezosParametersManager(protobuf.MessageType):
class TezosManagerTransfer(protobuf.MessageType): class TezosManagerTransfer(protobuf.MessageType):
MESSAGE_WIRE_TYPE = None MESSAGE_WIRE_TYPE = None
FIELDS = { FIELDS = {
1: protobuf.Field("destination", "TezosContractID", repeated=False, required=False), 1: protobuf.Field("destination", "TezosContractID", repeated=False, required=True),
2: protobuf.Field("amount", "uint64", repeated=False, required=False), 2: protobuf.Field("amount", "uint64", repeated=False, required=True),
} }
def __init__( def __init__(
self, self,
*, *,
destination: Optional["TezosContractID"] = None, destination: "TezosContractID",
amount: Optional["int"] = None, amount: "int",
) -> None: ) -> None:
self.destination = destination self.destination = destination
self.amount = amount self.amount = amount

View File

@ -36,11 +36,12 @@ TYPE_MOSAIC_SUPPLY_CHANGE = 0x4002
def create_transaction_common(transaction: dict) -> messages.NEMTransactionCommon: def create_transaction_common(transaction: dict) -> messages.NEMTransactionCommon:
msg = messages.NEMTransactionCommon() msg = messages.NEMTransactionCommon(
msg.network = (transaction["version"] >> 24) & 0xFF network=(transaction["version"] >> 24) & 0xFF,
msg.timestamp = transaction["timeStamp"] timestamp=transaction["timeStamp"],
msg.fee = transaction["fee"] fee=transaction["fee"],
msg.deadline = transaction["deadline"] deadline=transaction["deadline"],
)
if "signer" in transaction: if "signer" in transaction:
msg.signer = bytes.fromhex(transaction["signer"]) 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: def create_transfer(transaction: dict) -> messages.NEMTransfer:
msg = messages.NEMTransfer() msg = messages.NEMTransfer(
msg.recipient = transaction["recipient"] recipient=transaction["recipient"], amount=transaction["amount"]
msg.amount = transaction["amount"] )
if "payload" in transaction["message"]: if "payload" in transaction["message"]:
msg.payload = bytes.fromhex(transaction["message"]["payload"]) msg.payload = bytes.fromhex(transaction["message"]["payload"])
@ -75,14 +76,15 @@ def create_transfer(transaction: dict) -> messages.NEMTransfer:
def create_aggregate_modification( def create_aggregate_modification(
transaction: dict, transaction: dict,
) -> messages.NEMAggregateModification: ) -> messages.NEMAggregateModification:
msg = messages.NEMAggregateModification() msg = messages.NEMAggregateModification(
msg.modifications = [ modifications=[
messages.NEMCosignatoryModification( messages.NEMCosignatoryModification(
type=modification["modificationType"], type=modification["modificationType"],
public_key=bytes.fromhex(modification["cosignatoryAccount"]), public_key=bytes.fromhex(modification["cosignatoryAccount"]),
) )
for modification in transaction["modifications"] for modification in transaction["modifications"]
] ]
)
if "minCosignatories" in transaction: if "minCosignatories" in transaction:
msg.relative_change = transaction["minCosignatories"]["relativeChange"] msg.relative_change = transaction["minCosignatories"]["relativeChange"]
@ -91,65 +93,68 @@ def create_aggregate_modification(
def create_provision_namespace(transaction: dict) -> messages.NEMProvisionNamespace: def create_provision_namespace(transaction: dict) -> messages.NEMProvisionNamespace:
msg = messages.NEMProvisionNamespace() msg = messages.NEMProvisionNamespace(
msg.namespace = transaction["newPart"] sink=transaction["rentalFeeSink"],
fee=transaction["rentalFee"],
namespace=transaction["newPart"],
)
if transaction["parent"]: if transaction["parent"]:
msg.parent = transaction["parent"] msg.parent = transaction["parent"]
msg.sink = transaction["rentalFeeSink"]
msg.fee = transaction["rentalFee"]
return msg return msg
def create_mosaic_creation(transaction: dict) -> messages.NEMMosaicCreation: def create_mosaic_creation(transaction: dict) -> messages.NEMMosaicCreation:
definition = transaction["mosaicDefinition"] definition_dict = transaction["mosaicDefinition"]
msg = messages.NEMMosaicCreation()
msg.definition = messages.NEMMosaicDefinition()
msg.definition.namespace = definition["id"]["namespaceId"]
msg.definition.mosaic = definition["id"]["name"]
if definition["levy"]: definition = messages.NEMMosaicDefinition(
msg.definition.levy = definition["levy"]["type"] namespace=definition_dict["id"]["namespaceId"],
msg.definition.fee = definition["levy"]["fee"] mosaic=definition_dict["id"]["name"],
msg.definition.levy_address = definition["levy"]["recipient"] description=definition_dict["description"],
msg.definition.levy_namespace = definition["levy"]["mosaicId"]["namespaceId"] )
msg.definition.levy_mosaic = definition["levy"]["mosaicId"]["name"]
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"] name = property["name"]
value = json.loads(property["value"]) value = json.loads(property["value"])
if name == "divisibility": if name == "divisibility":
msg.definition.divisibility = value definition.divisibility = value
elif name == "initialSupply": elif name == "initialSupply":
msg.definition.supply = value definition.supply = value
elif name == "supplyMutable": elif name == "supplyMutable":
msg.definition.mutable_supply = value definition.mutable_supply = value
elif name == "transferable": elif name == "transferable":
msg.definition.transferable = value definition.transferable = value
msg.sink = transaction["creationFeeSink"] return messages.NEMMosaicCreation(
msg.fee = transaction["creationFee"] definition=definition,
return msg sink=transaction["creationFeeSink"],
fee=transaction["creationFee"],
)
def create_supply_change(transaction: dict) -> messages.NEMMosaicSupplyChange: def create_supply_change(transaction: dict) -> messages.NEMMosaicSupplyChange:
msg = messages.NEMMosaicSupplyChange() return messages.NEMMosaicSupplyChange(
msg.namespace = transaction["mosaicId"]["namespaceId"] namespace=transaction["mosaicId"]["namespaceId"],
msg.mosaic = transaction["mosaicId"]["name"] mosaic=transaction["mosaicId"]["name"],
msg.type = transaction["supplyType"] type=transaction["supplyType"],
msg.delta = transaction["delta"] delta=transaction["delta"],
return msg )
def create_importance_transfer(transaction: dict) -> messages.NEMImportanceTransfer: def create_importance_transfer(transaction: dict) -> messages.NEMImportanceTransfer:
msg = messages.NEMImportanceTransfer() return messages.NEMImportanceTransfer(
msg.mode = transaction["importanceTransfer"]["mode"] mode=transaction["importanceTransfer"]["mode"],
msg.public_key = bytes.fromhex(transaction["importanceTransfer"]["publicKey"]) public_key=bytes.fromhex(transaction["importanceTransfer"]["publicKey"]),
return msg )
def fill_transaction_by_type(msg: messages.NEMSignTx, transaction: dict) -> None: 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: def create_sign_tx(transaction: dict) -> messages.NEMSignTx:
msg = messages.NEMSignTx() msg = messages.NEMSignTx(
msg.transaction = create_transaction_common(transaction) transaction=create_transaction_common(transaction),
msg.cosigning = transaction["type"] == TYPE_MULTISIG_SIGNATURE cosigning=transaction["type"] == TYPE_MULTISIG_SIGNATURE,
)
if transaction["type"] in (TYPE_MULTISIG_SIGNATURE, TYPE_MULTISIG): if transaction["type"] in (TYPE_MULTISIG_SIGNATURE, TYPE_MULTISIG):
other_trans = transaction["otherTrans"] other_trans = transaction["otherTrans"]