diff options
Diffstat (limited to 'packages/contracts/util')
-rw-r--r-- | packages/contracts/util/exchange_wrapper.ts | 2 | ||||
-rw-r--r-- | packages/contracts/util/order.ts | 7 | ||||
-rw-r--r-- | packages/contracts/util/types.ts | 1 |
3 files changed, 4 insertions, 6 deletions
diff --git a/packages/contracts/util/exchange_wrapper.ts b/packages/contracts/util/exchange_wrapper.ts index b749cd72e..e44a0eab6 100644 --- a/packages/contracts/util/exchange_wrapper.ts +++ b/packages/contracts/util/exchange_wrapper.ts @@ -184,7 +184,7 @@ export class ExchangeWrapper { public async isValidSignatureAsync(order: Order): Promise<boolean> { const isValidSignature = await this._exchange.isValidSignature( order.params.maker, - order.params.orderHashHex as string, + order.getOrderHashHex(), order.params.v as number, order.params.r as string, order.params.s as string, diff --git a/packages/contracts/util/order.ts b/packages/contracts/util/order.ts index 57bb2bcbf..12f10fa4e 100644 --- a/packages/contracts/util/order.ts +++ b/packages/contracts/util/order.ts @@ -18,7 +18,7 @@ export class Order { if (_.isUndefined(v) || _.isUndefined(r) || _.isUndefined(s)) { throw new Error('Cannot call isValidSignature on unsigned order'); } - const orderHash = this._getOrderHash(); + const orderHash = this.getOrderHashHex(); const msgHash = ethUtil.hashPersonalMessage(ethUtil.toBuffer(orderHash)); try { const pubKey = ethUtil.ecrecover(msgHash, v, ethUtil.toBuffer(r), ethUtil.toBuffer(s)); @@ -29,11 +29,10 @@ export class Order { } } public async signAsync() { - const orderHash = this._getOrderHash(); + const orderHash = this.getOrderHashHex(); const signature = await this._web3Wrapper.signTransactionAsync(this.params.maker, orderHash); const { v, r, s } = ethUtil.fromRpcSig(signature); this.params = _.assign(this.params, { - orderHashHex: orderHash, v, r: ethUtil.bufferToHex(r), s: ethUtil.bufferToHex(s), @@ -85,7 +84,7 @@ export class Order { }; return cancel; } - private _getOrderHash(): string { + public getOrderHashHex(): string { const orderHash = crypto.solSHA3([ this.params.exchangeContractAddress, this.params.maker, diff --git a/packages/contracts/util/types.ts b/packages/contracts/util/types.ts index 38fd33161..5d474b596 100644 --- a/packages/contracts/util/types.ts +++ b/packages/contracts/util/types.ts @@ -76,7 +76,6 @@ export interface OrderParams { takerFee: BigNumber; expirationTimestampInSec: BigNumber; salt: BigNumber; - orderHashHex?: string; v?: number; r?: string; s?: string; |