utils

package
v1.3.2 Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2023 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AccAddressFromBech32 added in v0.6.0

func AccAddressFromBech32(address string, checkHRP string) (addr sdk.AccAddress, err error)

func CoinFromRequestKey added in v0.9.6

func CoinFromRequestKey(query []byte, accAddr sdk.AccAddress) (sdk.Coin, error)

coinFromRequestKey parses

func ConvertAccAddressForTestUsingPrefix added in v0.10.0

func ConvertAccAddressForTestUsingPrefix(address sdk.AccAddress, prefix string) string

func DenomFromRequestKey added in v0.9.6

func DenomFromRequestKey(query []byte, accAddr sdk.AccAddress) (string, error)

func GatherAllKeysFromStore added in v0.9.0

func GatherAllKeysFromStore(storeObj store.KVStore) []string

func GatherValuesFromStore added in v0.9.0

func GatherValuesFromStore[T any](storeObj store.KVStore, keyStart []byte, keyEnd []byte, parseValue func([]byte) (T, error)) ([]T, error)

func GatherValuesFromStorePrefix added in v0.9.0

func GatherValuesFromStorePrefix[T any](storeObj store.KVStore, prefix []byte, parseValue func([]byte) (T, error)) ([]T, error)

func GenerateAccAddressForTest added in v0.6.6

func GenerateAccAddressForTest() sdk.AccAddress

func GenerateAccAddressForTestWithPrefix added in v0.9.0

func GenerateAccAddressForTestWithPrefix(hrp string) string

func GenerateRandomHash added in v0.9.0

func GenerateRandomHash() []byte

func GenerateRandomHashAsHex added in v0.9.0

func GenerateRandomHashAsHex() string

func GenerateValAddressForTest added in v0.6.6

func GenerateValAddressForTest() sdk.ValAddress

func GenerateValAddressForTestWithPrefix added in v0.9.0

func GenerateValAddressForTestWithPrefix(hrp string) string

func GetFirstValueAfterPrefixInclusive added in v0.9.0

func GetFirstValueAfterPrefixInclusive[T any](storeObj store.KVStore, keyStart []byte, parseValue func([]byte) (T, error)) (T, error)

func GetFirstValueInRange added in v0.9.0

func GetFirstValueInRange[T any](storeObj store.KVStore, keyStart []byte, keyEnd []byte, reverseIterate bool, parseValue func([]byte) (T, error)) (T, error)

func GetIterValuesWithStop added in v0.9.0

func GetIterValuesWithStop[T any](
	storeObj store.KVStore,
	keyStart []byte,
	keyEnd []byte,
	reverse bool,
	stopFn func([]byte) bool,
	parseValue func([]byte) (T, error),
) ([]T, error)

func GetValuesUntilDerivedStop added in v0.9.0

func GetValuesUntilDerivedStop[T any](storeObj store.KVStore, keyStart []byte, stopFn func([]byte) bool, parseValue func([]byte) (T, error)) ([]T, error)

func Keys added in v0.9.0

func Keys[V interface{}](in map[string]V) []string

func MockProofOps added in v0.10.0

func MockProofOps(ctx sdk.Context, ibcKeeper *ibcKeeper.Keeper, connectionID string, chainID string, height int64, module string, key []byte, data []byte, proofOps *crypto.ProofOps) error

func MustGet added in v0.9.0

func MustGet(store store.KVStore, key []byte, result proto.Message)

MustGet gets key from store by mutating result Panics on any error.

func MustGetDec added in v0.9.0

func MustGetDec(store store.KVStore, key []byte) sdk.Dec

MustGetDec gets dec value from store at key. Panics on any error.

func MustSet added in v0.9.0

func MustSet(storeObj store.KVStore, key []byte, value proto.Message)

MustSet runs store.Set(key, proto.Marshal(value)) but panics on any error.

func MustSetDec added in v0.9.0

func MustSetDec(store store.KVStore, key []byte, value sdk.Dec)

MustSetDec sets dec value to store at key. Panics on any error.

func SortSlice added in v0.9.0

func SortSlice[T constraints.Ordered](s []T)

SortSlice sorts a slice of type T elements that implement constraints.Ordered. Mutates input slice s

func Unique added in v0.9.0

func Unique[V interface{}](in []V) []V

func ValAddressFromBech32 added in v0.6.0

func ValAddressFromBech32(address string, checkHRP string) (addr sdk.ValAddress, err error)

func ValidateProofOps added in v0.6.0

func ValidateProofOps(ctx sdk.Context, ibcKeeper *ibcKeeper.Keeper, connectionID string, chainID string, height int64, module string, key []byte, data []byte, proofOps *crypto.ProofOps) error

func VerifyNonAdjacent added in v0.9.0

func VerifyNonAdjacent(
	trustedHeader *types.SignedHeader,
	trustedVals *types.ValidatorSet,
	untrustedHeader *types.SignedHeader,
	untrustedVals *types.ValidatorSet,
	trustingPeriod time.Duration,
	now time.Time,
	maxClockDrift time.Duration,
	trustLevel tmmath.Fraction,
) error

VerifyNonAdjacent is identical to VerifyNonAdjacent in tendermint/tendermint/light/verifier.go, with the exception that it does not attempt to validate that the block is _newer_ than the current consensus state.

Types

type ContextKey added in v0.6.0

type ContextKey string

func (ContextKey) String added in v0.6.0

func (c ContextKey) String() string

type ProofOpsFn added in v0.10.0

type ProofOpsFn func(ctx sdk.Context, ibcKeeper *ibcKeeper.Keeper, connectionID string, chainID string, height int64, module string, key []byte, data []byte, proofOps *crypto.ProofOps) error

Jump to

Keyboard shortcuts

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