Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Data ¶
type Data []byte
Data is an individual RLP Data element - or an "RLP string"
func WrapAddress ¶
func WrapAddress(a *ethtypes.Address0xHex) Data
WrapAddress wraps an address, or writes empty data if the address is nil
func WrapHex ¶
WrapHex converts a hex encoded string (with or without 0x prefix) to an RLP Data element for encoding
func WrapString ¶
WrapString converts a plain string to an RLP Data element for encoding
func (Data) Address ¶ added in v1.1.14
func (r Data) Address() *ethtypes.Address0xHex
func (Data) BytesNotNil ¶ added in v1.1.14
type Element ¶
type Element interface { // When true the Element can safely be cast to List, and when false the Element can safely be cast to Data IsList() bool // Encode converts the element to a byte array Encode() []byte // Safe function that will give an entry as data, to use the nil-safe functions on it to get the value (will be treated as nil data for list) ToData() Data }
Element is an interface implemented by both Data and List elements
func Decode ¶
Decode will decode an RLP element at the beginning of the byte slice. An error is returned if problems are found in the RLP encoding
The position of the first byte after the RLP element is returned. This will be the length of the byte slice, if the RLP element filled the entire slice. Otherwise, the position can be used to find/decode additional data (RLP or otherwise) in the byte slice.
The element returned will be one of: - nil if passed an empty byte array - Data if the RLP stream contains a data element in the first position - List if the RLP stream contains a list in the first position