Skip to content

fix: testapp eth_signTypedData_v4 Example Message verify crash#268

Merged
fan-zhang-sv merged 1 commit intomasterfrom
fix/testapp-signTypedData-v4-verify
Apr 7, 2026
Merged

fix: testapp eth_signTypedData_v4 Example Message verify crash#268
fan-zhang-sv merged 1 commit intomasterfrom
fix/testapp-signTypedData-v4-verify

Conversation

@fan-zhang-sv
Copy link
Copy Markdown
Collaborator

@fan-zhang-sv fan-zhang-sv commented Apr 7, 2026

Summary

Fixes the "Example Message" shortcut button for eth_signTypedData_v4 in the testapp playground, which was crashing with:

{ "message": "Cannot read properties of undefined (reading 'domain')" }

Cause

Introduced in #217 (commit 69fbee3b — "Fix SDK source reload and remove noExplicitAny suppressions"), a type-narrowing guard was added to the verify flow in RpcMethodCard.tsx:

// Before #217
message: data.message,

// After #217
message: typeof data.message === 'string' ? data.message : undefined,

This guard was intended to satisfy Biome's noExplicitAny rule, but it's overly restrictive. When shortcuts call submit(shortcut.data) directly (bypassing the form), data.message is a JavaScript object — not a JSON string — because the shortcut data stores typed data payloads as objects (required for replaceAddressInValue to do deep placeholder replacement like YOUR_ADDRESS_HERE). The guard drops the object and passes undefined to verifySignMsg, which then crashes on typedData['domain'].

The form-based path is unaffected because textarea values are always strings.

Fix

Pass data.message through as-is. verifySignMsg already handles both strings and objects correctly:

const typedData = typeof message === 'string' ? JSON.parse(message) : message;

This also affects eth_signTypedData_v3 shortcuts which have the same object-based message structure.

Test plan

  • Open testapp playground
  • Connect a wallet
  • Under eth_signTypedData_v4, click the "Example Message" shortcut button
  • Verify signature is submitted and verified without error
  • Also test "Grant Permission" shortcut under eth_signTypedData_v4
  • Also test "Example Message" shortcut under eth_signTypedData_v3

Made with Cursor

@cb-heimdall
Copy link
Copy Markdown
Collaborator

cb-heimdall commented Apr 7, 2026

✅ Heimdall Review Status

Requirement Status More Info
Reviews 2/1
Denominator calculation
Show calculation
1 if user is bot 0
1 if user is external 0
2 if repo is sensitive 0
From .codeflow.yml 1
Additional review requirements
Show calculation
Max 0
0
From CODEOWNERS 0
Global minimum 0
Max 1
1
1 if commit is unverified 0
Sum 1

The "Example Message" shortcut button for eth_signTypedData_v4 was
crashing with "Cannot read properties of undefined (reading 'domain')"
during signature verification.

Made-with: Cursor
@fan-zhang-sv fan-zhang-sv force-pushed the fix/testapp-signTypedData-v4-verify branch from 76ab15f to c4489f3 Compare April 7, 2026 19:48
@fan-zhang-sv fan-zhang-sv merged commit 8501cf2 into master Apr 7, 2026
9 checks passed
@fan-zhang-sv fan-zhang-sv deleted the fix/testapp-signTypedData-v4-verify branch April 7, 2026 21:44
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.

4 participants