aboutsummaryrefslogtreecommitdiffstats
path: root/packages/ethereum-types/src/index.ts
diff options
context:
space:
mode:
authorBrandon Millman <brandon.millman@gmail.com>2018-08-24 01:58:33 +0800
committerBrandon Millman <brandon.millman@gmail.com>2018-08-24 01:58:33 +0800
commit57c104119c409c053eb977553c92341c3ca83afd (patch)
tree7f1129fd01001604e7412e33ccef202c1ff90612 /packages/ethereum-types/src/index.ts
parentcd5c73550b969fe0a87524143ce617749935427a (diff)
parent6e27324a341801e1a2d8d6989d749dfe021ae39b (diff)
downloaddexon-sol-tools-57c104119c409c053eb977553c92341c3ca83afd.tar
dexon-sol-tools-57c104119c409c053eb977553c92341c3ca83afd.tar.gz
dexon-sol-tools-57c104119c409c053eb977553c92341c3ca83afd.tar.bz2
dexon-sol-tools-57c104119c409c053eb977553c92341c3ca83afd.tar.lz
dexon-sol-tools-57c104119c409c053eb977553c92341c3ca83afd.tar.xz
dexon-sol-tools-57c104119c409c053eb977553c92341c3ca83afd.tar.zst
dexon-sol-tools-57c104119c409c053eb977553c92341c3ca83afd.zip
Merge branch 'development' into feature/forwarder-helper/init
* development: (187 commits) Remove trailing slash Fix linter Stop nesting interfaces and add necessary type exports Remove duplicate type and remove nested interface Add support for rending the Tuple type Add missing keyu Remove excessive timestamp Improve doc commebnt Remove docs catch-all endpoint Fix comments Look for all TS mapped types Add catch and exit with non-zero Remove superfluous dep Fix CHANGELOG entry Fix double assignment Upgrade Typedoc to 0.12.0, which works with TS 3.x Fix prettier issues Enable dry run of release publishing and handle git tags existing update yarn.lock Missing/superfluous type exports from connect ...
Diffstat (limited to 'packages/ethereum-types/src/index.ts')
-rw-r--r--packages/ethereum-types/src/index.ts154
1 files changed, 150 insertions, 4 deletions
diff --git a/packages/ethereum-types/src/index.ts b/packages/ethereum-types/src/index.ts
index f4d445e3b..3b6fdc77b 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'; // We hardcode this here b/c doc pages cannot render an enum value
name: string;
inputs: DataItem[];
outputs: DataItem[];
@@ -30,14 +30,14 @@ export interface MethodAbi {
}
export interface ConstructorAbi {
- type: AbiType.Constructor;
+ type: 'constructor'; // We hardcode this here b/c doc pages cannot render an enum value
inputs: DataItem[];
payable: boolean;
stateMutability: ConstructorStateMutability;
}
export interface FallbackAbi {
- type: AbiType.Fallback;
+ type: 'fallback'; // We hardcode this here b/c doc pages cannot render an enum value
payable: boolean;
}
@@ -46,7 +46,7 @@ export interface EventParameter extends DataItem {
}
export interface EventAbi {
- type: AbiType.Event;
+ type: 'event'; // We hardcode this here b/c doc pages cannot render an enum value
name: string;
inputs: EventParameter[];
anonymous: boolean;
@@ -287,3 +287,149 @@ 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 ContractNetworks {
+ [networkId: number]: ContractNetworkData;
+}
+
+export interface ContractNetworkData {
+ address: string;
+ links: {
+ [linkName: string]: string;
+ };
+ constructorArgs: string;
+}
+
+export interface StandardContractOutput {
+ abi: ContractAbi;
+ evm: EvmOutput;
+}
+
+export interface EvmOutput {
+ bytecode: EvmBytecodeOutput;
+ deployedBytecode: EvmBytecodeOutput;
+}
+
+export interface EvmBytecodeOutput {
+ object: string;
+ sourceMap: string;
+}
+
+export interface ContractVersionData {
+ compiler: CompilerOpts;
+ sources: {
+ [sourceName: string]: {
+ id: number;
+ };
+ };
+ sourceCodes: {
+ [sourceName: string]: string;
+ };
+ sourceTreeHashHex: string;
+ compilerOutput: StandardContractOutput;
+}
+
+export interface CompilerOpts {
+ name: 'solc';
+ version: string;
+ settings: CompilerSettings;
+}
+
+/**
+ * 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?: OptimizerSettings;
+ evmVersion?: 'homestead' | 'tangerineWhistle' | 'spuriousDragon' | 'byzantium' | 'constantinople';
+ metadata?: CompilerSettingsMetadata;
+ libraries?: {
+ [fileName: string]: {
+ [libName: string]: string;
+ };
+ };
+ outputSelection: {
+ [fileName: string]: {
+ [contractName: string]: OutputField[];
+ };
+ };
+}
+
+export interface CompilerSettingsMetadata {
+ useLiteralContent: true;
+}
+
+export interface OptimizerSettings {
+ enabled: boolean;
+ runs?: number;
+}
+
+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;
+}