diff options
author | Brandon Millman <brandon.millman@gmail.com> | 2018-07-31 08:43:02 +0800 |
---|---|---|
committer | Brandon Millman <brandon.millman@gmail.com> | 2018-07-31 15:11:28 +0800 |
commit | 045751a430c512d94bf7e515d7531bac68dc2179 (patch) | |
tree | 6cde58036f3c7090784b38b8ced3341905bf5c71 /packages/contract-wrappers/src/contract_wrappers/exchange_wrapper.ts | |
parent | a7238d0fdb302d7062f3f63c3119910286f992c5 (diff) | |
download | dexon-0x-contracts-045751a430c512d94bf7e515d7531bac68dc2179.tar dexon-0x-contracts-045751a430c512d94bf7e515d7531bac68dc2179.tar.gz dexon-0x-contracts-045751a430c512d94bf7e515d7531bac68dc2179.tar.bz2 dexon-0x-contracts-045751a430c512d94bf7e515d7531bac68dc2179.tar.lz dexon-0x-contracts-045751a430c512d94bf7e515d7531bac68dc2179.tar.xz dexon-0x-contracts-045751a430c512d94bf7e515d7531bac68dc2179.tar.zst dexon-0x-contracts-045751a430c512d94bf7e515d7531bac68dc2179.zip |
Add getOrdersInfo to exchange_wrapper
Diffstat (limited to 'packages/contract-wrappers/src/contract_wrappers/exchange_wrapper.ts')
-rw-r--r-- | packages/contract-wrappers/src/contract_wrappers/exchange_wrapper.ts | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/packages/contract-wrappers/src/contract_wrappers/exchange_wrapper.ts b/packages/contract-wrappers/src/contract_wrappers/exchange_wrapper.ts index 3e7619228..48bd00f90 100644 --- a/packages/contract-wrappers/src/contract_wrappers/exchange_wrapper.ts +++ b/packages/contract-wrappers/src/contract_wrappers/exchange_wrapper.ts @@ -869,16 +869,36 @@ export class ExchangeWrapper extends ContractWrapper { */ @decorators.asyncZeroExErrorHandler public async getOrderInfoAsync(order: Order | SignedOrder, methodOpts: MethodOpts = {}): Promise<OrderInfo> { + assert.doesConformToSchema('order', order, schemas.orderSchema); if (!_.isUndefined(methodOpts)) { assert.doesConformToSchema('methodOpts', methodOpts, methodOptsSchema); } const exchangeInstance = await this._getExchangeContractAsync(); - const txData = {}; const orderInfo = await exchangeInstance.getOrderInfo.callAsync(order, txData, methodOpts.defaultBlock); return orderInfo; } /** + * Get order info for multiple orders + * @param orders Orders + * @param methodOpts Optional arguments this method accepts. + * @returns Array of Order infos + */ + @decorators.asyncZeroExErrorHandler + public async getOrdersInfoAsync( + orders: Array<Order | SignedOrder>, + methodOpts: MethodOpts = {}, + ): Promise<OrderInfo[]> { + assert.doesConformToSchema('orders', orders, schemas.ordersSchema); + if (!_.isUndefined(methodOpts)) { + assert.doesConformToSchema('methodOpts', methodOpts, methodOptsSchema); + } + const exchangeInstance = await this._getExchangeContractAsync(); + const txData = {}; + const ordersInfo = await exchangeInstance.getOrdersInfo.callAsync(orders, txData, methodOpts.defaultBlock); + return ordersInfo; + } + /** * Cancel a given order. * @param order An object that conforms to the Order or SignedOrder interface. The order you would like to cancel. * @param transactionOpts Optional arguments this method accepts. |