cosmos

package
v0.0.0-...-de21b2d Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2022 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Block

type Block struct {
	ChainID      string `json:"chain_id"`
	Height       int64  `json:"height"`
	types.Txs    `json:"txs"`
	Results      []TxStatus `json:"tx_results"`
	T            time.Time  `json:"block_time"`
	BlockResults *ctypes.ResultBlockResults
	TxsResults   []*abci.ResponseDeliverTx `json:"txs_results"`
}

Block is a unit of data being sent over in order to be processed

func Normalize

func Normalize(w WithTxs) Block

Normalize takes block with transactions and transforms it Block structure that is being send over rabbitmq

func (Block) JSON

func (b Block) JSON() []byte

JSON returns byte slice which represents block in json from

type ProcessedBlock

type ProcessedBlock struct {
	Height_          int64
	ChainID_         string
	T                time.Time
	BeginBlockEvents []watcher.Message
	Txs              []watcher.Message
	EndBlockEvents   []watcher.Message
}

func (ProcessedBlock) ChainID

func (b ProcessedBlock) ChainID() string

func (ProcessedBlock) Height

func (b ProcessedBlock) Height() int64

func (ProcessedBlock) Messages

func (b ProcessedBlock) Messages() []watcher.Message

func (ProcessedBlock) Time

func (b ProcessedBlock) Time() time.Time

type TmBlock

type TmBlock struct {
	types.Header
	types.Txs
}

TmBlock is like tendermint block but without unnecessary mutex and unused data

func BlockFromTmResultBlock

func BlockFromTmResultBlock(b types.EventDataNewBlock) TmBlock

BlockFromTmResultBlock parses tm websocket response to fit our block structure

type TxStatus

type TxStatus struct {
	ResultCode uint32
	Hash       []byte
	Height     int64
}

TxStatus only stores transaction result code and it's hash

func TxStatusFromTmResultTx

func TxStatusFromTmResultTx(t types.EventDataTx) TxStatus

TxStatusFromTmResultTx parses ResultTx to give us tx hash, height and error code actual tx body is stored in the block

type WithTxs

type WithTxs struct {
	B   *TmBlock
	Txs []TxStatus
}

WithTxs is used to couple blocks with txs data together for our map

func (WithTxs) Full

func (w WithTxs) Full() bool

Full returns true if all txs are matched inside this block

func (WithTxs) JSON

func (w WithTxs) JSON() []byte

JSON marshall struct to json format

Jump to

Keyboard shortcuts

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