gnoland

package
v0.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2024 License: UNKNOWN not legal advice Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrBalanceEmptyAddress = errors.New("balance address is empty")
	ErrBalanceEmptyAmount  = errors.New("balance amount is empty")
)
View Source
var Package = amino.RegisterPackage(amino.NewPackage(
	"github.com/gnolang/gno/gno.land/pkg/gnoland",
	"gno",
	amino.GetCallersDirname(),
).WithDependencies().WithTypes(
	&GnoAccount{}, "Account",
	GnoGenesisState{}, "GenesisState",
))

Functions

func EndBlocker

func EndBlocker(vmk vm.VMKeeperI) func(ctx sdk.Context, req abci.RequestEndBlock) abci.ResponseEndBlock

XXX not used yet.

func GetNodeReadiness

func GetNodeReadiness(n *node.Node) <-chan struct{}

GetNodeReadiness waits until the node is ready, signaling via the EventNewBlock event. XXX: This should be replace by https://github.com/gnolang/gno/pull/1216

func InitChainer

func InitChainer(baseApp *sdk.BaseApp, acctKpr auth.AccountKeeperI, bankKpr bank.BankKeeperI, resHandler GenesisTxHandler) func(sdk.Context, abci.RequestInitChain) abci.ResponseInitChain

InitChainer returns a function that can initialize the chain with genesis.

func LoadGenesisTxsFile

func LoadGenesisTxsFile(path string, chainID string, genesisRemote string) ([]std.Tx, error)

LoadGenesisTxsFile loads genesis transactions from the provided file path. XXX: Improve the way we generate and load this file

func LoadPackage

func LoadPackage(pkg gnomod.Pkg, creator bft.Address, fee std.Fee, deposit std.Coins) (std.Tx, error)

LoadPackage loads a single package into a `std.Tx`

func LoadPackagesFromDir

func LoadPackagesFromDir(dir string, creator bft.Address, fee std.Fee) ([]std.Tx, error)

LoadPackagesFromDir loads gno packages from a directory. It creates and returns a list of transactions based on these packages.

func NewApp

func NewApp(dataRootDir string, skipFailingGenesisTxs bool, logger *slog.Logger, maxCycles int64) (abci.Application, error)

NewApp creates the GnoLand application.

func NewAppWithOptions

func NewAppWithOptions(cfg *AppOptions) (abci.Application, error)

NewApp creates the GnoLand application.

func NewDefaultGenesisConfig

func NewDefaultGenesisConfig(pk crypto.PubKey, chainid string) *bft.GenesisDoc

NewInMemoryNodeConfig creates a default configuration for an in-memory node.

func NewDefaultTMConfig

func NewDefaultTMConfig(rootdir string) *tmcfg.Config

func NewInMemoryNode

func NewInMemoryNode(logger *slog.Logger, cfg *InMemoryNodeConfig) (*node.Node, error)

NewInMemoryNode creates an in-memory gnoland node. In this mode, the node does not persist any data and uses an in-memory database. The `InMemoryNodeConfig.TMConfig.RootDir` should point to the correct gno repository to load the stdlibs.

func NewMockedPrivValidator

func NewMockedPrivValidator() bft.PrivValidator

NewMockedPrivValidator generate a new key

func NoopGenesisTxHandler

func NoopGenesisTxHandler(ctx sdk.Context, tx std.Tx, res sdk.Result)

func PanicOnFailingTxHandler

func PanicOnFailingTxHandler(ctx sdk.Context, tx std.Tx, res sdk.Result)

func ProtoGnoAccount

func ProtoGnoAccount() std.Account

Types

type AppOptions

type AppOptions struct {
	DB dbm.DB
	// `gnoRootDir` should point to the local location of the gno repository.
	// It serves as the gno equivalent of GOROOT.
	GnoRootDir       string
	GenesisTxHandler GenesisTxHandler
	Logger           *slog.Logger
	MaxCycles        int64
}

func NewAppOptions

func NewAppOptions() *AppOptions

type Balance

type Balance struct {
	Address bft.Address
	Amount  std.Coins
}

func LoadGenesisBalancesFile

func LoadGenesisBalancesFile(path string) ([]Balance, error)

LoadGenesisBalancesFile loads genesis balances from the provided file path.

func (Balance) MarshalAmino

func (b Balance) MarshalAmino() (string, error)

func (*Balance) Parse

func (b *Balance) Parse(entry string) error

func (Balance) String

func (b Balance) String() string

func (*Balance) UnmarshalAmino

func (b *Balance) UnmarshalAmino(rep string) error

func (*Balance) Verify

func (b *Balance) Verify() error

type Balances

type Balances map[crypto.Address]Balance

func GetBalancesFromEntries

func GetBalancesFromEntries(entries ...string) (Balances, error)

func GetBalancesFromSheet

func GetBalancesFromSheet(sheet io.Reader) (Balances, error)

func NewBalances

func NewBalances() Balances

func (Balances) Get

func (bs Balances) Get(address crypto.Address) (balance Balance, ok bool)

func (Balances) LeftMerge

func (bs Balances) LeftMerge(from Balances)

LeftMerge left-merges the two maps

func (Balances) List

func (bs Balances) List() []Balance

func (Balances) LoadFromEntries

func (bs Balances) LoadFromEntries(entries ...string) error

LoadFromEntries extracts the balance entries in the form of <address>=<amount>

func (Balances) LoadFromSheet

func (bs Balances) LoadFromSheet(sheet io.Reader) error

LoadFromSheet extracts the balance sheet from the passed in balance sheet file, that has the format of <address>=<amount>ugnot

func (Balances) Set

func (bs Balances) Set(address crypto.Address, amount std.Coins)

type GenesisTxHandler

type GenesisTxHandler func(ctx sdk.Context, tx std.Tx, res sdk.Result)

type GnoAccount

type GnoAccount struct {
	std.BaseAccount
}

type GnoGenesisState

type GnoGenesisState struct {
	Balances []Balance `json:"balances"`
	Txs      []std.Tx  `json:"txs"`
}

type InMemoryNodeConfig

type InMemoryNodeConfig struct {
	PrivValidator      bft.PrivValidator // identity of the validator
	Genesis            *bft.GenesisDoc
	TMConfig           *tmcfg.Config
	GenesisTxHandler   GenesisTxHandler
	GenesisMaxVMCycles int64
}

Jump to

Keyboard shortcuts

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