diff options
author | Jacob Evans <jacob@dekz.net> | 2018-06-08 07:03:14 +0800 |
---|---|---|
committer | Jacob Evans <jacob@dekz.net> | 2018-06-08 07:09:30 +0800 |
commit | a8d328bfc926a62d61830334fadc43fc5d013e0e (patch) | |
tree | d07cc75b63623a5a795b74c02b52d56edf392e90 /packages/order-utils/src/order_hash.ts | |
parent | a59e9f024e76122c76600d938b565ea47938b287 (diff) | |
download | dexon-0x-contracts-a8d328bfc926a62d61830334fadc43fc5d013e0e.tar dexon-0x-contracts-a8d328bfc926a62d61830334fadc43fc5d013e0e.tar.gz dexon-0x-contracts-a8d328bfc926a62d61830334fadc43fc5d013e0e.tar.bz2 dexon-0x-contracts-a8d328bfc926a62d61830334fadc43fc5d013e0e.tar.lz dexon-0x-contracts-a8d328bfc926a62d61830334fadc43fc5d013e0e.tar.xz dexon-0x-contracts-a8d328bfc926a62d61830334fadc43fc5d013e0e.tar.zst dexon-0x-contracts-a8d328bfc926a62d61830334fadc43fc5d013e0e.zip |
Basic EIP712 encoder
Diffstat (limited to 'packages/order-utils/src/order_hash.ts')
-rw-r--r-- | packages/order-utils/src/order_hash.ts | 19 |
1 files changed, 1 insertions, 18 deletions
diff --git a/packages/order-utils/src/order_hash.ts b/packages/order-utils/src/order_hash.ts index b2414febc..46cce4b3b 100644 --- a/packages/order-utils/src/order_hash.ts +++ b/packages/order-utils/src/order_hash.ts @@ -75,24 +75,7 @@ export const orderHashUtils = { * @return The resulting orderHash from hashing the supplied order as a Buffer */ getOrderHashBuffer(order: SignedOrder | Order): Buffer { - const makerAssetDataHash = crypto.solSHA3([ethUtil.toBuffer(order.makerAssetData)]); - const takerAssetDataHash = crypto.solSHA3([ethUtil.toBuffer(order.takerAssetData)]); - - const orderParamsHashBuff = crypto.solSHA3([ - orderHashUtils._getOrderSchemaBuffer(), - EIP712Utils.pad32Address(order.makerAddress), - EIP712Utils.pad32Address(order.takerAddress), - EIP712Utils.pad32Address(order.feeRecipientAddress), - EIP712Utils.pad32Address(order.senderAddress), - order.makerAssetAmount, - order.takerAssetAmount, - order.makerFee, - order.takerFee, - order.expirationTimeSeconds, - order.salt, - makerAssetDataHash, - takerAssetDataHash, - ]); + const orderParamsHashBuff = EIP712Utils.structHash(EIP712_ORDER_SCHEMA, order); const orderHashBuff = EIP712Utils.createEIP712Message(orderParamsHashBuff, order.exchangeAddress); return orderHashBuff; }, |