aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrandon Millman <brandon.millman@gmail.com>2018-08-28 03:59:53 +0800
committerBrandon Millman <brandon.millman@gmail.com>2018-08-28 04:21:10 +0800
commitf7469080f929d2364b1621e92857c76cb008bec9 (patch)
tree0e95df25235f148597e06eae6ffe170c116607c9
parentbe2f4cbdcafa19cc8433ff2dc2f0ff6befd64578 (diff)
downloaddexon-sol-tools-f7469080f929d2364b1621e92857c76cb008bec9.tar
dexon-sol-tools-f7469080f929d2364b1621e92857c76cb008bec9.tar.gz
dexon-sol-tools-f7469080f929d2364b1621e92857c76cb008bec9.tar.bz2
dexon-sol-tools-f7469080f929d2364b1621e92857c76cb008bec9.tar.lz
dexon-sol-tools-f7469080f929d2364b1621e92857c76cb008bec9.tar.xz
dexon-sol-tools-f7469080f929d2364b1621e92857c76cb008bec9.tar.zst
dexon-sol-tools-f7469080f929d2364b1621e92857c76cb008bec9.zip
Update getOrdersAndTradersInfo to return an array instead
-rw-r--r--packages/contract-wrappers/src/contract_wrappers/order_validator_wrapper.ts19
-rw-r--r--packages/contract-wrappers/src/types.ts5
2 files changed, 12 insertions, 12 deletions
diff --git a/packages/contract-wrappers/src/contract_wrappers/order_validator_wrapper.ts b/packages/contract-wrappers/src/contract_wrappers/order_validator_wrapper.ts
index 3b83fc53b..854a93bbf 100644
--- a/packages/contract-wrappers/src/contract_wrappers/order_validator_wrapper.ts
+++ b/packages/contract-wrappers/src/contract_wrappers/order_validator_wrapper.ts
@@ -44,13 +44,13 @@ export class OrderValidatorWrapper extends ContractWrapper {
return result;
}
/**
- * Get an object conforming to OrdersAndTradersInfo containing on-chain information of the provided orders and addresses
- * @return OrdersAndTradersInfo
+ * Get an array of objects conforming to OrderAndTraderInfo containing on-chain information of the provided orders and addresses
+ * @return array of OrderAndTraderInfo
*/
public async getOrdersAndTradersInfoAsync(
orders: SignedOrder[],
takerAddresses: string[],
- ): Promise<OrdersAndTradersInfo> {
+ ): Promise<OrderAndTraderInfo[]> {
assert.doesConformToSchema('orders', orders, schemas.signedOrdersSchema);
_.forEach(takerAddresses, (takerAddress, index) =>
assert.isETHAddressHex(`takerAddresses[${index}]`, takerAddress),
@@ -61,10 +61,15 @@ export class OrderValidatorWrapper extends ContractWrapper {
orders,
takerAddresses,
);
- const result = {
- ordersInfo: ordersAndTradersInfo[0],
- tradersInfo: ordersAndTradersInfo[1],
- };
+ const orderInfos = ordersAndTradersInfo[0];
+ const traderInfos = ordersAndTradersInfo[1];
+ const result = _.map(orderInfos, (orderInfo, index) => {
+ const traderInfo = traderInfos[index];
+ return {
+ orderInfo,
+ traderInfo,
+ };
+ });
return result;
}
/**
diff --git a/packages/contract-wrappers/src/types.ts b/packages/contract-wrappers/src/types.ts
index c51e0ae48..e0b12b7c9 100644
--- a/packages/contract-wrappers/src/types.ts
+++ b/packages/contract-wrappers/src/types.ts
@@ -200,11 +200,6 @@ export interface TraderInfo {
takerZrxAllowance: BigNumber;
}
-export interface OrdersAndTradersInfo {
- ordersInfo: OrderInfo[];
- tradersInfo: TraderInfo[];
-}
-
export interface OrderAndTraderInfo {
orderInfo: OrderInfo;
traderInfo: TraderInfo;