diff options
author | Leonid Logvinov <logvinov.leon@gmail.com> | 2017-06-08 16:51:13 +0800 |
---|---|---|
committer | Leonid Logvinov <logvinov.leon@gmail.com> | 2017-06-08 16:52:07 +0800 |
commit | 007102f2de38b59d54debd849719c525972ef2b4 (patch) | |
tree | cc0b315bd847284d6fd53aca1c89a9adbc99b529 /src | |
parent | 41f005a676b69311099441b170b277e76d5ca25b (diff) | |
download | dexon-0x-contracts-007102f2de38b59d54debd849719c525972ef2b4.tar dexon-0x-contracts-007102f2de38b59d54debd849719c525972ef2b4.tar.gz dexon-0x-contracts-007102f2de38b59d54debd849719c525972ef2b4.tar.bz2 dexon-0x-contracts-007102f2de38b59d54debd849719c525972ef2b4.tar.lz dexon-0x-contracts-007102f2de38b59d54debd849719c525972ef2b4.tar.xz dexon-0x-contracts-007102f2de38b59d54debd849719c525972ef2b4.tar.zst dexon-0x-contracts-007102f2de38b59d54debd849719c525972ef2b4.zip |
Don't use batch function for normal one
Diffstat (limited to 'src')
-rw-r--r-- | src/contract_wrappers/exchange_wrapper.ts | 30 |
1 files changed, 27 insertions, 3 deletions
diff --git a/src/contract_wrappers/exchange_wrapper.ts b/src/contract_wrappers/exchange_wrapper.ts index 47c49fad6..7ffcd824c 100644 --- a/src/contract_wrappers/exchange_wrapper.ts +++ b/src/contract_wrappers/exchange_wrapper.ts @@ -229,10 +229,34 @@ export class ExchangeWrapper extends ContractWrapper { */ public async cancelOrderAsync( order: Order|SignedOrder, takerTokenCancelAmount: BigNumber.BigNumber): Promise<void> { - await this.batchCancelOrderAsync([{ - order, + 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, + 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. |