compiler, cli: introduce *.manifest.json

Add ability to generate NEO3-compatable *.manifest.json into compiler.
This file represets contract manifest and includes ABI information, so
we don't need to create separate *.abi.json file. NEO3 debugger also
needs *.manifest.json only. So, switched from *.abi.json to
*.manifest.json file.
This commit is contained in:
Anna Shaleva 2020-06-25 16:10:08 +03:00
parent 1c1818d97e
commit 2f6065f541
4 changed files with 175 additions and 50 deletions

View file

@ -29,8 +29,8 @@ type Options struct {
// The name of the output for debug info.
DebugInfo string
// The name of the output for application binary interface info.
ABIInfo string
// The name of the output for contract manifest file.
ManifestFile string
// Contract metadata.
ContractFeatures smartcontract.PropertyState
@ -124,13 +124,16 @@ func CompileAndSave(src string, o *Options) ([]byte, error) {
if err := ioutil.WriteFile(o.DebugInfo, data, os.ModePerm); err != nil {
return b, err
}
if o.ABIInfo == "" {
if o.ManifestFile == "" {
return b, err
}
abi := di.convertToABI(o.ContractFeatures)
abiData, err := json.Marshal(abi)
m, err := di.convertToManifest(o.ContractFeatures)
if err != nil {
return b, err
}
return b, ioutil.WriteFile(o.ABIInfo, abiData, os.ModePerm)
mData, err := json.Marshal(m)
if err != nil {
return b, err
}
return b, ioutil.WriteFile(o.ManifestFile, mData, os.ModePerm)
}