From 464e761053e1f84a05dbc6af2512effafa8d6350 Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Thu, 8 Jun 2017 12:03:14 +0200 Subject: Add getOrderHashHexUsingContractCallAsync --- test/exchange_wrapper_test.ts | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'test') diff --git a/test/exchange_wrapper_test.ts b/test/exchange_wrapper_test.ts index 08936f1d2..6fef91946 100644 --- a/test/exchange_wrapper_test.ts +++ b/test/exchange_wrapper_test.ts @@ -661,4 +661,26 @@ describe('ExchangeWrapper', () => { })(); }); }); + describe('#getOrderHashHexUsingContractCallAsync', () => { + let makerTokenAddress: string; + let takerTokenAddress: string; + let makerAddress: string; + let takerAddress: string; + const fillableAmount = new BigNumber(5); + before(async () => { + [, makerAddress, takerAddress] = userAddresses; + const [makerToken, takerToken] = tokenUtils.getNonProtocolTokens(); + makerTokenAddress = makerToken.address; + takerTokenAddress = takerToken.address; + }); + it('get\'s the same hash as the local function', async () => { + const signedOrder = await fillScenarios.createFillableSignedOrderAsync( + makerTokenAddress, takerTokenAddress, makerAddress, takerAddress, fillableAmount, + ); + const orderHash = await zeroEx.getOrderHashHexAsync(signedOrder); + const orderHashFromContract = await (zeroEx.exchange as any) + .getOrderHashHexUsingContractCallAsync(signedOrder); + expect(orderHash).to.equal(orderHashFromContract); + }); + }); }); -- cgit v1.2.3