Skip to content

Commit

Permalink
fix: fix EIP-712 -> ERC-7730 conversion not using primary type (#49)
Browse files Browse the repository at this point in the history
* fix: fix EIP-712 -> ERC-7730 conversion not using primary type

* lint
  • Loading branch information
jnicoulaud-ledger authored Oct 4, 2024
1 parent 323f4c0 commit 5a653b8
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/erc7730/convert/convert_eip712_to_erc7730.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
from eip712 import (
EIP712Format as LegacyEIP712Format,
)
from eip712 import (
EIP712MessageDescriptor as LegacyEIP712MessageDescriptor,
)
from pydantic import AnyUrl

from erc7730.common.output import OutputAdder
Expand Down Expand Up @@ -53,9 +56,8 @@ def convert(
# TODO improve typing on EIP-712 library
schema = typing.cast(dict[str, list[EIP712Field]], message.schema_)
mapper = message.mapper
# FIXME this is wrong,
# see https://github.com/LedgerHQ/clear-signing-erc7730-registry/pull/21/files#r1785706984
primary_type = mapper.label
# TODO make this public on EIP-712 library
primary_type = LegacyEIP712MessageDescriptor._schema_top_level_type(schema)
schemas.append(EIP712JsonSchema(primaryType=primary_type, types=schema))
fields = [self._convert_field(field) for field in mapper.fields]
formats[primary_type] = InputFormat(intent=None, fields=fields, required=None, screens=None)
Expand Down

0 comments on commit 5a653b8

Please sign in to comment.