@0x:contracts-exchange-libs Added unit tests to exchange-libs

This commit is contained in:
Alex Towle
2019-08-09 17:17:56 -07:00
parent e3aa76cd09
commit c318b849fe
6 changed files with 364 additions and 19 deletions

View File

@@ -20,6 +20,15 @@ export const signTypedDataUtils = {
]),
);
},
/**
* Generates the EIP712 Typed Data hash for a typed data object without using the domain field. This
* makes hashing easier for non-EIP712 data.
* @param typedData An object that conforms to the EIP712TypedData interface
* @return A Buffer containing the hash of the typed data.
*/
generateTypedDataHashWithoutDomain(typedData: EIP712TypedData): Buffer {
return signTypedDataUtils._structHash(typedData.primaryType, typedData.message, typedData.types);
},
/**
* Generates the hash of a EIP712 Domain with the default schema
* @param domain An EIP712 domain with the default schema containing a name, version, chain id,