aboutsummaryrefslogtreecommitdiffstats
path: root/src/contract_wrappers/exchange_wrapper.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/contract_wrappers/exchange_wrapper.ts')
-rw-r--r--src/contract_wrappers/exchange_wrapper.ts15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/contract_wrappers/exchange_wrapper.ts b/src/contract_wrappers/exchange_wrapper.ts
index 0e0fb2f6f..d144d8aad 100644
--- a/src/contract_wrappers/exchange_wrapper.ts
+++ b/src/contract_wrappers/exchange_wrapper.ts
@@ -263,21 +263,24 @@ export class ExchangeWrapper extends ContractWrapper {
* All orders must be from the same maker.
*/
public async batchCancelOrderAsync(orderCancellationRequests: OrderCancellationRequest[]): Promise<void> {
- const makers = _.map(orderCancellationRequests, cancellationRequest => cancellationRequest.order.maker);
if (_.isEmpty(orderCancellationRequests)) {
- return;
+ return; // no-op
}
+ const makers = _.map(orderCancellationRequests, cancellationRequest => cancellationRequest.order.maker);
assert.assert(_.uniq(makers).length === 1, ExchangeContractErrs.MULTIPLE_MAKERS_IN_SINGLE_CANCEL_BATCH);
const maker = makers[0];
await assert.isSenderAddressAvailableAsync(this.web3Wrapper, 'maker', maker);
_.forEach(orderCancellationRequests,
async (cancellationRequest: OrderCancellationRequest, i: number) => {
assert.doesConformToSchema(`orderCancellationRequests[${i}].order`,
- SchemaValidator.convertToJSONSchemaCompatibleObject(cancellationRequest.order as object), orderSchema);
+ SchemaValidator.convertToJSONSchemaCompatibleObject(cancellationRequest.order as object), orderSchema,
+ );
assert.isBigNumber(`orderCancellationRequests[${i}].takerTokenCancelAmount`,
- cancellationRequest.takerTokenCancelAmount);
+ cancellationRequest.takerTokenCancelAmount,
+ );
await this.validateCancelOrderAndThrowIfInvalidAsync(
- cancellationRequest.order, cancellationRequest.takerTokenCancelAmount);
+ cancellationRequest.order, cancellationRequest.takerTokenCancelAmount,
+ );
});
const exchangeInstance = await this.getExchangeContractAsync();
const orderAddressesValuesAndTakerTokenCancelAmounts = _.map(orderCancellationRequests, cancellationRequest => {
@@ -286,7 +289,7 @@ export class ExchangeWrapper extends ContractWrapper {
cancellationRequest.takerTokenCancelAmount,
];
});
- // _.unzip doesn't type check if values have different types :'(
+ // We use _.unzip<any> because _.unzip doesn't type check if values have different types :'(
const [orderAddresses, orderValues, takerTokenCancelAmounts] =
_.unzip<any>(orderAddressesValuesAndTakerTokenCancelAmounts);
const gas = await exchangeInstance.batchCancel.estimateGas(