Documentation ¶
Index ¶
- Constants
- Variables
- func BytesReverse(u []byte) []byte
- func BytesToHexString(data []byte) string
- func BytesToInt16(b []byte) int16
- func ClearBytes(arr []byte)
- func FuncError(f string, desc string) error
- func Goid() string
- func HexStringToBytes(value string) ([]byte, error)
- func IntToBytes(n int) []byte
- func ReadBytes(r io.Reader, length uint64) ([]byte, error)
- func ReadElement(r io.Reader, element interface{}) (err error)
- func ReadElements(r io.Reader, elements ...interface{}) error
- func ReadUint16(r io.Reader) (uint16, error)
- func ReadUint32(r io.Reader) (uint32, error)
- func ReadUint64(r io.Reader) (uint64, error)
- func ReadUint8(r io.Reader) (uint8, error)
- func ReadVarBytes(r io.Reader, maxAllowed uint32, fieldName string) ([]byte, error)
- func ReadVarString(r io.Reader) (string, error)
- func ReadVarUint(r io.Reader, pver uint32) (uint64, error)
- func Sha256D(data []byte) [32]byte
- func SortProgramHashByCodeHash(hashes []Uint168)
- func SortUint160(hashes []Uint160)
- func VarIntSerializeSize(val uint64) int
- func VarUintSerializeSize(val uint64) int
- func WriteElement(w io.Writer, element interface{}) (err error)
- func WriteElements(w io.Writer, elements ...interface{}) error
- func WriteUint16(w io.Writer, val uint16) error
- func WriteUint32(w io.Writer, val uint32) error
- func WriteUint64(w io.Writer, val uint64) error
- func WriteUint8(w io.Writer, val uint8) error
- func WriteVarBytes(w io.Writer, bytes []byte) error
- func WriteVarString(w io.Writer, str string) error
- func WriteVarUint(w io.Writer, val uint64) error
- type Fixed64
- type Serializable
- type Uint160
- type Uint168
- func (u Uint168) Bytes() []byte
- func (u Uint168) Compare(o Uint168) int
- func (u *Uint168) Deserialize(r io.Reader) error
- func (u Uint168) IsEqual(o Uint168) bool
- func (u *Uint168) Serialize(w io.Writer) error
- func (u Uint168) String() string
- func (u Uint168) ToAddress() (string, error)
- func (u Uint168) ToCodeHash() Uint160
- type Uint256
Constants ¶
const ( UINT168SIZE = 21 // Address types STANDARD = 0xAC DID = 0xAD MULTISIG = 0xAE CROSSCHAIN = 0xAF )
const ( // MaxVarStringLength is the maximum bytes a var string. MaxVarStringLength = 1024 * 1024 * 16 // 16MB )
const UINT160SIZE int = 20
const UINT256SIZE = 32
Variables ¶
var EmptyHash = Uint256{}
Functions ¶
func BytesReverse ¶
func BytesToHexString ¶
func BytesToInt16 ¶ added in v0.2.2
func ClearBytes ¶ added in v0.2.2
func ClearBytes(arr []byte)
func HexStringToBytes ¶
func IntToBytes ¶ added in v0.2.2
func ReadElement ¶ added in v0.2.2
readElement reads the next sequence of bytes from r using little endian depending on the concrete type of element pointed to.
func ReadElements ¶ added in v0.2.2
ReadElements reads multiple items from r. It is equivalent to multiple calls to ReadElement.
func ReadVarBytes ¶ added in v0.2.2
func ReadVarUint ¶ added in v0.2.2
ReadVarUint reads a variable length integer from r and returns it as a uint64.
func SortProgramHashByCodeHash ¶ added in v0.2.2
func SortProgramHashByCodeHash(hashes []Uint168)
func SortUint160 ¶ added in v0.2.2
func SortUint160(hashes []Uint160)
func VarIntSerializeSize ¶ added in v0.4.0
VarIntSerializeSize returns the number of bytes it would take to serialize val as a variable length integer.
func VarUintSerializeSize ¶ added in v0.2.2
VarUintSerializeSize returns the number of bytes it would take to serialize val as a variable length integer.
func WriteElement ¶ added in v0.2.2
WriteElement writes the little endian representation of element to w.
func WriteElements ¶ added in v0.2.2
WriteElements writes multiple items to w. It is equivalent to multiple calls to WriteElement.
Types ¶
type Fixed64 ¶
type Fixed64 int64
the 64 bit fixed-point number, precise 10^-8
func Fixed64FromBytes ¶ added in v0.2.2
func StringToFixed64 ¶ added in v0.2.2
type Serializable ¶ added in v0.2.2
type Serializable interface { //Write data to writer Serialize(w io.Writer) error //read data to reader Deserialize(r io.Reader) error }
Serializable describe the data need be serialized.
type Uint160 ¶ added in v0.2.2
type Uint160 [UINT160SIZE]uint8
func ToCodeHash ¶ added in v0.2.2
func Uint160FromBytes ¶ added in v0.2.2
type Uint168 ¶
type Uint168 [UINT168SIZE]uint8
func ToProgramHash ¶ added in v0.2.2
func Uint168FromAddress ¶ added in v0.2.2
func Uint168FromBytes ¶
func Uint168FromCodeHash ¶ added in v0.2.2
func (Uint168) ToCodeHash ¶ added in v0.2.2
type Uint256 ¶
type Uint256 [UINT256SIZE]uint8