Update order utils

This commit is contained in:
Amir Bandeali
2018-03-08 10:42:06 -08:00
parent 6bfc02d79d
commit 49f6c20b20

View File

@@ -53,8 +53,7 @@ export const orderUtils = {
'uint256 expirationTimeSeconds', 'uint256 expirationTimeSeconds',
'uint256 salt', 'uint256 salt',
]); ]);
const orderSchemaHashHex = `0x${orderSchemaHashBuff.toString('hex')}`; const orderParamsHashBuff = crypto.solSHA3([
const orderHashBuff = crypto.solSHA3([
order.exchangeAddress, order.exchangeAddress,
order.makerAddress, order.makerAddress,
order.takerAddress, order.takerAddress,
@@ -68,9 +67,10 @@ export const orderUtils = {
order.expirationTimeSeconds, order.expirationTimeSeconds,
order.salt, order.salt,
]); ]);
const orderHashHex = `0x${orderHashBuff.toString('hex')}`; const orderSchemaHashHex = `0x${orderSchemaHashBuff.toString('hex')}`;
const prefixedOrderHashBuff = crypto.solSHA3([new BigNumber(orderSchemaHashHex), new BigNumber(orderHashHex)]); const orderParamsHashHex = `0x${orderParamsHashBuff.toString('hex')}`;
return prefixedOrderHashBuff; const orderHashBuff = crypto.solSHA3([new BigNumber(orderSchemaHashHex), new BigNumber(orderParamsHashHex)]);
return orderHashBuff;
}, },
getOrderHashHex(order: SignedOrder | UnsignedOrder): string { getOrderHashHex(order: SignedOrder | UnsignedOrder): string {
const orderHashBuff = orderUtils.getOrderHashBuff(order); const orderHashBuff = orderUtils.getOrderHashBuff(order);