types

package
v2.0.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2024 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoEventFound     = errors.New("no event found")
	ErrNoAttributeFound = errors.New("no event with attribute")
)
View Source
var (
	ErrBlockNotFound = errors.New("block not found")
)

Functions

func BytesToAddress

func BytesToAddress(key []byte) cryptotypes.Address

func ConvertAddressToBech32String

func ConvertAddressToBech32String(address cryptotypes.Address) (string, error)

func ConvertValidatorPubKeyToBech32String

func ConvertValidatorPubKeyToBech32String(pubKey cometbftcrypto.PubKey) (string, error)

ConvertValidatorPubKeyToBech32String converts the given pubKey to Bech32 string

Types

type BeginBlockerHandler

type BeginBlockerHandler interface {
	Module
	// HandleBeginBlocker handles of beginblocker events.
	HandleBeginBlocker(ctx context.Context, eventsMap BlockerEvents, height int64) error
}

type Block

type Block struct {
	Timestamp           time.Time
	Hash                string
	ProposerAddress     string
	ValidatorPreCommits []ValidatorPreCommit
	Evidence            cometbfttypes.EvidenceData
	TxNum               int
	TotalGas            uint64
	Height              int64
	// contains filtered or unexported fields
}

func NewBlock

func NewBlock(height int64, hash, proposerAddress string, txNum int, totalGas uint64, timestamp time.Time,
	evidence cometbfttypes.EvidenceData) *Block

func NewBlockFromTmBlock

func NewBlockFromTmBlock(blk *cometbftcoretypes.ResultBlock, totalGas uint64) *Block

NewBlockFromTmBlock builds a new Block instance from a given ResultBlock object

func (Block) Raw

type BlockHandler

type BlockHandler interface {
	Module
	// HandleBlock handles a single block in blockchain.
	HandleBlock(ctx context.Context, block *Block) error
}

type BlockerEvents

type BlockerEvents map[string][]abci.Event

func NewBlockerEventsAttributes

func NewBlockerEventsAttributes(events []abci.Event) BlockerEvents

type EndBlockerHandler

type EndBlockerHandler interface {
	Module
	// HandleEndBlocker handles of endblocker events.
	HandleEndBlocker(ctx context.Context, eventsMap BlockerEvents, height int64) error
}

type GenesisHandler

type GenesisHandler interface {
	Module
	// HandleGenesis handles a genesis state.
	HandleGenesis(ctx context.Context, doc *cometbfttypes.GenesisDoc, appState map[string]json.RawMessage) error
}

type MessageHandler

type MessageHandler interface {
	Module
	// HandleMessage handles a single message of transaction.
	HandleMessage(ctx context.Context, index int, msg sdk.Msg, tx *Tx) error
}

type Module

type Module interface {
	// Name base implementation of Module interface.
	Name() string
}

type PubKey

type PubKey interface {
	Bytes() []byte
}

type RecursiveMessagesHandler

type RecursiveMessagesHandler interface {
	Module
	HandleMessageRecursive(ctx context.Context, index int, msg sdk.Msg, tx *Tx) ([]*types.Any, error)
}

type TransactionHandler

type TransactionHandler interface {
	Module
	// HandleTx handles a single transaction of block.
	HandleTx(ctx context.Context, tx *Tx) error
}

type Tx

type Tx struct {
	*sdktx.Tx
	*sdk.TxResponse
	Signer string
}

Tx represents an already existing blockchain transaction

func (Tx) FindAttributeByKey

func (tx Tx) FindAttributeByKey(event sdk.StringEvent, attrKey string) (string, error)

FindAttributeByKey searches inside the specified event of the given tx to find the attribute having the given key. If the specified event does not contain a such attribute, returns an error instead.

func (Tx) FindEventByType

func (tx Tx) FindEventByType(index int, eventType string) (sdk.StringEvent, error)

FindEventByType searches inside the given tx events for the message having the specified index, in order to find the event having the given type, and returns it. If no such event is found, returns an error instead.

func (Tx) Successful

func (tx Tx) Successful() bool

Successful tells whether this tx is successful or not

type Txs

type Txs []*Tx

Txs - slice of transactions

func NewTxsFromTmTxs

func NewTxsFromTmTxs(txs []*sdktx.GetTxResponse, cdc codec.Codec) Txs

func (Txs) TotalGas

func (txs Txs) TotalGas() (totalGas uint64)

TotalGas calculates and returns total used gas of all transactions

type Validator

type Validator struct {
	ConsAddr   string
	ConsPubkey string
}

func NewValidator

func NewValidator(consAddr string, consPubKey string) *Validator

NewValidator allows to build a new Validator instance

type ValidatorPreCommit

type ValidatorPreCommit struct {
	Timestamp        time.Time
	ValidatorAddress string
	BlockIDFlag      uint64
	VotingPower      int64
}

func NewValidatorPreCommitsFromTmSignatures

func NewValidatorPreCommitsFromTmSignatures(sigs []cometbfttypes.CommitSig) []ValidatorPreCommit

type Validators

type Validators []*Validator

func NewValidatorsFromTmValidator

func NewValidatorsFromTmValidator(tmVals *cometbftcoretypes.ResultValidators) Validators

type ValidatorsHandler

type ValidatorsHandler interface {
	Module
	// HandleValidators handles of all validators in blockchain.
	HandleValidators(ctx context.Context, vals *cometbftcoretypes.ResultValidators) error
}

Directories

Path Synopsis
nolint
nolint

Jump to

Keyboard shortcuts

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