mock

package
v1.8.0 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2024 License: GPL-3.0 Imports: 18 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, common.BlockInfo, error)
	StatusMetricsHandler                        func() external.StatusMetricsHandler
	ComputeTransactionGasLimitHandler           func(tx *transaction.Transaction) (*transaction.CostResponse, error)
	SimulateTransactionExecutionHandler         func(tx *transaction.Transaction) (*txSimData.SimulationResultsWithVMOutput, 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) ([]*alteredAccount.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)
	GetInternalStartOfEpochValidatorsInfoCalled func(epoch uint32) ([]*state.ShardValidatorInfo, 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, senderAccountNonce uint64) (*common.TransactionsPoolNonceGapsForSenderApiResponse, error)
	GetGasConfigsCalled                         func() map[string]map[string]uint64
	GetManagedKeysCountCalled                   func() int
	GetManagedKeysCalled                        func() []string
	GetLoadedKeysCalled                         func() []string
	GetEligibleManagedKeysCalled                func() ([]string, error)
	GetWaitingManagedKeysCalled                 func() ([]string, error)
	GetWaitingEpochsLeftForPublicKeyCalled      func(publicKey string) (uint32, error)
	GetSCRsByTxHashCalled                       func(txHash string, scrHash string) ([]*transaction.ApiSmartContractResult, error)
}

ApiResolverStub -

func (*ApiResolverStub) Close

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, common.BlockInfo, error)

ExecuteSCQuery -

func (*ApiResolverStub) GetAlteredAccountsForBlock

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

GetAlteredAccountsForBlock -

func (*ApiResolverStub) GetBlockByHash

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

GetBlockByHash -

func (*ApiResolverStub) GetBlockByNonce

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

GetBlockByNonce -

func (*ApiResolverStub) GetBlockByRound

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

GetBlockByRound -

func (*ApiResolverStub) GetDelegatorsList

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

GetDelegatorsList -

func (*ApiResolverStub) GetDirectStakedList

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

GetDirectStakedList -

func (*ApiResolverStub) GetEligibleManagedKeys added in v1.6.0

func (ars *ApiResolverStub) GetEligibleManagedKeys() ([]string, error)

GetEligibleManagedKeys -

func (*ApiResolverStub) GetGasConfigs

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

GetGasConfigs -

func (*ApiResolverStub) GetGenesisBalances

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

GetGenesisBalances -

func (*ApiResolverStub) GetGenesisNodesPubKeys

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

GetGenesisNodesPubKeys -

func (*ApiResolverStub) GetInternalMetaBlockByHash

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

GetInternalMetaBlockByHash -

func (*ApiResolverStub) GetInternalMetaBlockByNonce

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

GetInternalMetaBlockByNonce -

func (*ApiResolverStub) GetInternalMetaBlockByRound

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

GetInternalMetaBlockByRound -

func (*ApiResolverStub) GetInternalMiniBlock

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

GetInternalMiniBlock -

func (*ApiResolverStub) GetInternalShardBlockByHash

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

GetInternalShardBlockByHash -

func (*ApiResolverStub) GetInternalShardBlockByNonce

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

GetInternalShardBlockByNonce -

func (*ApiResolverStub) GetInternalShardBlockByRound

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

GetInternalShardBlockByRound -

func (*ApiResolverStub) GetInternalStartOfEpochMetaBlock

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

GetInternalStartOfEpochMetaBlock -

func (*ApiResolverStub) GetInternalStartOfEpochValidatorsInfo

func (ars *ApiResolverStub) GetInternalStartOfEpochValidatorsInfo(epoch uint32) ([]*state.ShardValidatorInfo, error)

GetInternalStartOfEpochValidatorsInfo -

func (*ApiResolverStub) GetLastPoolNonceForSender

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

GetLastPoolNonceForSender -

func (*ApiResolverStub) GetLoadedKeys added in v1.6.16

func (ars *ApiResolverStub) GetLoadedKeys() []string

GetLoadedKeys -

func (*ApiResolverStub) GetManagedKeys added in v1.6.0

func (ars *ApiResolverStub) GetManagedKeys() []string

GetManagedKeys -

func (*ApiResolverStub) GetManagedKeysCount added in v1.6.0

func (ars *ApiResolverStub) GetManagedKeysCount() int

GetManagedKeysCount -

func (*ApiResolverStub) GetSCRsByTxHash added in v1.7.18

func (ars *ApiResolverStub) GetSCRsByTxHash(txHash string, scrHash string) ([]*transaction.ApiSmartContractResult, error)

GetSCRsByTxHash -

func (*ApiResolverStub) GetTotalStakedValue

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

GetTotalStakedValue -

func (*ApiResolverStub) GetTransaction

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

GetTransaction -

func (*ApiResolverStub) GetTransactionsPool

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

GetTransactionsPool -

func (*ApiResolverStub) GetTransactionsPoolForSender

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

GetTransactionsPoolForSender -

func (*ApiResolverStub) GetTransactionsPoolNonceGapsForSender

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

GetTransactionsPoolNonceGapsForSender -

func (*ApiResolverStub) GetWaitingEpochsLeftForPublicKey added in v1.7.0

func (ars *ApiResolverStub) GetWaitingEpochsLeftForPublicKey(publicKey string) (uint32, error)

GetWaitingEpochsLeftForPublicKey -

func (*ApiResolverStub) GetWaitingManagedKeys added in v1.6.0

func (ars *ApiResolverStub) GetWaitingManagedKeys() ([]string, error)

GetWaitingManagedKeys -

func (*ApiResolverStub) IsInterfaceNil

func (ars *ApiResolverStub) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*ApiResolverStub) SimulateTransactionExecution added in v1.6.0

func (ars *ApiResolverStub) SimulateTransactionExecution(tx *transaction.Transaction) (*txSimData.SimulationResultsWithVMOutput, error)

SimulateTransactionExecution -

func (*ApiResolverStub) StatusMetrics

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

StatusMetrics -

type NodeStub

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(txArgs *external.ArgsCreateTransaction) (*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)
	GetAccountWithKeysCalled                       func(address string, options api.AccountQueryOptions, ctx context.Context) (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]*validator.ValidatorStatistics, 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)
	GetGuardianDataCalled                          func(address string, options api.AccountQueryOptions) (api.GuardianData, api.BlockInfo, error)
	GetPeerInfoCalled                              func(pid string) ([]core.QueryP2PPeerInfo, error)
	GetConnectedPeersRatingsOnMainNetworkCalled    func() (string, 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)
	GetTokenSupplyCalled                           func(token string) (*api.ESDTSupply, error)
	IsDataTrieMigratedCalled                       func(address string, options api.AccountQueryOptions) (bool, error)
	AuctionListApiCalled                           func() ([]*common.AuctionListValidatorAPIResponse, error)
}

NodeStub -

func (*NodeStub) AuctionListApi added in v1.7.0

func (ns *NodeStub) AuctionListApi() ([]*common.AuctionListValidatorAPIResponse, error)

AuctionListApi -

func (*NodeStub) CreateTransaction

func (ns *NodeStub) CreateTransaction(txArgs *external.ArgsCreateTransaction) (*transaction.Transaction, []byte, error)

CreateTransaction -

func (*NodeStub) DecodeAddressPubkey

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

DecodeAddressPubkey -

func (*NodeStub) DirectTrigger

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

DirectTrigger -

func (*NodeStub) EncodeAddressPubkey

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

EncodeAddressPubkey -

func (*NodeStub) GetAccount

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

GetAccount -

func (*NodeStub) GetAccountWithKeys added in v1.7.9

func (ns *NodeStub) GetAccountWithKeys(address string, options api.AccountQueryOptions, ctx context.Context) (api.AccountResponse, api.BlockInfo, error)

GetAccountWithKeys -

func (*NodeStub) GetAllESDTTokens

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

GetAllESDTTokens -

func (*NodeStub) GetAllIssuedESDTs

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

GetAllIssuedESDTs -

func (*NodeStub) GetBalance

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

GetBalance -

func (*NodeStub) GetCode

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

GetCode -

func (*NodeStub) GetCodeHash

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

GetCodeHash -

func (*NodeStub) GetConnectedPeersRatingsOnMainNetwork added in v1.6.0

func (ns *NodeStub) GetConnectedPeersRatingsOnMainNetwork() (string, error)

GetConnectedPeersRatingsOnMainNetwork -

func (*NodeStub) GetESDTData

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

GetESDTData -

func (*NodeStub) GetESDTsRoles

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

GetESDTsRoles -

func (*NodeStub) GetESDTsWithRole

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

GetESDTsWithRole -

func (*NodeStub) GetEpochStartDataAPI

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

GetEpochStartDataAPI -

func (*NodeStub) GetGuardianData added in v1.5.0

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

GetGuardianData -

func (*NodeStub) GetHeartbeats

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

GetHeartbeats -

func (*NodeStub) GetKeyValuePairs

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

GetKeyValuePairs -

func (*NodeStub) GetNFTTokenIDsRegisteredByAddress

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

GetNFTTokenIDsRegisteredByAddress -

func (*NodeStub) GetPeerInfo

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

GetPeerInfo -

func (*NodeStub) GetProof

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

GetProof -

func (*NodeStub) GetProofDataTrie

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

GetProofDataTrie -

func (*NodeStub) GetQueryHandler

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

GetQueryHandler -

func (*NodeStub) GetTokenSupply

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

GetTokenSupply -

func (*NodeStub) GetUsername

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

GetUsername -

func (*NodeStub) GetValueForKey

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

GetValueForKey -

func (*NodeStub) IsDataTrieMigrated added in v1.6.0

func (ns *NodeStub) IsDataTrieMigrated(address string, options api.AccountQueryOptions) (bool, error)

IsDataTrieMigrated -

func (*NodeStub) IsInterfaceNil

func (ns *NodeStub) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*NodeStub) IsSelfTrigger

func (ns *NodeStub) IsSelfTrigger() bool

IsSelfTrigger -

func (*NodeStub) SendBulkTransactions

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

SendBulkTransactions -

func (*NodeStub) ValidateTransaction

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

ValidateTransaction -

func (*NodeStub) ValidateTransactionForSimulation

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

ValidateTransactionForSimulation -

func (*NodeStub) ValidatorStatisticsApi

func (ns *NodeStub) ValidatorStatisticsApi() (map[string]*validator.ValidatorStatistics, error)

ValidatorStatisticsApi -

func (*NodeStub) VerifyProof

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

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

func (stm *SyncTimerMock) StartSyncingTime()

StartSyncingTime is a mock implementation for StartSyncingTime

Jump to

Keyboard shortcuts

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