Skip to content

Fix EIP712Domain to support empty string name - #754

Closed
jgalat wants to merge 2 commits into
wevm:mainfrom
jgalat:main
Closed

jgalat wants to merge 2 commits into
wevm:mainfrom
jgalat:main

Conversation

@jgalat

@jgalat jgalat commented Jun 21, 2023 •

Copy link
Copy Markdown
Contributor

Hi,

We are migrating our web app to support the latest version of viem. However we were blocked by being unable to sign messages using signTypedData with an empty string as name in the domain structure.

According to the spec fields should not be considered only if absent, but the current implementation doesn't take into account that name could be '' which is a valid string.

Thanks!


PR-Codex overview

This PR adds support for empty string in the EIP712Domain name field. It includes changes to signTypedData.ts, hashTypedData.ts, hashTypedData.test.ts, and signTypedData.test.ts.

Detailed summary:

  • Added support for empty string in EIP712Domain name field
  • Changed comparison from && to != null in signTypedData.ts and hashTypedData.ts
  • Added test case for empty name in hashTypedData.test.ts and signTypedData.test.ts

✨ Ask PR-Codex anything about this PR by commenting with /codex {your question}

@changeset-bot

changeset-bot Bot commented Jun 21, 2023

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 99a3936

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel

vercel Bot commented Jun 21, 2023

Copy link
Copy Markdown

@jgalat is attempting to deploy a commit to the wagmi Team on Vercel.

A member of the Team first needs to authorize it.

@jxom

jxom commented Jun 22, 2023

Copy link
Copy Markdown
Member

Thanks for the PR! Just recreated it on viem's origin (had trouble pushing to your origin), see #758.

Your commits are still retained, so you still get credit. :)

@jxom jxom closed this Jun 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants