blockAPI

package
v1.6.4 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2023 License: GPL-3.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// BlockStatusOnChain represents the identifier for an on-chain block
	BlockStatusOnChain = "on-chain"
	// BlockStatusReverted represent the identifier for a reverted block
	BlockStatusReverted = "reverted"
)

Variables

View Source
var ErrInvalidOutputFormat = errors.New("the output format type is invalid")

ErrInvalidOutputFormat signals that the output format type is not valid

View Source
var ErrMetachainOnlyEndpoint = errors.New("the endpoint is only available on metachain nodes")

ErrMetachainOnlyEndpoint signals that an endpoint was called, but it is only available for metachain nodes

View Source
var ErrShardOnlyEndpoint = errors.New("the endpoint is only available on shard nodes")

ErrShardOnlyEndpoint signals that an endpoint was called, but it is only available for shard nodes

Functions

This section is empty.

Types

type APIBlockHandler

type APIBlockHandler interface {
	GetBlockByNonce(nonce uint64, options api.BlockQueryOptions) (*api.Block, error)
	GetBlockByHash(hash []byte, options api.BlockQueryOptions) (*api.Block, error)
	GetBlockByRound(round uint64, options api.BlockQueryOptions) (*api.Block, error)
	GetAlteredAccountsForBlock(options api.GetAlteredAccountsForBlockOptions) ([]*alteredAccount.AlteredAccount, error)
	IsInterfaceNil() bool
}

APIBlockHandler defines the behavior of a component able to return api blocks

func CreateAPIBlockProcessor

func CreateAPIBlockProcessor(arg *ArgAPIBlockProcessor) (APIBlockHandler, error)

CreateAPIBlockProcessor will create a new instance of APIBlockHandler

type APIInternalBlockHandler

type APIInternalBlockHandler interface {
	GetInternalShardBlockByNonce(format common.ApiOutputFormat, nonce uint64) (interface{}, error)
	GetInternalShardBlockByHash(format common.ApiOutputFormat, hash []byte) (interface{}, error)
	GetInternalShardBlockByRound(format common.ApiOutputFormat, round uint64) (interface{}, error)
	GetInternalMetaBlockByNonce(format common.ApiOutputFormat, nonce uint64) (interface{}, error)
	GetInternalMetaBlockByHash(format common.ApiOutputFormat, hash []byte) (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, hash []byte, epoch uint32) (interface{}, error)
	IsInterfaceNil() bool
}

APIInternalBlockHandler defines the behaviour of a component able to return internal blocks

func CreateAPIInternalBlockProcessor

func CreateAPIInternalBlockProcessor(arg *ArgAPIBlockProcessor) (APIInternalBlockHandler, error)

CreateAPIInternalBlockProcessor will create a new instance of APIInternalBlockHandler

type APITransactionHandler

type APITransactionHandler interface {
	UnmarshalTransaction(txBytes []byte, txType transaction.TxType) (*transaction.ApiTransactionResult, error)
	UnmarshalReceipt(receiptBytes []byte) (*transaction.ApiReceipt, error)
	PopulateComputedFields(tx *transaction.ApiTransactionResult)
	IsInterfaceNil() bool
}

APITransactionHandler defines what a transaction handler should do

type ArgAPIBlockProcessor

type ArgAPIBlockProcessor struct {
	SelfShardID                  uint32
	Store                        dataRetriever.StorageService
	Marshalizer                  marshal.Marshalizer
	Uint64ByteSliceConverter     typeConverters.Uint64ByteSliceConverter
	HistoryRepo                  dblookupext.HistoryRepository
	APITransactionHandler        APITransactionHandler
	StatusComputer               transaction.StatusComputerHandler
	Hasher                       hashing.Hasher
	AddressPubkeyConverter       core.PubkeyConverter
	LogsFacade                   logsFacade
	ReceiptsRepository           receiptsRepository
	AlteredAccountsProvider      outportProcess.AlteredAccountsProviderHandler
	AccountsRepository           state.AccountsRepository
	ScheduledTxsExecutionHandler process.ScheduledTxsExecutionHandler
	EnableEpochsHandler          common.EnableEpochsHandler
}

ArgAPIBlockProcessor is structure that store components that are needed to create an api block processor

type BlockStatus

type BlockStatus string

BlockStatus is the status of a block

Jump to

Keyboard shortcuts

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