aboutsummaryrefslogtreecommitdiffstats
path: root/src/ts/0x.js.ts
diff options
context:
space:
mode:
authorFabio Berger <me@fabioberger.com>2017-05-29 15:09:54 +0800
committerFabio Berger <me@fabioberger.com>2017-05-29 15:09:54 +0800
commit62cc3b919c73b7726793808e3b9631dba41cef28 (patch)
tree22c5f1728c56b09fa0e15e5e645c1f891224a6ee /src/ts/0x.js.ts
parent281b9eaa5d207d32ae38fbab25cbca83fe81efa1 (diff)
parentb897bdab79fe566ffc8c19c6ec9f1bb7260fa95e (diff)
downloaddexon-sol-tools-62cc3b919c73b7726793808e3b9631dba41cef28.tar
dexon-sol-tools-62cc3b919c73b7726793808e3b9631dba41cef28.tar.gz
dexon-sol-tools-62cc3b919c73b7726793808e3b9631dba41cef28.tar.bz2
dexon-sol-tools-62cc3b919c73b7726793808e3b9631dba41cef28.tar.lz
dexon-sol-tools-62cc3b919c73b7726793808e3b9631dba41cef28.tar.xz
dexon-sol-tools-62cc3b919c73b7726793808e3b9631dba41cef28.tar.zst
dexon-sol-tools-62cc3b919c73b7726793808e3b9631dba41cef28.zip
Merge branch 'master' of github.com:0xProject/0x.js
# Conflicts: # src/ts/0x.js.ts # src/ts/utils/utils.ts
Diffstat (limited to 'src/ts/0x.js.ts')
-rw-r--r--src/ts/0x.js.ts26
1 files changed, 14 insertions, 12 deletions
diff --git a/src/ts/0x.js.ts b/src/ts/0x.js.ts
index 67e7c2fdd..1ebafc604 100644
--- a/src/ts/0x.js.ts
+++ b/src/ts/0x.js.ts
@@ -1,25 +1,22 @@
+import * as _ from 'lodash';
import * as BigNumber from 'bignumber.js';
import * as ethUtil from 'ethereumjs-util';
+import contract = require('truffle-contract');
+import * as Web3 from 'web3';
import * as ethABI from 'ethereumjs-abi';
-import * as _ from 'lodash';
+import {Web3Wrapper} from './web3_wrapper';
import {constants} from './utils/constants';
import {utils} from './utils/utils';
import {assert} from './utils/assert';
+import {ExchangeWrapper} from './contract_wrappers/exchange_wrapper';
import {ECSignatureSchema} from './schemas/ec_signature_schema';
-import {SolidityTypes} from './types';
-
-/**
- * Elliptic Curve signature
- */
-export interface ECSignature {
- v: number;
- r: string;
- s: string;
-}
+import {SolidityTypes, ECSignature} from './types';
const MAX_DIGITS_IN_UNSIGNED_256_INT = 78;
export class ZeroEx {
+ public web3Wrapper: Web3Wrapper;
+ public exchange: ExchangeWrapper;
/**
* Computes the orderHash given the order parameters and returns it as a hex encoded string.
*/
@@ -74,7 +71,8 @@ export class ZeroEx {
const dataBuff = ethUtil.toBuffer(dataHex);
const msgHashBuff = ethUtil.hashPersonalMessage(dataBuff);
try {
- const pubKey = ethUtil.ecrecover(msgHashBuff,
+ const pubKey = ethUtil.ecrecover(
+ msgHashBuff,
signature.v,
ethUtil.toBuffer(signature.r),
ethUtil.toBuffer(signature.s));
@@ -129,4 +127,8 @@ export class ZeroEx {
const baseUnitAmount = amount.times(unit);
return baseUnitAmount;
}
+ constructor(web3: Web3) {
+ this.web3Wrapper = new Web3Wrapper(web3);
+ this.exchange = new ExchangeWrapper(this.web3Wrapper);
+ }
}