aboutsummaryrefslogtreecommitdiffstats
path: root/packages/order-utils/test/order_hash_test.ts
diff options
context:
space:
mode:
authorJacob Evans <jacob@dekz.net>2018-10-05 09:45:53 +0800
committerJacob Evans <jacob@dekz.net>2018-10-05 15:12:17 +0800
commit75d274f330dc0c18577e764ca77ffb36d5a3f27e (patch)
tree9a70714a89783dfe58ffa002d39f3967de957bdc /packages/order-utils/test/order_hash_test.ts
parent6e462b7dba61611a5347c9aa181d4ae69294d7af (diff)
downloaddexon-0x-contracts-75d274f330dc0c18577e764ca77ffb36d5a3f27e.tar
dexon-0x-contracts-75d274f330dc0c18577e764ca77ffb36d5a3f27e.tar.gz
dexon-0x-contracts-75d274f330dc0c18577e764ca77ffb36d5a3f27e.tar.bz2
dexon-0x-contracts-75d274f330dc0c18577e764ca77ffb36d5a3f27e.tar.lz
dexon-0x-contracts-75d274f330dc0c18577e764ca77ffb36d5a3f27e.tar.xz
dexon-0x-contracts-75d274f330dc0c18577e764ca77ffb36d5a3f27e.tar.zst
dexon-0x-contracts-75d274f330dc0c18577e764ca77ffb36d5a3f27e.zip
Return SignedOrder from signing utils.
Create a helper back in EIP712Utils for code cleanup. Moved constants in order-utils into the constants object
Diffstat (limited to 'packages/order-utils/test/order_hash_test.ts')
-rw-r--r--packages/order-utils/test/order_hash_test.ts14
1 files changed, 14 insertions, 0 deletions
diff --git a/packages/order-utils/test/order_hash_test.ts b/packages/order-utils/test/order_hash_test.ts
index 3fdbbad21..fe44218d6 100644
--- a/packages/order-utils/test/order_hash_test.ts
+++ b/packages/order-utils/test/order_hash_test.ts
@@ -35,6 +35,20 @@ describe('Order hashing', () => {
const orderHash = orderHashUtils.getOrderHashHex(order);
expect(orderHash).to.be.equal(expectedOrderHash);
});
+ it('calculates the order hash if amounts are strings', async () => {
+ // It's common for developers using javascript to provide the amounts
+ // as strings. Since we eventually toString() the BigNumber
+ // before encoding we should result in the same orderHash in this scenario
+ // tslint:disable-next-line:no-unnecessary-type-assertion
+ const orderHash = orderHashUtils.getOrderHashHex({
+ ...order,
+ makerAssetAmount: '0',
+ takerAssetAmount: '0',
+ makerFee: '0',
+ takerFee: '0',
+ } as any);
+ expect(orderHash).to.be.equal(expectedOrderHash);
+ });
it('throws a readable error message if taker format is invalid', async () => {
const orderWithInvalidtakerFormat = {
...order,