diff options
Diffstat (limited to 'packages/contracts/util/order_factory.ts')
-rw-r--r-- | packages/contracts/util/order_factory.ts | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/packages/contracts/util/order_factory.ts b/packages/contracts/util/order_factory.ts index 9d96a8394..3ae06a335 100644 --- a/packages/contracts/util/order_factory.ts +++ b/packages/contracts/util/order_factory.ts @@ -1,9 +1,9 @@ -import {ZeroEx} from '0x.js'; -import {BigNumber} from 'bignumber.js'; +import { ZeroEx } from '0x.js'; +import { BigNumber } from 'bignumber.js'; import * as _ from 'lodash'; -import {Order} from './order'; -import {DefaultOrderParams, OptionalOrderParams, OrderParams} from './types'; +import { Order } from './order'; +import { DefaultOrderParams, OptionalOrderParams, OrderParams } from './types'; export class OrderFactory { private _defaultOrderParams: DefaultOrderParams; @@ -11,12 +11,17 @@ export class OrderFactory { this._defaultOrderParams = defaultOrderParams; } public async newSignedOrderAsync(customOrderParams: OptionalOrderParams = {}) { - const randomExpiration = new BigNumber(Math.floor((Date.now() + (Math.random() * 100000000000)) / 1000)); - const orderParams: OrderParams = _.assign({}, { - expirationTimestampInSec: randomExpiration, - salt: ZeroEx.generatePseudoRandomSalt(), - taker: ZeroEx.NULL_ADDRESS, - }, this._defaultOrderParams, customOrderParams); + const randomExpiration = new BigNumber(Math.floor((Date.now() + Math.random() * 100000000000) / 1000)); + const orderParams: OrderParams = _.assign( + {}, + { + expirationTimestampInSec: randomExpiration, + salt: ZeroEx.generatePseudoRandomSalt(), + taker: ZeroEx.NULL_ADDRESS, + }, + this._defaultOrderParams, + customOrderParams, + ); const order = new Order(orderParams); await order.signAsync(); return order; |