Documentation
¶
Index ¶
- Constants
- func HexDecodeString(s string) ([]byte, error)
- func IsValidAddressByte(data []byte) bool
- type Address
- func (a *Address) Bytes() []byte
- func (a *Address) MarshalJSON() ([]byte, error)
- func (a *Address) MarshalTo(data []byte) (int, error)
- func (a *Address) ProtoMessage()
- func (a *Address) Reset()
- func (a *Address) Set(other *Address)
- func (a *Address) SetBytes(b []byte)
- func (a *Address) SetString(s 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) CalculateHash() ([]byte, error)
- func (h *Hash) Equals(other mt.Content) (bool, error)
- func (h *Hash) MarshalJSON() ([]byte, error)
- func (h *Hash) MarshalTo(data []byte) (int, error)
- func (h *Hash) ProtoMessage()
- func (h *Hash) Reset()
- func (h *Hash) SetBytes(b []byte)
- func (h *Hash) SetString(s 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 ¶
func HexDecodeString ¶ added in v1.0.1
HexDecodeString return rawBytes of a hex hash represent
func IsValidAddressByte ¶ added in v1.0.1
Types ¶
type Address ¶
type Address struct {
RawAddress [AddressLength]byte
Address string
}
func NewAddress ¶ added in v1.0.1
BytesToAddress returns Address with value b. If b is larger than len(h), b will be cropped address the left.
func NewAddressByStr ¶ added in v1.0.1
func (*Address) MarshalJSON ¶
Serialize given address to JSON
func (*Address) ProtoMessage ¶ added in v1.0.1
func (a *Address) ProtoMessage()
func (*Address) SetBytes ¶
SetBytes sets the address to the value of b. If b is larger than len(a) it will panic.
func (*Address) String ¶
String returns an EIP55-compliant hex string representation of the address.
func (*Address) UnmarshalJSON ¶
UnmarshalJSON parses a hash in hex syntax.
type Hash ¶
type Hash struct {
RawHash [HashLength]byte
Hash string
}
func NewHashByStr ¶ added in v1.0.1
func (*Hash) CalculateHash ¶ added in v1.0.1
CalculateHash hashes the values of a TestContent
func (*Hash) MarshalJSON ¶
Serialize given address to JSON
func (*Hash) ProtoMessage ¶ added in v1.0.1
func (h *Hash) ProtoMessage()
func (*Hash) UnmarshalJSON ¶
Click to show internal directories.
Click to hide internal directories.