aboutsummaryrefslogtreecommitdiffstats
path: root/packages/ethereum-types
diff options
context:
space:
mode:
Diffstat (limited to 'packages/ethereum-types')
-rw-r--r--packages/ethereum-types/CHANGELOG.json3
-rw-r--r--packages/ethereum-types/package.json15
-rw-r--r--packages/ethereum-types/src/index.ts169
-rw-r--r--packages/ethereum-types/src/monorepo_scripts/postpublish.ts8
-rw-r--r--packages/ethereum-types/src/monorepo_scripts/stage_docs.ts8
5 files changed, 172 insertions, 31 deletions
diff --git a/packages/ethereum-types/CHANGELOG.json b/packages/ethereum-types/CHANGELOG.json
index e67d68648..b001f6af3 100644
--- a/packages/ethereum-types/CHANGELOG.json
+++ b/packages/ethereum-types/CHANGELOG.json
@@ -46,6 +46,9 @@
{
"note": "Add `TransactionReceiptStatus` type",
"pr": 812
+ },
+ {
+ "note": "Add Artifact types: `CompilerSettings`, `CompilerOptions`, `OutputField`"
}
]
},
diff --git a/packages/ethereum-types/package.json b/packages/ethereum-types/package.json
index 4fa273c6a..73325da4b 100644
--- a/packages/ethereum-types/package.json
+++ b/packages/ethereum-types/package.json
@@ -9,20 +9,14 @@
"types": "lib/index.d.ts",
"scripts": {
"watch_without_deps": "tsc -w",
- "build": "tsc && copyfiles -u 2 './lib/monorepo_scripts/**/*' ./scripts",
- "clean": "shx rm -rf lib scripts",
+ "build": "tsc",
+ "clean": "shx rm -rf lib generated_docs",
"lint": "tslint --project .",
- "manual:postpublish": "yarn build; node ./scripts/postpublish.js",
- "docs:stage": "node scripts/stage_docs.js",
- "docs:json": "typedoc --excludePrivate --excludeExternals --target ES5 --json $JSON_FILE_PATH $PROJECT_FILES",
- "upload_docs_json": "aws s3 cp generated_docs/index.json $S3_URL --profile 0xproject --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers --content-type application/json"
+ "docs:json": "typedoc --excludePrivate --excludeExternals --target ES5 --json $JSON_FILE_PATH $PROJECT_FILES"
},
"config": {
"postpublish": {
- "docPublishConfigs": {
- "s3BucketPath": "s3://doc-jsons/ethereum-types/",
- "s3StagingBucketPath": "s3://staging-doc-jsons/ethereum-types/"
- }
+ "assets": []
}
},
"license": "Apache-2.0",
@@ -35,7 +29,6 @@
},
"homepage": "https://github.com/0xProject/0x-monorepo/packages/ethereum-types/README.md",
"devDependencies": {
- "@0xproject/monorepo-scripts": "^1.0.5",
"@0xproject/tslint-config": "^1.0.5",
"copyfiles": "^2.0.0",
"make-promises-safe": "^1.1.0",
diff --git a/packages/ethereum-types/src/index.ts b/packages/ethereum-types/src/index.ts
index f4d445e3b..5ace18452 100644
--- a/packages/ethereum-types/src/index.ts
+++ b/packages/ethereum-types/src/index.ts
@@ -20,7 +20,7 @@ export type ConstructorStateMutability = 'nonpayable' | 'payable';
export type StateMutability = 'pure' | 'view' | ConstructorStateMutability;
export interface MethodAbi {
- type: AbiType.Function;
+ type: 'function';
name: string;
inputs: DataItem[];
outputs: DataItem[];
@@ -30,14 +30,14 @@ export interface MethodAbi {
}
export interface ConstructorAbi {
- type: AbiType.Constructor;
+ type: 'constructor';
inputs: DataItem[];
payable: boolean;
stateMutability: ConstructorStateMutability;
}
export interface FallbackAbi {
- type: AbiType.Fallback;
+ type: 'fallback';
payable: boolean;
}
@@ -46,7 +46,7 @@ export interface EventParameter extends DataItem {
}
export interface EventAbi {
- type: AbiType.Event;
+ type: 'event';
name: string;
inputs: EventParameter[];
anonymous: boolean;
@@ -287,3 +287,164 @@ export interface TraceParams {
disableStack?: boolean;
disableStorage?: boolean;
}
+
+export type OutputField =
+ | '*'
+ | 'ast'
+ | 'legacyAST'
+ | 'abi'
+ | 'devdoc'
+ | 'userdoc'
+ | 'metadata'
+ | 'ir'
+ | 'evm.assembly'
+ | 'evm.legacyAssembly'
+ | 'evm.bytecode.object'
+ | 'evm.bytecode.opcodes'
+ | 'evm.bytecode.sourceMap'
+ | 'evm.bytecode.linkReferences'
+ | 'evm.deployedBytecode.object'
+ | 'evm.deployedBytecode.opcodes'
+ | 'evm.deployedBytecode.sourceMap'
+ | 'evm.deployedBytecode.linkReferences'
+ | 'evm.methodIdentifiers'
+ | 'evm.gasEstimates'
+ | 'ewasm.wast'
+ | 'ewasm.wasm';
+
+export interface CompilerSettings {
+ remappings?: string[];
+ optimizer?: {
+ enabled: boolean;
+ runs?: number;
+ };
+ evmVersion?: 'homestead' | 'tangerineWhistle' | 'spuriousDragon' | 'byzantium' | 'constantinople';
+ metadata?: {
+ useLiteralContent: true;
+ };
+ libraries?: {
+ [fileName: string]: {
+ [libName: string]: string;
+ };
+ };
+ outputSelection: {
+ [fileName: string]: {
+ [contractName: string]: OutputField[];
+ };
+ };
+}
+
+export interface ContractNetworks {
+ [networkId: number]: ContractNetworkData;
+}
+
+export interface ContractNetworkData {
+ address: string;
+ links: {
+ [linkName: string]: string;
+ };
+ constructorArgs: string;
+}
+
+export interface StandardContractOutput {
+ abi: ContractAbi;
+ evm: {
+ bytecode: {
+ object: string;
+ sourceMap: string;
+ };
+ deployedBytecode: {
+ object: string;
+ sourceMap: string;
+ };
+ };
+}
+
+export interface ContractVersionData {
+ compiler: {
+ name: 'solc';
+ version: string;
+ settings: CompilerSettings;
+ };
+ sources: {
+ [sourceName: string]: {
+ id: number;
+ };
+ };
+ sourceCodes: {
+ [sourceName: string]: string;
+ };
+ sourceTreeHashHex: string;
+ compilerOutput: StandardContractOutput;
+}
+
+/**
+ * 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: CompilerSettings;
+}
+
+// Copied from the solc.js library types
+export interface CompilerSettings {
+ remappings?: string[];
+ optimizer?: {
+ enabled: boolean;
+ runs?: number;
+ };
+ evmVersion?: 'homestead' | 'tangerineWhistle' | 'spuriousDragon' | 'byzantium' | 'constantinople';
+ metadata?: {
+ useLiteralContent: true;
+ };
+ libraries?: {
+ [fileName: string]: {
+ [libName: string]: string;
+ };
+ };
+ outputSelection: {
+ [fileName: string]: {
+ [contractName: string]: OutputField[];
+ };
+ };
+}
+
+export interface Source {
+ id: number;
+}
+
+/**
+ * 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?: CompilerSettings;
+ contracts?: string[] | '*';
+ solcVersion?: string;
+}
diff --git a/packages/ethereum-types/src/monorepo_scripts/postpublish.ts b/packages/ethereum-types/src/monorepo_scripts/postpublish.ts
deleted file mode 100644
index dcb99d0f7..000000000
--- a/packages/ethereum-types/src/monorepo_scripts/postpublish.ts
+++ /dev/null
@@ -1,8 +0,0 @@
-import { postpublishUtils } from '@0xproject/monorepo-scripts';
-
-import * as packageJSON from '../package.json';
-import * as tsConfigJSON from '../tsconfig.json';
-
-const cwd = `${__dirname}/..`;
-// tslint:disable-next-line:no-floating-promises
-postpublishUtils.runAsync(packageJSON, tsConfigJSON, cwd);
diff --git a/packages/ethereum-types/src/monorepo_scripts/stage_docs.ts b/packages/ethereum-types/src/monorepo_scripts/stage_docs.ts
deleted file mode 100644
index e732ac8eb..000000000
--- a/packages/ethereum-types/src/monorepo_scripts/stage_docs.ts
+++ /dev/null
@@ -1,8 +0,0 @@
-import { postpublishUtils } from '@0xproject/monorepo-scripts';
-
-import * as packageJSON from '../package.json';
-import * as tsConfigJSON from '../tsconfig.json';
-
-const cwd = `${__dirname}/..`;
-// tslint:disable-next-line:no-floating-promises
-postpublishUtils.publishDocsToStagingAsync(packageJSON, tsConfigJSON, cwd);