Update 0x.js version, fix build errors

This commit is contained in:
Amir Bandeali
2017-12-07 00:45:41 -08:00
parent 548fda8dba
commit 2cc410e61f
9 changed files with 41 additions and 60 deletions

View File

@@ -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",

View File

@@ -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];

View File

@@ -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,
});
});

View File

@@ -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);

View File

@@ -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([

View File

@@ -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];

View File

@@ -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;
});

View File

@@ -2,4 +2,5 @@ export const constants = {
NULL_BYTES: '0x',
INVALID_OPCODE: 'invalid opcode',
REVERT: 'revert',
TESTRPC_NETWORK_ID: 50,
};