sample

package
v0.3.1 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: 50 Imported by: 1

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 added in v0.2.0

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 added in v0.2.0

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 added in v0.3.0

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 added in v0.2.0

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 added in v0.2.0

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 added in v0.2.0

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 added in v0.2.0

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 added in v0.2.0

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

ConsAddress returns a sample consensus address

func ConsensusState added in v0.2.0

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 added in v0.2.0

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

CustomShareVestingOptions returns a sample ShareVestingOptions with shares

func Delegation added in v0.2.0

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

Delegation returns staking delegation with the given address

func Duration added in v0.2.0

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

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

func DurationFromRange added in v0.2.0

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 added in v0.3.0

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 added in v0.2.0

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

func Int added in v0.3.0

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

Int returns a sample sdkmath.Int

func InterfaceRegistry added in v0.3.0

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 added in v0.2.0

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

MainnetAccount returns a sample MainnetAccount

func Metadata added in v0.2.0

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

Metadata returns sample metadata bytes

func Mission added in v0.3.0

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

func MonitoringcParams added in v0.2.0

func MonitoringcParams() monitoringc.Params

MonitoringcParams returns a sample of params for the monitoring consumer module

func MonitoringpParams added in v0.2.0

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 added in v0.2.0

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

MsgCreateFixedAuction create a sample MsgCreateFixedAuction message

func MsgCreateProject added in v0.3.0

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

MsgCreateProject returns a sample MsgCreateProject

func MsgDisableCoordinator added in v0.2.0

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 added in v0.2.0

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

MsgRevertLaunch returns a sample MsgRevertLaunch

func MsgSendRequestWithAddAccount added in v0.3.0

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

MsgSendRequestWithAddAccount returns a sample MsgSendRequest with AddAccount request content

func MsgSendRequestWithAddValidator added in v0.3.0

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

MsgSendRequestWithAddValidator returns a sample MsgSendRequest with AddValidator request content

func MsgSendRequestWithAddVestingAccount added in v0.3.0

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

MsgSendRequestWithAddVestingAccount returns a sample MsgSendRequest with AddVestingAccount request content

func MsgSendRequestWithParamChange added in v0.3.0

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

MsgSendRequestWithParamChange returns a sample MsgSendRequest with ParamChange request content

func MsgSendRequestWithRemoveAccount added in v0.3.0

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

MsgSendRequestWithRemoveAccount returns a sample MsgSendRequest with RemoveAccount request content

func MsgSendRequestWithRemoveValidator added in v0.3.0

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

MsgSendRequestWithRemoveValidator returns a sample MsgSendRequest with RemoveValidator request content

func MsgSettleRequest added in v0.2.0

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

MsgSettleRequest returns a sample MsgSettleRequest

func MsgTriggerLaunch added in v0.2.0

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

MsgTriggerLaunch returns a sample MsgTriggerLaunch

func MsgUpdateCoordinatorDescription added in v0.2.0

func MsgUpdateCoordinatorDescription(coordAddress string) profile.MsgUpdateCoordinatorDescription

MsgUpdateCoordinatorDescription returns a sample MsgUpdateCoordinatorDescription

func MsgUpdateLaunchInformation added in v0.2.0

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

MsgUpdateLaunchInformation returns a sample MsgUpdateLaunchInformation

func NonAlphaString added in v0.3.0

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

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

func OperatorAddress added in v0.2.0

func OperatorAddress(r *rand.Rand) string

OperatorAddress returns a sample string validator operator address

func ParamChange added in v0.3.0

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

ParamChange returns a sample ParamChange

func ParticipationGenesisState added in v0.2.0

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

ParticipationGenesisState returns a sample genesis state for the participation module

func ParticipationGenesisStateWithAllocations added in v0.2.0

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

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

func ParticipationParams added in v0.2.0

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 added in v0.3.0

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

Project returns a sample project

func ProjectGenesisState added in v0.3.0

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

ProjectGenesisState returns a sample genesis state for the project module

func ProjectGenesisStateWithAccounts added in v0.3.0

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

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

func ProjectName added in v0.3.0

func ProjectName(r *rand.Rand) string

ProjectName returns a sample project name

func ProjectParams added in v0.3.0

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

ProjectParams returns a sample of params for the project module

func PubKey added in v0.2.0

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

PubKey returns a sample account PubKey

func Rand added in v0.2.0

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 added in v0.3.0

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 added in v0.2.0

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 added in v0.2.0

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

RewardPool returns a sample RewardPool

func RewardPoolWithCoinsRangeAmount added in v0.2.0

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 added in v0.2.0

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

ShareVestingOptions returns a sample ShareVestingOptions

func Shares added in v0.2.0

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

Shares returns a sample shares

func SimAccounts added in v0.2.0

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

SimAccounts returns a sample array of account for simulation

func SpecialAllocations added in v0.3.0

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 added in v0.3.0

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

Time returns a sample time

func TotalSupply added in v0.2.0

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 added in v0.2.0

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

ValAddress returns a sample validator operator address

func Validator added in v0.2.0

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 added in v0.2.0

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 added in v0.2.0

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

Voucher returns a sample voucher structure

func Vouchers added in v0.2.0

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

Vouchers returns a sample vouchers structure

func ZeroTime added in v0.3.0

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