aboutsummaryrefslogtreecommitdiffstats
path: root/src/contract_wrappers
diff options
context:
space:
mode:
authorLeonid Logvinov <logvinov.leon@gmail.com>2017-06-21 23:48:03 +0800
committerLeonid Logvinov <logvinov.leon@gmail.com>2017-06-21 23:55:21 +0800
commit42c61ecda5c29018b5984fb377eb9a3ba5cb1c86 (patch)
tree4c4a4da164839164092320e070e6f455796ff01b /src/contract_wrappers
parent656d74518d0d634febcb9e7f5540e85729530843 (diff)
downloaddexon-sol-tools-42c61ecda5c29018b5984fb377eb9a3ba5cb1c86.tar
dexon-sol-tools-42c61ecda5c29018b5984fb377eb9a3ba5cb1c86.tar.gz
dexon-sol-tools-42c61ecda5c29018b5984fb377eb9a3ba5cb1c86.tar.bz2
dexon-sol-tools-42c61ecda5c29018b5984fb377eb9a3ba5cb1c86.tar.lz
dexon-sol-tools-42c61ecda5c29018b5984fb377eb9a3ba5cb1c86.tar.xz
dexon-sol-tools-42c61ecda5c29018b5984fb377eb9a3ba5cb1c86.tar.zst
dexon-sol-tools-42c61ecda5c29018b5984fb377eb9a3ba5cb1c86.zip
Return filledAmount from fillOrderAsync
Diffstat (limited to 'src/contract_wrappers')
-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 6d42dc110..1044362a2 100644
--- a/src/contract_wrappers/exchange_wrapper.ts
+++ b/src/contract_wrappers/exchange_wrapper.ts
@@ -27,6 +27,7 @@ import {
OrderCancellationRequest,
OrderFillRequest,
LogErrorContractEventArgs,
+ LogFillContractEventArgs,
} from '../types';
import {assert} from '../utils/assert';
import {utils} from '../utils/utils';
@@ -144,10 +145,11 @@ export class ExchangeWrapper extends ContractWrapper {
* execution the tokens cannot be transferred.
* @param takerAddress The user Ethereum address who would like to fill this order.
* Must be available via the supplied Web3.Provider passed to 0x.js.
+ * @return The amount of the order (in taker tokens baseUnits) that was filled.
*/
@decorators.contractCallErrorHandler
public async fillOrderAsync(signedOrder: SignedOrder, takerTokenFillAmount: BigNumber.BigNumber,
- shouldCheckTransfer: boolean, takerAddress: string): Promise<void> {
+ shouldCheckTransfer: boolean, takerAddress: string): Promise<BigNumber.BigNumber> {
assert.doesConformToSchema('signedOrder', signedOrder, signedOrderSchema);
assert.isBigNumber('takerTokenFillAmount', takerTokenFillAmount);
assert.isBoolean('shouldCheckTransfer', shouldCheckTransfer);
@@ -184,6 +186,9 @@ export class ExchangeWrapper extends ContractWrapper {
},
);
this._throwErrorLogsAsErrors(response.logs);
+ const logFillArgs = response.logs[0].args as LogFillContractEventArgs;
+ const filledAmount = new BigNumber(logFillArgs.filledValueT);
+ return filledAmount;
}
/**
* Sequentially and atomically fills signedOrders up to the specified takerTokenFillAmount.