Migrate utils-cryptography to ethers (#4749)

Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
Co-authored-by: ernestognw <ernestognw@gmail.com>
This commit is contained in:
Renan Souza
2023-11-23 03:35:55 +00:00
committed by GitHub
parent e473bcf859
commit 9702b67ce1
6 changed files with 184 additions and 289 deletions

View File

@ -46,8 +46,9 @@ function domainType(domain) {
}
function hashTypedData(domain, structHash) {
return ethers.keccak256(
Buffer.concat(['0x1901', ethers.TypedDataEncoder.hashDomain(domain), structHash].map(ethers.toBeArray)),
return ethers.solidityPackedKeccak256(
['bytes', 'bytes32', 'bytes32'],
['0x1901', ethers.TypedDataEncoder.hashDomain(domain), structHash],
);
}