aboutsummaryrefslogtreecommitdiffstats
path: root/packages/contracts/src/utils
diff options
context:
space:
mode:
authorAmir Bandeali <abandeali1@gmail.com>2018-03-09 07:58:21 +0800
committerAmir Bandeali <abandeali1@gmail.com>2018-04-21 04:56:16 +0800
commit2c44c7ea8333dd26e96acd7869ee60cc1d177da4 (patch)
tree4a35f1fd448ab10461bf6f25607d4224cc97b6fc /packages/contracts/src/utils
parent9cc1956b4b25081810680d79b12f80727c96c1ef (diff)
downloaddexon-sol-tools-2c44c7ea8333dd26e96acd7869ee60cc1d177da4.tar
dexon-sol-tools-2c44c7ea8333dd26e96acd7869ee60cc1d177da4.tar.gz
dexon-sol-tools-2c44c7ea8333dd26e96acd7869ee60cc1d177da4.tar.bz2
dexon-sol-tools-2c44c7ea8333dd26e96acd7869ee60cc1d177da4.tar.lz
dexon-sol-tools-2c44c7ea8333dd26e96acd7869ee60cc1d177da4.tar.xz
dexon-sol-tools-2c44c7ea8333dd26e96acd7869ee60cc1d177da4.tar.zst
dexon-sol-tools-2c44c7ea8333dd26e96acd7869ee60cc1d177da4.zip
Add fillOrderNoThrow to exchange wrapper and add test
Diffstat (limited to 'packages/contracts/src/utils')
-rw-r--r--packages/contracts/src/utils/exchange_wrapper.ts21
1 files changed, 21 insertions, 0 deletions
diff --git a/packages/contracts/src/utils/exchange_wrapper.ts b/packages/contracts/src/utils/exchange_wrapper.ts
index 04e6c2feb..9dd414be2 100644
--- a/packages/contracts/src/utils/exchange_wrapper.ts
+++ b/packages/contracts/src/utils/exchange_wrapper.ts
@@ -81,6 +81,27 @@ export class ExchangeWrapper {
});
return tx;
}
+ public async fillOrderNoThrowAsync(
+ signedOrder: SignedOrder,
+ from: string,
+ opts: { takerTokenFillAmount?: BigNumber } = {},
+ ): Promise<TransactionReceiptWithDecodedLogs> {
+ const params = orderUtils.createFill(signedOrder, opts.takerTokenFillAmount);
+ const txHash = await this._exchange.fillOrderNoThrow.sendTransactionAsync(
+ params.order,
+ params.takerTokenFillAmount,
+ params.signature,
+ { from },
+ );
+ const tx = await this._zeroEx.awaitTransactionMinedAsync(txHash);
+ tx.logs = _.filter(tx.logs, log => log.address === this._exchange.address);
+ tx.logs = _.map(tx.logs, log => {
+ const logWithDecodedArgs = this._logDecoder.decodeLogOrThrow(log);
+ wrapLogBigNumbers(logWithDecodedArgs);
+ return logWithDecodedArgs;
+ });
+ return tx;
+ }
public async batchFillOrdersAsync(
orders: SignedOrder[],
from: string,