@@ -3,8 +3,6 @@ import { ethers } from 'ethers'
33import { Web3Provider } from '@ethersproject/providers'
44import { test , assert } from '../../utils/assert'
55
6- import { TypedDataUtils } from 'ethers-eip712'
7-
86import { isValidSignature , packMessageData , recoverConfig } from '@0xsequence/wallet'
97import { addressOf } from '@0xsequence/config'
108import { testWalletContext } from '../testutils'
@@ -129,15 +127,9 @@ export const tests = async () => {
129127
130128 const typedData = {
131129 types : {
132- EIP712Domain : [
133- { name : "name" , type : "string" } ,
134- { name : "version" , type : "string" } ,
135- { name : "chainId" , type : "uint256" } ,
136- { name : "verifyingContract" , type : "address" } ,
137- ] ,
138130 Person : [
139131 { name : "name" , type : "string" } ,
140- { name : "wallet" , type : "address" } ,
132+ { name : "wallet" , type : "address" } ,
141133 ]
142134 } ,
143135 primaryType : 'Person' as const ,
@@ -172,8 +164,9 @@ export const tests = async () => {
172164 //
173165 // Verify the message signature
174166 //
175- const message = TypedDataUtils . encodeDigest ( typedData )
176- const messageDigest = ethers . utils . arrayify ( ethers . utils . keccak256 ( message ) )
167+
168+ const messageHash = ethers . utils . _TypedDataEncoder . hash ( typedData . domain , typedData . types , typedData . message )
169+ const messageDigest = ethers . utils . arrayify ( ethers . utils . keccak256 ( messageHash ) )
177170 const isValid = await isValidSignature ( address , messageDigest , sig , provider , testWalletContext , await signer . getChainId ( ) )
178171 assert . true ( isValid , 'signature is valid' )
179172
0 commit comments