Skip to content

Commit

Permalink
test: update EIP-712 roundtrip tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jnicoulaud-ledger committed Oct 23, 2024
1 parent 83e3b74 commit 2dd1dbd
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions tests/convert/ledger/eip712/test_convert_eip712_round_trip.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,13 +104,20 @@ def _cleanup_formats(formats: dict[str, Any]) -> Any:
del_by_path(message, "screens")
if "fields" in message:
for field in message["fields"]:
# Other formats are always converted to RAW
if "format" in field and field["format"] not in (
FieldFormat.AMOUNT,
FieldFormat.TOKEN_AMOUNT,
FieldFormat.DATE,
):
field["format"] = "raw"
if "format" in field:
format = field["format"]

# Address name format parameters cannot be preserved
if format == "addressName":
del_by_path(field, "params")

# Other formats are always converted to RAW
if format not in (
FieldFormat.AMOUNT,
FieldFormat.TOKEN_AMOUNT,
FieldFormat.DATE,
):
field["format"] = "raw"

return formats

Expand Down

0 comments on commit 2dd1dbd

Please sign in to comment.