diff options
author | Amir Bandeali <abandeali1@gmail.com> | 2018-03-07 03:23:48 +0800 |
---|---|---|
committer | Amir Bandeali <abandeali1@gmail.com> | 2018-04-21 04:56:16 +0800 |
commit | cd8f8e1e4acc00e9e31265050456a4c98d79a7d4 (patch) | |
tree | 575786d2085af08cdcae09f91a727714df2b9c70 /packages/contracts/src/utils/order_factory.ts | |
parent | ed43d8d08b9a6cf6e015383a3edaba1946fcca6e (diff) | |
download | dexon-0x-contracts-cd8f8e1e4acc00e9e31265050456a4c98d79a7d4.tar.gz dexon-0x-contracts-cd8f8e1e4acc00e9e31265050456a4c98d79a7d4.tar.zst dexon-0x-contracts-cd8f8e1e4acc00e9e31265050456a4c98d79a7d4.zip |
Modify utils to work with new signature format
Diffstat (limited to 'packages/contracts/src/utils/order_factory.ts')
-rw-r--r-- | packages/contracts/src/utils/order_factory.ts | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/packages/contracts/src/utils/order_factory.ts b/packages/contracts/src/utils/order_factory.ts index 8ba5df24a..d5c3a9544 100644 --- a/packages/contracts/src/utils/order_factory.ts +++ b/packages/contracts/src/utils/order_factory.ts @@ -1,9 +1,10 @@ -import { Order, SignedOrder, ZeroEx } from '0x.js'; +import { Order, ZeroEx } from '0x.js'; import { BigNumber } from '@0xproject/utils'; import { Web3Wrapper } from '@0xproject/web3-wrapper'; import * as _ from 'lodash'; -import { DefaultOrderParams } from './types'; +import { signedOrderUtils } from './signed_order_utils'; +import { DefaultOrderParams, SignedOrder } from './types'; export class OrderFactory { private _defaultOrderParams: Partial<Order>; @@ -15,17 +16,17 @@ export class OrderFactory { public async newSignedOrderAsync(customOrderParams: Partial<Order> = {}): Promise<SignedOrder> { const randomExpiration = new BigNumber(Math.floor((Date.now() + Math.random() * 100000000000) / 1000)); const order = ({ - expirationUnixTimestampSec: randomExpiration, + expirationTimestampSeconds: randomExpiration, salt: ZeroEx.generatePseudoRandomSalt(), - taker: ZeroEx.NULL_ADDRESS, + takerAddress: ZeroEx.NULL_ADDRESS, ...this._defaultOrderParams, ...customOrderParams, - } as any) as Order; - const orderHashHex = ZeroEx.getOrderHashHex(order); + } as any) as SignedOrder; + const orderHashHex = signedOrderUtils.getOrderHashHex(order); const shouldAddPersonalMessagePrefix = false; const ecSignature = await this._zeroEx.signOrderHashAsync( orderHashHex, - order.maker, + order.makerAddress, shouldAddPersonalMessagePrefix, ); const signedOrder = { |