sample

package
v0.0.0-...-abdbe5d Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2024 License: Apache-2.0 Imports: 49 Imported by: 0

Documentation

Overview

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

Index

Constants

View Source
const ConsensusStateNb = 2

Variables

This section is empty.

Functions

func AccAddress

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

AccAddress returns a sample account address

func AccountRemoval

func AccountRemoval(address string) *launch.AccountRemoval

AccountRemoval returns a sample AccountRemoval

func Address

func Address(r *rand.Rand) string

Address returns a sample string account address

func AllRequestContents

func AllRequestContents(r *rand.Rand, launchID uint64, genesis, vesting, validator string) []launch.RequestContent

AllRequestContents creates all contents types for request

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 Chain

func Chain(r *rand.Rand, id, coordinatorID uint64) launch.Chain

Chain returns a sample Chain

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 ConsensusState

func ConsensusState(nb int) types.ConsensusState

ConsensusState returns a sample ConsensusState nb allows to select a consensus state with a matching validator set consensus state 0 match with validator set 0 nb is 0 if above max value

func Coordinator

func Coordinator(r *rand.Rand, address string) profile.Coordinator

Coordinator returns a sample Coordinator

func CoordinatorDescription

func CoordinatorDescription(r *rand.Rand) profile.CoordinatorDescription

CoordinatorDescription returns a sample CoordinatorDescription

func CustomShareVestingOptions

func CustomShareVestingOptions(r *rand.Rand, shares project.Shares) project.ShareVestingOptions

CustomShareVestingOptions returns a sample ShareVestingOptions with shares

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 GenesisAccount

func GenesisAccount(r *rand.Rand, launchID uint64, address string) launch.GenesisAccount

GenesisAccount returns a sample GenesisAccount

func GenesisAccountContent

func GenesisAccountContent(r *rand.Rand, launchID uint64, address string) launch.RequestContent

GenesisAccountContent returns a sample GenesisAccount request content

func GenesisChainID

func GenesisChainID(r *rand.Rand) string

GenesisChainID returns a sample chain id

func GenesisHash

func GenesisHash(r *rand.Rand) string

GenesisHash returns a sample sha256 hash of custom genesis for GenesisURL

func GenesisValidator

func GenesisValidator(r *rand.Rand, launchID uint64, address string) launch.GenesisValidator

GenesisValidator returns a sample GenesisValidator

func GenesisValidatorPeer

func GenesisValidatorPeer(r *rand.Rand) launch.Peer

func Int

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

Int returns a sample sdkmath.Int

func InterfaceRegistry

func InterfaceRegistry() codectypes.InterfaceRegistry

func LaunchGenesisState

func LaunchGenesisState(r *rand.Rand, addresses ...string) launch.GenesisState

LaunchGenesisState returns a sample genesis state for the launch module

func LaunchParams

func LaunchParams(r *rand.Rand) launch.Params

LaunchParams returns a sample of params for the launch module

func MainnetAccount

func MainnetAccount(r *rand.Rand, projectID uint64, address string) project.MainnetAccount

MainnetAccount returns a sample MainnetAccount

func Metadata

func Metadata(r *rand.Rand, len uint64) []byte

Metadata returns sample metadata bytes

func Mission

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

func MonitoringcParams

func MonitoringcParams() monitoringc.Params

MonitoringcParams returns a sample of params for the monitoring consumer module

func MonitoringpParams

func MonitoringpParams(r *rand.Rand) monitoringp.Params

MonitoringpParams returns a sample of params for the monitoring provider module

func MsgCreateChain

func MsgCreateChain(r *rand.Rand, coordAddress, genesisURL string, hasProject bool, projectID uint64) launch.MsgCreateChain

MsgCreateChain returns a sample MsgCreateChain

func MsgCreateCoordinator

func MsgCreateCoordinator(coordAddress string) profile.MsgCreateCoordinator

MsgCreateCoordinator returns a sample MsgCreateCoordinator

func MsgCreateFixedAuction

func MsgCreateFixedAuction(
	r *rand.Rand,
	auctioneer string,
	sellingCoin sdk.Coin,
	startTime,
	endTime time.Time,
) *fundraisingtypes.MsgCreateFixedPriceAuction

MsgCreateFixedAuction create a sample MsgCreateFixedAuction message

func MsgCreateProject

func MsgCreateProject(r *rand.Rand, coordAddr string) project.MsgCreateProject

MsgCreateProject returns a sample MsgCreateProject

func MsgDisableCoordinator

func MsgDisableCoordinator(coordAddress string) profile.MsgDisableCoordinator

MsgDisableCoordinator returns a sample MsgDisableCoordinator

func MsgEditChain

func MsgEditChain(
	r *rand.Rand,
	coordAddress string,
	launchID uint64,
	setProjectID bool,
	projectID uint64,
	modifyMetadata bool,
) launch.MsgEditChain

MsgEditChain returns a sample MsgEditChain

func MsgRevertLaunch

func MsgRevertLaunch(coordinator string, launchID uint64) launch.MsgRevertLaunch

MsgRevertLaunch returns a sample MsgRevertLaunch

func MsgSendRequestWithAddAccount

func MsgSendRequestWithAddAccount(r *rand.Rand, creator, address string, launchID uint64) launch.MsgSendRequest

MsgSendRequestWithAddAccount returns a sample MsgSendRequest with AddAccount request content

func MsgSendRequestWithAddValidator

func MsgSendRequestWithAddValidator(r *rand.Rand, creator, address string, launchID uint64) launch.MsgSendRequest

MsgSendRequestWithAddValidator returns a sample MsgSendRequest with AddValidator request content

func MsgSendRequestWithAddVestingAccount

func MsgSendRequestWithAddVestingAccount(r *rand.Rand, creator, address string, launchID uint64) launch.MsgSendRequest

MsgSendRequestWithAddVestingAccount returns a sample MsgSendRequest with AddVestingAccount request content

func MsgSendRequestWithParamChange

func MsgSendRequestWithParamChange(r *rand.Rand, creator string, launchID uint64) launch.MsgSendRequest

MsgSendRequestWithParamChange returns a sample MsgSendRequest with ParamChange request content

func MsgSendRequestWithRemoveAccount

func MsgSendRequestWithRemoveAccount(creator, address string, launchID uint64) launch.MsgSendRequest

MsgSendRequestWithRemoveAccount returns a sample MsgSendRequest with RemoveAccount request content

func MsgSendRequestWithRemoveValidator

func MsgSendRequestWithRemoveValidator(creator, validatorAddr string, launchID uint64) launch.MsgSendRequest

MsgSendRequestWithRemoveValidator returns a sample MsgSendRequest with RemoveValidator request content

func MsgSettleRequest

func MsgSettleRequest(coordinator string, launchID, requestID uint64, approve bool) launch.MsgSettleRequest

MsgSettleRequest returns a sample MsgSettleRequest

func MsgTriggerLaunch

func MsgTriggerLaunch(r *rand.Rand, coordinator string, launchID uint64) launch.MsgTriggerLaunch

MsgTriggerLaunch returns a sample MsgTriggerLaunch

func MsgUpdateCoordinatorDescription

func MsgUpdateCoordinatorDescription(coordAddress string) profile.MsgUpdateCoordinatorDescription

MsgUpdateCoordinatorDescription returns a sample MsgUpdateCoordinatorDescription

func MsgUpdateLaunchInformation

func MsgUpdateLaunchInformation(
	r *rand.Rand,
	coordAddress string,
	launchID uint64,
	modifyGenesisChainID,
	modifySource,
	modifyInitialGenesis,
	genesisURL bool,
) launch.MsgUpdateLaunchInformation

MsgUpdateLaunchInformation returns a sample MsgUpdateLaunchInformation

func NonAlphaString

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

NonAlphaString returns a random string with non alpha char of length n

func OperatorAddress

func OperatorAddress(r *rand.Rand) string

OperatorAddress returns a sample string validator operator address

func ParamChange

func ParamChange(r *rand.Rand, launchID uint64) launch.ParamChange

ParamChange returns a sample ParamChange

func ParticipationGenesisState

func ParticipationGenesisState(r *rand.Rand) participation.GenesisState

ParticipationGenesisState returns a sample genesis state for the participation module

func ParticipationGenesisStateWithAllocations

func ParticipationGenesisStateWithAllocations(r *rand.Rand) participation.GenesisState

ParticipationGenesisStateWithAllocations returns a sample genesis state for the participation module with some sample allocations

func ParticipationParams

func ParticipationParams(r *rand.Rand) participation.Params

ParticipationParams returns a sample of params for the participation module

func ProfileGenesisState

func ProfileGenesisState(r *rand.Rand, addresses ...string) profile.GenesisState

ProfileGenesisState returns a sample genesis state for the profile module

func Project

func Project(r *rand.Rand, id uint64) project.Project

Project returns a sample project

func ProjectGenesisState

func ProjectGenesisState(r *rand.Rand) project.GenesisState

ProjectGenesisState returns a sample genesis state for the project module

func ProjectGenesisStateWithAccounts

func ProjectGenesisStateWithAccounts(r *rand.Rand) project.GenesisState

ProjectGenesisStateWithAccounts returns a sample genesis state for the project module that includes accounts

func ProjectName

func ProjectName(r *rand.Rand) string

ProjectName returns a sample project name

func ProjectParams

func ProjectParams(r *rand.Rand) project.Params

ProjectParams returns a sample of params for the project module

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 Request

func Request(r *rand.Rand, launchID uint64, address string) launch.Request

Request returns a sample Request

func RequestContent

func RequestContent(r *rand.Rand, launchID uint64) launch.RequestContent

RequestContent returns a request content with Genesis Account

func RequestWithContent

func RequestWithContent(r *rand.Rand, launchID uint64, content launch.RequestContent) launch.Request

RequestWithContent creates a launch request object with launch id and content

func RequestWithContentAndCreator

func RequestWithContentAndCreator(r *rand.Rand, launchID uint64, content launch.RequestContent, creator string) launch.Request

RequestWithContentAndCreator creates a launch request object with launch id and content and creator

func RewardPool

func RewardPool(r *rand.Rand, launchID uint64) reward.RewardPool

RewardPool returns a sample RewardPool

func RewardPoolWithCoinsRangeAmount

func RewardPoolWithCoinsRangeAmount(r *rand.Rand, launchID uint64, denom1, denom2, denom3 string, min, max int64) reward.RewardPool

RewardPoolWithCoinsRangeAmount returns a sample RewardPool where the amount of remaining coins is a random number between provided min and max values with a set of given denoms. Initial coins will be in an amount between max and 2*max

func ShareVestingOptions

func ShareVestingOptions(r *rand.Rand) project.ShareVestingOptions

ShareVestingOptions returns a sample ShareVestingOptions

func Shares

func Shares(r *rand.Rand) project.Shares

Shares returns a sample shares

func SimAccounts

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

SimAccounts returns a sample array of account for simulation

func SpecialAllocations

func SpecialAllocations(r *rand.Rand) project.SpecialAllocations

SpecialAllocations returns a sample special allocations

func String

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

String returns a random string of length n

func Time

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

Time returns a sample time

func TotalSupply

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

TotalSupply returns a sample coins structure where each denom's total supply is within the default allowed supply range

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

func ValidatorDescription

func ValidatorDescription(desc string) profile.ValidatorDescription

ValidatorDescription returns a sample ValidatorDescription

func ValidatorSet

func ValidatorSet(nb int) types.ValidatorSet

ValidatorSet returns a sample ValidatorSet nb allows to select a consensus state with a matching validator set consensus state 0 match with validator set 0 nb is 0 if above max value

func VestingAccount

func VestingAccount(r *rand.Rand, launchID uint64, address string) launch.VestingAccount

VestingAccount returns a sample VestingAccount

func VestingOptions

func VestingOptions(r *rand.Rand) launch.VestingOptions

VestingOptions returns a sample VestingOptions

func Voucher

func Voucher(r *rand.Rand, projectID uint64) sdk.Coin

Voucher returns a sample voucher structure

func Vouchers

func Vouchers(r *rand.Rand, projectID uint64) sdk.Coins

Vouchers returns a sample vouchers structure

func ZeroTime

func ZeroTime() time.Time

ZeroTime returns time.Time that represents 0

Types

This section is empty.

Jump to

Keyboard shortcuts

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