aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLeonid Logvinov <logvinov.leon@gmail.com>2017-06-07 22:55:25 +0800
committerLeonid Logvinov <logvinov.leon@gmail.com>2017-06-07 22:55:25 +0800
commit3126279de715d74a73af270a730cf5b0c069634f (patch)
treec3e026384b810989e76598549ffe4c499948ceff /src
parentc3cd5812e61359b18c469f70c9f0240db777e67a (diff)
downloaddexon-sol-tools-3126279de715d74a73af270a730cf5b0c069634f.tar.gz
dexon-sol-tools-3126279de715d74a73af270a730cf5b0c069634f.tar.zst
dexon-sol-tools-3126279de715d74a73af270a730cf5b0c069634f.zip
Use batchCancel for normal cancel
Diffstat (limited to 'src')
-rw-r--r--src/contract_wrappers/exchange_wrapper.ts33
1 files changed, 5 insertions, 28 deletions
diff --git a/src/contract_wrappers/exchange_wrapper.ts b/src/contract_wrappers/exchange_wrapper.ts
index f67a125aa..e4d360690 100644
--- a/src/contract_wrappers/exchange_wrapper.ts
+++ b/src/contract_wrappers/exchange_wrapper.ts
@@ -175,35 +175,12 @@ export class ExchangeWrapper extends ContractWrapper {
/**
* Cancel a given fill amount of an order. Cancellations are cumulative.
*/
- public async cancelOrderAsync(order: Order|SignedOrder, takerTokenCancelAmount: BigNumber.BigNumber): Promise<void> {
- assert.doesConformToSchema('order',
- SchemaValidator.convertToJSONSchemaCompatibleObject(order as object),
- orderSchema);
- assert.isBigNumber('takerTokenCancelAmount', takerTokenCancelAmount);
- await assert.isSenderAddressAvailableAsync(this.web3Wrapper, 'order.maker', order.maker);
-
- const exchangeInstance = await this.getExchangeContractAsync();
- await this.validateCancelOrderAndThrowIfInvalidAsync(order, takerTokenCancelAmount);
-
- const [orderAddresses, orderValues] = ExchangeWrapper.getOrderAddressesAndValues(order);
- const gas = await exchangeInstance.cancel.estimateGas(
- orderAddresses,
- orderValues,
+ public async cancelOrderAsync(
+ order: Order|SignedOrder, takerTokenCancelAmount: BigNumber.BigNumber): Promise<void> {
+ await this.batchCancelOrderAsync([{
+ order,
takerTokenCancelAmount,
- {
- from: order.maker,
- },
- );
- const response: ContractResponse = await exchangeInstance.cancel(
- orderAddresses,
- orderValues,
- takerTokenCancelAmount,
- {
- from: order.maker,
- gas,
- },
- );
- this.throwErrorLogsAsErrors(response.logs);
+ }]);
}
/**
* Batch version of cancelOrderAsync. Atomically cancels multiple orders in a single transaction.