types

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: May 17, 2023 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

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 tmcrypto.PubKey) (string, error)

ConvertValidatorPubKeyToBech32String converts the given pubKey to Bech32 string

Types

type Account

type Account struct {
	Address string
	Height  int64
}

Account represents a chain account

func NewAccount

func NewAccount(address 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
	Evidence        tmtypes.EvidenceData
	TxNum           int
	TotalGas        uint64
	Height          int64
}

func NewBlock

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

func NewBlockFromTmBlock

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

NewBlockFromTmBlock builds a new Block instance from a given ResultBlock object

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 NewCoinFromCdk

func NewCoinFromCdk(coin sdk.Coin) Coin

func (Coin) IsEqual

func (c Coin) IsEqual(o Coin) bool

type Coins

type Coins []Coin

func NewCoinsFromCdk

func NewCoinsFromCdk(coins sdk.Coins) Coins

func NewCoinsFromCdkDec

func NewCoinsFromCdkDec(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 *tmtypes.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 StakingValidator

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

func NewStakingValidator

func NewStakingValidator(consAddr, opAddr, consPubKey, selfDelegateAddress string,
	maxChangeRate, maxRate *sdk.Dec, description stakingtypes.Description, height 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 Validators

type Validators []*Validator

func NewValidatorsFromTmValidator

func NewValidatorsFromTmValidator(tmVals *tmctypes.ResultValidators) Validators

type ValidatorsHandler

type ValidatorsHandler interface {
	Module
	// HandleValidators handles of all validators in blockchain.
	HandleValidators(ctx context.Context, vals *tmctypes.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