aboutsummaryrefslogtreecommitdiffstats
path: root/src/contract_wrappers
diff options
context:
space:
mode:
Diffstat (limited to 'src/contract_wrappers')
-rw-r--r--src/contract_wrappers/exchange_wrapper.ts32
1 files changed, 9 insertions, 23 deletions
diff --git a/src/contract_wrappers/exchange_wrapper.ts b/src/contract_wrappers/exchange_wrapper.ts
index ed0438372..522be4588 100644
--- a/src/contract_wrappers/exchange_wrapper.ts
+++ b/src/contract_wrappers/exchange_wrapper.ts
@@ -32,7 +32,6 @@ import {orderFillRequestsSchema} from '../schemas/order_fill_requests_schema';
import {orderCancellationRequestsSchema} from '../schemas/order_cancel_schema';
import {orderFillOrKillRequestsSchema} from '../schemas/order_fill_or_kill_requests_schema';
import {signedOrderSchema, orderSchema} from '../schemas/order_schemas';
-import {SchemaValidator} from '../utils/schema_validator';
import {constants} from '../utils/constants';
import {TokenWrapper} from './token_wrapper';
@@ -123,9 +122,7 @@ export class ExchangeWrapper extends ContractWrapper {
*/
public async fillOrderAsync(signedOrder: SignedOrder, takerTokenFillAmount: BigNumber.BigNumber,
shouldCheckTransfer: boolean, takerAddress: string): Promise<void> {
- assert.doesConformToSchema('signedOrder',
- SchemaValidator.convertToJSONSchemaCompatibleObject(signedOrder as object),
- signedOrderSchema);
+ assert.doesConformToSchema('signedOrder', signedOrder, signedOrderSchema);
assert.isBigNumber('takerTokenFillAmount', takerTokenFillAmount);
assert.isBoolean('shouldCheckTransfer', shouldCheckTransfer);
await assert.isSenderAddressAsync('takerAddress', takerAddress, this.web3Wrapper);
@@ -172,13 +169,11 @@ export class ExchangeWrapper extends ContractWrapper {
shouldCheckTransfer: boolean, takerAddress: string): Promise<void> {
assert.isBoolean('shouldCheckTransfer', shouldCheckTransfer);
await assert.isSenderAddressAsync('takerAddress', takerAddress, this.web3Wrapper);
- assert.doesConformToSchema('orderFillRequests',
- SchemaValidator.convertToJSONSchemaCompatibleObject(orderFillRequests as object),
- orderFillRequestsSchema);
- _.forEach(orderFillRequests, async (orderFillRequest: OrderFillRequest) => {
+ assert.doesConformToSchema('orderFillRequests', orderFillRequests, orderFillRequestsSchema);
+ for (const orderFillrequest of orderFillRequests) {
await this.validateFillOrderAndThrowIfInvalidAsync(
orderFillRequest.signedOrder, orderFillRequest.takerTokenFillAmount, takerAddress);
- });
+ }
if (_.isEmpty(orderFillRequests)) {
return; // no-op
}
@@ -231,9 +226,7 @@ export class ExchangeWrapper extends ContractWrapper {
*/
public async fillOrKillOrderAsync(signedOrder: SignedOrder, fillTakerAmount: BigNumber.BigNumber,
takerAddress: string) {
- assert.doesConformToSchema('signedOrder',
- SchemaValidator.convertToJSONSchemaCompatibleObject(signedOrder as object),
- signedOrderSchema);
+ assert.doesConformToSchema('signedOrder', signedOrder, signedOrderSchema);
assert.isBigNumber('fillTakerAmount', fillTakerAmount);
await assert.isSenderAddressAsync('takerAddress', takerAddress, this.web3Wrapper);
@@ -277,10 +270,7 @@ export class ExchangeWrapper extends ContractWrapper {
public async batchFillOrKillAsync(orderFillOrKillRequests: OrderFillOrKillRequest[],
takerAddress: string) {
await assert.isSenderAddressAsync('takerAddress', takerAddress, this.web3Wrapper);
- assert.doesConformToSchema('orderFillOrKillRequests',
- SchemaValidator.convertToJSONSchemaCompatibleObject(orderFillOrKillRequests),
- orderFillOrKillRequestsSchema,
- );
+ assert.doesConformToSchema('orderFillOrKillRequests', orderFillOrKillRequests, orderFillOrKillRequestsSchema);
const exchangeInstance = await this.getExchangeContractAsync();
_.each(orderFillOrKillRequests, request => {
this.validateFillOrKillOrderAndThrowIfInvalidAsync(request.signedOrder,
@@ -332,9 +322,7 @@ export class ExchangeWrapper extends ContractWrapper {
*/
public async cancelOrderAsync(
order: Order|SignedOrder, takerTokenCancelAmount: BigNumber.BigNumber): Promise<void> {
- assert.doesConformToSchema('order',
- SchemaValidator.convertToJSONSchemaCompatibleObject(order),
- orderSchema);
+ assert.doesConformToSchema('order', order, orderSchema);
assert.isBigNumber('takerTokenCancelAmount', takerTokenCancelAmount);
await assert.isSenderAddressAsync('order.maker', order.maker, this.web3Wrapper);
@@ -373,10 +361,8 @@ export class ExchangeWrapper extends ContractWrapper {
assert.assert(_.uniq(makers).length === 1, ExchangeContractErrs.MULTIPLE_MAKERS_IN_SINGLE_CANCEL_BATCH);
const maker = makers[0];
await assert.isSenderAddressAsync('maker', maker, this.web3Wrapper);
- assert.doesConformToSchema('orderCancellationRequests',
- SchemaValidator.convertToJSONSchemaCompatibleObject(orderCancellationRequests),
- orderCancellationRequestsSchema);
- _.forEach(orderCancellationRequests, async (cancellationRequest: OrderCancellationRequest) => {
+ assert.doesConformToSchema('orderCancellationRequests', orderCancellationRequests, orderCancellationRequestsSchema);
+ for (const cancellationRequest of orderCancellationRequests) {
await this.validateCancelOrderAndThrowIfInvalidAsync(
cancellationRequest.order, cancellationRequest.takerTokenCancelAmount,
);