types

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2020 License: Apache-2.0 Imports: 8 Imported by: 52

Documentation

Index

Constants

View Source
const (
	HashLength    = 32
	AddressLength = 20
)

Lengths of hashes and addresses in bytes.

Variables

This section is empty.

Functions

func IsValidAddressByte added in v1.0.1

func IsValidAddressByte(data []byte) bool

Types

type Address

type Address struct {
	// contains filtered or unexported fields
}

func Bytes2Address

func Bytes2Address(b []byte) *Address

BytesToAddress returns Address with value b. If b is larger than len(h), b will be cropped address the left.

func String2Address

func String2Address(s string) *Address

func (Address) Bytes

func (a Address) Bytes() []byte

func (*Address) Hex

func (a *Address) Hex() string

Hex returns an EIP55-compliant hex string representation of the address.

func (Address) MarshalJSON

func (a Address) MarshalJSON() ([]byte, error)

Serialize given address to JSON

func (*Address) MarshalTo

func (a *Address) MarshalTo(data []byte) (int, error)

func (*Address) Set

func (a *Address) Set(other *Address)

Sets a to other

func (*Address) SetBytes

func (a *Address) SetBytes(b []byte)

SetBytes sets the address to the value of b. If b is larger than len(a) it will panic.

func (Address) ShortString

func (a Address) ShortString() string

func (Address) Size

func (a Address) Size() int

func (*Address) String

func (a *Address) String() string

func (*Address) Unmarshal

func (a *Address) Unmarshal(data []byte) error

func (*Address) UnmarshalJSON

func (a *Address) UnmarshalJSON(data []byte) error

UnmarshalJSON parses a hash in hex syntax.

type Hash

type Hash struct {
	// contains filtered or unexported fields
}

func Bytes2Hash

func Bytes2Hash(b []byte) *Hash

func String2Hash

func String2Hash(s string) *Hash

func (Hash) Bytes

func (h Hash) Bytes() []byte

func (*Hash) CalculateHash added in v1.0.1

func (h *Hash) CalculateHash() ([]byte, error)

CalculateHash hashes the values of a TestContent

func (*Hash) Equals added in v1.0.1

func (h *Hash) Equals(other mt.Content) (bool, error)

Equals tests for equality of two Contents

func (*Hash) Hex

func (h *Hash) Hex() string

func (Hash) MarshalJSON

func (h Hash) MarshalJSON() ([]byte, error)

Serialize given address to JSON

func (*Hash) MarshalTo

func (h *Hash) MarshalTo(data []byte) (int, error)

func (*Hash) SetBytes

func (h *Hash) SetBytes(b []byte)

func (Hash) ShortString

func (h Hash) ShortString() string

func (Hash) Size

func (h Hash) Size() int

func (*Hash) String

func (h *Hash) String() string

func (*Hash) Unmarshal

func (h *Hash) Unmarshal(data []byte) error

func (*Hash) UnmarshalJSON

func (h *Hash) UnmarshalJSON(data []byte) error

Jump to

Keyboard shortcuts

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