aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLeonid Logvinov <logvinov.leon@gmail.com>2017-06-22 19:41:07 +0800
committerLeonid Logvinov <logvinov.leon@gmail.com>2017-06-22 19:41:07 +0800
commit0dbad86d239cc1afb9df3c805a7567180b458b36 (patch)
tree2d2f32712734d00250b769f551aafa6686371eb4
parentd088dcdd36ddab32568bd8b71fb59cb59e52acc2 (diff)
downloaddexon-sol-tools-0dbad86d239cc1afb9df3c805a7567180b458b36.tar
dexon-sol-tools-0dbad86d239cc1afb9df3c805a7567180b458b36.tar.gz
dexon-sol-tools-0dbad86d239cc1afb9df3c805a7567180b458b36.tar.bz2
dexon-sol-tools-0dbad86d239cc1afb9df3c805a7567180b458b36.tar.lz
dexon-sol-tools-0dbad86d239cc1afb9df3c805a7567180b458b36.tar.xz
dexon-sol-tools-0dbad86d239cc1afb9df3c805a7567180b458b36.tar.zst
dexon-sol-tools-0dbad86d239cc1afb9df3c805a7567180b458b36.zip
Return cancelledAmount from cancelOrderAsync
-rw-r--r--src/contract_wrappers/exchange_wrapper.ts7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/contract_wrappers/exchange_wrapper.ts b/src/contract_wrappers/exchange_wrapper.ts
index f47e7a5ac..92c18e3e0 100644
--- a/src/contract_wrappers/exchange_wrapper.ts
+++ b/src/contract_wrappers/exchange_wrapper.ts
@@ -28,6 +28,7 @@ import {
OrderFillRequest,
LogErrorContractEventArgs,
LogFillContractEventArgs,
+ LogCancelContractEventArgs,
} from '../types';
import {assert} from '../utils/assert';
import {utils} from '../utils/utils';
@@ -443,10 +444,11 @@ export class ExchangeWrapper extends ContractWrapper {
* @param order An object that conforms to the Order or SignedOrder interface.
* The order you would like to cancel.
* @param takerTokenCancelAmount The amount (specified in taker tokens) that you would like to cancel.
+ * @returns The amount of the order that was cancelled (in taker token baseUnits).
*/
@decorators.contractCallErrorHandler
public async cancelOrderAsync(
- order: Order|SignedOrder, takerTokenCancelAmount: BigNumber.BigNumber): Promise<void> {
+ order: Order|SignedOrder, takerTokenCancelAmount: BigNumber.BigNumber): Promise<BigNumber.BigNumber> {
assert.doesConformToSchema('order', order, orderSchema);
assert.isBigNumber('takerTokenCancelAmount', takerTokenCancelAmount);
await assert.isSenderAddressAsync('order.maker', order.maker, this._web3Wrapper);
@@ -473,6 +475,9 @@ export class ExchangeWrapper extends ContractWrapper {
},
);
this._throwErrorLogsAsErrors(response.logs);
+ const logFillArgs = response.logs[0].args as LogCancelContractEventArgs;
+ const cancelledAmount = new BigNumber(logFillArgs.cancelledValueT);
+ return cancelledAmount;
}
/**
* Batch version of cancelOrderAsync. Atomically cancels multiple orders in a single transaction.