Simple Summary
Vyper should provide an interface for non-python-based tools to use.
Abstract
This VIP proposes the addition of another CLI tool: vyper-json. This tool will compile contracts, generating a structured JSON output containing everything needed to integrate Vyper, including errors.
Motivation
See #1492
Specification
This section describes the input and output interfaces of vyper-json.
Input description
vyper-json doesn't need any special input apart from a list of files to compile.
An example execution could be vyper-json path/to/contract1.vy path/to/other.vy
Output description
vyper-json outputs a single JSON object with one key of type PATH per input
file, associated with an object of type OUTPUT.
PATH values should be absolute paths. If symlinks are present, they should not
be resolved, keeping the path closer to the user's input.
OUTPUT values are objects with the following properties:
files: An array of PATH values containing all the source files used to compile this contract. This is useful to implement things like cache, watchers, etc.
errors: An array of ERROR objects. One per each fatal compilation error. This array must be empty if the compilation succeeded.
warnings: An array of ERROR objects. One per each compilation warning. This array must be empty if no warning is emitted.
output: An object containing bytecode, bytecode_runtime, abi, source_map, method_identifiers as returned by vyper when format combined_json is used. This value should be null if the compilation failed.
ERROR objects must contain the following properties:
file: A PATH value pointing to the file where the warning or error originated.
line: The error/warning's line number.
column: The error/warning's line column.
message: An explanation of the warning/error.
Example
Executing vyper-json path/to/contract1.vy path/to/other.vy
should output something like:
{
"/absolute/path/to/contract1.vy": {
"files": ["/absolute/path/to/contract1.vy", "/absolute/path/to/interface.vy"],
"errors": [
{
"file": "/absolute/path/to/contract1.vy",
"line": 1,
"column": 20,
"message": "A fatal error"
}
],
"warnings": [],
"output": null
},
"/absolute/path/to/other.vy": {
"files": ["/absolute/path/to/other.vy", "/path/path/to/ERC20.vy"],
"errors": [],
"warnings": [
{
"file": "/absolute/path/to/other.vy",
"line": 2,
"column": 30,
"message": "A warning"
}
],
"output": { /* same as combined_json */ }
}
}
Backwards Compatibility
This VIP proposes the introduction of a new command-line tool, which should have no impact on the existing one.
Dependencies
This VIP has no dependencies.
Copyright
Copyright and related rights waived via CC0
Simple Summary
Vyper should provide an interface for non-python-based tools to use.
Abstract
This VIP proposes the addition of another CLI tool:
vyper-json. This tool will compile contracts, generating a structured JSON output containing everything needed to integrate Vyper, including errors.Motivation
See #1492
Specification
This section describes the input and output interfaces of
vyper-json.Input description
vyper-jsondoesn't need any special input apart from a list of files to compile.An example execution could be
vyper-json path/to/contract1.vy path/to/other.vyOutput description
vyper-jsonoutputs a single JSON object with one key of typePATHper inputfile, associated with an object of type
OUTPUT.PATHvalues should be absolute paths. If symlinks are present, they should notbe resolved, keeping the path closer to the user's input.
OUTPUTvalues are objects with the following properties:files: An array ofPATHvalues containing all the source files used to compile this contract. This is useful to implement things like cache, watchers, etc.errors: An array ofERRORobjects. One per each fatal compilation error. This array must be empty if the compilation succeeded.warnings: An array ofERRORobjects. One per each compilation warning. This array must be empty if no warning is emitted.output: An object containingbytecode,bytecode_runtime,abi,source_map,method_identifiersas returned byvyperwhen formatcombined_jsonis used. This value should benullif the compilation failed.ERRORobjects must contain the following properties:file: APATHvalue pointing to the file where the warning or error originated.line: The error/warning's line number.column: The error/warning's line column.message: An explanation of the warning/error.Example
Executing
vyper-json path/to/contract1.vy path/to/other.vyshould output something like:
Backwards Compatibility
This VIP proposes the introduction of a new command-line tool, which should have no impact on the existing one.
Dependencies
This VIP has no dependencies.
Copyright
Copyright and related rights waived via CC0