Documentation ¶
Index ¶
- Constants
- type Address
- func (a Address) Bytes() []byte
- func (a Address) Hex() string
- func (a Address) MarshalJSON() ([]byte, error)
- func (a *Address) MarshalTo(data []byte) (int, error)
- func (a *Address) Set(other Address)
- func (a *Address) SetBytes(b []byte)
- func (a Address) ShortString() string
- func (a Address) Size() int
- func (a Address) String() string
- func (a *Address) Unmarshal(data []byte) error
- func (a *Address) UnmarshalJSON(data []byte) error
- type Hash
- func (h Hash) Bytes() []byte
- func (h Hash) Hex() string
- func (h Hash) MarshalJSON() ([]byte, error)
- func (h *Hash) MarshalTo(data []byte) (int, error)
- func (h *Hash) SetBytes(b []byte)
- func (h Hash) ShortString() string
- func (h Hash) Size() int
- func (h Hash) String() string
- func (h *Hash) Unmarshal(data []byte) error
- func (h *Hash) UnmarshalJSON(data []byte) error
Constants ¶
View Source
const ( HashLength = 32 AddressLength = 20 )
Lengths of hashes and addresses in bytes.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Address ¶
type Address [AddressLength]byte
func Bytes2Address ¶
BytesToAddress returns Address with value b. If b is larger than len(h), b will be cropped from the left.
func String2Address ¶
func (Address) MarshalJSON ¶
Serialize given address to JSON
func (*Address) SetBytes ¶
SetBytes sets the address to the value of b. If b is larger than len(a) it will panic.
func (Address) ShortString ¶
func (*Address) UnmarshalJSON ¶
UnmarshalJSON parses a hash in hex syntax.
type Hash ¶
type Hash [HashLength]byte
func Bytes2Hash ¶
func String2Hash ¶
func (Hash) MarshalJSON ¶
Serialize given address to JSON
func (Hash) ShortString ¶
func (*Hash) UnmarshalJSON ¶
Click to show internal directories.
Click to hide internal directories.