codec

package
v0.10.2-fix Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2022 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BlockDecoder

func BlockDecoder(blk *bstream.Block) (interface{}, error)

func BlockFromProto

func BlockFromProto(b *pbcodec.Block) (*bstream.Block, error)

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) *pbcodec.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 MustBalanceChangeReasonFromString

func MustBalanceChangeReasonFromString(reason string) pbcodec.BalanceChange_Reason

func MustGasChangeReasonFromString

func MustGasChangeReasonFromString(reason string) pbcodec.GasChange_Reason

func MustGasEventIDFromString

func MustGasEventIDFromString(reason string) pbcodec.GasEvent_Id

func PBcodecLogToEOS

func PBcodecLogToEOS(pblog *pbcodec.Log) *eth.Log

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, count int) ([]string, error)

splitInChunks split the line in `count` chunks and returns the slice `chunks[1:count]` (so exclusive end), but verifies that there are only exactly `count` chunks, and nothing more.

func ToTimestamp

func ToTimestamp(t time.Time) *tspb.Timestamp

Types

type BlockHeader

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

type BlockReader

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

BlockReader reads the dbin format where each element is assumed to be a `bstream.Block`.

func NewBlockReader

func NewBlockReader(reader io.Reader) (out *BlockReader, err error)

func (*BlockReader) Read

func (l *BlockReader) Read() (*bstream.Block, error)

type BlockWriter

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

BlockWriter reads the dbin format where each element is assumed to be a `bstream.Block`.

func NewBlockWriter

func NewBlockWriter(writer io.Writer) (*BlockWriter, error)

func (*BlockWriter) Write

func (w *BlockWriter) Write(block *bstream.Block) error

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(lines chan string, producer Producer) (*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 *pbcodec.TransactionTrace, err error)

type Hash

type Hash []byte

func (Hash) String

func (h Hash) String() string

type HexBytes

type HexBytes []byte

func (HexBytes) MarshalJSON

func (t HexBytes) MarshalJSON() ([]byte, error)

func (HexBytes) String

func (t HexBytes) String() string

func (*HexBytes) UnmarshalJSON

func (t *HexBytes) UnmarshalJSON(data []byte) (err error)

type Log

type Log struct {
	Address HexBytes   `json:"address"`
	Topics  []HexBytes `json:"topics"`
	Data    HexBytes   `json:"data"`
}

type NilProducer

type NilProducer struct{}

func (NilProducer) Send

func (n NilProducer) Send(block *pbcodec.Block)

type Producer

type Producer interface {
	Send(block *pbcodec.Block)
}

type Uint64

type Uint64 uint64

func (*Uint64) UnmarshalJSON

func (i *Uint64) UnmarshalJSON(data []byte) (err error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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