From 9b1015bbce81b3f2a245e3dab6eea7c9028ce93b Mon Sep 17 00:00:00 2001 From: Greg Hysen Date: Thu, 10 May 2018 14:22:49 -0700 Subject: Atomic Order Matching - Tests --- packages/contracts/src/utils/exchange_wrapper.ts | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'packages/contracts/src/utils/exchange_wrapper.ts') diff --git a/packages/contracts/src/utils/exchange_wrapper.ts b/packages/contracts/src/utils/exchange_wrapper.ts index 27fdd698f..6d36198f2 100644 --- a/packages/contracts/src/utils/exchange_wrapper.ts +++ b/packages/contracts/src/utils/exchange_wrapper.ts @@ -231,4 +231,26 @@ export class ExchangeWrapper { tx.logs = _.map(tx.logs, log => this._logDecoder.decodeLogOrThrow(log)); return tx; } + public async getOrderInfoAsync( + signedOrder: SignedOrder, + ): Promise<[number /* orderStatus */, string /* orderHash */, BigNumber /* orderTakerAssetAmountFilled */]> { + const orderInfo: [number, string, BigNumber] = await this._exchange.getOrderInfo.callAsync(signedOrder); + return orderInfo; + } + public async matchOrdersAsync( + signedOrderLeft: SignedOrder, + signedOrderRight: SignedOrder, + from: string, + ): Promise { + const params = orderUtils.createMatchOrders(signedOrderLeft, signedOrderRight); + const txHash = await this._exchange.matchOrders.sendTransactionAsync( + params.left, + params.right, + params.leftSignature, + params.rightSignature, + { from }, + ); + const tx = await this._getTxWithDecodedExchangeLogsAsync(txHash); + return tx; + } } -- cgit