nef

package
v0.92.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 28, 2020 License: MIT Imports: 6 Imported by: 3

Documentation

Index

Constants

View Source
const (
	// Magic is a magic File header constant.
	Magic uint32 = 0x3346454E
	// MaxScriptLength is the maximum allowed contract script length.
	MaxScriptLength = 512 * 1024
)

Variables

This section is empty.

Functions

This section is empty.

Types

type File

type File struct {
	Header   Header
	Script   []byte
	Checksum uint32
}

File represents compiled contract file structure according to the NEF3 standard.

func FileFromBytes

func FileFromBytes(source []byte) (File, error)

FileFromBytes returns NEF File deserialized from given bytes.

func NewFile

func NewFile(script []byte) (*File, error)

NewFile returns new NEF3 file with script specified.

func (File) Bytes

func (n File) Bytes() ([]byte, error)

Bytes returns byte array with serialized NEF File.

func (*File) CalculateChecksum added in v0.92.0

func (n *File) CalculateChecksum() uint32

CalculateChecksum returns first 4 bytes of double-SHA256(Header) converted to uint32.

func (*File) DecodeBinary

func (n *File) DecodeBinary(r *io.BinReader)

DecodeBinary implements io.Serializable interface.

func (*File) EncodeBinary

func (n *File) EncodeBinary(w *io.BinWriter)

EncodeBinary implements io.Serializable interface.

type Header struct {
	Magic    uint32
	Compiler string
	Version  string
}

Header represents File header.

func (*Header) DecodeBinary

func (h *Header) DecodeBinary(r *io.BinReader)

DecodeBinary implements io.Serializable interface.

func (*Header) EncodeBinary

func (h *Header) EncodeBinary(w *io.BinWriter)

EncodeBinary implements io.Serializable interface.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL