docs: some comment in code

This commit is contained in:
Coline
2022-07-25 11:03:41 +02:00
parent 986b4b427e
commit fd0f893615
2 changed files with 2 additions and 3 deletions

View File

@@ -200,15 +200,13 @@ class EthereumCommand:
@contextmanager
def personal_sign_tx(self, bip32_path: str, transaction: PersonalTransaction, result: List = list()) -> None:
"""
Does the same thing as simple_personal_sign but allows to create a batch of cmd apdu
"""
try:
for islast_apdu, apdu in self.builder.personal_sign_tx(bip32_path=bip32_path, transaction=transaction):
if islast_apdu:
with self.client.apdu_exchange_nowait(cla=apdu[0], ins=apdu[1],
p1=apdu[2], p2=apdu[3],
data=apdu[5:]) as exchange:
# the "yield" here allows to wait for a button interaction (click right, left, both)
yield exchange
response: bytes = exchange.receive()
else:

View File

@@ -266,6 +266,7 @@ class EthereumCommandBuilder:
cdata = cdata + tx
last_chunk = len(cdata) // MAX_APDU_LEN
# The generator allows to send apdu frames because we can't send an apdu > 255
for i, (chunk) in enumerate(chunked(MAX_APDU_LEN, cdata)):
if i == 0 and i == last_chunk:
yield True, self.serialize(cla=self.CLA,