{"modulePath":"github.com/multiversx/mx-chain-go","version":"v1.11.11","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package blockAPI\n\n## Constants\n\n```go\nconst (\n\t// BlockStatusOnChain represents the identifier for an on-chain block\n\tBlockStatusOnChain = \"on-chain\"\n\t// BlockStatusReverted represent the identifier for a reverted block\n\tBlockStatusReverted = \"reverted\"\n)\n```\n\n## Variables\n\n```go\nvar ErrInvalidOutputFormat = errors.New(\"the output format type is invalid\")\n```\nErrInvalidOutputFormat signals that the output format type is not valid\n\n```go\nvar ErrMetachainOnlyEndpoint = errors.New(\"the endpoint is only available on metachain nodes\")\n```\nErrMetachainOnlyEndpoint signals that an endpoint was called, but it is only available for metachain nodes\n\n```go\nvar ErrShardOnlyEndpoint = errors.New(\"the endpoint is only available on shard nodes\")\n```\nErrShardOnlyEndpoint signals that an endpoint was called, but it is only available for shard nodes\n\n## Types\n\n```go\ntype APIBlockHandler interface {\n\tGetBlockByNonce(nonce uint64, options api.BlockQueryOptions) (*api.Block, error)\n\tGetBlockByHash(hash []byte, options api.BlockQueryOptions) (*api.Block, error)\n\tGetBlockByRound(round uint64, options api.BlockQueryOptions) (*api.Block, error)\n\tGetAlteredAccountsForBlock(options api.GetAlteredAccountsForBlockOptions) ([]*alteredAccount.AlteredAccount, error)\n\tIsInterfaceNil() bool\n}\n```\nAPIBlockHandler defines the behavior of a component able to return api blocks\n\n```go\nfunc CreateAPIBlockProcessor(arg *ArgAPIBlockProcessor) (APIBlockHandler, error)\n```\nCreateAPIBlockProcessor will create a new instance of APIBlockHandler\n\n```go\ntype APIInternalBlockHandler interface {\n\tGetInternalShardBlockByNonce(format common.ApiOutputFormat, nonce uint64) (interface{}, error)\n\tGetInternalShardBlockByHash(format common.ApiOutputFormat, hash []byte) (interface{}, error)\n\tGetInternalShardBlockByRound(format common.ApiOutputFormat, round uint64) (interface{}, error)\n\tGetInternalMetaBlockByNonce(format common.ApiOutputFormat, nonce uint64) (interface{}, error)\n\tGetInternalMetaBlockByHash(format common.ApiOutputFormat, hash []byte) (interface{}, error)\n\tGetInternalMetaBlockByRound(format common.ApiOutputFormat, round uint64) (interface{}, error)\n\tGetInternalStartOfEpochMetaBlock(format common.ApiOutputFormat, epoch uint32) (interface{}, error)\n\tGetInternalStartOfEpochValidatorsInfo(epoch uint32) ([]*state.ShardValidatorInfo, error)\n\tGetInternalMiniBlock(format common.ApiOutputFormat, hash []byte, epoch uint32) (interface{}, error)\n\tIsInterfaceNil() bool\n}\n```\nAPIInternalBlockHandler defines the behaviour of a component able to return internal blocks\n\n```go\nfunc CreateAPIInternalBlockProcessor(arg *ArgAPIBlockProcessor) (APIInternalBlockHandler, error)\n```\nCreateAPIInternalBlockProcessor will create a new instance of APIInternalBlockHandler\n\n```go\ntype APITransactionHandler interface {\n\tUnmarshalTransaction(txBytes []byte, txType transaction.TxType, epoch uint32) (*transaction.ApiTransactionResult, error)\n\tUnmarshalReceipt(receiptBytes []byte) (*transaction.ApiReceipt, error)\n\tPopulateComputedFields(tx *transaction.ApiTransactionResult)\n\tIsInterfaceNil() bool\n}\n```\nAPITransactionHandler defines what a transaction handler should do\n\n```go\ntype ArgAPIBlockProcessor struct {\n\tSelfShardID                  uint32\n\tStore                        dataRetriever.StorageService\n\tMarshalizer                  marshal.Marshalizer\n\tUint64ByteSliceConverter     typeConverters.Uint64ByteSliceConverter\n\tHistoryRepo                  dblookupext.HistoryRepository\n\tAPITransactionHandler        APITransactionHandler\n\tStatusComputer               transaction.StatusComputerHandler\n\tHasher                       hashing.Hasher\n\tAddressPubkeyConverter       core.PubkeyConverter\n\tLogsFacade                   logsFacade\n\tReceiptsRepository           receiptsRepository\n\tAlteredAccountsProvider      outportProcess.AlteredAccountsProviderHandler\n\tAccountsRepository           state.AccountsRepository\n\tScheduledTxsExecutionHandler process.ScheduledTxsExecutionHandler\n\tEnableEpochsHandler          common.EnableEpochsHandler\n\tProofsPool                   dataRetriever.ProofsPool\n\tBlockChain                   data.ChainHandler\n}\n```\nArgAPIBlockProcessor is structure that store components that are needed to create an api block processor\n\n```go\ntype BlockStatus string\n```\nBlockStatus is the status of a block\n\n","path":"github.com/multiversx/mx-chain-go/node/external/blockAPI","name":"blockAPI","synopsis":"","isRedistributable":true}
