codec

package
v1.2.2 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2022 License: Apache-2.0 Imports: 17 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var BlockVersion = int32(0) // this will be set inside readInit()

Functions

func CanonicalHex

func CanonicalHex(input string) string

CanonicalHex receives an input and return it's canonical form, i.e. the single unique well-formed which in our case is an all-lower case version with even number of characters.

The only differences with `SanitizeHexInput` here is an additional call to `strings.ToLower` before returning the result.

func ConcatHex

func ConcatHex(with0x bool, in ...string) (out string)

ConcatHex concatenates sanitized hex strings

func DecodeHex

func DecodeHex(input string) ([]byte, error)

func FromHeader

func FromHeader(header *BlockHeader) *pbeth.BlockHeader

func FromHex

func FromHex(input string, tag string) []byte

func FromInt32

func FromInt32(input string, tag string) int32

func FromUint32

func FromUint32(input string, tag string) uint32

func FromUint64

func FromUint64(input string, tag string) uint64

func Has0xPrefix

func Has0xPrefix(input string) bool

func PrefixedHex

func PrefixedHex(input string) string

PrefixedHex is CanonicalHex but with 0x prefix

func SanitizeHex

func SanitizeHex(input string) string

SanitizeHex removes the prefix `0x` if it exists and ensures there is an even number of characters in the string, padding on the left of the string is it's not the case.

func SplitInBoundedChunks

func SplitInBoundedChunks(line string, count int) ([]string, error)

splitInBoundedChunks split the line in `count` chunks and returns the slice `chunks[1:count]` (so exclusive end), but will accumulate all trailing chunks within the last (for free-form strings, or JSON objects)

func SplitInChunks

func SplitInChunks(line string, validCounts ...int) ([]string, error)

splitInChunks split the line in chunks and returns the slice `chunks[1:]`, but verifies that there are only exactly one of `validCounts` number of chunks

Types

type BlockHeader

type BlockHeader struct {
	Hash          eth.Hash    `json:"hash"`
	ParentHash    eth.Hash    `json:"parentHash"`
	UncleHash     eth.Hash    `json:"sha3Uncles"`
	Coinbase      eth.Address `json:"miner"`
	Root          eth.Hash    `json:"stateRoot"`
	TxHash        eth.Hash    `json:"transactionsRoot"`
	ReceiptHash   eth.Hash    `json:"receiptsRoot"`
	Bloom         eth.Hex     `json:"logsBloom"`
	Difficulty    eth.Hex     `json:"difficulty"`
	Number        eth.Uint64  `json:"number"`
	GasLimit      eth.Uint64  `json:"gasLimit"`
	GasUsed       eth.Uint64  `json:"gasUsed"`
	Time          eth.Uint64  `json:"timestamp"`
	Extra         eth.Hex     `json:"extraData"`
	MixDigest     eth.Hash    `json:"mixHash"`
	Nonce         eth.Uint64  `json:"nonce"`
	BaseFeePerGas eth.Hex     `json:"baseFeePerGas"`
}

type ConsoleReader

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

ConsoleReader is what reads the `geth` output directly. It builds up some LogEntry objects. See `LogReader to read those entries .

func NewConsoleReader

func NewConsoleReader(logger *zap.Logger, lines chan string) (*ConsoleReader, error)

func (*ConsoleReader) Close

func (c *ConsoleReader) Close()

func (*ConsoleReader) Done

func (l *ConsoleReader) Done() <-chan interface{}

todo: WTF?

func (*ConsoleReader) ProcessData

func (c *ConsoleReader) ProcessData(reader io.Reader) error

func (*ConsoleReader) ReadBlock

func (c *ConsoleReader) ReadBlock() (out *bstream.Block, err error)

func (ConsoleReader) ReadTransaction

func (c ConsoleReader) ReadTransaction() (trace *pbeth.TransactionTrace, err error)

type Log

type Log struct {
	Address eth.Address `json:"address"`
	Topics  []eth.Hash  `json:"topics"`
	Data    eth.Hex     `json:"data"`
}

Jump to

Keyboard shortcuts

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