Skip to content

Commit

Permalink
Fix typed Data sign
Browse files Browse the repository at this point in the history
  • Loading branch information
yagopv committed Nov 8, 2023
1 parent 79d2a81 commit 998b99f
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions packages/auth-kit/example/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down

0 comments on commit 998b99f

Please sign in to comment.