take into account PR remarks on Ethereum python client

This commit is contained in:
tdejoigny-ledger
2023-09-18 11:45:49 +02:00
committed by Alexandre Paillier
parent 5d1d16c2de
commit d7bf69b56c
2 changed files with 13 additions and 3 deletions

View File

@@ -271,6 +271,16 @@ class EthAppClient:
algo_id,
sig))
def set_external_plugin(self,
plugin_name: str,
contract_address: bytes,
method_selelector: bytes,
sig: Optional[bytes] = None):
if sig is None:
# Temporarily get a command with an empty signature to extract the payload and
# compute the signature on it
tmp = self._cmd_builder.set_external_plugin(plugin_name, contract_address, method_selelector, bytes())
def external_plugin_setup(self, plugin_name: str, contract_address: bytes, method_selelector: bytes, sig: bytes):
return self._send(self._cmd_builder.external_plugin_setup(plugin_name, contract_address, method_selelector, sig))
# skip APDU header & empty sig
sig = sign_data(Key.SET_PLUGIN, tmp[5:-1])
return self._send(self._cmd_builder.set_external_plugin(plugin_name, contract_address, method_selelector, sig))

View File

@@ -182,7 +182,7 @@ class CommandBuilder:
P2Type.FILTERING_FIELD_NAME,
self._eip712_filtering_send_name(name, sig))
def external_plugin_setup(self, plugin_name: str, contract_address: bytes, method_selelector: bytes, sig: bytes) -> bytes:
def set_external_plugin(self, plugin_name: str, contract_address: bytes, method_selelector: bytes, sig: bytes) -> bytes:
data = bytearray()
data.append(len(plugin_name))
data += self._string_to_bytes(plugin_name)