From 998b99f1a5694e08c1fb2b426afc23a409f17894 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20P=C3=A9rez=20V=C3=A1zquez?= Date: Wed, 8 Nov 2023 13:21:10 +0100 Subject: [PATCH] Fix typed Data sign --- packages/auth-kit/example/src/App.tsx | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/packages/auth-kit/example/src/App.tsx b/packages/auth-kit/example/src/App.tsx index bd5ee06d7..168b7abf4 100644 --- a/packages/auth-kit/example/src/App.tsx +++ b/packages/auth-kit/example/src/App.tsx @@ -146,18 +146,16 @@ function App() { const signMessage = async (data: any, method: string) => { let signedMessage - console.log(data) + const params = { - data: JSON.stringify(data), + data, from: safeAuthSignInResponse?.eoa } - if (method.startsWith('eth_signTypedData')) { - // @ts-expect-error TODO: fix this - params.version = - method === 'eth_signTypedData' ? 'V1' : method === 'eth_signTypedData_v3' ? 'V3' : 'V4' - - signedMessage = await provider?.send(method, [params.from, params.data]) + if (method === 'eth_signTypedData') { + signedMessage = await provider?.send(method, [params.data, params.from]) + } else if (method === 'eth_signTypedData_v3' || method === 'eth_signTypedData_v4') { + signedMessage = await provider?.send(method, [params.from, JSON.stringify(params.data)]) } else { signedMessage = await provider?.getSigner()?.signMessage(data) }