utils

package
v1.3.24 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2022 License: Apache-2.0 Imports: 36 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterDecoderInterfaces

func RegisterDecoderInterfaces(interfaceRegistry types.InterfaceRegistry)

Types

type Amount

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

type AuthInfo

type AuthInfo struct {
	SignerInfos []SignerInfo `json:"signer_infos"`
	Fee         Fee          `json:"fee"`
}

type Bitarray

type Bitarray struct {
	ExtraBitsStored int64  `json:"extra_bits_stored"`
	Elems           string `json:"elems"`
}

type BlockHeightToCosmosParserMap

type BlockHeightToCosmosParserMap map[ParserBlockHeight]CosmosParser

type Body

type Body struct {
	Messages                    []map[string]interface{} `json:"messages"`
	Memo                        string                   `json:"memo"`
	TimeoutHeight               string                   `json:"timeout_height"`
	ExtensionOptions            []interface{}            `json:"extension_options"`
	NonCriticalExtensionOptions []interface{}            `json:"non_critical_extension_options"`
}

type CosmosParser

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

type CosmosParserKey

type CosmosParserKey string

type CosmosParserManager

type CosmosParserManager struct {
	// 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

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
}

type CosmosTx

type CosmosTx struct {
	Body       Body     `json:"body"`
	AuthInfo   AuthInfo `json:"auth_info"`
	Signatures []string `json:"signatures"`
}

type CosmosVersionBlockHeight

type CosmosVersionBlockHeight struct {
	V0_42_7 ParserBlockHeight
}

type Fee

type Fee struct {
	Amount   []Amount `json:"amount"`
	GasLimit string   `json:"gas_limit"`
	Payer    string   `json:"payer"`
	Granter  string   `json:"granter"`
}

type ModeInfo

type ModeInfo struct {
	MaybeSingle *Single `json:"single,omitempty"`
	MaybeMulti  *Multi  `json:"multi,omitempty"`
}

type Multi

type Multi struct {
	Bitarray  Bitarray         `json:"bitarray"`
	ModeInfos []SingleModeInfo `json:"mode_infos"`
}

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

type PublicKey

type PublicKey struct {
	Type string `json:"@type"`
	Key  string `json:"key"`
}

type SignerInfo

type SignerInfo struct {
	MaybePublicKey *SignerInfoPublicKey `json:"public_key"`
	ModeInfo       ModeInfo             `json:"mode_info"`
	Sequence       string               `json:"sequence"`
}

type SignerInfoPublicKey

type SignerInfoPublicKey struct {
	Type            string      `json:"@type"`
	MaybeThreshold  *int        `json:"threshold,omitempty"`
	MaybePublicKeys []PublicKey `json:"public_keys,omitempty"`
	MaybeKey        *string     `json:"key,omitempty"`
}

type Single

type Single struct {
	Mode string `json:"mode"`
}

type SingleModeInfo

type SingleModeInfo struct {
	Single Single `json:"single"`
}

type TxDecoder

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

func NewTxDecoder

func NewTxDecoder() *TxDecoder

func (*TxDecoder) Decode

func (decoder *TxDecoder) Decode(base64Tx string) (*CosmosTx, error)

func (*TxDecoder) GetFee

func (decoder *TxDecoder) GetFee(base64Tx string) (coin.Coins, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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