scaffold-eth / create-eth-extensions

Extensions for create-eth (npx tool for Scaffold-ETH)
MIT License
6 stars 5 forks source link

Eip 712 adjustements #5

Closed rin-st closed 3 months ago

rin-st commented 3 months ago

fixes #4

Current version:

https://github.com/scaffold-eth/create-eth-extensions/assets/25638585/a5283272-5b5c-4450-ae43-ad3c68ace78a

Some notes

Same text size on input / textarea

FIxed. Not sure why, but on Daisy UI Input and Textarea font sizes are different.

Loading button / spinner when sending the request (specially backend)

I added loading only for backend verification, and its slow only for first verification. Regarding frontend verification, it works using useVerifyTypedData hook and it's fast. So I think we don't need it for frontend button. Example of using isLoading from the hook

https://github.com/scaffold-eth/create-eth-extensions/assets/25638585/65d61791-98aa-4cd0-907b-b78f3f33c448

Have some info about EIP 712 in the page (a paragraph with a small description and a link to https://eips.ethereum.org/EIPS/eip-712 and hinting to check the eip-712/page.tsx). We can tinker in the PR (deciding the text, etc)

I added it to the top of the page. Also thought about just adding to tooltip, but in Daisy UI only text can be added there (without links, jsx etc)

Also, there are two different fail messages for frontend and backend. Because backend error is parsed, but on frontend useVerifyTypedData returns only true or false and no error when false. We can adjust error messages but not sure it's necessary

Снимок экрана 2024-06-17 в 12 44 32

To test

yarn cli -e scaffold-eth/create-eth-extensions:eip-712-adjustements
carletex commented 3 months ago

reviewing this atm. Will push some tweaks.

carletex commented 3 months ago

Oh. I see that Shiv is already reviewing. I'll leave you to it, Rinat.

rin-st commented 3 months ago

Thanks for comments and good suggestions!

also noticed a bug : When you first sign message and verify it's all good but when you change the message and click verify it fails

It is expected behavior, because verifying takes data from input/textarea and then checks if signature is right for that data. But yes, it's not so obvious. To clarify it, I added typed data representation, both current and signed, and a message about it.

Снимок экрана 2024-06-18 в 10 56 36

Representation:

Снимок экрана 2024-06-18 в 10 57 28 image
carletex commented 3 months ago

This is great stuff @rin-st Thank you! Also <3 Shiv for the review.

Merging and we can iterate if needed.