diff options
author | Fabio Berger <me@fabioberger.com> | 2017-06-09 00:13:54 +0800 |
---|---|---|
committer | Fabio Berger <me@fabioberger.com> | 2017-06-09 00:13:54 +0800 |
commit | 23a4dcb729084c0e00c759da487ae3959f436b3a (patch) | |
tree | 17446623d60c9beecedab6248e4485082fe1ad5e /src/contract_wrappers | |
parent | 2b08c04d4d7b67592d3f846dc31d01892bdbeaeb (diff) | |
download | dexon-sol-tools-23a4dcb729084c0e00c759da487ae3959f436b3a.tar dexon-sol-tools-23a4dcb729084c0e00c759da487ae3959f436b3a.tar.gz dexon-sol-tools-23a4dcb729084c0e00c759da487ae3959f436b3a.tar.bz2 dexon-sol-tools-23a4dcb729084c0e00c759da487ae3959f436b3a.tar.lz dexon-sol-tools-23a4dcb729084c0e00c759da487ae3959f436b3a.tar.xz dexon-sol-tools-23a4dcb729084c0e00c759da487ae3959f436b3a.tar.zst dexon-sol-tools-23a4dcb729084c0e00c759da487ae3959f436b3a.zip |
Add orderFillOrKillRequestsSchema and validate using it instead of looping over the requests and validating them individually
Diffstat (limited to 'src/contract_wrappers')
-rw-r--r-- | src/contract_wrappers/exchange_wrapper.ts | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/contract_wrappers/exchange_wrapper.ts b/src/contract_wrappers/exchange_wrapper.ts index 6ef87b7ed..cfbea43a5 100644 --- a/src/contract_wrappers/exchange_wrapper.ts +++ b/src/contract_wrappers/exchange_wrapper.ts @@ -28,6 +28,7 @@ import {utils} from '../utils/utils'; import {ContractWrapper} from './contract_wrapper'; import * as ExchangeArtifacts from '../artifacts/Exchange.json'; import {ecSignatureSchema} from '../schemas/ec_signature_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'; @@ -276,12 +277,12 @@ 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, + ); const exchangeInstance = await this.getExchangeContractAsync(); _.each(orderFillOrKillRequests, request => { - assert.doesConformToSchema('signedOrder', - SchemaValidator.convertToJSONSchemaCompatibleObject(request.signedOrder as object), - signedOrderSchema); - assert.isBigNumber('fillTakerAmount', request.fillTakerAmount); this.validateFillOrKillOrderAndThrowIfInvalidAsync(request.signedOrder, exchangeInstance.address, request.fillTakerAmount); |