utils

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: May 17, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Collisions added in v1.1.1

func Collisions(slice1, slice2 []string) []string

func Distinct added in v1.1.0

func Distinct[T comparable](slice ...T) []T

func FromAnyPubKeyToConsensusAddress

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

func GetValconsHrpFromValoperHrp

func GetValconsHrpFromValoperHrp(valoper string) (valconsHrp string, success bool)

GetValconsHrpFromValoperHrp predicts valcons hrp from valoper hrp

func IsValoperAddressFormat

func IsValoperAddressFormat(address string) bool

func NormalizeRpcEndpoint added in v1.1.0

func NormalizeRpcEndpoint(endpoint string) string

func RatioOfInt64

func RatioOfInt64(num, den int64) float64

func ReplaceAnySchemeWithHttp

func ReplaceAnySchemeWithHttp(endpoint string) string

func Retry

func Retry[T any](
	f func() (T, error),
	retryOption ...RetryOption,
) (res T, err error)

Types

type RetryOption

type RetryOption struct {
	MinRetryCount        int
	MaximumRetryDuration time.Duration
}

func DefaultRetryOption

func DefaultRetryOption() RetryOption

func (RetryOption) MaxDuration

func (m RetryOption) MaxDuration(maximumRetryDuration time.Duration) RetryOption

func (RetryOption) MinCount

func (m RetryOption) MinCount(minRetryCount int) RetryOption

Jump to

Keyboard shortcuts

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