Merge branch 'master' into batchFillOrKill
This commit is contained in:
commit
f25447aa3d
@ -394,6 +394,12 @@ export class ExchangeWrapper extends ContractWrapper {
|
|||||||
const orderHashHex = utils.getOrderHashHex(order, exchangeInstance.address);
|
const orderHashHex = utils.getOrderHashHex(order, exchangeInstance.address);
|
||||||
return orderHashHex;
|
return orderHashHex;
|
||||||
}
|
}
|
||||||
|
private async getOrderHashHexUsingContractCallAsync(order: Order|SignedOrder): Promise<string> {
|
||||||
|
const exchangeInstance = await this.getExchangeContractAsync();
|
||||||
|
const [orderAddresses, orderValues] = ExchangeWrapper.getOrderAddressesAndValues(order);
|
||||||
|
const orderHashHex = await exchangeInstance.getOrderHash.call(orderAddresses, orderValues);
|
||||||
|
return orderHashHex;
|
||||||
|
}
|
||||||
private async stopWatchingExchangeLogEventsAsync() {
|
private async stopWatchingExchangeLogEventsAsync() {
|
||||||
const stopWatchingPromises = _.map(this.exchangeLogEventObjs, logEventObj => {
|
const stopWatchingPromises = _.map(this.exchangeLogEventObjs, logEventObj => {
|
||||||
return promisify(logEventObj.stopWatching, logEventObj)();
|
return promisify(logEventObj.stopWatching, logEventObj)();
|
||||||
|
@ -686,4 +686,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);
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user