diff options
author | Leonid Logvinov <logvinov.leon@gmail.com> | 2018-01-23 04:53:32 +0800 |
---|---|---|
committer | Leonid Logvinov <logvinov.leon@gmail.com> | 2018-01-30 23:01:36 +0800 |
commit | 387363283ca03ac1d6c9be5b7be2107790bbf79d (patch) | |
tree | 7f9ce518e2f4931321901dfeb2675d70854e996d /packages/contracts/util/order.ts | |
parent | 709026bf1a49d468850b4ebed845c8598fa4fd75 (diff) | |
download | dexon-0x-contracts-387363283ca03ac1d6c9be5b7be2107790bbf79d.tar.gz dexon-0x-contracts-387363283ca03ac1d6c9be5b7be2107790bbf79d.tar.zst dexon-0x-contracts-387363283ca03ac1d6c9be5b7be2107790bbf79d.zip |
Remove truffle from tests
Diffstat (limited to 'packages/contracts/util/order.ts')
-rw-r--r-- | packages/contracts/util/order.ts | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/packages/contracts/util/order.ts b/packages/contracts/util/order.ts index e202d485b..702b2312c 100644 --- a/packages/contracts/util/order.ts +++ b/packages/contracts/util/order.ts @@ -1,4 +1,5 @@ import { BigNumber, promisify } from '@0xproject/utils'; +import { Web3Wrapper } from '@0xproject/web3-wrapper'; import ethUtil = require('ethereumjs-util'); import * as _ from 'lodash'; import Web3 = require('web3'); @@ -12,8 +13,10 @@ const web3: Web3 = (global as any).web3; export class Order { public params: OrderParams; - constructor(params: OrderParams) { + private _web3Wrapper: Web3Wrapper; + constructor(web3Wrapper: Web3Wrapper, params: OrderParams) { this.params = params; + this._web3Wrapper = web3Wrapper; } public isValidSignature() { const { v, r, s } = this.params; @@ -32,7 +35,7 @@ export class Order { } public async signAsync() { const orderHash = this._getOrderHash(); - const signature = await promisify<string>(web3.eth.sign)(this.params.maker, orderHash); + const signature = await this._web3Wrapper.signTransactionAsync(this.params.maker, orderHash); const { v, r, s } = ethUtil.fromRpcSig(signature); this.params = _.assign(this.params, { orderHashHex: orderHash, |