Documentation ¶
Overview ¶
Package sample provides methods to initialize sample object of various types for test purposes
Index ¶
- func AccAddress(r *rand.Rand) sdk.AccAddress
- func Address(r *rand.Rand) string
- func AlphaString(r *rand.Rand, n int) string
- func Bool(r *rand.Rand) bool
- func Bytes(r *rand.Rand, n int) []byte
- func Codec(registries ...ExtraRegistries) codec.Codec
- func Coin(r *rand.Rand) sdk.Coin
- func CoinWithRange(r *rand.Rand, min, max int64) sdk.Coin
- func CoinWithRangeAmount(r *rand.Rand, denom string, min, max int64) sdk.Coin
- func Coins(r *rand.Rand) sdk.Coins
- func CoinsWithRange(r *rand.Rand, min, max int64) sdk.Coins
- func CoinsWithRangeAmount(r *rand.Rand, denom1, denom2, denom3 string, min, max int64) sdk.Coins
- func ConsAddress(r *rand.Rand) sdk.ConsAddress
- func Delegation(t testing.TB, r *rand.Rand, addr string) stakingtypes.Delegation
- func Duration(r *rand.Rand) time.Duration
- func DurationFromRange(r *rand.Rand, min, max time.Duration) time.Duration
- func Int(r *rand.Rand) sdkmath.Int
- func InterfaceRegistry(registries ...ExtraRegistries) codectypes.InterfaceRegistry
- func NonAlphaString(r *rand.Rand, n int) string
- func OperatorAddress(r *rand.Rand) string
- func PubKey(r *rand.Rand) crypto.PubKey
- func Rand() *rand.Rand
- func String(r *rand.Rand, n int) string
- func Time(r *rand.Rand) time.Time
- func Uint64(r *rand.Rand) uint64
- func ValAddress(r *rand.Rand) sdk.ValAddress
- func Validator(t testing.TB, r *rand.Rand) stakingtypes.Validator
- func ZeroTime() time.Time
- type ExtraRegistries
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 AlphaString ¶
AlphaString returns a random string with lowercase alpha char of length n
func Codec ¶
func Codec(registries ...ExtraRegistries) codec.Codec
Codec returns a codec with preregistered interfaces
func CoinWithRange ¶
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 ¶
CoinWithRangeAmount returns a sample coin structure where the amount is a random number between provided min and max values with a given denom
func CoinsWithRange ¶
CoinsWithRange returns a sample coins structure where the amount is a random number between provided min and max values
func CoinsWithRangeAmount ¶
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 DurationFromRange ¶
DurationFromRange returns a sample time.Duration between the min and max values provided
func InterfaceRegistry ¶
func InterfaceRegistry(registries ...ExtraRegistries) codectypes.InterfaceRegistry
func NonAlphaString ¶
NonAlphaString returns a random string with non alpha char of length n
func OperatorAddress ¶
OperatorAddress returns a sample string validator operator address
func ValAddress ¶
func ValAddress(r *rand.Rand) sdk.ValAddress
ValAddress returns a sample validator operator address
Types ¶
type ExtraRegistries ¶
type ExtraRegistries func(codectypes.InterfaceRegistry)
ExtraRegistries is a function passed to sample.InterfaceRegistry() where any added interface registries can be registered. To register all interfaces for your application pass app.ModuleBasics.RegisterInterfaces as the argument.