From 973ac23d498eb2c0a09da8c3802516c5ac3576fb Mon Sep 17 00:00:00 2001 From: "qdqd.sismo.eth" Date: Wed, 20 Apr 2022 13:56:01 +0200 Subject: [PATCH] fix(wc): work with all versions of the EIP-712 (#1851) The 712 specification has evolved over time. The current accepted version in the community is `eth_signTypedData_v4`. That's why we have to check any method `eth_signTypedData` called with a version parameter. --- src/walletconnect/index.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/walletconnect/index.ts b/src/walletconnect/index.ts index 4a8c856f1f..1886571922 100644 --- a/src/walletconnect/index.ts +++ b/src/walletconnect/index.ts @@ -48,7 +48,9 @@ export const parseCallRequest: Parser = async (account, payload) => { data: payload.params[0], }; - case "eth_signTypedData": + // @dev: Today, `eth_signTypedData` is versionned. We can't only check `eth_signTypedData` + // This regex matches `eth_signTypedData` and `eth_signTypedData_v[0-9]` + case payload.method.match(/eth_signTypedData(_v.)?$/)?.input: message = JSON.parse(payload.params[1]); hashes = { // $FlowFixMe