utils

package
v1.7.14 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddressParse added in v1.6.0

func AddressParse(address string) string

func SumAmount added in v1.5.1

func SumAmount(amounts []model.CosmosTxAuthInfoFeeAmount) (coin.Coins, error)

Types

type BlockHeightToCosmosParserMap

type BlockHeightToCosmosParserMap map[ParserBlockHeight]CosmosParser

type CosmosParser

type CosmosParser func(
	CosmosParserParams,
) ([]command.Command, []string)

type CosmosParserKey

type CosmosParserKey string

type CosmosParserManager

type CosmosParserManager struct {
	TxDecoder txdecoder.TxDecoder
	// contains filtered or unexported fields
}

func NewCosmosParserManager

func NewCosmosParserManager(params CosmosParserManagerParams) *CosmosParserManager

func (*CosmosParserManager) GetCosmosV0_42_7BlockHeight

func (cpm *CosmosParserManager) GetCosmosV0_42_7BlockHeight() ParserBlockHeight

GetCosmosV0_42_7BlockHeight return height of the first block with cosmos sdk v0.42.7

func (*CosmosParserManager) GetLogger added in v1.3.17

func (cpm *CosmosParserManager) GetLogger() applogger.Logger

func (*CosmosParserManager) GetParser

func (cpm *CosmosParserManager) GetParser(name CosmosParserKey, blockHeight ParserBlockHeight) CosmosParser

GetParser return a cosmos message parser from a registered key and a specific block height. Panic if the key is not found in the registered store

func (*CosmosParserManager) RegisterParser

func (cpm *CosmosParserManager) RegisterParser(name CosmosParserKey, fromHeight ParserBlockHeight, parser CosmosParser)

RegisterParser register a cosmos message parser by a given key and a starting block height

type CosmosParserManagerConfig

type CosmosParserManagerConfig struct {
	CosmosVersionBlockHeight
}

type CosmosParserManagerParams

type CosmosParserManagerParams struct {
	Logger applogger.Logger
	Config CosmosParserManagerConfig
}

type CosmosParserParams

type CosmosParserParams struct {
	AddressPrefix      string
	StakingDenom       string
	TxsResult          model.BlockResultsTxsResult
	MsgCommonParams    event.MsgCommonParams
	MsgIndex           int
	Msg                map[string]interface{}
	ParserManager      *CosmosParserManager
	Logger             applogger.Logger
	TxDecoder          txdecoder.TxDecoder
	IsProposalInnerMsg bool
}

type CosmosVersionBlockHeight

type CosmosVersionBlockHeight struct {
	V0_42_7 ParserBlockHeight
}

type ParsedTxsResultLog

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

func NewParsedTxsResultLog

func NewParsedTxsResultLog(txsResultLog *model.BlockResultsTxsResultLog) *ParsedTxsResultLog

func (*ParsedTxsResultLog) GetEventByType

func (log *ParsedTxsResultLog) GetEventByType(t string) *ParsedTxsResultLogEvent

Get the last event by type

func (*ParsedTxsResultLog) GetEventsByType

func (log *ParsedTxsResultLog) GetEventsByType(t string) []ParsedTxsResultLogEvent

Get all events by type

func (*ParsedTxsResultLog) GetFirstEventByType

func (log *ParsedTxsResultLog) GetFirstEventByType(t string) *ParsedTxsResultLogEvent

Get first event by type

func (*ParsedTxsResultLog) HasEvent

func (log *ParsedTxsResultLog) HasEvent(t string) bool

type ParsedTxsResultLogEvent

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

ParsedTxsResultLogEvent is only usable in txs_results log because it has unique attribute key. For txs_results.events, begin_block_events, end_block_events, they have to be parsed manually.

func NewParsedTxsResultLogEvent

func NewParsedTxsResultLogEvent(rawEvent *model.BlockResultsEvent) *ParsedTxsResultLogEvent

func NewParsedTxsResultLogEventsSplitByKey

func NewParsedTxsResultLogEventsSplitByKey(
	rawEvent *model.BlockResultsEvent,
) []ParsedTxsResultLogEvent

In the txs_results log, multiple event of the same types are grouped together into single event. This method pars txs_results log and split into a new event when a same key name appears.

func (*ParsedTxsResultLogEvent) GetAttributeByKey

func (log *ParsedTxsResultLogEvent) GetAttributeByKey(key string) *string

func (*ParsedTxsResultLogEvent) HasAttribute

func (log *ParsedTxsResultLogEvent) HasAttribute(key string) bool

func (*ParsedTxsResultLogEvent) MustGetAttributeByKey

func (log *ParsedTxsResultLogEvent) MustGetAttributeByKey(key string) string

type ParsedTxsResultsEvents

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

func NewParsedTxsResultsEvents

func NewParsedTxsResultsEvents(txsResultsEvents []model.BlockResultsEvent) *ParsedTxsResultsEvents

func (*ParsedTxsResultsEvents) GetEventByType

func (log *ParsedTxsResultsEvents) GetEventByType(t string) *ParsedTxsResultLogEvent

Get the last event by type

func (*ParsedTxsResultsEvents) GetEventsByType

func (log *ParsedTxsResultsEvents) GetEventsByType(t string) []*ParsedTxsResultLogEvent

Get all events by type

func (*ParsedTxsResultsEvents) GetFirstEventByType

func (log *ParsedTxsResultsEvents) GetFirstEventByType(t string) *ParsedTxsResultLogEvent

Get first event by type

func (*ParsedTxsResultsEvents) HasEvent

func (log *ParsedTxsResultsEvents) HasEvent(t string) bool

type ParserBlockHeight

type ParserBlockHeight uint64

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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