-
Notifications
You must be signed in to change notification settings - Fork 199
/
interface.go
51 lines (45 loc) · 2.49 KB
/
interface.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
package blockAPI
import (
"github.com/multiversx/mx-chain-core-go/data"
"github.com/multiversx/mx-chain-core-go/data/alteredAccount"
"github.com/multiversx/mx-chain-core-go/data/api"
"github.com/multiversx/mx-chain-core-go/data/transaction"
"github.com/multiversx/mx-chain-go/common"
"github.com/multiversx/mx-chain-go/state"
)
// APITransactionHandler defines what a transaction handler should do
type APITransactionHandler interface {
UnmarshalTransaction(txBytes []byte, txType transaction.TxType) (*transaction.ApiTransactionResult, error)
UnmarshalReceipt(receiptBytes []byte) (*transaction.ApiReceipt, error)
PopulateComputedFields(tx *transaction.ApiTransactionResult)
IsInterfaceNil() bool
}
// APIBlockHandler defines the behavior of a component able to return api blocks
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
}
// APIInternalBlockHandler defines the behaviour of a component able to return internal blocks
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
}
type logsFacade interface {
IncludeLogsInTransactions(txs []*transaction.ApiTransactionResult, logsKeys [][]byte, epoch uint32) error
IsInterfaceNil() bool
}
type receiptsRepository interface {
LoadReceipts(header data.HeaderHandler, headerHash []byte) (common.ReceiptsHolder, error)
IsInterfaceNil() bool
}