From 88316455b74d2ecde1da55bf2bb36b6c9b46bcb1 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Thu, 1 Jun 2017 15:10:22 +0200 Subject: Make taker required on Order object and expect NULL_ADDRESS from 0x.js --- src/0x.js.ts | 3 ++- src/contract_wrappers/exchange_wrapper.ts | 4 +--- src/schemas/order_schemas.ts | 2 +- src/types.ts | 4 ++-- 4 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/0x.js.ts b/src/0x.js.ts index bf56d5f8d..1a46fe9a5 100644 --- a/src/0x.js.ts +++ b/src/0x.js.ts @@ -26,6 +26,8 @@ bigNumberConfigs.configure(); const MAX_DIGITS_IN_UNSIGNED_256_INT = 78; export class ZeroEx { + public static NULL_ADDRESS = constants.NULL_ADDRESS; + public exchange: ExchangeWrapper; public tokenRegistry: TokenRegistryWrapper; public token: TokenWrapper; @@ -37,7 +39,6 @@ export class ZeroEx { assert.doesConformToSchema('order', SchemaValidator.convertToJSONSchemaCompatibleObject(order as object), orderSchema); - const taker = _.isEmpty(order.taker) ? constants.NULL_ADDRESS : order.taker ; const orderParts = [ {value: exchangeContractAddr, type: SolidityTypes.address}, diff --git a/src/contract_wrappers/exchange_wrapper.ts b/src/contract_wrappers/exchange_wrapper.ts index ad2573c6b..d1763e307 100644 --- a/src/contract_wrappers/exchange_wrapper.ts +++ b/src/contract_wrappers/exchange_wrapper.ts @@ -66,11 +66,9 @@ export class ExchangeWrapper extends ContractWrapper { const senderAddress = await this.web3Wrapper.getSenderAddressOrThrowAsync(); const exchangeInstance = await this.getExchangeInstanceOrThrowAsync(); - const taker = _.isUndefined(signedOrder.taker) ? constants.NULL_ADDRESS : signedOrder.taker; - const orderAddresses: OrderAddresses = [ signedOrder.maker, - taker, + signedOrder.taker, signedOrder.makerTokenAddress, signedOrder.takerTokenAddress, signedOrder.feeRecipient, diff --git a/src/schemas/order_schemas.ts b/src/schemas/order_schemas.ts index dc7e51e40..72012dc26 100644 --- a/src/schemas/order_schemas.ts +++ b/src/schemas/order_schemas.ts @@ -30,7 +30,7 @@ export const orderSchema = { expirationUnixTimestampSec: {$ref: '/numberSchema'}, }, required: [ - 'maker', /*'taker',*/ 'makerFee', 'takerFee', 'makerTokenAmount', 'takerTokenAmount', + 'maker', 'taker', 'makerFee', 'takerFee', 'makerTokenAmount', 'takerTokenAmount', 'salt', 'feeRecipient', 'expirationUnixTimestampSec', ], type: 'object', diff --git a/src/types.ts b/src/types.ts index c3cabd4c7..7d668e78a 100644 --- a/src/types.ts +++ b/src/types.ts @@ -31,7 +31,7 @@ export type OrderAddresses = [string, string, string, string, string]; export type OrderValues = [ BigNumber.BigNumber, BigNumber.BigNumber, BigNumber.BigNumber, - BigNumber.BigNumber, BigNumber.BigNumber, BigNumber.BigNumber + BigNumber.BigNumber, BigNumber.BigNumber, BigNumber.BigNumber, ]; export interface ExchangeContract { @@ -90,7 +90,7 @@ export interface ContractEvent { export interface Order { maker: string; - taker?: string; + taker: string; makerFee: BigNumber.BigNumber; takerFee: BigNumber.BigNumber; makerTokenAmount: BigNumber.BigNumber; -- cgit