Documentation
¶
Index ¶
- Variables
- type Node
- func (n *Node) AddPackagePaths(paths ...string)
- 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) HasPackageLoaded(path string) bool
- func (n *Node) ListPkgs() []packages.Package
- 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) SetPackagePaths(paths ...string)
- type NodeConfig
- type QueryPath
Constants ¶
This section is empty.
Variables ¶
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 (*Node) AddPackagePaths ¶
AddPackagePaths to load
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) HasPackageLoaded ¶
HasPackageLoaded returns true if the specified package has already been loaded. NOTE: This only checks if the package was loaded at the genesis level.
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) SetPackagePaths ¶
type NodeConfig ¶
type NodeConfig struct { // Logger is used for logging node activities. It can be set to a custom logger or a noop logger for // silent operation. Logger *slog.Logger // Loader is responsible for loading packages. It abstracts the mechanism for retrieving and managing // package data. Loader packages.Loader // DefaultCreator specifies the default address used for creating packages and transactions. DefaultCreator crypto.Address // DefaultDeposit is the default amount of coins deposited when creating a package. DefaultDeposit std.Coins // BalancesList defines the initial balance of accounts in the genesis state. BalancesList []gnoland.Balance // PackagesModifier allows modifications to be applied to packages during initialization. PackagesModifier []QueryPath // Emitter is used to emit events for various node operations. It can be set to a noop emitter if no // event emission is required. Emitter emitter.Emitter // InitialTxs contains the transactions that are included in the genesis state. InitialTxs []gnoland.TxWithMetadata // TMConfig holds the Tendermint configuration settings. TMConfig *tmcfg.Config // SkipFailingGenesisTxs indicates whether to skip failing transactions during the genesis // initialization. SkipFailingGenesisTxs bool // NoReplay, if set to true, prevents replaying of transactions from the block store during node // initialization. NoReplay bool // MaxGasPerBlock sets the maximum amount of gas that can be used in a single block. MaxGasPerBlock int64 // ChainID is the unique identifier for the blockchain. ChainID string // ChainDomain specifies the domain name associated with the blockchain network. ChainDomain string }
func DefaultNodeConfig ¶
func DefaultNodeConfig(rootdir, domain string) *NodeConfig