-
Notifications
You must be signed in to change notification settings - Fork 119
Closed
Description
โ Prerequisites
- Did you perform a cursory search of open issues? Is this bug already reported elsewhere?
- Are you running the latest SDK version?
- Are you reporting to the correct repository (
magic-sdk
)?
๐ Description
eth_signTypedData_v4
fails if the message params are stringified instead of sent as an object. Breaks on v17 and v18
๐งฉ Steps to Reproduce
To reproduce, request eth_signTypedData_v4
while passing a stringified object in its params.
const message = {
...
}
const { publicAddress } = await magic.user.getInfo();
magic.rpcProvider.request({
method: "eth_signTypedData_v4",
params: [publicAddress, JSON.stringify(message)]
});
if I send it as params: [publicAddress, message]
, it works as expected. However, Metamask expects it as params: [publicAddress, JSON.stringify(message)]
. We're working with an SDK that makes these signature requests, so it would be difficult to change it directly.
๐ค Expected behavior
I expect sending it as JSON.stringify(message)
to pop up a signature transaction window. This how Metamask expects it.
๐ฎ Actual behavior
The UI breaks, with the MagicLink iframe frozen over the UI, and this minified errors show up:
Error: Minified React error #301; visit https://reactjs.org/docs/error-decoder.html?invariant=301 for the full message or use the non-minified dev environment for full errors and additional helpful warnings.
at Yi (app.chunk~vendor~react.a7eafcd306300c9d25bc.js:2:233470)
at rs (app.chunk~vendor~react.a7eafcd306300c9d25bc.js:2:286726)
at Zc (app.chunk~vendor~react.a7eafcd306300c9d25bc.js:2:282342)
at Uc (app.chunk~vendor~react.a7eafcd306300c9d25bc.js:2:282270)
at $c (app.chunk~vendor~react.a7eafcd306300c9d25bc.js:2:282123)
at Tc (app.chunk~vendor~react.a7eafcd306300c9d25bc.js:2:278435)
at _c (app.chunk~vendor~react.a7eafcd306300c9d25bc.js:2:277387)
at w (app.chunk~vendor~react.a7eafcd306300c9d25bc.js:2:301845)
at L (app.chunk~vendor~react.a7eafcd306300c9d25bc.js:2:302209)
at m.<computed> (app.chunk~vendor~fad58de7366495db4650cfefac2fcd61.906262e51ffe63ccda63.js:2:738716)
(anonymous) @ app.chunk~vendor~fad58de7366495db4650cfefac2fcd61.906262e51ffe63ccda63.js:2
Ze @ app.chunk~vendor~fad58de7366495db4650cfefac2fcd61.906262e51ffe63ccda63.js:2
console.error @ app.chunk~vendor~fad58de7366495db4650cfefac2fcd61.906262e51ffe63ccda63.js:2
console.<computed> @ app.chunk~vendor~fad58de7366495db4650cfefac2fcd61.906262e51ffe63ccda63.js:2
Vu @ app.chunk~vendor~react.a7eafcd306300c9d25bc.js:2
n.callback @ app.chunk~vendor~react.a7eafcd306300c9d25bc.js:2
li @ app.chunk~vendor~react.a7eafcd306300c9d25bc.js:2
Yl @ app.chunk~vendor~react.a7eafcd306300c9d25bc.js:2
Zl @ app.chunk~vendor~react.a7eafcd306300c9d25bc.js:2
Wl @ app.chunk~vendor~react.a7eafcd306300c9d25bc.js:2
Xc @ app.chunk~vendor~react.a7eafcd306300c9d25bc.js:2
Gc @ app.chunk~vendor~react.a7eafcd306300c9d25bc.js:2
_c @ app.chunk~vendor~react.a7eafcd306300c9d25bc.js:2
w @ app.chunk~vendor~react.a7eafcd306300c9d25bc.js:2
L @ app.chunk~vendor~react.a7eafcd306300c9d25bc.js:2
m.<computed> @ app.chunk~vendor~fad58de7366495db4650cfefac2fcd61.906262e51ffe63ccda63.js:2
E @ app.chunk~vendor~fad58de7366495db4650cfefac2fcd61.906262e51ffe63ccda63.js:2
S @ app.chunk~vendor~fad58de7366495db4650cfefac2fcd61.906262e51ffe63ccda63.js:2
๐ป Code Sample
๐ Environment
Software | Version(s) |
---|---|
magic-sdk |
v18, v17 |
Browser | chrome |
yarn |
1.22.19 |
Operating System | OSX |