-
Notifications
You must be signed in to change notification settings - Fork 88
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to sign typed data using Ethers.js and Magic Connect? #374
Comments
Hi @0xFloop , thank you for reporting this issue. We will be taking a look at this and following up here! |
Update on the issue, using ethers method _signTypedData(domain, types, value) does not work for some reason. But the same data manually signed via signer.provider.send("eth_signTypedData_v4", params) does work. This is confusing because the ethers method is calling the .send method within it. All it does is format the data a little different. This discrepancy between methods of signing data does not pose any problem with metamask as provider, only when using magic connect. Hope that helps solve the issue |
@am-hernandez any update? |
@0xFloop We will need more time to dig into this. No updates yet! |
Any word on this - I'm experiencing this issue signing a transaction with the ThirdWebSdk and magic |
@am-hernandez any update on this? |
@0xFloop @0xJacobean Magic Connect includes
This is why you will see the error: Changes are required from our end to make it work with the example shared by @0xFloop from the ethers docs. For now, if possible for your use-case, you can use |
thanks |
"TypeError: Cannot read properties of undefined (reading 'EIP712Domain')". This is because etherjs stringify the object before sending it out and the popup becomes a string, not typed string. I have to bypass ethers js and send it directly. However, it fails in the encoding. I am trying to sign a ERC2612 Permit request(which works both in ether js private wallet and also work in metamask direct, so the object is perfectly ok) but failed in magic.link. The dialog popup also see everything correctly but the signing failed in the encoding process. Unfortunately, this is a packed app so no way I can trace it. coming from here (https://assets.auth.magic.link/static/app.chunk~vendor~crypto.891afc247160367a9f08.js). Has anyone really get it working for the permit request ? I thought it is very standard. app.chunk
|
This is not possible in my case as I am using seaport.js to sign typed seaport orders. Because of this I do not have the luxury of changing the method by which the orders are being signed within seaport.js |
Was able to achieve what I needed using 0xFloop's suggestions of manually signing with ("eth_signTypedData_v4", params). |
@0xFloop We just pushed changes to resolve this issue. I just tested it using the example from const signTypedDataWithMagic = async () => {
const domain = {
name: "Ether Mail",
version: "1",
chainId: 5,
verifyingContract: "0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC"
};
// The named list of all type definitions
const types = {
Person: [
{ name: "name", type: "string" },
{ name: "wallet", type: "address" }
],
Contact: [
{ name: "from", type: "Person" },
{ name: "to", type: "Person" },
{ name: "contents", type: "string" }
]
};
// The data to sign
const value = {
from: {
name: "Cow",
wallet: "0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826"
},
to: {
name: "Bob",
wallet: "0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB"
},
contents: "Hello, Bob!"
};
try {
const signer = await web3.getSigner();
const signature = await signer._signTypedData(domain, types, value);
console.log(signature);
} catch (err) {
console.log(err);
}
}; Please let us know if you are still experiencing this issue and we'll reopen! |
✅ Prerequisites
magic-sdk
)?❓ Question
Signing typed data using Magic Connect as wallet provider in ethers is throwing "TypeError: Cannot read properties of undefined (reading 'EIP712Domain')" after clicking the sign button. The ui is then stuck in perpetual loading sign. Same sig using metamask as provider works as intended. Code pulled directly from Ethers docs.
🌎 Environment
magic-sdk
@magic-ext/connect
npm
The text was updated successfully, but these errors were encountered: