Documentation ¶
Index ¶
Constants ¶
const ( // Magic is a magic File header constant. Magic uint32 = 0x3346454E // MaxSourceURLLength is the maximum allowed source URL length. MaxSourceURLLength = 256 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type File ¶
type File struct { Header Source string `json:"source"` Tokens []MethodToken `json:"tokens"` Script []byte `json:"script"` Checksum uint32 `json:"checksum"` }
File represents a compiled contract file structure according to the NEF3 standard.
func FileFromBytes ¶
FileFromBytes returns a NEF File deserialized from the given bytes.
func (File) Bytes ¶
Bytes returns a byte array with a serialized NEF File. It performs the resulting NEF file size check and returns an error if serialized slice length exceeds stackitem.MaxSize.
func (File) BytesLong ¶ added in v0.104.0
BytesLong returns a byte array with a serialized NEF File. It performs no resulting slice check.
func (*File) CalculateChecksum ¶ added in v0.92.0
CalculateChecksum returns first 4 bytes of double-SHA256(Header) converted to uint32. CalculateChecksum doesn't perform the resulting serialized NEF size check, and return the checksum irrespectively to the size limit constraint. It's a caller's duty to check the resulting NEF size.
func (*File) DecodeBinary ¶
DecodeBinary implements the io.Serializable interface.
func (*File) EncodeBinary ¶
EncodeBinary implements the io.Serializable interface.
type Header ¶
Header represents a File header.
func (*Header) DecodeBinary ¶
DecodeBinary implements the io.Serializable interface.
func (*Header) EncodeBinary ¶
EncodeBinary implements the io.Serializable interface.
type MethodToken ¶ added in v0.93.0
type MethodToken struct { // Hash is contract hash. Hash util.Uint160 `json:"hash"` // Method is method name. Method string `json:"method"` // ParamCount is method parameter count. ParamCount uint16 `json:"paramcount"` // HasReturn is true if method returns value. HasReturn bool `json:"hasreturnvalue"` // CallFlag is a set of call flags the method will be called with. CallFlag callflag.CallFlag `json:"callflags"` }
MethodToken is contract method description.
func (*MethodToken) DecodeBinary ¶ added in v0.93.0
func (t *MethodToken) DecodeBinary(r *io.BinReader)
DecodeBinary implements io.Serializable.
func (*MethodToken) EncodeBinary ¶ added in v0.93.0
func (t *MethodToken) EncodeBinary(w *io.BinWriter)
EncodeBinary implements io.Serializable.