diff options
author | Greg Hysen <greg.hysen@gmail.com> | 2018-05-11 05:22:49 +0800 |
---|---|---|
committer | Greg Hysen <greg.hysen@gmail.com> | 2018-05-19 08:01:05 +0800 |
commit | 9b1015bbce81b3f2a245e3dab6eea7c9028ce93b (patch) | |
tree | 3c698977176d907e04a8cfe0716f5d1f36167398 /packages/contracts/src/utils/exchange_wrapper.ts | |
parent | a4c821eb60c227df4512d6c24ce0e5239b8bb6ce (diff) | |
download | dexon-0x-contracts-9b1015bbce81b3f2a245e3dab6eea7c9028ce93b.tar dexon-0x-contracts-9b1015bbce81b3f2a245e3dab6eea7c9028ce93b.tar.gz dexon-0x-contracts-9b1015bbce81b3f2a245e3dab6eea7c9028ce93b.tar.bz2 dexon-0x-contracts-9b1015bbce81b3f2a245e3dab6eea7c9028ce93b.tar.lz dexon-0x-contracts-9b1015bbce81b3f2a245e3dab6eea7c9028ce93b.tar.xz dexon-0x-contracts-9b1015bbce81b3f2a245e3dab6eea7c9028ce93b.tar.zst dexon-0x-contracts-9b1015bbce81b3f2a245e3dab6eea7c9028ce93b.zip |
Atomic Order Matching - Tests
Diffstat (limited to 'packages/contracts/src/utils/exchange_wrapper.ts')
-rw-r--r-- | packages/contracts/src/utils/exchange_wrapper.ts | 22 |
1 files changed, 22 insertions, 0 deletions
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<TransactionReceiptWithDecodedLogs> { + 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; + } } |