simapp

package
v1.1.4 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2023 License: AGPL-3.0 Imports: 21 Imported by: 0

Documentation

Overview

Package simapp contains utils to bootstrap the chain.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenAccountAddress added in v0.0.8

func GenAccountAddress() sdk.AccAddress

GenAccountAddress generates random account.

Types

type GenesisState

type GenesisState map[string]json.RawMessage

GenesisState of the blockchain is represented here as a map of raw json messages key'd by a identifier string. The identifier is used to determine which module genesis information belongs to so it may be appropriately routed during init chain. Within this application default genesis information is retrieved from the ModuleBasicManager which populates json from each BasicModule object provided to it during init.

func NewDefaultGenesisState

func NewDefaultGenesisState(cdc codec.JSONCodec) GenesisState

NewDefaultGenesisState generates the default state for the application.

type Option

type Option struct {
	// contains filtered or unexported fields
}

Option is an option pattern function used fot the test simapp customisations.

func WithAppCommit

func WithAppCommit() Option

WithAppCommit commits the app state after the initialisation.

func WithGenesisAccountsAndBalances

func WithGenesisAccountsAndBalances(balances ...banktypes.Balance) Option

WithGenesisAccountsAndBalances returns genesis override Option for initial balances.

func WithGenesisOverride

func WithGenesisOverride(override func(map[string]json.RawMessage) map[string]json.RawMessage) Option

WithGenesisOverride returns genesis override ConfigOption.

type SimApp

type SimApp struct {
	// contains filtered or unexported fields
}

The SimApp is OnomyApp wrapper with the advance testing capabilities.

func Setup

func Setup(opts ...Option) *SimApp

Setup initializes a new SimApp. A Nop logger is set in SimApp.

func SetupWithValidators

func SetupWithValidators(t *testing.T, vals map[string]ValReq, opts ...Option) (*SimApp, map[string]*secp256k1.PrivKey)

SetupWithValidators create new simApp with the defined list of the validators.

func (*SimApp) BeginNextBlock

func (s *SimApp) BeginNextBlock()

BeginNextBlock begins new SimApp block.

func (*SimApp) CreateProposal

func (s *SimApp) CreateProposal(
	t *testing.T,
	content govtypes.Content,
	deposit sdk.Coin,
	priv cryptotypes.PrivKey,
)

CreateProposal creates a new proposal with the provided contant.

func (*SimApp) CreateValidator

func (s *SimApp) CreateValidator(
	t *testing.T,
	selfDelegation sdk.Coin,
	description stakingtypes.Description,
	commission stakingtypes.CommissionRates,
	minSelfDelegation sdk.Int,
	priv cryptotypes.PrivKey,
)

CreateValidator creates the validator.

func (*SimApp) CurrentContext

func (s *SimApp) CurrentContext() sdk.Context

CurrentContext returns current context for the SimApp.

func (*SimApp) EndBlock

func (s *SimApp) EndBlock(ctx sdk.Context)

EndBlock ends the current block.

func (*SimApp) EndBlockAndCommit

func (s *SimApp) EndBlockAndCommit(ctx sdk.Context)

EndBlockAndCommit ends the current block and commit the state.

func (*SimApp) NewContext

func (s *SimApp) NewContext() sdk.Context

NewContext returns empty sdk context for the SimApp.

func (*SimApp) NewNextContext

func (s *SimApp) NewNextContext() sdk.Context

NewNextContext creates next block sdk context for the SimApp.

func (*SimApp) OnomyApp

func (s *SimApp) OnomyApp() *app.OnomyApp

OnomyApp returns OnomyApp from the SimApp.

func (*SimApp) VoteProposal

func (s *SimApp) VoteProposal(
	t *testing.T,
	proposalID uint64,
	option govtypes.VoteOption,
	priv cryptotypes.PrivKey,
)

VoteProposal votes for the proposal.

type ValReq

type ValReq struct {
	Balance      sdk.Coins
	SelfBondCoin sdk.Coin
	Commission   stakingtypes.CommissionRates
	Reward       sdk.Coin
}

ValReq is simplified struct for the validator creation.

Jump to

Keyboard shortcuts

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