diff options
author | F. Eugene Aumson <feuGeneA@users.noreply.github.com> | 2018-11-14 05:30:12 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-11-14 05:30:12 +0800 |
commit | 7b4f63a39ca4b4e05123d2b6871c6e01f8a132a2 (patch) | |
tree | 0ea077c2041a77203f90b4f696edfdff7bc6f943 /packages/utils | |
parent | 5c21d3f6af2ffc513b2bbfe92abf99181a32ceca (diff) | |
download | dexon-0x-contracts-7b4f63a39ca4b4e05123d2b6871c6e01f8a132a2.tar.gz dexon-0x-contracts-7b4f63a39ca4b4e05123d2b6871c6e01f8a132a2.tar.zst dexon-0x-contracts-7b4f63a39ca4b4e05123d2b6871c6e01f8a132a2.zip |
feat(order_utils.py) generate_order_hash_hex() (#1234)
Diffstat (limited to 'packages/utils')
-rw-r--r-- | packages/utils/test/sign_typed_data_utils_test.ts | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/packages/utils/test/sign_typed_data_utils_test.ts b/packages/utils/test/sign_typed_data_utils_test.ts index dcba08b04..3d2cb2496 100644 --- a/packages/utils/test/sign_typed_data_utils_test.ts +++ b/packages/utils/test/sign_typed_data_utils_test.ts @@ -136,5 +136,28 @@ describe('signTypedDataUtils', () => { const hashHex = `0x${hash}`; expect(hashHex).to.be.eq(orderSignTypedDataHashHex); }); + it('creates a hash of an uninitialized order', () => { + const uninitializedOrder = { + ...orderSignTypedData, + message: { + makerAddress: '0x0000000000000000000000000000000000000000', + takerAddress: '0x0000000000000000000000000000000000000000', + makerAssetAmount: 0, + takerAssetAmount: 0, + expirationTimeSeconds: 0, + makerFee: 0, + takerFee: 0, + feeRecipientAddress: '0x0000000000000000000000000000000000000000', + senderAddress: '0x0000000000000000000000000000000000000000', + salt: 0, + makerAssetData: '0x0000000000000000000000000000000000000000', + takerAssetData: '0x0000000000000000000000000000000000000000', + exchangeAddress: '0x0000000000000000000000000000000000000000', + }, + }; + const hash = signTypedDataUtils.generateTypedDataHash(uninitializedOrder).toString('hex'); + const hashHex = `0x${hash}`; + expect(hashHex).to.be.eq('0xfaa49b35faeb9197e9c3ba7a52075e6dad19739549f153b77dfcf59408a4b422'); + }); }); }); |