In @0x/contracts-test-utils add generatePseudoRandomOrderHash() to orderUtils.

This commit is contained in:
Lawrence Forman
2019-04-04 12:42:29 -04:00
committed by Amir Bandeali
parent 3a6664282c
commit 79cf9156eb
2 changed files with 12 additions and 0 deletions

View File

@@ -1,3 +1,5 @@
import { generatePseudoRandomSalt } from '@0x/order-utils';
import { crypto } from '@0x/order-utils/lib/src/crypto';
import { OrderWithoutDomain, SignedOrder } from '@0x/types';
import { BigNumber } from '@0x/utils';
import * as _ from 'lodash';
@@ -42,4 +44,10 @@ export const orderUtils = {
fill.right.takerAssetData = constants.NULL_BYTES;
return fill;
},
generatePseudoRandomOrderHash(): string {
const randomBigNum = generatePseudoRandomSalt();
const randomBuff = crypto.solSHA3([randomBigNum]);
const randomHash = `0x${randomBuff.toString('hex')}`;
return randomHash;
},
};