aboutsummaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
authorBrandon Millman <brandon.millman@gmail.com>2018-08-28 01:28:07 +0800
committerBrandon Millman <brandon.millman@gmail.com>2018-08-28 04:04:54 +0800
commitd6c670dfcb1bd74f675a9a1cf3b86cfcf6cd85df (patch)
tree57e87b91fcf2d96f90c2386401c09bbed9bad6ae /packages
parent0736c413572e6e55dcc7866a03b8da2eb46a406f (diff)
downloaddexon-sol-tools-d6c670dfcb1bd74f675a9a1cf3b86cfcf6cd85df.tar
dexon-sol-tools-d6c670dfcb1bd74f675a9a1cf3b86cfcf6cd85df.tar.gz
dexon-sol-tools-d6c670dfcb1bd74f675a9a1cf3b86cfcf6cd85df.tar.bz2
dexon-sol-tools-d6c670dfcb1bd74f675a9a1cf3b86cfcf6cd85df.tar.lz
dexon-sol-tools-d6c670dfcb1bd74f675a9a1cf3b86cfcf6cd85df.tar.xz
dexon-sol-tools-d6c670dfcb1bd74f675a9a1cf3b86cfcf6cd85df.tar.zst
dexon-sol-tools-d6c670dfcb1bd74f675a9a1cf3b86cfcf6cd85df.zip
Add getOrderAndTraderInfoAsync to wrapper
Diffstat (limited to 'packages')
-rw-r--r--packages/contract-wrappers/src/contract_wrappers/order_validator_wrapper.ts22
-rw-r--r--packages/contract-wrappers/src/types.ts4
2 files changed, 24 insertions, 2 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 6857dcd69..1e06d191c 100644
--- a/packages/contract-wrappers/src/contract_wrappers/order_validator_wrapper.ts
+++ b/packages/contract-wrappers/src/contract_wrappers/order_validator_wrapper.ts
@@ -5,7 +5,7 @@ import { ContractAbi } from 'ethereum-types';
import * as _ from 'lodash';
import { artifacts } from '../artifacts';
-import { OrdersAndTradersInfo } from '../types';
+import { OrderAndTraderInfo, OrdersAndTradersInfo } from '../types';
import { assert } from '../utils/assert';
import { ContractWrapper } from './contract_wrapper';
@@ -26,7 +26,25 @@ export class OrderValidatorWrapper extends ContractWrapper {
super(web3Wrapper, networkId);
}
/**
- * Get and object conforming to OrdersAndTradersInfo containing on-chain information of the provided orders and addresses
+ * Get and object conforming to OrderAndTraderInfo containing on-chain information of the provided order and address
+ * @return OrderAndTraderInfo
+ */
+ public async getOrderAndTraderInfoAsync(order: SignedOrder, takerAddress: string): Promise<OrderAndTraderInfo> {
+ assert.doesConformToSchema('order', order, schemas.signedOrderSchema);
+ assert.isETHAddressHex('takerAddress', takerAddress);
+ const OrderValidatorContractInstance = await this._getOrderValidatorContractAsync();
+ const orderAndTraderInfo = await OrderValidatorContractInstance.getOrderAndTraderInfo.callAsync(
+ order,
+ takerAddress,
+ );
+ const result = {
+ orderInfo: orderAndTraderInfo[0],
+ traderInfo: orderAndTraderInfo[1],
+ };
+ return result;
+ }
+ /**
+ * Get an object conforming to OrdersAndTradersInfo containing on-chain information of the provided orders and addresses
* @return OrdersAndTradersInfo
*/
public async getOrdersAndTradersInfoAsync(
diff --git a/packages/contract-wrappers/src/types.ts b/packages/contract-wrappers/src/types.ts
index efc102a33..e73a09fe3 100644
--- a/packages/contract-wrappers/src/types.ts
+++ b/packages/contract-wrappers/src/types.ts
@@ -204,3 +204,7 @@ export interface OrdersAndTradersInfo {
ordersInfo: OrderInfo[];
tradersInfo: TraderInfo[];
}
+export interface OrderAndTraderInfo {
+ orderInfo: OrderInfo;
+ traderInfo: TraderInfo;
+}