facade

package
v1.11.5 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2026 License: GPL-3.0 Imports: 30 Imported by: 5 modules, 5 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const DefaultRestInterface = "localhost:8080"

DefaultRestInterface is the default interface the rest API will start on if not specified

View Source
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

View Source
var ErrEmptyGasConfigs = errors.New("empty gas configs")

ErrEmptyGasConfigs signals that the provided gas configs map is empty

View Source
var ErrEmptyRootHash = errors.New("empty current root hash")

ErrEmptyRootHash signals that the current root hash is empty

View Source
var ErrHeartbeatsNotActive = errors.New("heartbeat system not active")

ErrHeartbeatsNotActive signals that the heartbeat system is not active

View Source
var ErrInvalidValue = errors.New("invalid value")

ErrInvalidValue signals that an invalid value has been provided

View Source
var ErrNilAccountState = errors.New("nil account state")

ErrNilAccountState signals that a nil account state has been provided

View Source
var ErrNilApiResolver = errors.New("nil api resolver")

ErrNilApiResolver signals that a nil api resolver instance has been provided

View Source
var ErrNilBlockchain = errors.New("nil blockchain")

ErrNilBlockchain signals that a nil blockchain has been provided

View Source
var ErrNilGenesisBalances = errors.New("nil genesis balances slice")

ErrNilGenesisBalances signals that the provided genesis balances slice is nil

View Source
var ErrNilGenesisNodes = errors.New("nil genesis nodes")

ErrNilGenesisNodes signals that the provided genesis nodes configuration is nil

View Source
var ErrNilNode = errors.New("nil node")

ErrNilNode signals that a nil node instance has been provided

View Source
var ErrNilPeerState = errors.New("nil peer state")

ErrNilPeerState signals that a nil peer state has been provided

View Source
var ErrNilStatusMetrics = errors.New("nil status metrics handler")

ErrNilStatusMetrics signals that a nil status metrics was provided

View Source
var ErrNilTransactionSimulatorProcessor = errors.New("nil transaction simulator processor")

ErrNilTransactionSimulatorProcessor signals that a nil transaction simulator processor has been provided

View Source
var ErrNoApiRoutesConfig = errors.New("no configuration found for API routes")

ErrNoApiRoutesConfig signals that no configuration was found for API routes

View Source
var ErrTooManyAddressesInBulk = errors.New("too many addresses in the bulk request")

ErrTooManyAddressesInBulk signals that there are too many addresses present in a bulk request

Functions

func NewNodeFacade

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, common.BlockInfo, error)
	ComputeTransactionGasLimit(tx *transaction.Transaction) (*transaction.CostResponse, error)
	SimulateTransactionExecution(tx *transaction.Transaction) (*txSimData.SimulationResultsWithVMOutput, error)
	SimulateSCRExecutionCost(scr *smartContractResult.SmartContractResult) (*transaction.CostResponse, error)
	StatusMetrics() external.StatusMetricsHandler
	GetTotalStakedValue(ctx context.Context) (*api.StakeValues, error)
	GetDirectStakedList(ctx context.Context) ([]*api.DirectStakedValue, error)
	GetDelegatorsList(ctx context.Context) ([]*api.Delegator, error)
	GetTransaction(hash string, withResults bool) (*transaction.ApiTransactionResult, error)
	GetSCRsByTxHash(txHash string, scrHash string) ([]*transaction.ApiSmartContractResult, error)
	GetTransactionsPool(fields string) (*common.TransactionsPoolAPIResponse, error)
	GetTransactionsPoolForSender(sender, fields string) (*common.TransactionsPoolForSenderApiResponse, error)
	GetLastPoolNonceForSender(sender string) (uint64, error)
	GetTransactionsPoolNonceGapsForSender(sender string, senderAccountNonce uint64) (*common.TransactionsPoolNonceGapsForSenderApiResponse, error)
	GetBlockByHash(hash string, options api.BlockQueryOptions) (*api.Block, error)
	GetBlockByNonce(nonce uint64, options api.BlockQueryOptions) (*api.Block, error)
	GetBlockByRound(round uint64, options api.BlockQueryOptions) (*api.Block, error)
	GetAlteredAccountsForBlock(options api.GetAlteredAccountsForBlockOptions) ([]*alteredAccount.AlteredAccount, error)
	GetInternalShardBlockByNonce(format common.ApiOutputFormat, nonce uint64) (interface{}, error)
	GetInternalShardBlockByHash(format common.ApiOutputFormat, hash string) (interface{}, error)
	GetInternalShardBlockByRound(format common.ApiOutputFormat, round uint64) (interface{}, error)
	GetInternalMetaBlockByNonce(format common.ApiOutputFormat, nonce uint64) (interface{}, error)
	GetInternalMetaBlockByHash(format common.ApiOutputFormat, hash string) (interface{}, error)
	GetInternalMetaBlockByRound(format common.ApiOutputFormat, round uint64) (interface{}, error)
	GetInternalStartOfEpochMetaBlock(format common.ApiOutputFormat, epoch uint32) (interface{}, error)
	GetInternalStartOfEpochValidatorsInfo(epoch uint32) ([]*state.ShardValidatorInfo, error)
	GetInternalMiniBlock(format common.ApiOutputFormat, txHash string, epoch uint32) (interface{}, error)
	GetGenesisNodesPubKeys() (map[uint32][]string, map[uint32][]string)
	GetGenesisBalances() ([]*common.InitialAccountAPI, error)
	GetGasConfigs() map[string]map[string]uint64
	GetManagedKeysCount() int
	GetManagedKeys() []string
	GetLoadedKeys() []string
	GetEligibleManagedKeys() ([]string, error)
	GetWaitingManagedKeys() ([]string, error)
	GetWaitingEpochsLeftForPublicKey(publicKey string) (uint32, error)
	Close() error
	IsInterfaceNil() bool
}

ApiResolver defines a structure capable of resolving REST API requests

type ArgNodeFacade

type ArgNodeFacade struct {
	Node                   NodeHandler
	ApiResolver            ApiResolver
	RestAPIServerDebugMode bool
	WsAntifloodConfig      config.WebServerAntifloodConfig
	FacadeConfig           config.FacadeConfig
	ApiRoutesConfig        config.ApiRoutesConfig
	AccountsState          state.AccountsAdapter
	PeerState              state.AccountsAdapter
	Blockchain             chainData.ChainHandler
}

ArgNodeFacade represents the argument for the nodeFacade

type HardforkTrigger

type HardforkTrigger interface {
	Trigger(epoch uint32, withEarlyEndOfEpoch bool) error
	IsSelfTrigger() bool
	IsInterfaceNil() bool
}

HardforkTrigger defines the structure used to trigger hardforks

type NodeHandler

type NodeHandler interface {
	// GetBalance returns the balance for a specific address
	GetBalance(address string, options api.AccountQueryOptions) (*big.Int, api.BlockInfo, error)

	// GetUsername returns the username for a specific address
	GetUsername(address string, options api.AccountQueryOptions) (string, api.BlockInfo, error)

	// GetCodeHash returns the username for a specific address
	GetCodeHash(address string, options api.AccountQueryOptions) ([]byte, api.BlockInfo, error)

	// GetValueForKey returns the value of a key from a given account
	GetValueForKey(address string, key string, options api.AccountQueryOptions) (string, api.BlockInfo, error)

	// GetGuardianData returns the guardian data for given account
	GetGuardianData(address string, options api.AccountQueryOptions) (api.GuardianData, api.BlockInfo, error)

	// GetKeyValuePairs returns the key-value pairs under a given address
	GetKeyValuePairs(address string, options api.AccountQueryOptions, ctx context.Context) (map[string]string, api.BlockInfo, error)

	// IterateKeys returns the key-value pairs under a given address starting from a given state
	IterateKeys(address string, numKeys uint, iteratorState [][]byte, options api.AccountQueryOptions, ctx context.Context) (map[string]string, [][]byte, api.BlockInfo, error)

	// GetAllIssuedESDTs returns all the issued esdt tokens from esdt system smart contract
	GetAllIssuedESDTs(tokenType string, ctx context.Context) ([]string, error)

	// GetESDTData returns the esdt data from a given account, given key and given nonce
	GetESDTData(address, tokenID string, nonce uint64, options api.AccountQueryOptions) (*esdt.ESDigitalToken, api.BlockInfo, error)

	// GetESDTsRoles returns the token identifiers and the roles for a given address
	GetESDTsRoles(address string, options api.AccountQueryOptions, ctx context.Context) (map[string][]string, api.BlockInfo, error)

	// GetNFTTokenIDsRegisteredByAddress returns all the token identifiers for semi or non fungible tokens registered by the address
	GetNFTTokenIDsRegisteredByAddress(address string, options api.AccountQueryOptions, ctx context.Context) ([]string, api.BlockInfo, error)

	// GetESDTsWithRole returns the token identifiers where the specified address has the given role
	GetESDTsWithRole(address string, role string, options api.AccountQueryOptions, ctx context.Context) ([]string, api.BlockInfo, error)

	// GetAllESDTTokens returns the value of a key from a given account
	GetAllESDTTokens(address string, options api.AccountQueryOptions, ctx context.Context) (map[string]*esdt.ESDigitalToken, api.BlockInfo, error)

	// GetTokenSupply returns the provided token supply from current shard
	GetTokenSupply(token string) (*api.ESDTSupply, error)

	// CreateTransaction will return a transaction from all needed fields
	CreateTransaction(txArgs *external.ArgsCreateTransaction) (*transaction.Transaction, []byte, error)

	// ValidateTransaction will validate a transaction
	ValidateTransaction(tx *transaction.Transaction) error
	ValidateTransactionForSimulation(tx *transaction.Transaction, checkSignature bool) error

	// SendBulkTransactions will send a bulk of transactions on the 'send transactions pipe' channel
	SendBulkTransactions(txs []*transaction.Transaction) (uint64, error)

	// GetAccount returns an accountResponse containing information
	//  about the account correlated with provided address
	GetAccount(address string, options api.AccountQueryOptions) (api.AccountResponse, api.BlockInfo, error)

	// GetAccountWithKeys returns an accountResponse containing information
	// about the account correlated with provided address and all keys
	GetAccountWithKeys(address string, options api.AccountQueryOptions, ctx context.Context) (api.AccountResponse, api.BlockInfo, error)

	// GetCode returns the code for the given code hash
	GetCode(codeHash []byte, options api.AccountQueryOptions) ([]byte, api.BlockInfo)

	// 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]*validator.ValidatorStatistics, error)

	AuctionListApi() ([]*common.AuctionListValidatorAPIResponse, 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)
	GetConnectedPeersRatingsOnMainNetwork() (string, error)

	GetEpochStartDataAPI(epoch uint32) (*common.EpochStartDataAPI, error)

	GetProof(rootHash string, key string) (*common.GetProofResponse, error)
	GetProofDataTrie(rootHash string, address string, key string) (*common.GetProofResponse, *common.GetProofResponse, error)
	VerifyProof(rootHash string, address string, proof [][]byte) (bool, error)
	IsDataTrieMigrated(address string, options api.AccountQueryOptions) (bool, error)
}

NodeHandler contains all functions that a node should contain.

type TransactionSimulatorProcessor

type TransactionSimulatorProcessor interface {
	ProcessSCR(scr *smartContractResult.SmartContractResult, currentHeader coreData.HeaderHandler) (*txSimData.SimulationResultsWithVMOutput, error)
	ProcessTx(tx *transaction.Transaction, currentHeader coreData.HeaderHandler) (*txSimData.SimulationResultsWithVMOutput, error)
	IsInterfaceNil() bool
}

TransactionSimulatorProcessor defines the actions which a transaction simulator processor has to implement

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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