diff options
Diffstat (limited to 'packages/contracts/src/utils/order_factory.ts')
-rw-r--r-- | packages/contracts/src/utils/order_factory.ts | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/packages/contracts/src/utils/order_factory.ts b/packages/contracts/src/utils/order_factory.ts index e60f25605..af411c01f 100644 --- a/packages/contracts/src/utils/order_factory.ts +++ b/packages/contracts/src/utils/order_factory.ts @@ -1,23 +1,21 @@ -import { generatePseudoRandomSalt } from '@0xproject/order-utils'; -import { SignedOrder, UnsignedOrder } from '@0xproject/types'; +import { generatePseudoRandomSalt, orderHashUtils } from '@0xproject/order-utils'; +import { Order, SignatureType, SignedOrder } from '@0xproject/types'; import { BigNumber } from '@0xproject/utils'; import * as _ from 'lodash'; import { constants } from './constants'; -import { orderUtils } from './order_utils'; import { signingUtils } from './signing_utils'; -import { SignatureType } from './types'; export class OrderFactory { - private _defaultOrderParams: Partial<UnsignedOrder>; + private _defaultOrderParams: Partial<Order>; private _privateKey: Buffer; - constructor(privateKey: Buffer, defaultOrderParams: Partial<UnsignedOrder>) { + constructor(privateKey: Buffer, defaultOrderParams: Partial<Order>) { this._defaultOrderParams = defaultOrderParams; this._privateKey = privateKey; } public newSignedOrder( - customOrderParams: Partial<UnsignedOrder> = {}, - signatureType: SignatureType = SignatureType.Ecrecover, + customOrderParams: Partial<Order> = {}, + signatureType: SignatureType = SignatureType.EthSign, ): SignedOrder { const tenMinutes = 10 * 60 * 1000; const randomExpiration = new BigNumber(Date.now() + tenMinutes); @@ -28,8 +26,8 @@ export class OrderFactory { takerAddress: constants.NULL_ADDRESS, ...this._defaultOrderParams, ...customOrderParams, - } as any) as UnsignedOrder; - const orderHashBuff = orderUtils.getOrderHashBuff(order); + } as any) as Order; + const orderHashBuff = orderHashUtils.getOrderHashBuff(order); const signature = signingUtils.signMessage(orderHashBuff, this._privateKey, signatureType); const signedOrder = { ...order, |