Documentation ¶
Index ¶
- Variables
- type Node
- func (n *Node) Client() client.Client
- func (n *Node) Close() error
- func (n *Node) ExportCurrentState(ctx context.Context) ([]gnoland.TxWithMetadata, error)
- func (n *Node) ExportStateAsGenesis(ctx context.Context) (*bft.GenesisDoc, error)
- func (n *Node) GetBlockTransactions(blockNum uint64) ([]gnoland.TxWithMetadata, error)
- func (n *Node) GetLatestBlockNumber() (uint64, error)
- func (n *Node) GetRemoteAddress() string
- func (n *Node) ListPkgs() []gnomod.Pkg
- func (n *Node) MoveBy(ctx context.Context, x int) error
- func (n *Node) MoveToNextTX(ctx context.Context) error
- func (n *Node) MoveToPreviousTX(ctx context.Context) error
- func (n *Node) Reload(ctx context.Context) error
- func (n *Node) ReloadAll(ctx context.Context) error
- func (n *Node) Reset(ctx context.Context) error
- func (n *Node) SaveCurrentState(ctx context.Context) error
- func (n *Node) SendTransaction(tx *std.Tx) error
- func (n *Node) UpdatePackages(paths ...string) error
- type NodeConfig
- type Package
- type PackagePath
- type PackagesMap
Constants ¶
This section is empty.
Variables ¶
var ( ErrEmptyCreatorPackage = errors.New("no creator specified for package") ErrEmptyDepositPackage = errors.New("no deposit specified for package") )
var DefaultFee = std.NewFee(50000, std.MustParseCoin(ugnot.ValueString(1000000)))
var ErrEmptyState = errors.New("empty state")
Functions ¶
This section is empty.
Types ¶
type Node ¶
Node is not thread safe
func NewDevNode ¶
func NewDevNode(ctx context.Context, cfg *NodeConfig) (*Node, error)
func (*Node) ExportCurrentState ¶
Export the current state as list of txs
func (*Node) ExportStateAsGenesis ¶
Export the current state as genesis doc
func (*Node) GetBlockTransactions ¶
func (n *Node) GetBlockTransactions(blockNum uint64) ([]gnoland.TxWithMetadata, error)
GetBlockTransactions returns the transactions contained within the specified block, if any
func (*Node) GetLatestBlockNumber ¶
GetBlockTransactions returns the transactions contained within the specified block, if any GetLatestBlockNumber returns the latest block height from the chain
func (*Node) GetRemoteAddress ¶
func (*Node) MoveBy ¶
MoveBy adjusts the current state of the node by `x` transactions. `x` can be negative to move backward or positive to move forward, however, index boundaries are respected with a lower limit of 0 and upper limit equaling the total number of states. If a move is successful, node is reloaded.
func (*Node) Reload ¶
Reload saves the current state, stops the node if running, starts a new node, and re-apply previously saved state along with packages updated by `UpdatePackages`. If any transaction, including 'addpkg', fails, it will be ignored. Use 'Reset' to completely reset the node's state in case of persistent errors.
func (*Node) ReloadAll ¶
ReloadAll updates all currently known packages and then reloads the node. It's actually a simple combination between `UpdatePackage` and `Reload` method.
func (*Node) Reset ¶
Reset stops the node, if running, and reloads it with a new genesis state, effectively ignoring the current state.
func (*Node) SaveCurrentState ¶
Save the current state as initialState
func (*Node) SendTransaction ¶
SendTransaction executes a broadcast commit send of the specified transaction to the chain
func (*Node) UpdatePackages ¶
UpdatePackages updates the currently known packages. It will be taken into consideration in the next reload of the node.
type NodeConfig ¶
type NodeConfig struct { Logger *slog.Logger DefaultDeployer crypto.Address BalancesList []gnoland.Balance PackagesPathList []PackagePath Emitter emitter.Emitter InitialTxs []gnoland.TxWithMetadata TMConfig *tmcfg.Config SkipFailingGenesisTxs bool NoReplay bool MaxGasPerBlock int64 ChainID string }
func DefaultNodeConfig ¶
func DefaultNodeConfig(rootdir string) *NodeConfig
type PackagePath ¶
func ResolvePackagePathQuery ¶
func ResolvePackagePathQuery(bk *address.Book, path string) (PackagePath, error)
type PackagesMap ¶
func NewPackagesMap ¶
func NewPackagesMap(ppaths []PackagePath) (PackagesMap, error)
func (PackagesMap) Load ¶
func (pm PackagesMap) Load(fee std.Fee) ([]gnoland.TxWithMetadata, error)