mock

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2022 License: GPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ApiResolverStub

type ApiResolverStub struct {
	ExecuteSCQueryHandler                       func(query *process.SCQuery) (*vmcommon.VMOutput, error)
	StatusMetricsHandler                        func() external.StatusMetricsHandler
	ComputeTransactionGasLimitHandler           func(tx *transaction.Transaction) (*transaction.CostResponse, error)
	GetTotalStakedValueHandler                  func(ctx context.Context) (*api.StakeValues, error)
	GetDirectStakedListHandler                  func(ctx context.Context) ([]*api.DirectStakedValue, error)
	GetDelegatorsListHandler                    func(ctx context.Context) ([]*api.Delegator, error)
	GetBlockByHashCalled                        func(hash string, options api.BlockQueryOptions) (*api.Block, error)
	GetBlockByNonceCalled                       func(nonce uint64, options api.BlockQueryOptions) (*api.Block, error)
	GetBlockByRoundCalled                       func(round uint64, options api.BlockQueryOptions) (*api.Block, error)
	GetAlteredAccountsForBlockCalled            func(options api.GetAlteredAccountsForBlockOptions) ([]*outportcore.AlteredAccount, error)
	GetTransactionHandler                       func(hash string, withEvents bool) (*transaction.ApiTransactionResult, error)
	GetInternalShardBlockByNonceCalled          func(format common.ApiOutputFormat, nonce uint64) (interface{}, error)
	GetInternalShardBlockByHashCalled           func(format common.ApiOutputFormat, hash string) (interface{}, error)
	GetInternalShardBlockByRoundCalled          func(format common.ApiOutputFormat, round uint64) (interface{}, error)
	GetInternalMetaBlockByNonceCalled           func(format common.ApiOutputFormat, nonce uint64) (interface{}, error)
	GetInternalMetaBlockByHashCalled            func(format common.ApiOutputFormat, hash string) (interface{}, error)
	GetInternalMetaBlockByRoundCalled           func(format common.ApiOutputFormat, round uint64) (interface{}, error)
	GetInternalMiniBlockCalled                  func(format common.ApiOutputFormat, hash string, epoch uint32) (interface{}, error)
	GetInternalStartOfEpochMetaBlockCalled      func(format common.ApiOutputFormat, epoch uint32) (interface{}, error)
	GetGenesisNodesPubKeysCalled                func() (map[uint32][]string, map[uint32][]string)
	GetTransactionsPoolCalled                   func(fields string) (*common.TransactionsPoolAPIResponse, error)
	GetGenesisBalancesCalled                    func() ([]*common.InitialAccountAPI, error)
	GetTransactionsPoolForSenderCalled          func(sender, fields string) (*common.TransactionsPoolForSenderApiResponse, error)
	GetLastPoolNonceForSenderCalled             func(sender string) (uint64, error)
	GetTransactionsPoolNonceGapsForSenderCalled func(sender string) (*common.TransactionsPoolNonceGapsForSenderApiResponse, error)
	GetGasConfigsCalled                         func() map[string]map[string]uint64
}

ApiResolverStub -

func (*ApiResolverStub) Close added in v1.2.0

func (ars *ApiResolverStub) Close() error

Close -

func (*ApiResolverStub) ComputeTransactionGasLimit

func (ars *ApiResolverStub) ComputeTransactionGasLimit(tx *transaction.Transaction) (*transaction.CostResponse, error)

ComputeTransactionGasLimit -

func (*ApiResolverStub) ExecuteSCQuery

func (ars *ApiResolverStub) ExecuteSCQuery(query *process.SCQuery) (*vmcommon.VMOutput, error)

ExecuteSCQuery -

func (*ApiResolverStub) GetAlteredAccountsForBlock added in v1.4.0

func (ars *ApiResolverStub) GetAlteredAccountsForBlock(options api.GetAlteredAccountsForBlockOptions) ([]*outportcore.AlteredAccount, error)

GetAlteredAccountsForBlock -

func (*ApiResolverStub) GetBlockByHash added in v1.3.29

func (ars *ApiResolverStub) GetBlockByHash(hash string, options api.BlockQueryOptions) (*api.Block, error)

GetBlockByHash -

func (*ApiResolverStub) GetBlockByNonce added in v1.3.29

func (ars *ApiResolverStub) GetBlockByNonce(nonce uint64, options api.BlockQueryOptions) (*api.Block, error)

GetBlockByNonce -

func (*ApiResolverStub) GetBlockByRound added in v1.3.29

func (ars *ApiResolverStub) GetBlockByRound(round uint64, options api.BlockQueryOptions) (*api.Block, error)

GetBlockByRound -

func (*ApiResolverStub) GetDelegatorsList added in v1.1.45

func (ars *ApiResolverStub) GetDelegatorsList(ctx context.Context) ([]*api.Delegator, error)

GetDelegatorsList -

func (*ApiResolverStub) GetDirectStakedList added in v1.1.45

func (ars *ApiResolverStub) GetDirectStakedList(ctx context.Context) ([]*api.DirectStakedValue, error)

GetDirectStakedList -

func (*ApiResolverStub) GetGasConfigs added in v1.3.37

func (ars *ApiResolverStub) GetGasConfigs() map[string]map[string]uint64

GetGasConfigs -

func (*ApiResolverStub) GetGenesisBalances added in v1.3.37

func (ars *ApiResolverStub) GetGenesisBalances() ([]*common.InitialAccountAPI, error)

GetGenesisBalances -

func (*ApiResolverStub) GetGenesisNodesPubKeys added in v1.3.29

func (ars *ApiResolverStub) GetGenesisNodesPubKeys() (map[uint32][]string, map[uint32][]string)

GetGenesisNodesPubKeys -

func (*ApiResolverStub) GetInternalMetaBlockByHash added in v1.3.29

func (ars *ApiResolverStub) GetInternalMetaBlockByHash(format common.ApiOutputFormat, hash string) (interface{}, error)

GetInternalMetaBlockByHash -

func (*ApiResolverStub) GetInternalMetaBlockByNonce added in v1.3.29

func (ars *ApiResolverStub) GetInternalMetaBlockByNonce(format common.ApiOutputFormat, nonce uint64) (interface{}, error)

GetInternalMetaBlockByNonce -

func (*ApiResolverStub) GetInternalMetaBlockByRound added in v1.3.29

func (ars *ApiResolverStub) GetInternalMetaBlockByRound(format common.ApiOutputFormat, round uint64) (interface{}, error)

GetInternalMetaBlockByRound -

func (*ApiResolverStub) GetInternalMiniBlock added in v1.3.29

func (ars *ApiResolverStub) GetInternalMiniBlock(format common.ApiOutputFormat, hash string, epoch uint32) (interface{}, error)

GetInternalMiniBlock -

func (*ApiResolverStub) GetInternalShardBlockByHash added in v1.3.29

func (ars *ApiResolverStub) GetInternalShardBlockByHash(format common.ApiOutputFormat, hash string) (interface{}, error)

GetInternalShardBlockByHash -

func (*ApiResolverStub) GetInternalShardBlockByNonce added in v1.3.29

func (ars *ApiResolverStub) GetInternalShardBlockByNonce(format common.ApiOutputFormat, nonce uint64) (interface{}, error)

GetInternalShardBlockByNonce -

func (*ApiResolverStub) GetInternalShardBlockByRound added in v1.3.29

func (ars *ApiResolverStub) GetInternalShardBlockByRound(format common.ApiOutputFormat, round uint64) (interface{}, error)

GetInternalShardBlockByRound -

func (*ApiResolverStub) GetInternalStartOfEpochMetaBlock added in v1.3.29

func (ars *ApiResolverStub) GetInternalStartOfEpochMetaBlock(format common.ApiOutputFormat, epoch uint32) (interface{}, error)

GetInternalStartOfEpochMetaBlock -

func (*ApiResolverStub) GetLastPoolNonceForSender added in v1.3.37

func (ars *ApiResolverStub) GetLastPoolNonceForSender(sender string) (uint64, error)

GetLastPoolNonceForSender -

func (*ApiResolverStub) GetTotalStakedValue added in v1.1.18

func (ars *ApiResolverStub) GetTotalStakedValue(ctx context.Context) (*api.StakeValues, error)

GetTotalStakedValue -

func (*ApiResolverStub) GetTransaction added in v1.3.29

func (ars *ApiResolverStub) GetTransaction(hash string, withEvents bool) (*transaction.ApiTransactionResult, error)

GetTransaction -

func (*ApiResolverStub) GetTransactionsPool added in v1.3.29

func (ars *ApiResolverStub) GetTransactionsPool(fields string) (*common.TransactionsPoolAPIResponse, error)

GetTransactionsPool -

func (*ApiResolverStub) GetTransactionsPoolForSender added in v1.3.37

func (ars *ApiResolverStub) GetTransactionsPoolForSender(sender, fields string) (*common.TransactionsPoolForSenderApiResponse, error)

GetTransactionsPoolForSender -

func (*ApiResolverStub) GetTransactionsPoolNonceGapsForSender added in v1.3.37

func (ars *ApiResolverStub) GetTransactionsPoolNonceGapsForSender(sender string) (*common.TransactionsPoolNonceGapsForSenderApiResponse, error)

GetTransactionsPoolNonceGapsForSender -

func (*ApiResolverStub) IsInterfaceNil

func (ars *ApiResolverStub) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*ApiResolverStub) StatusMetrics

func (ars *ApiResolverStub) StatusMetrics() external.StatusMetricsHandler

StatusMetrics -

type NodeStub added in v1.0.102

type NodeStub struct {
	ConnectToAddressesHandler  func([]string) error
	GetBalanceCalled           func(address string, options api.AccountQueryOptions) (*big.Int, api.BlockInfo, error)
	GenerateTransactionHandler func(sender string, receiver string, amount string, code string) (*transaction.Transaction, error)
	CreateTransactionHandler   func(nonce uint64, value string, receiver string, receiverUsername []byte, sender string, senderUsername []byte, gasPrice uint64,
		gasLimit uint64, data []byte, signatureHex string, chainID string, version, options uint32) (*transaction.Transaction, []byte, error)
	ValidateTransactionHandler                     func(tx *transaction.Transaction) error
	ValidateTransactionForSimulationCalled         func(tx *transaction.Transaction, bypassSignature bool) error
	SendBulkTransactionsHandler                    func(txs []*transaction.Transaction) (uint64, error)
	GetAccountCalled                               func(address string, options api.AccountQueryOptions) (api.AccountResponse, api.BlockInfo, error)
	GetCodeCalled                                  func(codeHash []byte, options api.AccountQueryOptions) ([]byte, api.BlockInfo)
	GetCurrentPublicKeyHandler                     func() string
	GenerateAndSendBulkTransactionsHandler         func(destination string, value *big.Int, nrTransactions uint64) error
	GenerateAndSendBulkTransactionsOneByOneHandler func(destination string, value *big.Int, nrTransactions uint64) error
	GetHeartbeatsHandler                           func() []data.PubKeyHeartbeat
	ValidatorStatisticsApiCalled                   func() (map[string]*state.ValidatorApiResponse, error)
	DirectTriggerCalled                            func(epoch uint32, withEarlyEndOfEpoch bool) error
	IsSelfTriggerCalled                            func() bool
	GetQueryHandlerCalled                          func(name string) (debug.QueryHandler, error)
	GetValueForKeyCalled                           func(address string, key string, options api.AccountQueryOptions) (string, api.BlockInfo, error)
	GetPeerInfoCalled                              func(pid string) ([]core.QueryP2PPeerInfo, error)
	GetEpochStartDataAPICalled                     func(epoch uint32) (*common.EpochStartDataAPI, error)
	GetUsernameCalled                              func(address string, options api.AccountQueryOptions) (string, api.BlockInfo, error)
	GetCodeHashCalled                              func(address string, options api.AccountQueryOptions) ([]byte, api.BlockInfo, error)
	GetESDTDataCalled                              func(address string, key string, nonce uint64, options api.AccountQueryOptions) (*esdt.ESDigitalToken, api.BlockInfo, error)
	GetAllESDTTokensCalled                         func(address string, options api.AccountQueryOptions, ctx context.Context) (map[string]*esdt.ESDigitalToken, api.BlockInfo, error)
	GetNFTTokenIDsRegisteredByAddressCalled        func(address string, options api.AccountQueryOptions, ctx context.Context) ([]string, api.BlockInfo, error)
	GetESDTsWithRoleCalled                         func(address string, role string, options api.AccountQueryOptions, ctx context.Context) ([]string, api.BlockInfo, error)
	GetESDTsRolesCalled                            func(address string, options api.AccountQueryOptions, ctx context.Context) (map[string][]string, api.BlockInfo, error)
	GetKeyValuePairsCalled                         func(address string, options api.AccountQueryOptions, ctx context.Context) (map[string]string, api.BlockInfo, error)
	GetAllIssuedESDTsCalled                        func(tokenType string, ctx context.Context) ([]string, error)
	GetProofCalled                                 func(rootHash string, key string) (*common.GetProofResponse, error)
	GetProofDataTrieCalled                         func(rootHash string, address string, key string) (*common.GetProofResponse, *common.GetProofResponse, error)
	VerifyProofCalled                              func(rootHash string, address string, proof [][]byte) (bool, error)
}

NodeStub -

func (*NodeStub) CreateTransaction added in v1.0.102

func (ns *NodeStub) CreateTransaction(nonce uint64, value string, receiver string, receiverUsername []byte, sender string, senderUsername []byte, gasPrice uint64,
	gasLimit uint64, data []byte, signatureHex string, chainID string, version uint32, options uint32) (*transaction.Transaction, []byte, error)

CreateTransaction -

func (*NodeStub) DecodeAddressPubkey added in v1.0.104

func (ns *NodeStub) DecodeAddressPubkey(pk string) ([]byte, error)

DecodeAddressPubkey -

func (*NodeStub) DirectTrigger added in v1.0.102

func (ns *NodeStub) DirectTrigger(epoch uint32, withEarlyEndOfEpoch bool) error

DirectTrigger -

func (*NodeStub) EncodeAddressPubkey added in v1.0.104

func (ns *NodeStub) EncodeAddressPubkey(pk []byte) (string, error)

EncodeAddressPubkey -

func (*NodeStub) GetAccount added in v1.0.102

func (ns *NodeStub) GetAccount(address string, options api.AccountQueryOptions) (api.AccountResponse, api.BlockInfo, error)

GetAccount -

func (*NodeStub) GetAllESDTTokens added in v1.1.12

func (ns *NodeStub) GetAllESDTTokens(address string, options api.AccountQueryOptions, ctx context.Context) (map[string]*esdt.ESDigitalToken, api.BlockInfo, error)

GetAllESDTTokens -

func (*NodeStub) GetAllIssuedESDTs added in v1.1.42

func (ns *NodeStub) GetAllIssuedESDTs(tokenType string, ctx context.Context) ([]string, error)

GetAllIssuedESDTs -

func (*NodeStub) GetBalance added in v1.0.102

func (ns *NodeStub) GetBalance(address string, options api.AccountQueryOptions) (*big.Int, api.BlockInfo, error)

GetBalance -

func (*NodeStub) GetCode added in v1.1.22

func (ns *NodeStub) GetCode(codeHash []byte, options api.AccountQueryOptions) ([]byte, api.BlockInfo)

GetCode -

func (*NodeStub) GetCodeHash added in v1.4.0

func (ns *NodeStub) GetCodeHash(address string, options api.AccountQueryOptions) ([]byte, api.BlockInfo, error)

GetCodeHash -

func (*NodeStub) GetESDTData added in v1.1.39

func (ns *NodeStub) GetESDTData(address, tokenID string, nonce uint64, options api.AccountQueryOptions) (*esdt.ESDigitalToken, api.BlockInfo, error)

GetESDTData -

func (*NodeStub) GetESDTsRoles added in v1.2.10

func (ns *NodeStub) GetESDTsRoles(address string, options api.AccountQueryOptions, ctx context.Context) (map[string][]string, api.BlockInfo, error)

GetESDTsRoles -

func (*NodeStub) GetESDTsWithRole added in v1.1.58

func (ns *NodeStub) GetESDTsWithRole(address string, role string, options api.AccountQueryOptions, ctx context.Context) ([]string, api.BlockInfo, error)

GetESDTsWithRole -

func (*NodeStub) GetEpochStartDataAPI added in v1.3.45

func (ns *NodeStub) GetEpochStartDataAPI(epoch uint32) (*common.EpochStartDataAPI, error)

GetEpochStartDataAPI -

func (*NodeStub) GetHeartbeats added in v1.0.102

func (ns *NodeStub) GetHeartbeats() []data.PubKeyHeartbeat

GetHeartbeats -

func (*NodeStub) GetKeyValuePairs added in v1.1.29

func (ns *NodeStub) GetKeyValuePairs(address string, options api.AccountQueryOptions, ctx context.Context) (map[string]string, api.BlockInfo, error)

GetKeyValuePairs -

func (*NodeStub) GetNFTTokenIDsRegisteredByAddress added in v1.1.58

func (ns *NodeStub) GetNFTTokenIDsRegisteredByAddress(address string, options api.AccountQueryOptions, ctx context.Context) ([]string, api.BlockInfo, error)

GetNFTTokenIDsRegisteredByAddress -

func (*NodeStub) GetPeerInfo added in v1.0.130

func (ns *NodeStub) GetPeerInfo(pid string) ([]core.QueryP2PPeerInfo, error)

GetPeerInfo -

func (*NodeStub) GetProof added in v1.2.23

func (ns *NodeStub) GetProof(rootHash string, key string) (*common.GetProofResponse, error)

GetProof -

func (*NodeStub) GetProofDataTrie added in v1.2.23

func (ns *NodeStub) GetProofDataTrie(rootHash string, address string, key string) (*common.GetProofResponse, *common.GetProofResponse, error)

GetProofDataTrie -

func (*NodeStub) GetQueryHandler added in v1.0.110

func (ns *NodeStub) GetQueryHandler(name string) (debug.QueryHandler, error)

GetQueryHandler -

func (*NodeStub) GetTokenSupply added in v1.2.16

func (ns *NodeStub) GetTokenSupply(_ string) (*api.ESDTSupply, error)

GetTokenSupply -

func (*NodeStub) GetUsername added in v1.1.1

func (ns *NodeStub) GetUsername(address string, options api.AccountQueryOptions) (string, api.BlockInfo, error)

GetUsername -

func (*NodeStub) GetValueForKey added in v1.0.125

func (ns *NodeStub) GetValueForKey(address string, key string, options api.AccountQueryOptions) (string, api.BlockInfo, error)

GetValueForKey -

func (*NodeStub) IsInterfaceNil added in v1.0.102

func (ns *NodeStub) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*NodeStub) IsSelfTrigger added in v1.0.102

func (ns *NodeStub) IsSelfTrigger() bool

IsSelfTrigger -

func (*NodeStub) SendBulkTransactions added in v1.0.102

func (ns *NodeStub) SendBulkTransactions(txs []*transaction.Transaction) (uint64, error)

SendBulkTransactions -

func (*NodeStub) ValidateTransaction added in v1.0.102

func (ns *NodeStub) ValidateTransaction(tx *transaction.Transaction) error

ValidateTransaction -

func (*NodeStub) ValidateTransactionForSimulation added in v1.1.4

func (ns *NodeStub) ValidateTransactionForSimulation(tx *transaction.Transaction, bypassSignature bool) error

ValidateTransactionForSimulation -

func (*NodeStub) ValidatorStatisticsApi added in v1.0.102

func (ns *NodeStub) ValidatorStatisticsApi() (map[string]*state.ValidatorApiResponse, error)

ValidatorStatisticsApi -

func (*NodeStub) VerifyProof added in v1.2.23

func (ns *NodeStub) VerifyProof(rootHash string, address string, proof [][]byte) (bool, error)

VerifyProof -

type SyncTimerMock

type SyncTimerMock struct {
	StartSyncingTimeCalled     func()
	ClockOffsetCalled          func() time.Duration
	FormattedCurrentTimeCalled func() string
	CurrentTimeCalled          func() time.Time
}

SyncTimerMock is a mock implementation of SyncTimer interface

func (*SyncTimerMock) ClockOffset

func (stm *SyncTimerMock) ClockOffset() time.Duration

ClockOffset is a mock implementation for ClockOffset

func (*SyncTimerMock) Close added in v1.0.116

func (stm *SyncTimerMock) Close() error

Close -

func (*SyncTimerMock) CurrentTime

func (stm *SyncTimerMock) CurrentTime() time.Time

CurrentTime is a mock implementation for CurrentTime

func (*SyncTimerMock) FormattedCurrentTime

func (stm *SyncTimerMock) FormattedCurrentTime() string

FormattedCurrentTime is a mock implementation for FormattedCurrentTime

func (*SyncTimerMock) IsInterfaceNil

func (stm *SyncTimerMock) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*SyncTimerMock) StartSyncingTime added in v1.0.116

func (stm *SyncTimerMock) StartSyncingTime()

StartSyncingTime is a mock implementation for StartSyncingTime

type TxExecutionSimulatorStub added in v1.1.1

type TxExecutionSimulatorStub struct {
	ProcessTxCalled func(tx *transaction.Transaction) (*txSimData.SimulationResults, error)
}

TxExecutionSimulatorStub -

func (*TxExecutionSimulatorStub) IsInterfaceNil added in v1.1.1

func (t *TxExecutionSimulatorStub) IsInterfaceNil() bool

IsInterfaceNil -

func (*TxExecutionSimulatorStub) ProcessTx added in v1.1.1

ProcessTx -

Jump to

Keyboard shortcuts

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