Refactor contracts tests to not use injected web3 instance
This commit is contained in:
@@ -267,11 +267,6 @@ export type SyncMethod = (...args: any[]) => any;
|
|||||||
*/
|
*/
|
||||||
export type Web3Provider = Web3.Provider;
|
export type Web3Provider = Web3.Provider;
|
||||||
|
|
||||||
export interface JSONRPCPayload {
|
|
||||||
params: any[];
|
|
||||||
method: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* orderExpirationCheckingIntervalMs: How often to check for expired orders. Default: 50
|
* orderExpirationCheckingIntervalMs: How often to check for expired orders. Default: 50
|
||||||
* eventPollingIntervalMs: How often to poll the Ethereum node for new events. Defaults: 200
|
* eventPollingIntervalMs: How often to poll the Ethereum node for new events. Defaults: 200
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { BlockchainLifecycle } from '@0xproject/dev-utils';
|
import { BlockchainLifecycle, devConstants, web3Factory } from '@0xproject/dev-utils';
|
||||||
import { BigNumber } from '@0xproject/utils';
|
import { BigNumber } from '@0xproject/utils';
|
||||||
import * as chai from 'chai';
|
import * as chai from 'chai';
|
||||||
import * as _ from 'lodash';
|
import * as _ from 'lodash';
|
||||||
@@ -10,9 +10,8 @@ import { ApprovalContractEventArgs, LogWithDecodedArgs, Order, TokenEvents, Zero
|
|||||||
import { chaiSetup } from './utils/chai_setup';
|
import { chaiSetup } from './utils/chai_setup';
|
||||||
import { constants } from './utils/constants';
|
import { constants } from './utils/constants';
|
||||||
import { TokenUtils } from './utils/token_utils';
|
import { TokenUtils } from './utils/token_utils';
|
||||||
import { web3Factory } from './utils/web3_factory';
|
|
||||||
|
|
||||||
const blockchainLifecycle = new BlockchainLifecycle(constants.RPC_URL);
|
const blockchainLifecycle = new BlockchainLifecycle(devConstants.RPC_URL);
|
||||||
chaiSetup.configure();
|
chaiSetup.configure();
|
||||||
const expect = chai.expect;
|
const expect = chai.expect;
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import { web3Factory } from '@0xproject/dev-utils';
|
||||||
import * as chai from 'chai';
|
import * as chai from 'chai';
|
||||||
import 'mocha';
|
import 'mocha';
|
||||||
|
|
||||||
@@ -5,7 +6,6 @@ import { ZeroEx } from '../src';
|
|||||||
import { assert } from '../src/utils/assert';
|
import { assert } from '../src/utils/assert';
|
||||||
|
|
||||||
import { constants } from './utils/constants';
|
import { constants } from './utils/constants';
|
||||||
import { web3Factory } from './utils/web3_factory';
|
|
||||||
|
|
||||||
const expect = chai.expect;
|
const expect = chai.expect;
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { BlockchainLifecycle } from '@0xproject/dev-utils';
|
import { BlockchainLifecycle, devConstants, web3Factory } from '@0xproject/dev-utils';
|
||||||
import { BigNumber } from '@0xproject/utils';
|
import { BigNumber } from '@0xproject/utils';
|
||||||
import * as chai from 'chai';
|
import * as chai from 'chai';
|
||||||
import 'mocha';
|
import 'mocha';
|
||||||
@@ -24,11 +24,10 @@ import { chaiSetup } from './utils/chai_setup';
|
|||||||
import { constants } from './utils/constants';
|
import { constants } from './utils/constants';
|
||||||
import { reportNodeCallbackErrors } from './utils/report_callback_errors';
|
import { reportNodeCallbackErrors } from './utils/report_callback_errors';
|
||||||
import { TokenUtils } from './utils/token_utils';
|
import { TokenUtils } from './utils/token_utils';
|
||||||
import { web3Factory } from './utils/web3_factory';
|
|
||||||
|
|
||||||
chaiSetup.configure();
|
chaiSetup.configure();
|
||||||
const expect = chai.expect;
|
const expect = chai.expect;
|
||||||
const blockchainLifecycle = new BlockchainLifecycle(constants.RPC_URL);
|
const blockchainLifecycle = new BlockchainLifecycle(devConstants.RPC_URL);
|
||||||
|
|
||||||
// Since the address depositing/withdrawing ETH/WETH also needs to pay gas costs for the transaction,
|
// Since the address depositing/withdrawing ETH/WETH also needs to pay gas costs for the transaction,
|
||||||
// a small amount of ETH will be used to pay this gas cost. We therefore check that the difference between
|
// a small amount of ETH will be used to pay this gas cost. We therefore check that the difference between
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import { web3Factory } from '@0xproject/dev-utils';
|
||||||
import { Web3Wrapper } from '@0xproject/web3-wrapper';
|
import { Web3Wrapper } from '@0xproject/web3-wrapper';
|
||||||
import * as chai from 'chai';
|
import * as chai from 'chai';
|
||||||
import * as _ from 'lodash';
|
import * as _ from 'lodash';
|
||||||
@@ -11,7 +12,6 @@ import { DoneCallback } from '../src/types';
|
|||||||
|
|
||||||
import { chaiSetup } from './utils/chai_setup';
|
import { chaiSetup } from './utils/chai_setup';
|
||||||
import { reportNodeCallbackErrors } from './utils/report_callback_errors';
|
import { reportNodeCallbackErrors } from './utils/report_callback_errors';
|
||||||
import { web3Factory } from './utils/web3_factory';
|
|
||||||
|
|
||||||
chaiSetup.configure();
|
chaiSetup.configure();
|
||||||
const expect = chai.expect;
|
const expect = chai.expect;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { BlockchainLifecycle } from '@0xproject/dev-utils';
|
import { BlockchainLifecycle, devConstants, web3Factory } from '@0xproject/dev-utils';
|
||||||
import { BigNumber } from '@0xproject/utils';
|
import { BigNumber } from '@0xproject/utils';
|
||||||
import * as chai from 'chai';
|
import * as chai from 'chai';
|
||||||
|
|
||||||
@@ -8,11 +8,10 @@ import { ExchangeTransferSimulator } from '../src/utils/exchange_transfer_simula
|
|||||||
|
|
||||||
import { chaiSetup } from './utils/chai_setup';
|
import { chaiSetup } from './utils/chai_setup';
|
||||||
import { constants } from './utils/constants';
|
import { constants } from './utils/constants';
|
||||||
import { web3Factory } from './utils/web3_factory';
|
|
||||||
|
|
||||||
chaiSetup.configure();
|
chaiSetup.configure();
|
||||||
const expect = chai.expect;
|
const expect = chai.expect;
|
||||||
const blockchainLifecycle = new BlockchainLifecycle(constants.RPC_URL);
|
const blockchainLifecycle = new BlockchainLifecycle(devConstants.RPC_URL);
|
||||||
|
|
||||||
describe('ExchangeTransferSimulator', () => {
|
describe('ExchangeTransferSimulator', () => {
|
||||||
const web3 = web3Factory.create();
|
const web3 = web3Factory.create();
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { BlockchainLifecycle } from '@0xproject/dev-utils';
|
import { BlockchainLifecycle, devConstants, web3Factory } from '@0xproject/dev-utils';
|
||||||
import { BigNumber } from '@0xproject/utils';
|
import { BigNumber } from '@0xproject/utils';
|
||||||
import * as chai from 'chai';
|
import * as chai from 'chai';
|
||||||
import * as _ from 'lodash';
|
import * as _ from 'lodash';
|
||||||
@@ -25,11 +25,10 @@ import { constants } from './utils/constants';
|
|||||||
import { FillScenarios } from './utils/fill_scenarios';
|
import { FillScenarios } from './utils/fill_scenarios';
|
||||||
import { reportNodeCallbackErrors } from './utils/report_callback_errors';
|
import { reportNodeCallbackErrors } from './utils/report_callback_errors';
|
||||||
import { TokenUtils } from './utils/token_utils';
|
import { TokenUtils } from './utils/token_utils';
|
||||||
import { web3Factory } from './utils/web3_factory';
|
|
||||||
|
|
||||||
chaiSetup.configure();
|
chaiSetup.configure();
|
||||||
const expect = chai.expect;
|
const expect = chai.expect;
|
||||||
const blockchainLifecycle = new BlockchainLifecycle(constants.RPC_URL);
|
const blockchainLifecycle = new BlockchainLifecycle(devConstants.RPC_URL);
|
||||||
|
|
||||||
const NON_EXISTENT_ORDER_HASH = '0x79370342234e7acd6bbeac335bd3bb1d368383294b64b8160a00f4060e4d3777';
|
const NON_EXISTENT_ORDER_HASH = '0x79370342234e7acd6bbeac335bd3bb1d368383294b64b8160a00f4060e4d3777';
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { BlockchainLifecycle } from '@0xproject/dev-utils';
|
import { BlockchainLifecycle, devConstants, web3Factory } from '@0xproject/dev-utils';
|
||||||
import { BigNumber } from '@0xproject/utils';
|
import { BigNumber } from '@0xproject/utils';
|
||||||
import * as chai from 'chai';
|
import * as chai from 'chai';
|
||||||
import * as _ from 'lodash';
|
import * as _ from 'lodash';
|
||||||
@@ -13,15 +13,13 @@ import { constants } from '../src/utils/constants';
|
|||||||
import { utils } from '../src/utils/utils';
|
import { utils } from '../src/utils/utils';
|
||||||
|
|
||||||
import { chaiSetup } from './utils/chai_setup';
|
import { chaiSetup } from './utils/chai_setup';
|
||||||
import { constants as testConstants } from './utils/constants';
|
|
||||||
import { FillScenarios } from './utils/fill_scenarios';
|
import { FillScenarios } from './utils/fill_scenarios';
|
||||||
import { reportNoErrorCallbackErrors } from './utils/report_callback_errors';
|
import { reportNoErrorCallbackErrors } from './utils/report_callback_errors';
|
||||||
import { TokenUtils } from './utils/token_utils';
|
import { TokenUtils } from './utils/token_utils';
|
||||||
import { web3Factory } from './utils/web3_factory';
|
|
||||||
|
|
||||||
chaiSetup.configure();
|
chaiSetup.configure();
|
||||||
const expect = chai.expect;
|
const expect = chai.expect;
|
||||||
const blockchainLifecycle = new BlockchainLifecycle(testConstants.RPC_URL);
|
const blockchainLifecycle = new BlockchainLifecycle(devConstants.RPC_URL);
|
||||||
|
|
||||||
describe('ExpirationWatcher', () => {
|
describe('ExpirationWatcher', () => {
|
||||||
let web3: Web3;
|
let web3: Web3;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { BlockchainLifecycle } from '@0xproject/dev-utils';
|
import { BlockchainLifecycle, devConstants, web3Factory } from '@0xproject/dev-utils';
|
||||||
import { BigNumber } from '@0xproject/utils';
|
import { BigNumber } from '@0xproject/utils';
|
||||||
import * as chai from 'chai';
|
import * as chai from 'chai';
|
||||||
import * as _ from 'lodash';
|
import * as _ from 'lodash';
|
||||||
@@ -22,13 +22,12 @@ import { constants } from './utils/constants';
|
|||||||
import { FillScenarios } from './utils/fill_scenarios';
|
import { FillScenarios } from './utils/fill_scenarios';
|
||||||
import { reportNodeCallbackErrors } from './utils/report_callback_errors';
|
import { reportNodeCallbackErrors } from './utils/report_callback_errors';
|
||||||
import { TokenUtils } from './utils/token_utils';
|
import { TokenUtils } from './utils/token_utils';
|
||||||
import { web3Factory } from './utils/web3_factory';
|
|
||||||
|
|
||||||
const TIMEOUT_MS = 150;
|
const TIMEOUT_MS = 150;
|
||||||
|
|
||||||
chaiSetup.configure();
|
chaiSetup.configure();
|
||||||
const expect = chai.expect;
|
const expect = chai.expect;
|
||||||
const blockchainLifecycle = new BlockchainLifecycle(constants.RPC_URL);
|
const blockchainLifecycle = new BlockchainLifecycle(devConstants.RPC_URL);
|
||||||
|
|
||||||
describe('OrderStateWatcher', () => {
|
describe('OrderStateWatcher', () => {
|
||||||
let web3: Web3;
|
let web3: Web3;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { BlockchainLifecycle } from '@0xproject/dev-utils';
|
import { BlockchainLifecycle, devConstants, web3Factory } from '@0xproject/dev-utils';
|
||||||
import { BigNumber } from '@0xproject/utils';
|
import { BigNumber } from '@0xproject/utils';
|
||||||
import * as chai from 'chai';
|
import * as chai from 'chai';
|
||||||
import * as Sinon from 'sinon';
|
import * as Sinon from 'sinon';
|
||||||
@@ -13,11 +13,10 @@ import { chaiSetup } from './utils/chai_setup';
|
|||||||
import { constants } from './utils/constants';
|
import { constants } from './utils/constants';
|
||||||
import { FillScenarios } from './utils/fill_scenarios';
|
import { FillScenarios } from './utils/fill_scenarios';
|
||||||
import { TokenUtils } from './utils/token_utils';
|
import { TokenUtils } from './utils/token_utils';
|
||||||
import { web3Factory } from './utils/web3_factory';
|
|
||||||
|
|
||||||
chaiSetup.configure();
|
chaiSetup.configure();
|
||||||
const expect = chai.expect;
|
const expect = chai.expect;
|
||||||
const blockchainLifecycle = new BlockchainLifecycle(constants.RPC_URL);
|
const blockchainLifecycle = new BlockchainLifecycle(devConstants.RPC_URL);
|
||||||
|
|
||||||
describe('OrderValidation', () => {
|
describe('OrderValidation', () => {
|
||||||
let web3: Web3;
|
let web3: Web3;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { BlockchainLifecycle } from '@0xproject/dev-utils';
|
import { BlockchainLifecycle, devConstants, web3Factory } from '@0xproject/dev-utils';
|
||||||
import { BigNumber } from '@0xproject/utils';
|
import { BigNumber } from '@0xproject/utils';
|
||||||
import * as _ from 'lodash';
|
import * as _ from 'lodash';
|
||||||
import 'mocha';
|
import 'mocha';
|
||||||
@@ -11,10 +11,9 @@ import { DoneCallback } from '../src/types';
|
|||||||
import { chaiSetup } from './utils/chai_setup';
|
import { chaiSetup } from './utils/chai_setup';
|
||||||
import { constants } from './utils/constants';
|
import { constants } from './utils/constants';
|
||||||
import { assertNodeCallbackError } from './utils/report_callback_errors';
|
import { assertNodeCallbackError } from './utils/report_callback_errors';
|
||||||
import { web3Factory } from './utils/web3_factory';
|
|
||||||
|
|
||||||
chaiSetup.configure();
|
chaiSetup.configure();
|
||||||
const blockchainLifecycle = new BlockchainLifecycle(constants.RPC_URL);
|
const blockchainLifecycle = new BlockchainLifecycle(devConstants.RPC_URL);
|
||||||
|
|
||||||
describe('SubscriptionTest', () => {
|
describe('SubscriptionTest', () => {
|
||||||
let web3: Web3;
|
let web3: Web3;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { BlockchainLifecycle } from '@0xproject/dev-utils';
|
import { BlockchainLifecycle, devConstants, web3Factory } from '@0xproject/dev-utils';
|
||||||
import { schemas, SchemaValidator } from '@0xproject/json-schemas';
|
import { schemas, SchemaValidator } from '@0xproject/json-schemas';
|
||||||
import * as chai from 'chai';
|
import * as chai from 'chai';
|
||||||
import * as _ from 'lodash';
|
import * as _ from 'lodash';
|
||||||
@@ -8,11 +8,10 @@ import { Token, ZeroEx } from '../src';
|
|||||||
|
|
||||||
import { chaiSetup } from './utils/chai_setup';
|
import { chaiSetup } from './utils/chai_setup';
|
||||||
import { constants } from './utils/constants';
|
import { constants } from './utils/constants';
|
||||||
import { web3Factory } from './utils/web3_factory';
|
|
||||||
|
|
||||||
chaiSetup.configure();
|
chaiSetup.configure();
|
||||||
const expect = chai.expect;
|
const expect = chai.expect;
|
||||||
const blockchainLifecycle = new BlockchainLifecycle(constants.RPC_URL);
|
const blockchainLifecycle = new BlockchainLifecycle(devConstants.RPC_URL);
|
||||||
|
|
||||||
const TOKEN_REGISTRY_SIZE_AFTER_MIGRATION = 7;
|
const TOKEN_REGISTRY_SIZE_AFTER_MIGRATION = 7;
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
|
import { web3Factory } from '@0xproject/dev-utils';
|
||||||
import * as chai from 'chai';
|
import * as chai from 'chai';
|
||||||
|
|
||||||
import { ZeroEx } from '../src';
|
import { ZeroEx } from '../src';
|
||||||
|
|
||||||
import { chaiSetup } from './utils/chai_setup';
|
import { chaiSetup } from './utils/chai_setup';
|
||||||
import { constants } from './utils/constants';
|
import { constants } from './utils/constants';
|
||||||
import { web3Factory } from './utils/web3_factory';
|
|
||||||
|
|
||||||
chaiSetup.configure();
|
chaiSetup.configure();
|
||||||
const expect = chai.expect;
|
const expect = chai.expect;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { BlockchainLifecycle } from '@0xproject/dev-utils';
|
import { BlockchainLifecycle, devConstants, web3Factory } from '@0xproject/dev-utils';
|
||||||
import { BigNumber } from '@0xproject/utils';
|
import { BigNumber } from '@0xproject/utils';
|
||||||
import { Web3Wrapper } from '@0xproject/web3-wrapper';
|
import { Web3Wrapper } from '@0xproject/web3-wrapper';
|
||||||
import * as chai from 'chai';
|
import * as chai from 'chai';
|
||||||
@@ -22,11 +22,10 @@ import { chaiSetup } from './utils/chai_setup';
|
|||||||
import { constants } from './utils/constants';
|
import { constants } from './utils/constants';
|
||||||
import { reportNodeCallbackErrors } from './utils/report_callback_errors';
|
import { reportNodeCallbackErrors } from './utils/report_callback_errors';
|
||||||
import { TokenUtils } from './utils/token_utils';
|
import { TokenUtils } from './utils/token_utils';
|
||||||
import { web3Factory } from './utils/web3_factory';
|
|
||||||
|
|
||||||
chaiSetup.configure();
|
chaiSetup.configure();
|
||||||
const expect = chai.expect;
|
const expect = chai.expect;
|
||||||
const blockchainLifecycle = new BlockchainLifecycle(constants.RPC_URL);
|
const blockchainLifecycle = new BlockchainLifecycle(devConstants.RPC_URL);
|
||||||
|
|
||||||
describe('TokenWrapper', () => {
|
describe('TokenWrapper', () => {
|
||||||
let web3: Web3;
|
let web3: Web3;
|
||||||
|
|||||||
@@ -1,11 +1,9 @@
|
|||||||
export const constants = {
|
export const constants = {
|
||||||
NULL_ADDRESS: '0x0000000000000000000000000000000000000000',
|
NULL_ADDRESS: '0x0000000000000000000000000000000000000000',
|
||||||
RPC_URL: 'http://localhost:8545',
|
|
||||||
ROPSTEN_NETWORK_ID: 3,
|
ROPSTEN_NETWORK_ID: 3,
|
||||||
KOVAN_NETWORK_ID: 42,
|
KOVAN_NETWORK_ID: 42,
|
||||||
TESTRPC_NETWORK_ID: 50,
|
TESTRPC_NETWORK_ID: 50,
|
||||||
KOVAN_RPC_URL: 'https://kovan.infura.io/',
|
KOVAN_RPC_URL: 'https://kovan.infura.io/',
|
||||||
ROPSTEN_RPC_URL: 'https://ropsten.infura.io/',
|
ROPSTEN_RPC_URL: 'https://ropsten.infura.io/',
|
||||||
ZRX_DECIMALS: 18,
|
ZRX_DECIMALS: 18,
|
||||||
GAS_ESTIMATE: 500000,
|
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,9 +1,8 @@
|
|||||||
import { ZeroEx, ZeroExError } from '0x.js';
|
import { ZeroEx, ZeroExError } from '0x.js';
|
||||||
import { BlockchainLifecycle } from '@0xproject/dev-utils';
|
import { BlockchainLifecycle, devConstants, web3Factory } from '@0xproject/dev-utils';
|
||||||
import { BigNumber, promisify } from '@0xproject/utils';
|
import { BigNumber, promisify } from '@0xproject/utils';
|
||||||
import { Web3Wrapper } from '@0xproject/web3-wrapper';
|
import { Web3Wrapper } from '@0xproject/web3-wrapper';
|
||||||
import * as chai from 'chai';
|
import * as chai from 'chai';
|
||||||
import * as Web3 from 'web3';
|
|
||||||
|
|
||||||
import { Artifacts } from '../util/artifacts';
|
import { Artifacts } from '../util/artifacts';
|
||||||
import { constants } from '../util/constants';
|
import { constants } from '../util/constants';
|
||||||
@@ -15,10 +14,8 @@ const { EtherToken } = new Artifacts(artifacts);
|
|||||||
chaiSetup.configure();
|
chaiSetup.configure();
|
||||||
const expect = chai.expect;
|
const expect = chai.expect;
|
||||||
|
|
||||||
// In order to benefit from type-safety, we re-assign the global web3 instance injected by Truffle
|
const web3 = web3Factory.create();
|
||||||
// with type `any` to a variable of type `Web3`.
|
const blockchainLifecycle = new BlockchainLifecycle(devConstants.RPC_URL);
|
||||||
const web3: Web3 = (global as any).web3;
|
|
||||||
const blockchainLifecycle = new BlockchainLifecycle(constants.RPC_URL);
|
|
||||||
|
|
||||||
describe('EtherToken', () => {
|
describe('EtherToken', () => {
|
||||||
const web3Wrapper = new Web3Wrapper(web3.currentProvider);
|
const web3Wrapper = new Web3Wrapper(web3.currentProvider);
|
||||||
|
|||||||
@@ -1,10 +1,9 @@
|
|||||||
import { ZeroEx } from '0x.js';
|
import { ZeroEx } from '0x.js';
|
||||||
import { BlockchainLifecycle } from '@0xproject/dev-utils';
|
import { BlockchainLifecycle, devConstants, web3Factory } from '@0xproject/dev-utils';
|
||||||
import { BigNumber } from '@0xproject/utils';
|
import { BigNumber } from '@0xproject/utils';
|
||||||
import { Web3Wrapper } from '@0xproject/web3-wrapper';
|
import { Web3Wrapper } from '@0xproject/web3-wrapper';
|
||||||
import * as chai from 'chai';
|
import * as chai from 'chai';
|
||||||
import ethUtil = require('ethereumjs-util');
|
import ethUtil = require('ethereumjs-util');
|
||||||
import * as Web3 from 'web3';
|
|
||||||
|
|
||||||
import { Artifacts } from '../../util/artifacts';
|
import { Artifacts } from '../../util/artifacts';
|
||||||
import { Balances } from '../../util/balances';
|
import { Balances } from '../../util/balances';
|
||||||
@@ -19,11 +18,8 @@ import { chaiSetup } from '../utils/chai_setup';
|
|||||||
chaiSetup.configure();
|
chaiSetup.configure();
|
||||||
const expect = chai.expect;
|
const expect = chai.expect;
|
||||||
const { Exchange, TokenTransferProxy, DummyToken, TokenRegistry, MaliciousToken } = new Artifacts(artifacts);
|
const { Exchange, TokenTransferProxy, DummyToken, TokenRegistry, MaliciousToken } = new Artifacts(artifacts);
|
||||||
|
const web3 = web3Factory.create();
|
||||||
// In order to benefit from type-safety, we re-assign the global web3 instance injected by Truffle
|
const blockchainLifecycle = new BlockchainLifecycle(devConstants.RPC_URL);
|
||||||
// with type `any` to a variable of type `Web3`.
|
|
||||||
const web3: Web3 = (global as any).web3;
|
|
||||||
const blockchainLifecycle = new BlockchainLifecycle(constants.RPC_URL);
|
|
||||||
|
|
||||||
describe('Exchange', () => {
|
describe('Exchange', () => {
|
||||||
const web3Wrapper = new Web3Wrapper(web3.currentProvider);
|
const web3Wrapper = new Web3Wrapper(web3.currentProvider);
|
||||||
|
|||||||
@@ -1,13 +1,11 @@
|
|||||||
import { ZeroEx } from '0x.js';
|
import { ZeroEx } from '0x.js';
|
||||||
import { BlockchainLifecycle } from '@0xproject/dev-utils';
|
import { BlockchainLifecycle, devConstants, web3Factory } from '@0xproject/dev-utils';
|
||||||
import { BigNumber } from '@0xproject/utils';
|
import { BigNumber } from '@0xproject/utils';
|
||||||
import { Web3Wrapper } from '@0xproject/web3-wrapper';
|
import { Web3Wrapper } from '@0xproject/web3-wrapper';
|
||||||
import * as chai from 'chai';
|
import * as chai from 'chai';
|
||||||
import ethUtil = require('ethereumjs-util');
|
import ethUtil = require('ethereumjs-util');
|
||||||
import * as Web3 from 'web3';
|
|
||||||
|
|
||||||
import { Artifacts } from '../../util/artifacts';
|
import { Artifacts } from '../../util/artifacts';
|
||||||
import { constants } from '../../util/constants';
|
|
||||||
import { ExchangeWrapper } from '../../util/exchange_wrapper';
|
import { ExchangeWrapper } from '../../util/exchange_wrapper';
|
||||||
import { Order } from '../../util/order';
|
import { Order } from '../../util/order';
|
||||||
import { OrderFactory } from '../../util/order_factory';
|
import { OrderFactory } from '../../util/order_factory';
|
||||||
@@ -17,10 +15,8 @@ chaiSetup.configure();
|
|||||||
const expect = chai.expect;
|
const expect = chai.expect;
|
||||||
|
|
||||||
const { Exchange, TokenRegistry } = new Artifacts(artifacts);
|
const { Exchange, TokenRegistry } = new Artifacts(artifacts);
|
||||||
// In order to benefit from type-safety, we re-assign the global web3 instance injected by Truffle
|
const web3 = web3Factory.create();
|
||||||
// with type `any` to a variable of type `Web3`.
|
const blockchainLifecycle = new BlockchainLifecycle(devConstants.RPC_URL);
|
||||||
const web3: Web3 = (global as any).web3;
|
|
||||||
const blockchainLifecycle = new BlockchainLifecycle(constants.RPC_URL);
|
|
||||||
|
|
||||||
describe('Exchange', () => {
|
describe('Exchange', () => {
|
||||||
const web3Wrapper = new Web3Wrapper(web3.currentProvider);
|
const web3Wrapper = new Web3Wrapper(web3.currentProvider);
|
||||||
|
|||||||
@@ -1,10 +1,9 @@
|
|||||||
import { ZeroEx } from '0x.js';
|
import { ZeroEx } from '0x.js';
|
||||||
import { BlockchainLifecycle } from '@0xproject/dev-utils';
|
import { BlockchainLifecycle, devConstants, web3Factory } from '@0xproject/dev-utils';
|
||||||
import { BigNumber } from '@0xproject/utils';
|
import { BigNumber } from '@0xproject/utils';
|
||||||
import { Web3Wrapper } from '@0xproject/web3-wrapper';
|
import { Web3Wrapper } from '@0xproject/web3-wrapper';
|
||||||
import * as chai from 'chai';
|
import * as chai from 'chai';
|
||||||
import * as _ from 'lodash';
|
import * as _ from 'lodash';
|
||||||
import * as Web3 from 'web3';
|
|
||||||
|
|
||||||
import { Artifacts } from '../../util/artifacts';
|
import { Artifacts } from '../../util/artifacts';
|
||||||
import { Balances } from '../../util/balances';
|
import { Balances } from '../../util/balances';
|
||||||
@@ -18,10 +17,8 @@ import { chaiSetup } from '../utils/chai_setup';
|
|||||||
chaiSetup.configure();
|
chaiSetup.configure();
|
||||||
const expect = chai.expect;
|
const expect = chai.expect;
|
||||||
const { Exchange, TokenTransferProxy, DummyToken, TokenRegistry } = new Artifacts(artifacts);
|
const { Exchange, TokenTransferProxy, DummyToken, TokenRegistry } = new Artifacts(artifacts);
|
||||||
// In order to benefit from type-safety, we re-assign the global web3 instance injected by Truffle
|
const web3 = web3Factory.create();
|
||||||
// with type `any` to a variable of type `Web3`.
|
const blockchainLifecycle = new BlockchainLifecycle(devConstants.RPC_URL);
|
||||||
const web3: Web3 = (global as any).web3;
|
|
||||||
const blockchainLifecycle = new BlockchainLifecycle(constants.RPC_URL);
|
|
||||||
|
|
||||||
describe('Exchange', () => {
|
describe('Exchange', () => {
|
||||||
const web3Wrapper = new Web3Wrapper(web3.currentProvider);
|
const web3Wrapper = new Web3Wrapper(web3.currentProvider);
|
||||||
|
|||||||
@@ -1,8 +1,7 @@
|
|||||||
import { BlockchainLifecycle, RPC } from '@0xproject/dev-utils';
|
import { BlockchainLifecycle, devConstants, RPC, web3Factory } from '@0xproject/dev-utils';
|
||||||
import { BigNumber, promisify } from '@0xproject/utils';
|
import { BigNumber } from '@0xproject/utils';
|
||||||
import { Web3Wrapper } from '@0xproject/web3-wrapper';
|
import { Web3Wrapper } from '@0xproject/web3-wrapper';
|
||||||
import * as chai from 'chai';
|
import * as chai from 'chai';
|
||||||
import * as Web3 from 'web3';
|
|
||||||
|
|
||||||
import * as multiSigWalletJSON from '../../build/contracts/MultiSigWalletWithTimeLock.json';
|
import * as multiSigWalletJSON from '../../build/contracts/MultiSigWalletWithTimeLock.json';
|
||||||
import * as truffleConf from '../truffle.js';
|
import * as truffleConf from '../truffle.js';
|
||||||
@@ -19,10 +18,8 @@ const MULTI_SIG_ABI = (multiSigWalletJSON as any).abi;
|
|||||||
chaiSetup.configure();
|
chaiSetup.configure();
|
||||||
const expect = chai.expect;
|
const expect = chai.expect;
|
||||||
|
|
||||||
// In order to benefit from type-safety, we re-assign the global web3 instance injected by Truffle
|
const web3 = web3Factory.create();
|
||||||
// with type `any` to a variable of type `Web3`.
|
const blockchainLifecycle = new BlockchainLifecycle(devConstants.RPC_URL);
|
||||||
const web3: Web3 = (global as any).web3;
|
|
||||||
const blockchainLifecycle = new BlockchainLifecycle(constants.RPC_URL);
|
|
||||||
|
|
||||||
describe('MultiSigWalletWithTimeLock', () => {
|
describe('MultiSigWalletWithTimeLock', () => {
|
||||||
const web3Wrapper = new Web3Wrapper(web3.currentProvider);
|
const web3Wrapper = new Web3Wrapper(web3.currentProvider);
|
||||||
@@ -79,8 +76,9 @@ describe('MultiSigWalletWithTimeLock', () => {
|
|||||||
it('should set confirmation time with enough confirmations', async () => {
|
it('should set confirmation time with enough confirmations', async () => {
|
||||||
const res = await multiSig.confirmTransaction(txId, { from: owners[1] });
|
const res = await multiSig.confirmTransaction(txId, { from: owners[1] });
|
||||||
expect(res.logs).to.have.length(2);
|
expect(res.logs).to.have.length(2);
|
||||||
const blockNum = await promisify<number>(web3.eth.getBlockNumber)();
|
|
||||||
const blockInfo = await promisify<Web3.BlockWithoutTransactionData>(web3.eth.getBlock)(blockNum);
|
const blockNum = await web3Wrapper.getBlockNumberAsync();
|
||||||
|
const blockInfo = await web3Wrapper.getBlockAsync(blockNum);
|
||||||
const timestamp = new BigNumber(blockInfo.timestamp);
|
const timestamp = new BigNumber(blockInfo.timestamp);
|
||||||
const confirmationTimeBigNum = new BigNumber(await multiSig.confirmationTimes.call(txId));
|
const confirmationTimeBigNum = new BigNumber(await multiSig.confirmationTimes.call(txId));
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import { BlockchainLifecycle } from '@0xproject/dev-utils';
|
import { BlockchainLifecycle, devConstants, web3Factory } from '@0xproject/dev-utils';
|
||||||
import { Web3Wrapper } from '@0xproject/web3-wrapper';
|
import { Web3Wrapper } from '@0xproject/web3-wrapper';
|
||||||
import * as chai from 'chai';
|
import * as chai from 'chai';
|
||||||
import * as Web3 from 'web3';
|
|
||||||
|
|
||||||
import * as tokenTransferProxyJSON from '../../build/contracts/TokenTransferProxy.json';
|
import * as tokenTransferProxyJSON from '../../build/contracts/TokenTransferProxy.json';
|
||||||
import { Artifacts } from '../util/artifacts';
|
import { Artifacts } from '../util/artifacts';
|
||||||
@@ -16,10 +15,8 @@ const PROXY_ABI = (tokenTransferProxyJSON as any).abi;
|
|||||||
|
|
||||||
chaiSetup.configure();
|
chaiSetup.configure();
|
||||||
const expect = chai.expect;
|
const expect = chai.expect;
|
||||||
// In order to benefit from type-safety, we re-assign the global web3 instance injected by Truffle
|
const web3 = web3Factory.create();
|
||||||
// with type `any` to a variable of type `Web3`.
|
const blockchainLifecycle = new BlockchainLifecycle(devConstants.RPC_URL);
|
||||||
const web3: Web3 = (global as any).web3;
|
|
||||||
const blockchainLifecycle = new BlockchainLifecycle(constants.RPC_URL);
|
|
||||||
|
|
||||||
describe('MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress', () => {
|
describe('MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress', () => {
|
||||||
const web3Wrapper = new Web3Wrapper(web3.currentProvider);
|
const web3Wrapper = new Web3Wrapper(web3.currentProvider);
|
||||||
|
|||||||
@@ -1,10 +1,9 @@
|
|||||||
import { ZeroEx } from '0x.js';
|
import { ZeroEx } from '0x.js';
|
||||||
import { BlockchainLifecycle } from '@0xproject/dev-utils';
|
import { BlockchainLifecycle, devConstants, web3Factory } from '@0xproject/dev-utils';
|
||||||
import { Web3Wrapper } from '@0xproject/web3-wrapper';
|
import { Web3Wrapper } from '@0xproject/web3-wrapper';
|
||||||
import * as chai from 'chai';
|
import * as chai from 'chai';
|
||||||
import ethUtil = require('ethereumjs-util');
|
import ethUtil = require('ethereumjs-util');
|
||||||
import * as _ from 'lodash';
|
import * as _ from 'lodash';
|
||||||
import * as Web3 from 'web3';
|
|
||||||
|
|
||||||
import { Artifacts } from '../util/artifacts';
|
import { Artifacts } from '../util/artifacts';
|
||||||
import { constants } from '../util/constants';
|
import { constants } from '../util/constants';
|
||||||
@@ -16,10 +15,8 @@ import { chaiSetup } from './utils/chai_setup';
|
|||||||
const { TokenRegistry } = new Artifacts(artifacts);
|
const { TokenRegistry } = new Artifacts(artifacts);
|
||||||
chaiSetup.configure();
|
chaiSetup.configure();
|
||||||
const expect = chai.expect;
|
const expect = chai.expect;
|
||||||
// In order to benefit from type-safety, we re-assign the global web3 instance injected by Truffle
|
const web3 = web3Factory.create();
|
||||||
// with type `any` to a variable of type `Web3`.
|
const blockchainLifecycle = new BlockchainLifecycle(devConstants.RPC_URL);
|
||||||
const web3: Web3 = (global as any).web3;
|
|
||||||
const blockchainLifecycle = new BlockchainLifecycle(constants.RPC_URL);
|
|
||||||
|
|
||||||
describe('TokenRegistry', () => {
|
describe('TokenRegistry', () => {
|
||||||
const web3Wrapper = new Web3Wrapper(web3.currentProvider);
|
const web3Wrapper = new Web3Wrapper(web3.currentProvider);
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import { BlockchainLifecycle } from '@0xproject/dev-utils';
|
import { BlockchainLifecycle, devConstants, web3Factory } from '@0xproject/dev-utils';
|
||||||
import { Web3Wrapper } from '@0xproject/web3-wrapper';
|
import { Web3Wrapper } from '@0xproject/web3-wrapper';
|
||||||
import * as chai from 'chai';
|
import * as chai from 'chai';
|
||||||
import * as Web3 from 'web3';
|
|
||||||
|
|
||||||
import { constants } from '../../util/constants';
|
import { constants } from '../../util/constants';
|
||||||
import { ContractInstance } from '../../util/types';
|
import { ContractInstance } from '../../util/types';
|
||||||
@@ -10,10 +9,8 @@ import { chaiSetup } from '../utils/chai_setup';
|
|||||||
chaiSetup.configure();
|
chaiSetup.configure();
|
||||||
const expect = chai.expect;
|
const expect = chai.expect;
|
||||||
const TokenTransferProxy = artifacts.require('./db/TokenTransferProxy.sol');
|
const TokenTransferProxy = artifacts.require('./db/TokenTransferProxy.sol');
|
||||||
// In order to benefit from type-safety, we re-assign the global web3 instance injected by Truffle
|
const web3 = web3Factory.create();
|
||||||
// with type `any` to a variable of type `Web3`.
|
const blockchainLifecycle = new BlockchainLifecycle(devConstants.RPC_URL);
|
||||||
const web3: Web3 = (global as any).web3;
|
|
||||||
const blockchainLifecycle = new BlockchainLifecycle(constants.RPC_URL);
|
|
||||||
|
|
||||||
describe('TokenTransferProxy', () => {
|
describe('TokenTransferProxy', () => {
|
||||||
const web3Wrapper = new Web3Wrapper(web3.currentProvider);
|
const web3Wrapper = new Web3Wrapper(web3.currentProvider);
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import { BlockchainLifecycle } from '@0xproject/dev-utils';
|
import { BlockchainLifecycle, devConstants, web3Factory } from '@0xproject/dev-utils';
|
||||||
import { Web3Wrapper } from '@0xproject/web3-wrapper';
|
import { Web3Wrapper } from '@0xproject/web3-wrapper';
|
||||||
import * as chai from 'chai';
|
import * as chai from 'chai';
|
||||||
import * as Web3 from 'web3';
|
|
||||||
|
|
||||||
import { Artifacts } from '../../util/artifacts';
|
import { Artifacts } from '../../util/artifacts';
|
||||||
import { Balances } from '../../util/balances';
|
import { Balances } from '../../util/balances';
|
||||||
@@ -12,10 +11,8 @@ import { chaiSetup } from '../utils/chai_setup';
|
|||||||
chaiSetup.configure();
|
chaiSetup.configure();
|
||||||
const expect = chai.expect;
|
const expect = chai.expect;
|
||||||
const { TokenTransferProxy, DummyToken, TokenRegistry } = new Artifacts(artifacts);
|
const { TokenTransferProxy, DummyToken, TokenRegistry } = new Artifacts(artifacts);
|
||||||
// In order to benefit from type-safety, we re-assign the global web3 instance injected by Truffle
|
const web3 = web3Factory.create();
|
||||||
// with type `any` to a variable of type `Web3`.
|
const blockchainLifecycle = new BlockchainLifecycle(devConstants.RPC_URL);
|
||||||
const web3: Web3 = (global as any).web3;
|
|
||||||
const blockchainLifecycle = new BlockchainLifecycle(constants.RPC_URL);
|
|
||||||
|
|
||||||
describe('TokenTransferProxy', () => {
|
describe('TokenTransferProxy', () => {
|
||||||
const web3Wrapper = new Web3Wrapper(web3.currentProvider);
|
const web3Wrapper = new Web3Wrapper(web3.currentProvider);
|
||||||
|
|||||||
@@ -1,9 +1,8 @@
|
|||||||
import { ZeroEx } from '0x.js';
|
import { ZeroEx } from '0x.js';
|
||||||
import { BlockchainLifecycle } from '@0xproject/dev-utils';
|
import { BlockchainLifecycle, devConstants, web3Factory } from '@0xproject/dev-utils';
|
||||||
import { BigNumber } from '@0xproject/utils';
|
import { BigNumber } from '@0xproject/utils';
|
||||||
import { Web3Wrapper } from '@0xproject/web3-wrapper';
|
import { Web3Wrapper } from '@0xproject/web3-wrapper';
|
||||||
import * as chai from 'chai';
|
import * as chai from 'chai';
|
||||||
import * as Web3 from 'web3';
|
|
||||||
|
|
||||||
import { Artifacts } from '../util/artifacts';
|
import { Artifacts } from '../util/artifacts';
|
||||||
import { constants } from '../util/constants';
|
import { constants } from '../util/constants';
|
||||||
@@ -12,12 +11,10 @@ import { ContractInstance } from '../util/types';
|
|||||||
import { chaiSetup } from './utils/chai_setup';
|
import { chaiSetup } from './utils/chai_setup';
|
||||||
|
|
||||||
const { DummyToken } = new Artifacts(artifacts);
|
const { DummyToken } = new Artifacts(artifacts);
|
||||||
// In order to benefit from type-safety, we re-assign the global web3 instance injected by Truffle
|
const web3 = web3Factory.create();
|
||||||
// with type `any` to a variable of type `Web3`.
|
|
||||||
const web3: Web3 = (global as any).web3;
|
|
||||||
chaiSetup.configure();
|
chaiSetup.configure();
|
||||||
const expect = chai.expect;
|
const expect = chai.expect;
|
||||||
const blockchainLifecycle = new BlockchainLifecycle(constants.RPC_URL);
|
const blockchainLifecycle = new BlockchainLifecycle(devConstants.RPC_URL);
|
||||||
|
|
||||||
describe('UnlimitedAllowanceToken', () => {
|
describe('UnlimitedAllowanceToken', () => {
|
||||||
const web3Wrapper = new Web3Wrapper(web3.currentProvider);
|
const web3Wrapper = new Web3Wrapper(web3.currentProvider);
|
||||||
|
|||||||
@@ -1,9 +1,8 @@
|
|||||||
import { ZeroEx } from '0x.js';
|
import { ZeroEx } from '0x.js';
|
||||||
import { BlockchainLifecycle } from '@0xproject/dev-utils';
|
import { BlockchainLifecycle, devConstants, web3Factory } from '@0xproject/dev-utils';
|
||||||
import { BigNumber } from '@0xproject/utils';
|
import { BigNumber } from '@0xproject/utils';
|
||||||
import { Web3Wrapper } from '@0xproject/web3-wrapper';
|
import { Web3Wrapper } from '@0xproject/web3-wrapper';
|
||||||
import * as chai from 'chai';
|
import * as chai from 'chai';
|
||||||
import * as Web3 from 'web3';
|
|
||||||
|
|
||||||
import { Artifacts } from '../util/artifacts';
|
import { Artifacts } from '../util/artifacts';
|
||||||
import { constants } from '../util/constants';
|
import { constants } from '../util/constants';
|
||||||
@@ -14,8 +13,8 @@ import { chaiSetup } from './utils/chai_setup';
|
|||||||
const { DummyTokenV2 } = new Artifacts(artifacts);
|
const { DummyTokenV2 } = new Artifacts(artifacts);
|
||||||
chaiSetup.configure();
|
chaiSetup.configure();
|
||||||
const expect = chai.expect;
|
const expect = chai.expect;
|
||||||
const web3: Web3 = (global as any).web3;
|
const web3 = web3Factory.create();
|
||||||
const blockchainLifecycle = new BlockchainLifecycle(constants.RPC_URL);
|
const blockchainLifecycle = new BlockchainLifecycle(devConstants.RPC_URL);
|
||||||
|
|
||||||
describe('UnlimitedAllowanceTokenV2', () => {
|
describe('UnlimitedAllowanceTokenV2', () => {
|
||||||
const web3Wrapper = new Web3Wrapper(web3.currentProvider);
|
const web3Wrapper = new Web3Wrapper(web3.currentProvider);
|
||||||
|
|||||||
@@ -1,9 +1,8 @@
|
|||||||
import { ZeroEx } from '0x.js';
|
import { ZeroEx } from '0x.js';
|
||||||
import { BlockchainLifecycle } from '@0xproject/dev-utils';
|
import { BlockchainLifecycle, devConstants, web3Factory } from '@0xproject/dev-utils';
|
||||||
import { BigNumber } from '@0xproject/utils';
|
import { BigNumber } from '@0xproject/utils';
|
||||||
import { Web3Wrapper } from '@0xproject/web3-wrapper';
|
import { Web3Wrapper } from '@0xproject/web3-wrapper';
|
||||||
import * as chai from 'chai';
|
import * as chai from 'chai';
|
||||||
import Web3 = require('web3');
|
|
||||||
|
|
||||||
import { Artifacts } from '../util/artifacts';
|
import { Artifacts } from '../util/artifacts';
|
||||||
import { constants } from '../util/constants';
|
import { constants } from '../util/constants';
|
||||||
@@ -14,10 +13,8 @@ import { chaiSetup } from './utils/chai_setup';
|
|||||||
chaiSetup.configure();
|
chaiSetup.configure();
|
||||||
const expect = chai.expect;
|
const expect = chai.expect;
|
||||||
const { Exchange, ZRXToken } = new Artifacts(artifacts);
|
const { Exchange, ZRXToken } = new Artifacts(artifacts);
|
||||||
// In order to benefit from type-safety, we re-assign the global web3 instance injected by Truffle
|
const web3 = web3Factory.create();
|
||||||
// with type `any` to a variable of type `Web3`.
|
const blockchainLifecycle = new BlockchainLifecycle(devConstants.RPC_URL);
|
||||||
const web3: Web3 = (global as any).web3;
|
|
||||||
const blockchainLifecycle = new BlockchainLifecycle(constants.RPC_URL);
|
|
||||||
|
|
||||||
describe('ZRXToken', () => {
|
describe('ZRXToken', () => {
|
||||||
const web3Wrapper = new Web3Wrapper(web3.currentProvider);
|
const web3Wrapper = new Web3Wrapper(web3.currentProvider);
|
||||||
@@ -140,10 +137,10 @@ describe('ZRXToken', () => {
|
|||||||
const initOwnerBalance = await zeroEx.token.getBalanceAsync(zrxAddress, owner);
|
const initOwnerBalance = await zeroEx.token.getBalanceAsync(zrxAddress, owner);
|
||||||
const amountToTransfer = initOwnerBalance;
|
const amountToTransfer = initOwnerBalance;
|
||||||
const initSpenderAllowance = MAX_UINT;
|
const initSpenderAllowance = MAX_UINT;
|
||||||
let txHash = await zeroEx.token.setAllowanceAsync(zrxAddress, owner, spender, initSpenderAllowance, {
|
await zeroEx.token.setAllowanceAsync(zrxAddress, owner, spender, initSpenderAllowance, {
|
||||||
gasLimit: constants.MAX_TOKEN_APPROVE_GAS,
|
gasLimit: constants.MAX_TOKEN_APPROVE_GAS,
|
||||||
});
|
});
|
||||||
txHash = await zeroEx.token.transferFromAsync(zrxAddress, owner, spender, spender, amountToTransfer, {
|
await zeroEx.token.transferFromAsync(zrxAddress, owner, spender, spender, amountToTransfer, {
|
||||||
gasLimit: constants.MAX_TOKEN_TRANSFERFROM_GAS,
|
gasLimit: constants.MAX_TOKEN_TRANSFERFROM_GAS,
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -156,8 +153,8 @@ describe('ZRXToken', () => {
|
|||||||
const initSpenderBalance = await zeroEx.token.getBalanceAsync(zrxAddress, spender);
|
const initSpenderBalance = await zeroEx.token.getBalanceAsync(zrxAddress, spender);
|
||||||
const amountToTransfer = initOwnerBalance;
|
const amountToTransfer = initOwnerBalance;
|
||||||
const initSpenderAllowance = initOwnerBalance;
|
const initSpenderAllowance = initOwnerBalance;
|
||||||
let txHash = await zeroEx.token.setAllowanceAsync(zrxAddress, owner, spender, initSpenderAllowance);
|
await zeroEx.token.setAllowanceAsync(zrxAddress, owner, spender, initSpenderAllowance);
|
||||||
txHash = await zeroEx.token.transferFromAsync(zrxAddress, owner, spender, spender, amountToTransfer, {
|
await zeroEx.token.transferFromAsync(zrxAddress, owner, spender, spender, amountToTransfer, {
|
||||||
gasLimit: constants.MAX_TOKEN_TRANSFERFROM_GAS,
|
gasLimit: constants.MAX_TOKEN_TRANSFERFROM_GAS,
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -171,8 +168,8 @@ describe('ZRXToken', () => {
|
|||||||
it('should modify allowance if spender has sufficient allowance less than 2^256 - 1', async () => {
|
it('should modify allowance if spender has sufficient allowance less than 2^256 - 1', async () => {
|
||||||
const initOwnerBalance = await zeroEx.token.getBalanceAsync(zrxAddress, owner);
|
const initOwnerBalance = await zeroEx.token.getBalanceAsync(zrxAddress, owner);
|
||||||
const amountToTransfer = initOwnerBalance;
|
const amountToTransfer = initOwnerBalance;
|
||||||
let txHash = await zeroEx.token.setAllowanceAsync(zrxAddress, owner, spender, amountToTransfer);
|
await zeroEx.token.setAllowanceAsync(zrxAddress, owner, spender, amountToTransfer);
|
||||||
txHash = await zeroEx.token.transferFromAsync(zrxAddress, owner, spender, spender, amountToTransfer, {
|
await zeroEx.token.transferFromAsync(zrxAddress, owner, spender, spender, amountToTransfer, {
|
||||||
gasLimit: constants.MAX_TOKEN_TRANSFERFROM_GAS,
|
gasLimit: constants.MAX_TOKEN_TRANSFERFROM_GAS,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ export const constants = {
|
|||||||
INVALID_OPCODE: 'invalid opcode',
|
INVALID_OPCODE: 'invalid opcode',
|
||||||
REVERT: 'revert',
|
REVERT: 'revert',
|
||||||
TESTRPC_NETWORK_ID: 50,
|
TESTRPC_NETWORK_ID: 50,
|
||||||
RPC_URL: 'http://localhost:8545',
|
|
||||||
MAX_ETHERTOKEN_WITHDRAW_GAS: 43000,
|
MAX_ETHERTOKEN_WITHDRAW_GAS: 43000,
|
||||||
MAX_TOKEN_TRANSFERFROM_GAS: 80000,
|
MAX_TOKEN_TRANSFERFROM_GAS: 80000,
|
||||||
MAX_TOKEN_APPROVE_GAS: 60000,
|
MAX_TOKEN_APPROVE_GAS: 60000,
|
||||||
|
|||||||
@@ -21,6 +21,7 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@0xproject/tslint-config": "^0.4.5",
|
"@0xproject/tslint-config": "^0.4.5",
|
||||||
"@types/lodash": "^4.14.86",
|
"@types/lodash": "^4.14.86",
|
||||||
|
"@0xproject/types": "^0.1.4",
|
||||||
"npm-run-all": "^4.1.2",
|
"npm-run-all": "^4.1.2",
|
||||||
"shx": "^0.2.2",
|
"shx": "^0.2.2",
|
||||||
"tslint": "5.8.0",
|
"tslint": "5.8.0",
|
||||||
@@ -32,6 +33,8 @@
|
|||||||
"@0xproject/utils": "^0.2.3",
|
"@0xproject/utils": "^0.2.3",
|
||||||
"ethereumjs-util": "^5.1.2",
|
"ethereumjs-util": "^5.1.2",
|
||||||
"lodash": "^4.17.4",
|
"lodash": "^4.17.4",
|
||||||
"request-promise-native": "^1.0.5"
|
"request-promise-native": "^1.0.5",
|
||||||
|
"web3": "^0.20.0",
|
||||||
|
"web3-provider-engine": "^13.0.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
4
packages/dev-utils/src/constants.ts
Normal file
4
packages/dev-utils/src/constants.ts
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
export const constants = {
|
||||||
|
RPC_URL: 'http://localhost:8545',
|
||||||
|
GAS_ESTIMATE: 500000,
|
||||||
|
};
|
||||||
2
packages/dev-utils/src/globals.d.ts
vendored
Normal file
2
packages/dev-utils/src/globals.d.ts
vendored
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
declare module 'web3-provider-engine';
|
||||||
|
declare module 'web3-provider-engine/subproviders/rpc';
|
||||||
@@ -1,2 +1,4 @@
|
|||||||
export { RPC } from './rpc';
|
export { RPC } from './rpc';
|
||||||
export { BlockchainLifecycle } from './blockchain_lifecycle';
|
export { BlockchainLifecycle } from './blockchain_lifecycle';
|
||||||
|
export { web3Factory } from './web3_factory';
|
||||||
|
export { constants as devConstants } from './constants';
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { JSONRPCPayload } from '../../../src/types';
|
import { JSONRPCPayload } from '@0xproject/types';
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This class implements the web3-provider-engine subprovider interface and returns
|
* This class implements the web3-provider-engine subprovider interface and returns
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
import { JSONRPCPayload } from '../../../src/types';
|
import { JSONRPCPayload } from '@0xproject/types';
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This class implements the web3-provider-engine subprovider interface and returns
|
* This class implements the web3-provider-engine subprovider interface and returns
|
||||||
@@ -6,6 +6,7 @@
|
|||||||
"include": [
|
"include": [
|
||||||
"./src/**/*",
|
"./src/**/*",
|
||||||
"../../node_modules/types-bn/index.d.ts",
|
"../../node_modules/types-bn/index.d.ts",
|
||||||
|
"../../node_modules/web3-typescript-typings/index.d.ts",
|
||||||
"../../node_modules/types-ethereumjs-util/index.d.ts"
|
"../../node_modules/types-ethereumjs-util/index.d.ts"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,3 +25,8 @@ export interface TransactionReceipt {
|
|||||||
contractAddress: string | null;
|
contractAddress: string | null;
|
||||||
logs: Web3.LogEntry[];
|
logs: Web3.LogEntry[];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface JSONRPCPayload {
|
||||||
|
params: any[];
|
||||||
|
method: string;
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user