diff options
author | Leonid Logvinov <logvinov.leon@gmail.com> | 2017-06-08 16:58:14 +0800 |
---|---|---|
committer | Leonid Logvinov <logvinov.leon@gmail.com> | 2017-06-08 16:58:14 +0800 |
commit | 5ba4cd22e3a14f60666f4092ab00a012ff7786a4 (patch) | |
tree | 8ee9ae067efa81d2d1c16610fa0f065ef0fba713 /src | |
parent | 007102f2de38b59d54debd849719c525972ef2b4 (diff) | |
download | dexon-sol-tools-5ba4cd22e3a14f60666f4092ab00a012ff7786a4.tar.gz dexon-sol-tools-5ba4cd22e3a14f60666f4092ab00a012ff7786a4.tar.zst dexon-sol-tools-5ba4cd22e3a14f60666f4092ab00a012ff7786a4.zip |
Address feedback
Diffstat (limited to 'src')
-rw-r--r-- | src/contract_wrappers/exchange_wrapper.ts | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/contract_wrappers/exchange_wrapper.ts b/src/contract_wrappers/exchange_wrapper.ts index 7ffcd824c..0e0fb2f6f 100644 --- a/src/contract_wrappers/exchange_wrapper.ts +++ b/src/contract_wrappers/exchange_wrapper.ts @@ -260,16 +260,17 @@ export class ExchangeWrapper extends ContractWrapper { } /** * Batch version of cancelOrderAsync. Atomically cancels multiple orders in a single transaction. + * All orders must be from the same maker. */ - public async batchCancelOrderAsync(cancellationRequestsBatch: OrderCancellationRequest[]): Promise<void> { - const makers = _.map(cancellationRequestsBatch, cancellationRequest => cancellationRequest.order.maker); - if (_.isEmpty(cancellationRequestsBatch)) { + public async batchCancelOrderAsync(orderCancellationRequests: OrderCancellationRequest[]): Promise<void> { + const makers = _.map(orderCancellationRequests, cancellationRequest => cancellationRequest.order.maker); + if (_.isEmpty(orderCancellationRequests)) { return; } 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(cancellationRequestsBatch, + _.forEach(orderCancellationRequests, async (cancellationRequest: OrderCancellationRequest, i: number) => { assert.doesConformToSchema(`orderCancellationRequests[${i}].order`, SchemaValidator.convertToJSONSchemaCompatibleObject(cancellationRequest.order as object), orderSchema); @@ -279,7 +280,7 @@ export class ExchangeWrapper extends ContractWrapper { cancellationRequest.order, cancellationRequest.takerTokenCancelAmount); }); const exchangeInstance = await this.getExchangeContractAsync(); - const orderAddressesValuesAndTakerTokenCancelAmounts = _.map(cancellationRequestsBatch, cancellationRequest => { + const orderAddressesValuesAndTakerTokenCancelAmounts = _.map(orderCancellationRequests, cancellationRequest => { return [ ...ExchangeWrapper.getOrderAddressesAndValues(cancellationRequest.order), cancellationRequest.takerTokenCancelAmount, |