In @0x/contracts-test-utils add generatePseudoRandomOrderHash() to orderUtils.
This commit is contained in:
committed by
Amir Bandeali
parent
3a6664282c
commit
79cf9156eb
@@ -13,6 +13,10 @@
|
|||||||
{
|
{
|
||||||
"note": "Inherit `chaiSetup` from `@0x/dev-utils`",
|
"note": "Inherit `chaiSetup` from `@0x/dev-utils`",
|
||||||
"pr": TODO
|
"pr": TODO
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"note": "Add `generatePseudoRandomOrderHash()` to `orderUtils`",
|
||||||
|
"pr": TODO
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -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 { OrderWithoutDomain, SignedOrder } from '@0x/types';
|
||||||
import { BigNumber } from '@0x/utils';
|
import { BigNumber } from '@0x/utils';
|
||||||
import * as _ from 'lodash';
|
import * as _ from 'lodash';
|
||||||
@@ -42,4 +44,10 @@ export const orderUtils = {
|
|||||||
fill.right.takerAssetData = constants.NULL_BYTES;
|
fill.right.takerAssetData = constants.NULL_BYTES;
|
||||||
return fill;
|
return fill;
|
||||||
},
|
},
|
||||||
|
generatePseudoRandomOrderHash(): string {
|
||||||
|
const randomBigNum = generatePseudoRandomSalt();
|
||||||
|
const randomBuff = crypto.solSHA3([randomBigNum]);
|
||||||
|
const randomHash = `0x${randomBuff.toString('hex')}`;
|
||||||
|
return randomHash;
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user