From 3d58b38e4e8565e7ee10e4d6c9f57cd745957ab4 Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Mon, 7 May 2018 22:11:09 +0200 Subject: Remove deployer from metacoin and contract tests --- packages/metacoin/src/global.d.ts | 4 ++++ packages/metacoin/test/metacoin_test.ts | 11 +++++++---- packages/metacoin/test/utils/config.ts | 4 ++++ packages/metacoin/test/utils/deployer.ts | 17 ----------------- 4 files changed, 15 insertions(+), 21 deletions(-) create mode 100644 packages/metacoin/src/global.d.ts delete mode 100644 packages/metacoin/test/utils/deployer.ts (limited to 'packages/metacoin') diff --git a/packages/metacoin/src/global.d.ts b/packages/metacoin/src/global.d.ts new file mode 100644 index 000000000..783b92913 --- /dev/null +++ b/packages/metacoin/src/global.d.ts @@ -0,0 +1,4 @@ +declare module '*.json' { + const value: any; + export default value; +} diff --git a/packages/metacoin/test/metacoin_test.ts b/packages/metacoin/test/metacoin_test.ts index 51830d1ef..6fe751d12 100644 --- a/packages/metacoin/test/metacoin_test.ts +++ b/packages/metacoin/test/metacoin_test.ts @@ -1,15 +1,19 @@ +import { ContractArtifact } from '@0xproject/deployer'; import { BlockchainLifecycle, devConstants } from '@0xproject/dev-utils'; import { LogWithDecodedArgs } from '@0xproject/types'; import { BigNumber } from '@0xproject/utils'; import { Web3Wrapper } from '@0xproject/web3-wrapper'; import * as chai from 'chai'; +import * as MetacoinArtifact from '../artifacts/Metacoin.json'; import { MetacoinContract, TransferContractEventArgs } from '../src/contract_wrappers/metacoin'; import { chaiSetup } from './utils/chai_setup'; -import { deployer } from './utils/deployer'; +import { config } from './utils/config'; import { provider, web3Wrapper } from './utils/web3_wrapper'; +const artifact: ContractArtifact = MetacoinArtifact as any; + chaiSetup.configure(); const { expect } = chai; const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper); @@ -19,9 +23,8 @@ describe('Metacoin', () => { const ownerAddress = devConstants.TESTRPC_FIRST_ADDRESS; const INITIAL_BALANCE = new BigNumber(10000); before(async () => { - const metacoinInstance = await deployer.deployAsync('Metacoin'); - web3Wrapper.abiDecoder.addABI(metacoinInstance.abi); - metacoin = new MetacoinContract(metacoinInstance.abi, metacoinInstance.address, provider); + metacoin = await MetacoinContract.deploy0xArtifactAsync(artifact, provider, config.defaults); + web3Wrapper.abiDecoder.addABI(metacoin.abi); }); beforeEach(async () => { await blockchainLifecycle.startAsync(); diff --git a/packages/metacoin/test/utils/config.ts b/packages/metacoin/test/utils/config.ts index d3a830754..8ae6d39a2 100644 --- a/packages/metacoin/test/utils/config.ts +++ b/packages/metacoin/test/utils/config.ts @@ -1,3 +1,4 @@ +import { devConstants } from '@0xproject/dev-utils'; import * as path from 'path'; export const config = { @@ -5,5 +6,8 @@ export const config = { artifactsDir: path.resolve(__dirname, '../../artifacts'), contractsDir: path.resolve(__dirname, '../../contracts'), ganacheLogFile: 'ganache.log', + defaults: { + from: devConstants.TESTRPC_FIRST_ADDRESS, + }, mnemonic: 'concert load couple harbor equip island argue ramp clarify fence smart topic', }; diff --git a/packages/metacoin/test/utils/deployer.ts b/packages/metacoin/test/utils/deployer.ts deleted file mode 100644 index 5a631fa0a..000000000 --- a/packages/metacoin/test/utils/deployer.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { Deployer } from '@0xproject/deployer'; -import { devConstants } from '@0xproject/dev-utils'; -import * as path from 'path'; - -import { config } from './config'; -import { web3Wrapper } from './web3_wrapper'; - -const deployerOpts = { - provider: web3Wrapper.getProvider(), - artifactsDir: config.artifactsDir, - networkId: config.networkId, - defaults: { - from: devConstants.TESTRPC_FIRST_ADDRESS, - }, -}; - -export const deployer = new Deployer(deployerOpts); -- cgit From a6f72de09d7b2c9738b78d2097baa9906838fbe9 Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Tue, 8 May 2018 15:42:07 +0200 Subject: Rename deployer to sol-compiler --- packages/metacoin/package.json | 4 ++-- packages/metacoin/test/metacoin_test.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'packages/metacoin') diff --git a/packages/metacoin/package.json b/packages/metacoin/package.json index 17aad0aaf..77099534d 100644 --- a/packages/metacoin/package.json +++ b/packages/metacoin/package.json @@ -18,14 +18,14 @@ "coverage:report:html": "istanbul report html && open coverage/index.html", "coverage:report:lcov": "istanbul report lcov", "test:circleci": "yarn test:coverage", - "compile": "node ../deployer/lib/src/cli.js compile" + "compile": "node ../sol-compiler/lib/src/cli.js compile" }, "author": "", "license": "Apache-2.0", "dependencies": { "@0xproject/abi-gen": "^0.2.13", "@0xproject/base-contract": "^0.3.1", - "@0xproject/deployer": "^0.4.3", + "@0xproject/sol-compiler": "^0.4.3", "@0xproject/sol-cov": "^0.0.10", "@0xproject/subproviders": "^0.10.1", "@0xproject/tslint-config": "^0.4.17", diff --git a/packages/metacoin/test/metacoin_test.ts b/packages/metacoin/test/metacoin_test.ts index 6fe751d12..830551968 100644 --- a/packages/metacoin/test/metacoin_test.ts +++ b/packages/metacoin/test/metacoin_test.ts @@ -1,4 +1,4 @@ -import { ContractArtifact } from '@0xproject/deployer'; +import { ContractArtifact } from '@0xproject/sol-compiler'; import { BlockchainLifecycle, devConstants } from '@0xproject/dev-utils'; import { LogWithDecodedArgs } from '@0xproject/types'; import { BigNumber } from '@0xproject/utils'; -- cgit From 75d24dea0e10d098d3833488a420498410c22991 Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Tue, 8 May 2018 16:02:04 +0200 Subject: Fix linter issues --- packages/metacoin/test/metacoin_test.ts | 4 ++-- packages/metacoin/test/utils/coverage.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'packages/metacoin') diff --git a/packages/metacoin/test/metacoin_test.ts b/packages/metacoin/test/metacoin_test.ts index 830551968..a31ce1779 100644 --- a/packages/metacoin/test/metacoin_test.ts +++ b/packages/metacoin/test/metacoin_test.ts @@ -1,5 +1,5 @@ -import { ContractArtifact } from '@0xproject/sol-compiler'; import { BlockchainLifecycle, devConstants } from '@0xproject/dev-utils'; +import { ContractArtifact } from '@0xproject/sol-compiler'; import { LogWithDecodedArgs } from '@0xproject/types'; import { BigNumber } from '@0xproject/utils'; import { Web3Wrapper } from '@0xproject/web3-wrapper'; @@ -23,7 +23,7 @@ describe('Metacoin', () => { const ownerAddress = devConstants.TESTRPC_FIRST_ADDRESS; const INITIAL_BALANCE = new BigNumber(10000); before(async () => { - metacoin = await MetacoinContract.deploy0xArtifactAsync(artifact, provider, config.defaults); + metacoin = await MetacoinContract.deployFrom0xArtifactAsync(artifact, provider, config.defaults); web3Wrapper.abiDecoder.addABI(metacoin.abi); }); beforeEach(async () => { diff --git a/packages/metacoin/test/utils/coverage.ts b/packages/metacoin/test/utils/coverage.ts index 6b249384f..debd544ed 100644 --- a/packages/metacoin/test/utils/coverage.ts +++ b/packages/metacoin/test/utils/coverage.ts @@ -15,6 +15,6 @@ export const coverage = { }, _getCoverageSubprovider(): CoverageSubprovider { const defaultFromAddress = devConstants.TESTRPC_FIRST_ADDRESS; - return new CoverageSubprovider(config.artifactsDir, config.contractsDir, config.networkId, defaultFromAddress); + return new CoverageSubprovider(config.artifactsDir, config.contractsDir, defaultFromAddress); }, }; -- cgit From f854f3ee2bd74bbb61ed465099168b4d391f92c8 Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Thu, 10 May 2018 15:20:00 +0200 Subject: Remove unused deployer docs configs --- packages/metacoin/test/metacoin_test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'packages/metacoin') diff --git a/packages/metacoin/test/metacoin_test.ts b/packages/metacoin/test/metacoin_test.ts index a31ce1779..8369632c2 100644 --- a/packages/metacoin/test/metacoin_test.ts +++ b/packages/metacoin/test/metacoin_test.ts @@ -23,7 +23,7 @@ describe('Metacoin', () => { const ownerAddress = devConstants.TESTRPC_FIRST_ADDRESS; const INITIAL_BALANCE = new BigNumber(10000); before(async () => { - metacoin = await MetacoinContract.deployFrom0xArtifactAsync(artifact, provider, config.defaults); + metacoin = await MetacoinContract.deployFrom0xArtifactAsync(artifact, provider, config.txDefaults); web3Wrapper.abiDecoder.addABI(metacoin.abi); }); beforeEach(async () => { -- cgit From 2e1c2d9dfeca4439435fdf1ed58504142963585a Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Thu, 10 May 2018 16:57:51 +0200 Subject: Fix templates --- packages/metacoin/test/utils/config.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'packages/metacoin') diff --git a/packages/metacoin/test/utils/config.ts b/packages/metacoin/test/utils/config.ts index 8ae6d39a2..389edb388 100644 --- a/packages/metacoin/test/utils/config.ts +++ b/packages/metacoin/test/utils/config.ts @@ -6,7 +6,7 @@ export const config = { artifactsDir: path.resolve(__dirname, '../../artifacts'), contractsDir: path.resolve(__dirname, '../../contracts'), ganacheLogFile: 'ganache.log', - defaults: { + txDefaults: { from: devConstants.TESTRPC_FIRST_ADDRESS, }, mnemonic: 'concert load couple harbor equip island argue ramp clarify fence smart topic', -- cgit