aboutsummaryrefslogtreecommitdiffstats
path: root/packages/contracts
diff options
context:
space:
mode:
authorAmir Bandeali <abandeali1@gmail.com>2017-12-07 16:45:41 +0800
committerAmir Bandeali <abandeali1@gmail.com>2017-12-13 07:05:27 +0800
commit2cc410e61f75a43ce36416b7d15f897d6e7fc92c (patch)
treedb2a73fe71f1f59d4f99c7ad041b705566435cdc /packages/contracts
parent548fda8dbaadc4827137d4b90753b306fdfd554b (diff)
downloaddexon-sol-tools-2cc410e61f75a43ce36416b7d15f897d6e7fc92c.tar.gz
dexon-sol-tools-2cc410e61f75a43ce36416b7d15f897d6e7fc92c.tar.zst
dexon-sol-tools-2cc410e61f75a43ce36416b7d15f897d6e7fc92c.zip
Update 0x.js version, fix build errors
Diffstat (limited to 'packages/contracts')
-rw-r--r--packages/contracts/package.json2
-rw-r--r--packages/contracts/test/ts/erc20Token.ts5
-rw-r--r--packages/contracts/test/ts/ether_token.ts7
-rw-r--r--packages/contracts/test/ts/ether_token_v2.ts10
-rw-r--r--packages/contracts/test/ts/exchange/core.ts1
-rw-r--r--packages/contracts/test/ts/unlimitedAllowanceToken.ts6
-rw-r--r--packages/contracts/test/ts/zrxToken.ts6
-rw-r--r--packages/contracts/util/constants.ts1
8 files changed, 27 insertions, 11 deletions
diff --git a/packages/contracts/package.json b/packages/contracts/package.json
index 3c5dfe890..31c69e8d5 100644
--- a/packages/contracts/package.json
+++ b/packages/contracts/package.json
@@ -53,7 +53,7 @@
"yargs": "^10.0.3"
},
"dependencies": {
- "0x.js": "^0.22.6",
+ "0x.js": "^0.27.1",
"@0xproject/json-schemas": "^0.6.10",
"@0xproject/utils": "^0.1.0",
"@0xproject/web3-wrapper": "^0.1.0",
diff --git a/packages/contracts/test/ts/erc20Token.ts b/packages/contracts/test/ts/erc20Token.ts
index 9aa93180b..1edcfcbbd 100644
--- a/packages/contracts/test/ts/erc20Token.ts
+++ b/packages/contracts/test/ts/erc20Token.ts
@@ -15,7 +15,10 @@ chaiSetup.configure();
const expect = chai.expect;
contract('ERC20Token', (accounts: string[]) => {
- const zeroEx = new ZeroEx(web3.currentProvider);
+ const config = {
+ networkId: constants.TESTRPC_NETWORK_ID,
+ };
+ const zeroEx = new ZeroEx(web3.currentProvider, config);
const owner = accounts[0];
const spender = accounts[1];
diff --git a/packages/contracts/test/ts/ether_token.ts b/packages/contracts/test/ts/ether_token.ts
index dbb4d2ee6..79c618ec2 100644
--- a/packages/contracts/test/ts/ether_token.ts
+++ b/packages/contracts/test/ts/ether_token.ts
@@ -5,6 +5,7 @@ import * as chai from 'chai';
import Web3 = require('web3');
import {Artifacts} from '../../util/artifacts';
+import {constants} from '../../util/constants';
import {chaiSetup} from './utils/chai_setup';
@@ -22,11 +23,13 @@ contract('EtherToken', (accounts: string[]) => {
const gasPrice = ZeroEx.toBaseUnitAmount(new BigNumber(20), 9);
let zeroEx: ZeroEx;
let etherTokenAddress: string;
+
before(async () => {
etherTokenAddress = EtherToken.address;
zeroEx = new ZeroEx(web3.currentProvider, {
- gasPrice,
- etherTokenContractAddress: etherTokenAddress,
+ gasPrice,
+ etherTokenContractAddress: etherTokenAddress,
+ networkId: constants.TESTRPC_NETWORK_ID,
});
});
diff --git a/packages/contracts/test/ts/ether_token_v2.ts b/packages/contracts/test/ts/ether_token_v2.ts
index 0c352b522..4931eb798 100644
--- a/packages/contracts/test/ts/ether_token_v2.ts
+++ b/packages/contracts/test/ts/ether_token_v2.ts
@@ -5,6 +5,7 @@ import promisify = require('es6-promisify');
import Web3 = require('web3');
import {Artifacts} from '../../util/artifacts';
+import {constants} from '../../util/constants';
import {chaiSetup} from './utils/chai_setup';
@@ -26,8 +27,9 @@ contract('EtherTokenV2', (accounts: string[]) => {
const etherToken = await EtherTokenV2.new();
etherTokenAddress = etherToken.address;
zeroEx = new ZeroEx(web3.currentProvider, {
- gasPrice,
- etherTokenContractAddress: etherTokenAddress,
+ gasPrice,
+ etherTokenContractAddress: etherTokenAddress,
+ networkId: constants.TESTRPC_NETWORK_ID,
});
});
@@ -76,7 +78,7 @@ contract('EtherTokenV2', (accounts: string[]) => {
const expectedFrom = ZeroEx.NULL_ADDRESS;
const expectedTo = account;
const expectedValue = ethToDeposit;
- const logArgs = logs[0].args;
+ const logArgs = (logs[0] as any).args;
expect(logArgs._from).to.equal(expectedFrom);
expect(logArgs._to).to.equal(expectedTo);
expect(logArgs._value).to.be.bignumber.equal(ethToDeposit);
@@ -128,7 +130,7 @@ contract('EtherTokenV2', (accounts: string[]) => {
const expectedFrom = account;
const expectedTo = ZeroEx.NULL_ADDRESS;
const expectedValue = ethTokensToWithdraw;
- const logArgs = logs[0].args;
+ const logArgs = (logs[0] as any).args;
expect(logArgs._from).to.equal(expectedFrom);
expect(logArgs._to).to.equal(expectedTo);
expect(logArgs._value).to.be.bignumber.equal(ethTokensToWithdraw);
diff --git a/packages/contracts/test/ts/exchange/core.ts b/packages/contracts/test/ts/exchange/core.ts
index 7f632c6e6..641084937 100644
--- a/packages/contracts/test/ts/exchange/core.ts
+++ b/packages/contracts/test/ts/exchange/core.ts
@@ -59,6 +59,7 @@ contract('Exchange', (accounts: string[]) => {
exWrapper = new ExchangeWrapper(exchange);
zeroEx = new ZeroEx(web3.currentProvider, {
exchangeContractAddress: exchange.address,
+ networkId: constants.TESTRPC_NETWORK_ID,
});
const [repAddress, dgdAddress, zrxAddress] = await Promise.all([
diff --git a/packages/contracts/test/ts/unlimitedAllowanceToken.ts b/packages/contracts/test/ts/unlimitedAllowanceToken.ts
index ca3fcd7d2..3b4d2db77 100644
--- a/packages/contracts/test/ts/unlimitedAllowanceToken.ts
+++ b/packages/contracts/test/ts/unlimitedAllowanceToken.ts
@@ -4,6 +4,7 @@ import * as chai from 'chai';
import * as Web3 from 'web3';
import {Artifacts} from '../../util/artifacts';
+import {constants} from '../../util/constants';
import {ContractInstance} from '../../util/types';
import {chaiSetup} from './utils/chai_setup';
@@ -14,7 +15,10 @@ chaiSetup.configure();
const expect = chai.expect;
contract('UnlimitedAllowanceToken', (accounts: string[]) => {
- const zeroEx = new ZeroEx(web3.currentProvider);
+ const config = {
+ networkId: constants.TESTRPC_NETWORK_ID,
+ };
+ const zeroEx = new ZeroEx(web3.currentProvider, config);
const owner = accounts[0];
const spender = accounts[1];
diff --git a/packages/contracts/test/ts/zrxToken.ts b/packages/contracts/test/ts/zrxToken.ts
index 471ee93f2..1c9655402 100644
--- a/packages/contracts/test/ts/zrxToken.ts
+++ b/packages/contracts/test/ts/zrxToken.ts
@@ -4,6 +4,7 @@ import * as chai from 'chai';
import Web3 = require('web3');
import {Artifacts} from '../../util/artifacts';
+import {constants} from '../../util/constants';
import {ContractInstance} from '../../util/types';
import {chaiSetup} from './utils/chai_setup';
@@ -25,9 +26,10 @@ contract('ZRXToken', (accounts: string[]) => {
beforeEach(async () => {
zeroEx = new ZeroEx(web3.currentProvider, {
- exchangeContractAddress: Exchange.address,
+ exchangeContractAddress: Exchange.address,
+ networkId: constants.TESTRPC_NETWORK_ID,
});
- zrxAddress = await zeroEx.exchange.getZRXTokenAddressAsync();
+ zrxAddress = zeroEx.exchange.getZRXTokenAddress();
zrx = await ZRXToken.at(zrxAddress);
MAX_UINT = zeroEx.token.UNLIMITED_ALLOWANCE_IN_BASE_UNITS;
});
diff --git a/packages/contracts/util/constants.ts b/packages/contracts/util/constants.ts
index 733ad2312..c28a18e27 100644
--- a/packages/contracts/util/constants.ts
+++ b/packages/contracts/util/constants.ts
@@ -2,4 +2,5 @@ export const constants = {
NULL_BYTES: '0x',
INVALID_OPCODE: 'invalid opcode',
REVERT: 'revert',
+ TESTRPC_NETWORK_ID: 50,
};