Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fix EIP-712 -> ERC-7730 conversion not using primary type #49

Merged
merged 2 commits into from
Oct 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading