types

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2024 License: MIT Imports: 19 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 Account

type Account struct {
	Address string
	Type    string
	Height  int64
}

Account represents a chain account

func NewAccount

func NewAccount(address, typeURL string, height int64) Account

NewAccount builds a new Account instance

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 added in v1.1.0

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 Coin

type Coin struct {
	Denom  string  `json:"denom"`
	Amount float64 `json:"amount"`
}

func NewCoin added in v0.4.0

func NewCoin(denom string, amount float64) Coin

func NewCoinFromSDK added in v1.0.0

func NewCoinFromSDK(coin sdk.Coin) Coin

func (Coin) IsEqual

func (c Coin) IsEqual(o Coin) bool

type Coins

type Coins []Coin

func NewCoinsFromSDK added in v1.0.0

func NewCoinsFromSDK(coins sdk.Coins) Coins

func NewCoinsFromSDKDec added in v1.0.0

func NewCoinsFromSDKDec(coins sdk.DecCoins) Coins

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 added in v0.4.0

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

type StakingValidator

type StakingValidator interface {
	GetConsAddr() string
	GetConsPubKey() string
	GetOperator() string
	GetSelfDelegateAddress() string
	GetMaxChangeRate() *sdk.Dec
	GetMaxRate() *sdk.Dec
	GetHeight() int64
	GetMinSelfDelegation() int64
	GetDescription() stakingtypes.Description
}

func NewStakingValidator

func NewStakingValidator(
	consensusAddr,
	operatorAddr,
	consensusPubKey,
	selfDelegateAddress string,
	maxChangeRate,
	maxRate *sdk.Dec,
	description stakingtypes.Description,
	height,
	minSelfDelegation int64,
) StakingValidator

NewStakingValidator allows to build a new Validator implementation having the given data

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 added in v1.0.0

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

func NewValidatorPreCommitsFromTmSignatures added in v1.0.0

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