aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLeonid Logvinov <logvinov.leon@gmail.com>2017-06-08 17:16:06 +0800
committerLeonid Logvinov <logvinov.leon@gmail.com>2017-06-08 17:16:06 +0800
commit32ba65ee265d6acc3fe8ff87a5a36df36cd9a3d5 (patch)
tree5f9de5948df1b471c93d3445a3deda7ac75d935a /src
parent80294873c16aed756d2d6c321396d6e97b2e9b03 (diff)
downloaddexon-sol-tools-32ba65ee265d6acc3fe8ff87a5a36df36cd9a3d5.tar
dexon-sol-tools-32ba65ee265d6acc3fe8ff87a5a36df36cd9a3d5.tar.gz
dexon-sol-tools-32ba65ee265d6acc3fe8ff87a5a36df36cd9a3d5.tar.bz2
dexon-sol-tools-32ba65ee265d6acc3fe8ff87a5a36df36cd9a3d5.tar.lz
dexon-sol-tools-32ba65ee265d6acc3fe8ff87a5a36df36cd9a3d5.tar.xz
dexon-sol-tools-32ba65ee265d6acc3fe8ff87a5a36df36cd9a3d5.tar.zst
dexon-sol-tools-32ba65ee265d6acc3fe8ff87a5a36df36cd9a3d5.zip
Address feedback
Diffstat (limited to 'src')
-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(