aboutsummaryrefslogtreecommitdiffstats
path: root/packages/sol-compiler
diff options
context:
space:
mode:
authorFabio Berger <me@fabioberger.com>2018-08-22 06:58:06 +0800
committerFabio Berger <me@fabioberger.com>2018-08-22 06:58:06 +0800
commit301cb296ec77e8af5c1722679e04cb983c848153 (patch)
treec4f3c94c2f76e47d7b12d3761af57c15819c9cc2 /packages/sol-compiler
parent1bbd7bf870730dfe2146819e3740522990eb83ca (diff)
downloaddexon-sol-tools-301cb296ec77e8af5c1722679e04cb983c848153.tar
dexon-sol-tools-301cb296ec77e8af5c1722679e04cb983c848153.tar.gz
dexon-sol-tools-301cb296ec77e8af5c1722679e04cb983c848153.tar.bz2
dexon-sol-tools-301cb296ec77e8af5c1722679e04cb983c848153.tar.lz
dexon-sol-tools-301cb296ec77e8af5c1722679e04cb983c848153.tar.xz
dexon-sol-tools-301cb296ec77e8af5c1722679e04cb983c848153.tar.zst
dexon-sol-tools-301cb296ec77e8af5c1722679e04cb983c848153.zip
Move types from sol-compiler to types so they can be used in other places without requiring sol-compiler as a dep
Diffstat (limited to 'packages/sol-compiler')
-rw-r--r--packages/sol-compiler/src/compiler.ts2
-rw-r--r--packages/sol-compiler/src/index.ts3
-rw-r--r--packages/sol-compiler/src/utils/compiler.ts2
-rw-r--r--packages/sol-compiler/src/utils/types.ts74
-rw-r--r--packages/sol-compiler/test/compiler_test.ts2
5 files changed, 4 insertions, 79 deletions
diff --git a/packages/sol-compiler/src/compiler.ts b/packages/sol-compiler/src/compiler.ts
index 2503f7315..eb4ff3be6 100644
--- a/packages/sol-compiler/src/compiler.ts
+++ b/packages/sol-compiler/src/compiler.ts
@@ -10,6 +10,7 @@ import {
} from '@0xproject/sol-resolver';
import { fetchAsync, logUtils } from '@0xproject/utils';
import chalk from 'chalk';
+import { CompilerOptions, ContractArtifact, ContractVersionData } from 'ethereum-types';
import * as ethUtil from 'ethereumjs-util';
import * as fs from 'fs';
import * as _ from 'lodash';
@@ -29,7 +30,6 @@ import {
} from './utils/compiler';
import { constants } from './utils/constants';
import { fsWrapper } from './utils/fs_wrapper';
-import { CompilerOptions, ContractArtifact, ContractVersionData } from './utils/types';
import { utils } from './utils/utils';
type TYPE_ALL_FILES_IDENTIFIER = '*';
diff --git a/packages/sol-compiler/src/index.ts b/packages/sol-compiler/src/index.ts
index 570de931b..74c2b80d5 100644
--- a/packages/sol-compiler/src/index.ts
+++ b/packages/sol-compiler/src/index.ts
@@ -1,3 +1,2 @@
export { Compiler } from './compiler';
-
-export { CompilerOptions } from './utils/types';
+export { ContractArtifact, CompilerOptions, ContractNetworks } from 'ethereum-types';
diff --git a/packages/sol-compiler/src/utils/compiler.ts b/packages/sol-compiler/src/utils/compiler.ts
index 968fcc5b2..c918ed1f3 100644
--- a/packages/sol-compiler/src/utils/compiler.ts
+++ b/packages/sol-compiler/src/utils/compiler.ts
@@ -1,10 +1,10 @@
import { ContractSource } from '@0xproject/sol-resolver';
import { logUtils } from '@0xproject/utils';
+import { ContractArtifact } from 'ethereum-types';
import * as _ from 'lodash';
import * as path from 'path';
import { fsWrapper } from './fs_wrapper';
-import { ContractArtifact } from './types';
/**
* Gets contract data on network or returns if an artifact does not exist.
diff --git a/packages/sol-compiler/src/utils/types.ts b/packages/sol-compiler/src/utils/types.ts
index e2e7a4e53..b211cfcbc 100644
--- a/packages/sol-compiler/src/utils/types.ts
+++ b/packages/sol-compiler/src/utils/types.ts
@@ -1,5 +1,3 @@
-import * as solc from 'solc';
-
export enum AbiType {
Function = 'function',
Constructor = 'constructor',
@@ -7,82 +5,10 @@ export enum AbiType {
Fallback = 'fallback',
}
-/**
- * This type defines the schema of the artifact.json file generated by Sol-compiler
- * schemaVersion: The version of the artifact schema
- * contractName: The contract name it represents
- * networks: Network specific information by network (address, id, constructor args, etc...)
- * compilerOutput: The Solidity compiler output generated from the specified compiler input
- * description (http://solidity.readthedocs.io/en/v0.4.24/using-the-compiler.html#compiler-input-and-output-json-description)
- * compiler: The compiler settings used
- * sourceCodes: The source code of the contract and all it's dependencies
- * sources: A mapping from source filePath to sourceMap id
- * sourceTreeHashHex: A unique hash generated from the contract source and that of it's dependencies.
- * If any of the sources change, the hash would change notifying us that a re-compilation is necessary
- */
-export interface ContractArtifact extends ContractVersionData {
- schemaVersion: string;
- contractName: string;
- networks: ContractNetworks;
-}
-
-export interface GeneratedCompilerOptions {
- name: 'solc';
- version: string;
- settings: solc.CompilerSettings;
-}
-
-export interface Source {
- id: number;
-}
-
-export interface ContractVersionData {
- compiler: GeneratedCompilerOptions;
- sources: {
- [sourceName: string]: Source;
- };
- sourceCodes: {
- [sourceName: string]: string;
- };
- sourceTreeHashHex: string;
- compilerOutput: solc.StandardContractOutput;
-}
-
-export interface ContractNetworks {
- [networkId: number]: ContractNetworkData;
-}
-
-export interface ContractNetworkData {
- address: string;
- links: {
- [linkName: string]: string;
- };
- constructorArgs: string;
-}
-
export interface SolcErrors {
[key: string]: boolean;
}
-/**
- * Options you can specify (as flags or in a compiler.json file) when invoking sol-compiler
- * contractsDir: Directory containing your project's Solidity contracts. Can contain nested directories.
- * artifactsDir: Directory where you want the generated artifacts.json written to
- * compilerSettings: Desired settings to pass to the Solidity compiler during compilation.
- * (http://solidity.readthedocs.io/en/v0.4.24/using-the-compiler.html#compiler-input-and-output-json-description)
- * contracts: List of contract names you wish to compile, or alternatively ['*'] to compile all contracts in the
- * specified directory.
- * solcVersion: If you don't want to compile each contract with the Solidity version specified in-file, you can force all
- * contracts to compile with the the version specified here.
- */
-export interface CompilerOptions {
- contractsDir?: string;
- artifactsDir?: string;
- compilerSettings?: solc.CompilerSettings;
- contracts?: string[] | '*';
- solcVersion?: string;
-}
-
export interface ContractSourceData {
[contractName: string]: ContractSpecificSourceData;
}
diff --git a/packages/sol-compiler/test/compiler_test.ts b/packages/sol-compiler/test/compiler_test.ts
index c9e141ee9..46853e882 100644
--- a/packages/sol-compiler/test/compiler_test.ts
+++ b/packages/sol-compiler/test/compiler_test.ts
@@ -1,10 +1,10 @@
import { DoneCallback } from '@0xproject/types';
import * as chai from 'chai';
+import { CompilerOptions, ContractArtifact } from 'ethereum-types';
import 'mocha';
import { Compiler } from '../src/compiler';
import { fsWrapper } from '../src/utils/fs_wrapper';
-import { CompilerOptions, ContractArtifact } from '../src/utils/types';
import { exchange_binary } from './fixtures/exchange_bin';
import { constants } from './util/constants';