utils

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: Apache-2.0 Imports: 19 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AccAddressFromTopic

func AccAddressFromTopic(topic common.Hash) sdk.AccAddress

func CoinsToMap

func CoinsToMap(coins ...sdk.Coin) map[string]string

func FromAnyPubKeyToConsensusAddress

func FromAnyPubKeyToConsensusAddress(protoAny *codectypes.Any, codec codec.Codec) (consAddr sdk.ConsAddress, success bool)

func FromAnyToJsonMap

func FromAnyToJsonMap(protoAny *codectypes.Any, codec codec.Codec) (map[string]any, error)

func GetEvmTransactionHashFromEvent

func GetEvmTransactionHashFromEvent(events []abci.Event) *common.Hash

func GetIncomingIBCCoin

func GetIncomingIBCCoin(srcPort, srcChannel string, dstPort, dstChannel string, denom, amt string) (sdk.Coin, error)

func IsEventTypeWithAllAttributes

func IsEventTypeWithAllAttributes(event abci.Event, eventType string, attributeKeys ...string) (bool, map[string]string)

func IsEvmEventMatch

func IsEvmEventMatch(
	topics []common.Hash, data []byte,
	wantTopicSize int,
	wantTopic0 common.Hash,
	wantTopic1MustBeAddress, wantTopic2MustBeAddress, wantTopic3MustBeAddress, wantData bool,
) bool

func IsEvmTx

func IsEvmTx(tx *tx.Tx) bool

func IsZeroAccAddress added in v1.0.3

func IsZeroAccAddress(accAddr sdk.AccAddress) bool

IsZeroAccAddress returns true if the address is 0x00..00

func IsZeroEvmAddress added in v1.0.3

func IsZeroEvmAddress(addr common.Address) bool

IsZeroEvmAddress returns true if the address is 0x00..00

func NormalizeAddress

func NormalizeAddress(address string) string

func NormalizeTransactionHash

func NormalizeTransactionHash(hash string, upper bool) string

NormalizeTransactionHash normalizes the transaction hash into '0xHASH' format. Contract: input hash is a valid transaction hash, with or without '0x' prefix.

func ProtoMessageName

func ProtoMessageName(msg sdk.Msg) string

func QueryContextWithHeight

func QueryContextWithHeight(height int64) context.Context

func TryConvertAnyStructToMap added in v1.1.2

func TryConvertAnyStructToMap(source any) (res map[string]any, err error)

func TryGetMapValueAsType added in v1.1.2

func TryGetMapValueAsType[T any](m map[string]any, key string) (value T, ok bool)

Types

This section is empty.

Jump to

Keyboard shortcuts

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