aboutsummaryrefslogtreecommitdiffstats
path: root/src/ts/0x.js.ts
diff options
context:
space:
mode:
authorFabio Berger <me@fabioberger.com>2017-05-26 01:47:11 +0800
committerFabio Berger <me@fabioberger.com>2017-05-26 01:47:11 +0800
commitbc8fc534332b5ea82f881bdd3a75773384714f4d (patch)
tree2e50db69032c0c5e8817db34f5a3db34ee088589 /src/ts/0x.js.ts
parent74e7dc46b4ba8b3931a1cdf4dc7f55670219e324 (diff)
downloaddexon-sol-tools-bc8fc534332b5ea82f881bdd3a75773384714f4d.tar
dexon-sol-tools-bc8fc534332b5ea82f881bdd3a75773384714f4d.tar.gz
dexon-sol-tools-bc8fc534332b5ea82f881bdd3a75773384714f4d.tar.bz2
dexon-sol-tools-bc8fc534332b5ea82f881bdd3a75773384714f4d.tar.lz
dexon-sol-tools-bc8fc534332b5ea82f881bdd3a75773384714f4d.tar.xz
dexon-sol-tools-bc8fc534332b5ea82f881bdd3a75773384714f4d.tar.zst
dexon-sol-tools-bc8fc534332b5ea82f881bdd3a75773384714f4d.zip
Add initial exchange contract function, set up web3Wrapper, added types and utils
Diffstat (limited to 'src/ts/0x.js.ts')
-rw-r--r--src/ts/0x.js.ts22
1 files changed, 13 insertions, 9 deletions
diff --git a/src/ts/0x.js.ts b/src/ts/0x.js.ts
index ead1f56df..7025f8804 100644
--- a/src/ts/0x.js.ts
+++ b/src/ts/0x.js.ts
@@ -1,21 +1,21 @@
import * as BigNumber from 'bignumber.js';
import * as ethUtil from 'ethereumjs-util';
import * as _ from 'lodash';
+import Web3 from 'web3';
import {assert} from './utils/assert';
+import {utils} from './utils/utils';
+import {ZeroExError} from './types';
+import {Web3Wrapper} from './web3_wrapper';
+import {ExchangeWrapper} from './contract_wrappers/exchange_wrapper';
+import contract = require('truffle-contract');
import {ECSignatureSchema} from './schemas/ec_signature_schema';
-
-/**
- * Elliptic Curve signature
- */
-export interface ECSignature {
- v: number;
- r: string;
- s: string;
-}
+import {ECSignature} from './types';
const MAX_DIGITS_IN_UNSIGNED_256_INT = 78;
export class ZeroEx {
+ public web3Wrapper: Web3Wrapper;
+ public exchange: ContractInstance;
/**
* Verifies that the elliptic curve signature `signature` was generated
* by signing `data` with the private key corresponding to the `signerAddressHex` address.
@@ -83,4 +83,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);
+ }
}