Documentation
¶
Index ¶
- Constants
- Variables
- 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) MarshalJSONPB(m *jsonpb.Marshaler) ([]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
- func (a *Address) UnmarshalJSONPB(m *jsonpb.Unmarshaler, data []byte) error
- type Bloom
- func (b *Bloom) Add(d []byte)
- func (b Bloom) MarshalText() ([]byte, error)
- func (b *Bloom) MarshalTo(data []byte) (int, error)
- func (b *Bloom) OrBloom(bl *Bloom)
- func (b *Bloom) ProtoMessage()
- func (b *Bloom) SetBytes(d []byte)
- func (b *Bloom) Size() int
- func (b Bloom) Test(topic []byte) bool
- func (b *Bloom) Unmarshal(data []byte) error
- func (b *Bloom) UnmarshalText(input []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) MarshalJSONPB(m *jsonpb.Marshaler) ([]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
- func (h *Hash) UnmarshalJSONPB(m *jsonpb.Unmarshaler, data []byte) error
- type KeccakState
Constants ¶
const ( HashLength = 32 AddressLength = 20 BloomByteLength = 256 )
Lengths of hashes and addresses in bytes.
Variables ¶
var ( ErrSyntax = fmt.Errorf("invalid hex string") ErrMissingPrefix = fmt.Errorf("hex string without 0x prefix") ErrOddLength = fmt.Errorf("hex string of odd length") )
hasherPool holds LegacyKeccak256 hashers for rlpHash.
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 `json:"raw_address"` Address string `json:"address"` }
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) MarshalJSONPB ¶ added in v1.2.0
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.
func (*Address) UnmarshalJSONPB ¶ added in v1.2.0
func (a *Address) UnmarshalJSONPB(m *jsonpb.Unmarshaler, data []byte) error
type Bloom ¶ added in v1.2.0
type Bloom [BloomByteLength]byte
func (*Bloom) Add ¶ added in v1.2.0
Add adds d to the filter. Future calls of Test(d) will return true.
func (Bloom) MarshalText ¶ added in v1.2.0
MarshalText encodes b as a hex string with 0x prefix.
func (*Bloom) ProtoMessage ¶ added in v1.2.0
func (b *Bloom) ProtoMessage()
func (*Bloom) SetBytes ¶ added in v1.20.0
SetBytes sets the content of b to the given bytes. It panics if d is not of suitable size.
func (*Bloom) UnmarshalText ¶ added in v1.2.0
UnmarshalText b as a hex string with 0x prefix.
type Hash ¶
type Hash struct { RawHash [HashLength]byte `json:"raw_hash"` Hash string `json:"hash"` }
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) MarshalJSONPB ¶ added in v1.2.0
func (*Hash) ProtoMessage ¶ added in v1.0.1
func (h *Hash) ProtoMessage()
func (*Hash) UnmarshalJSON ¶
func (*Hash) UnmarshalJSONPB ¶ added in v1.2.0
func (h *Hash) UnmarshalJSONPB(m *jsonpb.Unmarshaler, data []byte) error