parent
0a52c32df3
commit
42a9d3d7b8
20 changed files with 54 additions and 10 deletions
|
@ -52,6 +52,9 @@ type Options struct {
|
|||
// Name is contract's name to be written to manifest.
|
||||
Name string
|
||||
|
||||
// SourceURL is contract's source URL to be written to manifest.
|
||||
SourceURL string
|
||||
|
||||
// Runtime notifications.
|
||||
ContractEvents []manifest.Event
|
||||
|
||||
|
@ -199,6 +202,13 @@ func CompileAndSave(src string, o *Options) ([]byte, error) {
|
|||
if err != nil {
|
||||
return nil, fmt.Errorf("error while trying to create .nef file: %w", err)
|
||||
}
|
||||
if o.SourceURL != "" {
|
||||
if len(o.SourceURL) > nef.MaxSourceURLLength {
|
||||
return nil, errors.New("too long source URL")
|
||||
}
|
||||
f.Source = o.SourceURL
|
||||
f.Checksum = f.CalculateChecksum()
|
||||
}
|
||||
bytes, err := f.Bytes()
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("error while serializing .nef file: %w", err)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue