Skip to content

Conversation

@ultraviolet10
Copy link
Contributor

@ultraviolet10 ultraviolet10 commented Apr 29, 2025

Linked Issues

Description

Added support for handling eth_signTypedData_v4 requests in the iframe component. This implementation:

  • Creates a new component EthSignTypedDatav4.tsx that renders EIP-712 structured data in a user-friendly format.
Toggle Checklist

Checklist

Basics

  • B1. I have applied the proper label & proper branch name (e.g. norswap/build-system-caching).
  • B2. This PR is not so big that it should be split & addresses only one concern.
  • B3. The PR targets the lowest branch it can (ideally master).

Reminder: PR review guidelines

Correctness

  • C1. Builds and passes tests.
  • C2. The code is properly parameterized & compatible with different environments (e.g. local,
    testnet, mainnet, standalone wallet, ...).
  • C3. I have manually tested my changes & connected features.

< INDICATE BROWSER, DEMO APP & OTHER ENV DETAILS USED FOR TESTING HERE >

< INDICATE TESTED SCENARIOS (USER INTERFACE INTERACTION, CODE FLOWS) HERE >

  • C4. I have performed a thorough self-review of my code after submitting the PR,
    and have updated the code & comments accordingly.

Architecture & Documentation

  • D1. I made it easy to reason locally about the code, by (1) using proper abstraction boundaries,
    (2) commenting these boundaries correctly, (3) adding inline comments for context when needed.
  • D2. All public-facing APIs are documented in the docs.
    Public APIS and meaningful (non-local) internal APIs are properly documented in code comments.
  • D3. If appropriate, the general architecture of the code is documented in a code comment or
    in a Markdown document.
  • D4. An appropriate Changeset has been generated (and committed) with make changeset for
    breaking and meaningful changes in packages (not required for cleanups & refactors).

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Apr 29, 2025

Deploying happychain with  Cloudflare Pages  Cloudflare Pages

Latest commit: f2975be
Status: ✅  Deploy successful!
Preview URL: https://1f6d08db.happychain.pages.dev
Branch Preview URL: https://aritra-eth-signtypeddata-v4.happychain.pages.dev

View logs

Copy link
Contributor Author

ultraviolet10 commented Apr 29, 2025

This stack of pull requests is managed by Graphite. Learn more about stacking.

@linear
Copy link

linear bot commented Apr 29, 2025

HAPPY-500 Implement `eth_signedTypedData_v4` request frame.

cf. HAPPY-235 for some background

Key highlight:

It's as simple as doing an additional request frame — no work is required from the handler side, it will automatically be forwarded to the underlying client (web3auth or injected).

@ultraviolet10 ultraviolet10 added reviewing-1 Ready for, or undergoing first-line review priority-post-testnet labels Apr 30, 2025
Comment on lines 78 to 80
case "eth_signTypedData_v4": {
return await sendToWalletClient(request)
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isn't this the default? i think you don't need this

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

file moved to src/requests/approved.ts where the code doesn't exist, hence this is handled!

Comment on lines 78 to 80
case "eth_signTypedData_v4": {
return await sendToInjectedClient(app, request)
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isn't this the default? i think you don't need this

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above :)

@ultraviolet10 ultraviolet10 force-pushed the aritra/eth_signTypedData_v4 branch from d994330 to f2975be Compare May 21, 2025 11:50
@ultraviolet10 ultraviolet10 marked this pull request as ready for review May 21, 2025 11:59
*
* This is used to safely recurse into nested structs defined in EIP-712 typed data.
*/
function isObject(value: unknown): value is Record<string, unknown> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should probably live in common utils i think 🫡

<FormattedDetailsLine>{domain.version}</FormattedDetailsLine>
</div>
)}
{(typeof domain.chainId === "number" || typeof domain.chainId === "bigint") && (
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nipick/suggestion/preference 😄

Suggested change
{(typeof domain.chainId === "number" || typeof domain.chainId === "bigint") && (
{['number', 'bigint'].includes(typeof domain.chainId) && (

@not-reed not-reed added reviewing-2 Ready for, or undergoing final review and removed reviewing-1 Ready for, or undergoing first-line review labels May 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

priority-post-testnet reviewing-2 Ready for, or undergoing final review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants