diff options
Diffstat (limited to 'packages/sol-compiler')
-rw-r--r-- | packages/sol-compiler/src/utils/types.ts | 44 |
1 files changed, 36 insertions, 8 deletions
diff --git a/packages/sol-compiler/src/utils/types.ts b/packages/sol-compiler/src/utils/types.ts index 4321a2235..e2e7a4e53 100644 --- a/packages/sol-compiler/src/utils/types.ts +++ b/packages/sol-compiler/src/utils/types.ts @@ -7,22 +7,39 @@ 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: { - name: 'solc'; - version: string; - settings: solc.CompilerSettings; - }; + compiler: GeneratedCompilerOptions; sources: { - [sourceName: string]: { - id: number; - }; + [sourceName: string]: Source; }; sourceCodes: { [sourceName: string]: string; @@ -47,6 +64,17 @@ 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; |