sample

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2023 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Overview

Package sample provides methods to initialize sample object of various types for test purposes

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AccAddress

func AccAddress(r *rand.Rand) sdk.AccAddress

AccAddress returns a sample account address

func Address

func Address(r *rand.Rand) string

Address returns a sample string account address

func AlphaString

func AlphaString(r *rand.Rand, n int) string

AlphaString returns a random string with lowercase alpha char of length n

func Bool

func Bool(r *rand.Rand) bool

Bool returns randomly true or false

func Bytes

func Bytes(r *rand.Rand, n int) []byte

Bytes returns a random array of bytes

func ClaimRecord

func ClaimRecord(r *rand.Rand) claim.ClaimRecord

func Codec

func Codec() codec.Codec

Codec returns a codec with preregistered interfaces

func Coin

func Coin(r *rand.Rand) sdk.Coin

Coin returns a sample coin structure

func CoinWithRange

func CoinWithRange(r *rand.Rand, min, max int64) sdk.Coin

CoinWithRange returns a sample coin structure where the amount is a random number between provided min and max values with a random denom

func CoinWithRangeAmount

func CoinWithRangeAmount(r *rand.Rand, denom string, min, max int64) sdk.Coin

CoinWithRangeAmount returns a sample coin structure where the amount is a random number between provided min and max values with a given denom

func Coins

func Coins(r *rand.Rand) sdk.Coins

Coins returns a sample coins structure

func CoinsWithRange

func CoinsWithRange(r *rand.Rand, min, max int64) sdk.Coins

CoinsWithRange returns a sample coins structure where the amount is a random number between provided min and max values

func CoinsWithRangeAmount

func CoinsWithRangeAmount(r *rand.Rand, denom1, denom2, denom3 string, min, max int64) sdk.Coins

CoinsWithRangeAmount returns a sample coins structure where the amount is a random number between provided min and max values with a set of given denoms

func ConsAddress

func ConsAddress(r *rand.Rand) sdk.ConsAddress

ConsAddress returns a sample consensus address

func Delegation

func Delegation(t testing.TB, r *rand.Rand, addr string) stakingtypes.Delegation

Delegation returns staking delegation with the given address

func Duration

func Duration(r *rand.Rand) time.Duration

Duration returns a sample time.Duration between a second and 21 days

func DurationFromRange

func DurationFromRange(r *rand.Rand, min, max time.Duration) time.Duration

DurationFromRange returns a sample time.Duration between the min and max values provided

func Fees

func Fees(r *rand.Rand, spendableCoins sdk.Coins) (sdk.Coins, error)

Fees returns a random fee by selecting a random amount of bond denomination from the account's available balance. If the user doesn't have enough funds for paying fees, it returns empty coins.

func Int

func Int(r *rand.Rand) sdkmath.Int

Int returns a sample sdkmath.Int

func IntN

func IntN(r *rand.Rand, n int64) sdkmath.Int

IntN returns a sample sdkmath.Int in open range [0, n)

func Mission

func Mission(r *rand.Rand) claim.Mission

func OperatorAddress

func OperatorAddress(r *rand.Rand) string

OperatorAddress returns a sample string validator operator address

func PubKey

func PubKey(r *rand.Rand) crypto.PubKey

PubKey returns a sample account PubKey

func Rand

func Rand() *rand.Rand

Rand returns a sample Rand object for randomness

func SimAccounts

func SimAccounts() (accounts []simtypes.Account)

SimAccounts returns a sample array of account for simulation

func String

func String(r *rand.Rand, n int) string

String returns a random string of length n

func Uint64

func Uint64(r *rand.Rand) uint64

Uint64 returns a random uint64

func ValAddress

func ValAddress(r *rand.Rand) sdk.ValAddress

ValAddress returns a sample validator operator address

func Validator

func Validator(t testing.TB, r *rand.Rand) stakingtypes.Validator

Validator returns a sample staking validator

Types

This section is empty.

Jump to

Keyboard shortcuts

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