diff options
author | Leonid Logvinov <logvinov.leon@gmail.com> | 2018-02-07 18:59:40 +0800 |
---|---|---|
committer | Leonid Logvinov <logvinov.leon@gmail.com> | 2018-02-07 18:59:40 +0800 |
commit | 4b6324050da4862f4d8bdb7d6dbd66107929a2b5 (patch) | |
tree | 7c18197754541bfe70e72ae670b19e290808408f /packages/contracts/util/order.ts | |
parent | 12d62e1157168ec9e8cd23749523b2bcda8eefe5 (diff) | |
download | dexon-sol-tools-4b6324050da4862f4d8bdb7d6dbd66107929a2b5.tar dexon-sol-tools-4b6324050da4862f4d8bdb7d6dbd66107929a2b5.tar.gz dexon-sol-tools-4b6324050da4862f4d8bdb7d6dbd66107929a2b5.tar.bz2 dexon-sol-tools-4b6324050da4862f4d8bdb7d6dbd66107929a2b5.tar.lz dexon-sol-tools-4b6324050da4862f4d8bdb7d6dbd66107929a2b5.tar.xz dexon-sol-tools-4b6324050da4862f4d8bdb7d6dbd66107929a2b5.tar.zst dexon-sol-tools-4b6324050da4862f4d8bdb7d6dbd66107929a2b5.zip |
Make orderHashHex a getter instead of a property
Diffstat (limited to 'packages/contracts/util/order.ts')
-rw-r--r-- | packages/contracts/util/order.ts | 7 |
1 files changed, 3 insertions, 4 deletions
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, |