Add getOrderHashHexUsingContractCallAsync

This commit is contained in:
Leonid Logvinov
2017-06-08 12:03:14 +02:00
parent c6645f9f4f
commit 464e761053
2 changed files with 28 additions and 0 deletions

View File

@@ -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);
});
});
});