Documentation ¶
Index ¶
Constants ¶
const DefaultRestInterface = "localhost:8080"
DefaultRestInterface is the default interface the rest API will start on if not specified
const DefaultRestPortOff = "off"
DefaultRestPortOff is the default value that should be passed if it is desired
to start the node without a REST endpoint available
Variables ¶
var ErrErrNilTransactionSimulatorProcessor = errors.New("nil transaction simulator processor")
ErrNilTransactionSimulatorProcessor signals that a nil transaction simulator processor has been provided
var ErrHeartbeatsNotActive = errors.New("heartbeat system not active")
ErrHeartbeatsNotActive signals that the heartbeat system is not active
var ErrInvalidValue = errors.New("invalid value")
ErrInvalidValue signals that an invalid value has been provided
var ErrNilAccountState = errors.New("nil account state")
ErrNilAccountState signals that a nil account state has been provided
var ErrNilApiResolver = errors.New("nil api resolver")
ErrNilApiResolver signals that a nil api resolver instance has been provided
var ErrNilNode = errors.New("nil node")
ErrNilNode signals that a nil node instance has been provided
var ErrNilPeerState = errors.New("nil peer state")
ErrNilPeerState signals that a nil peer state has been provided
var ErrNoApiRoutesConfig = errors.New("no configuration found for API routes")
ErrNoApiRoutesConfig signals that no configuration was found for API routes
Functions ¶
func NewNodeFacade ¶ added in v1.0.102
func NewNodeFacade(arg ArgNodeFacade) (*nodeFacade, error)
NewNodeFacade creates a new Facade with a NodeWrapper
Types ¶
type ApiResolver ¶
type ApiResolver interface { ExecuteSCQuery(query *process.SCQuery) (*vmcommon.VMOutput, error) ComputeTransactionGasLimit(tx *transaction.Transaction) (uint64, error) StatusMetrics() external.StatusMetricsHandler IsInterfaceNil() bool }
ApiResolver defines a structure capable of resolving REST API requests
type ArgNodeFacade ¶ added in v1.0.102
type ArgNodeFacade struct { Node NodeHandler ApiResolver ApiResolver TxSimulatorProcessor TransactionSimulatorProcessor RestAPIServerDebugMode bool WsAntifloodConfig config.WebServerAntifloodConfig FacadeConfig config.FacadeConfig ApiRoutesConfig config.ApiRoutesConfig AccountsState state.AccountsAdapter PeerState state.AccountsAdapter }
ArgNodeFacade represents the argument for the nodeFacade
type HardforkTrigger ¶ added in v1.0.102
type HardforkTrigger interface { Trigger(epoch uint32, withEarlyEndOfEpoch bool) error IsSelfTrigger() bool IsInterfaceNil() bool }
HardforkTrigger defines the structure used to trigger hardforks
type NodeHandler ¶ added in v1.0.102
type NodeHandler interface { // StartConsensus will start the consesus service for the current node StartConsensus() error // GetBalance returns the balance for a specific address GetBalance(address string) (*big.Int, error) // GetUsername returns the username for a specific address GetUsername(address string) (string, error) // GetValueForKey returns the value of a key from a given account GetValueForKey(address string, key string) (string, error) //CreateTransaction will return a transaction from all needed fields CreateTransaction(nonce uint64, value string, receiverHex string, senderHex string, gasPrice uint64, gasLimit uint64, data []byte, signatureHex string, chainID string, version uint32) (*transaction.Transaction, []byte, error) //ValidateTransaction will validate a transaction ValidateTransaction(tx *transaction.Transaction) error ValidateTransactionForSimulation(tx *transaction.Transaction) error //SendBulkTransactions will send a bulk of transactions on the 'send transactions pipe' channel SendBulkTransactions(txs []*transaction.Transaction) (uint64, error) //GetTransaction will return a transaction based on the hash GetTransaction(hash string) (*transaction.ApiTransactionResult, error) // GetAccount returns an accountResponse containing information // about the account corelated with provided address GetAccount(address string) (state.UserAccountHandler, error) // GetHeartbeats returns the heartbeat status for each public key defined in genesis.json GetHeartbeats() []data.PubKeyHeartbeat // IsInterfaceNil returns true if there is no value under the interface IsInterfaceNil() bool // ValidatorStatisticsApi return the statistics for all the validators ValidatorStatisticsApi() (map[string]*state.ValidatorApiResponse, error) DirectTrigger(epoch uint32, withEarlyEndOfEpoch bool) error IsSelfTrigger() bool EncodeAddressPubkey(pk []byte) (string, error) DecodeAddressPubkey(pk string) ([]byte, error) GetQueryHandler(name string) (debug.QueryHandler, error) GetPeerInfo(pid string) ([]core.QueryP2PPeerInfo, error) GetBlockByHash(hash string, withTxs bool) (*block.APIBlock, error) GetBlockByNonce(nonce uint64, withTxs bool) (*block.APIBlock, error) }
NodeHandler contains all functions that a node should contain.
type TransactionSimulatorProcessor ¶ added in v1.1.1
type TransactionSimulatorProcessor interface { ProcessTx(tx *transaction.Transaction) (*transaction.SimulationResults, error) IsInterfaceNil() bool }
TransactionSimulatorProcessor defines the actions which a transaction simulator processor has to implement