Add date/time support in client
This commit is contained in:
@@ -115,6 +115,9 @@ class EthAppClient:
|
||||
name,
|
||||
sig))
|
||||
|
||||
def eip712_filtering_datetime(self, name: str, sig: bytes):
|
||||
return self._exchange_async(self._cmd_builder.eip712_filtering_datetime(name, sig))
|
||||
|
||||
def eip712_filtering_raw(self, name: str, sig: bytes):
|
||||
return self._exchange_async(self._cmd_builder.eip712_filtering_raw(name, sig))
|
||||
|
||||
|
||||
@@ -42,6 +42,7 @@ class P2Type(IntEnum):
|
||||
NEW_IMPLEM = 0x01
|
||||
FILTERING_ACTIVATE = 0x00
|
||||
FILTERING_MESSAGE_INFO = 0x0f
|
||||
FILTERING_DATETIME = 0xfc
|
||||
FILTERING_TOKEN_ADDR_CHECK = 0xfd
|
||||
FILTERING_AMOUNT_FIELD = 0xfe
|
||||
FILTERING_RAW = 0xff
|
||||
@@ -197,6 +198,12 @@ class CommandBuilder:
|
||||
P2Type.FILTERING_AMOUNT_FIELD,
|
||||
data)
|
||||
|
||||
def eip712_filtering_datetime(self, name: str, sig: bytes) -> bytes:
|
||||
return self._serialize(InsType.EIP712_SEND_FILTERING,
|
||||
P1Type.COMPLETE_SEND,
|
||||
P2Type.FILTERING_DATETIME,
|
||||
self._eip712_filtering_send_name(name, sig))
|
||||
|
||||
def eip712_filtering_raw(self, name: str, sig: bytes) -> bytes:
|
||||
return self._serialize(InsType.EIP712_SEND_FILTERING,
|
||||
P1Type.COMPLETE_SEND,
|
||||
|
||||
@@ -205,6 +205,8 @@ def send_struct_impl_field(value, field):
|
||||
elif filtering_paths[path]["type"] == "amount_join_value":
|
||||
send_filtering_amount_join_value(filtering_paths[path]["token"],
|
||||
filtering_paths[path]["name"])
|
||||
elif filtering_paths[path]["type"] == "datetime":
|
||||
send_filtering_datetime(filtering_paths[path]["name"])
|
||||
elif filtering_paths[path]["type"] == "raw":
|
||||
send_filtering_raw(filtering_paths[path]["name"])
|
||||
else:
|
||||
@@ -311,6 +313,19 @@ def send_filtering_amount_join_value(token_idx: int, display_name: str):
|
||||
pass
|
||||
|
||||
|
||||
def send_filtering_datetime(display_name: str):
|
||||
global sig_ctx
|
||||
|
||||
path_str = ".".join(current_path)
|
||||
|
||||
to_sign = start_signature_payload(sig_ctx, 33)
|
||||
to_sign += path_str.encode()
|
||||
to_sign += display_name.encode()
|
||||
sig = keychain.sign_data(keychain.Key.CAL, to_sign)
|
||||
with app_client.eip712_filtering_datetime(display_name, sig):
|
||||
pass
|
||||
|
||||
|
||||
# ledgerjs doesn't actually sign anything, and instead uses already pre-computed signatures
|
||||
def send_filtering_raw(display_name):
|
||||
global sig_ctx
|
||||
|
||||
Reference in New Issue
Block a user