mock

package
v0.55.2 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2025 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Key

type Key struct {
	sync.RWMutex

	AddressFn         func() types.Address
	SignMessageFn     func(ctx context.Context, data []byte) (*types.Signature, error)
	SignTransactionFn func(ctx context.Context, tx *types.Transaction) error
	VerifyMessageFn   func(ctx context.Context, data []byte, sig types.Signature) bool
}

func NewKey

func NewKey(t *testing.T) *Key

func (*Key) Address

func (k *Key) Address() types.Address

func (*Key) MockReset

func (k *Key) MockReset(t *testing.T)

func (*Key) SignMessage

func (k *Key) SignMessage(ctx context.Context, data []byte) (*types.Signature, error)

func (*Key) SignTransaction

func (k *Key) SignTransaction(ctx context.Context, tx *types.Transaction) error

func (*Key) VerifyMessage

func (k *Key) VerifyMessage(ctx context.Context, data []byte, sig types.Signature) bool

type RPC

type RPC struct {
	sync.RWMutex

	ClientVersionFn                       func(ctx context.Context) (string, error)
	ListeningFn                           func(ctx context.Context) (bool, error)
	PeerCountFn                           func(ctx context.Context) (uint64, error)
	ProtocolVersionFn                     func(ctx context.Context) (uint64, error)
	SyncingFn                             func(ctx context.Context) (*types.SyncStatus, error)
	NetworkIDFn                           func(ctx context.Context) (uint64, error)
	ChainIDFn                             func(ctx context.Context) (uint64, error)
	GasPriceFn                            func(ctx context.Context) (*big.Int, error)
	AccountsFn                            func(ctx context.Context) ([]types.Address, error)
	BlockNumberFn                         func(ctx context.Context) (*big.Int, error)
	GetBalanceFn                          func(ctx context.Context, address types.Address, block types.BlockNumber) (*big.Int, error)
	GetStorageAtFn                        func(ctx context.Context, account types.Address, key types.Hash, block types.BlockNumber) (*types.Hash, error)
	GetTransactionCountFn                 func(ctx context.Context, account types.Address, block types.BlockNumber) (uint64, error)
	GetBlockTransactionCountByHashFn      func(ctx context.Context, hash types.Hash) (uint64, error)
	GetBlockTransactionCountByNumberFn    func(ctx context.Context, number types.BlockNumber) (uint64, error)
	GetUncleCountByBlockHashFn            func(ctx context.Context, hash types.Hash) (uint64, error)
	GetUncleCountByBlockNumberFn          func(ctx context.Context, number types.BlockNumber) (uint64, error)
	GetCodeFn                             func(ctx context.Context, account types.Address, block types.BlockNumber) ([]byte, error)
	SignFn                                func(ctx context.Context, account types.Address, data []byte) (*types.Signature, error)
	SignTransactionFn                     func(ctx context.Context, tx *types.Transaction) ([]byte, *types.Transaction, error)
	SendTransactionFn                     func(ctx context.Context, tx *types.Transaction) (*types.Hash, *types.Transaction, error)
	SendRawTransactionFn                  func(ctx context.Context, data []byte) (*types.Hash, error)
	CallFn                                func(ctx context.Context, call *types.Call, block types.BlockNumber) ([]byte, *types.Call, error)
	EstimateGasFn                         func(ctx context.Context, call *types.Call, block types.BlockNumber) (uint64, *types.Call, error)
	BlockByHashFn                         func(ctx context.Context, hash types.Hash, full bool) (*types.Block, error)
	BlockByNumberFn                       func(ctx context.Context, number types.BlockNumber, full bool) (*types.Block, error)
	GetTransactionByHashFn                func(ctx context.Context, hash types.Hash) (*types.OnChainTransaction, error)
	GetTransactionByBlockHashAndIndexFn   func(ctx context.Context, hash types.Hash, index uint64) (*types.OnChainTransaction, error)
	GetTransactionByBlockNumberAndIndexFn func(ctx context.Context, number types.BlockNumber, index uint64) (*types.OnChainTransaction, error)
	GetTransactionReceiptFn               func(ctx context.Context, hash types.Hash) (*types.TransactionReceipt, error)
	GetBlockReceiptsFn                    func(ctx context.Context, block types.BlockNumber) ([]*types.TransactionReceipt, error)
	GetUncleByBlockHashAndIndexFn         func(ctx context.Context, hash types.Hash, index uint64) (*types.Block, error)
	GetUncleByBlockNumberAndIndexFn       func(ctx context.Context, number types.BlockNumber, index uint64) (*types.Block, error)
	NewFilterFn                           func(ctx context.Context, query *types.FilterLogsQuery) (*big.Int, error)
	NewBlockFilterFn                      func(ctx context.Context) (*big.Int, error)
	NewPendingTransactionFilterFn         func(ctx context.Context) (*big.Int, error)
	UninstallFilterFn                     func(ctx context.Context, id *big.Int) (bool, error)
	GetFilterChangesFn                    func(ctx context.Context, id *big.Int) ([]types.Log, error)
	GetBlockFilterChangesFn               func(ctx context.Context, id *big.Int) ([]types.Hash, error)
	GetFilterLogsFn                       func(ctx context.Context, id *big.Int) ([]types.Log, error)
	GetLogsFn                             func(ctx context.Context, query *types.FilterLogsQuery) ([]types.Log, error)
	MaxPriorityFeePerGasFn                func(ctx context.Context) (*big.Int, error)
	SubscribeLogsFn                       func(ctx context.Context, query *types.FilterLogsQuery) (<-chan types.Log, error)
	SubscribeNewHeadsFn                   func(ctx context.Context) (<-chan types.Block, error)
	SubscribeNewPendingTransactionsFn     func(ctx context.Context) (<-chan types.Hash, error)
}

func NewRPC

func NewRPC(t *testing.T) *RPC

func (*RPC) Accounts

func (r *RPC) Accounts(ctx context.Context) ([]types.Address, error)

func (*RPC) BlockByHash

func (r *RPC) BlockByHash(ctx context.Context, hash types.Hash, full bool) (*types.Block, error)

func (*RPC) BlockByNumber

func (r *RPC) BlockByNumber(ctx context.Context, number types.BlockNumber, full bool) (*types.Block, error)

func (*RPC) BlockNumber

func (r *RPC) BlockNumber(ctx context.Context) (*big.Int, error)

func (*RPC) Call

func (r *RPC) Call(ctx context.Context, call *types.Call, block types.BlockNumber) ([]byte, *types.Call, error)

func (*RPC) ChainID

func (r *RPC) ChainID(ctx context.Context) (uint64, error)

func (*RPC) ClientVersion

func (r *RPC) ClientVersion(ctx context.Context) (string, error)

func (*RPC) EstimateGas

func (r *RPC) EstimateGas(ctx context.Context, call *types.Call, block types.BlockNumber) (uint64, *types.Call, error)

func (*RPC) GasPrice

func (r *RPC) GasPrice(ctx context.Context) (*big.Int, error)

func (*RPC) GetBalance

func (r *RPC) GetBalance(ctx context.Context, address types.Address, block types.BlockNumber) (*big.Int, error)

func (*RPC) GetBlockFilterChanges

func (r *RPC) GetBlockFilterChanges(ctx context.Context, id *big.Int) ([]types.Hash, error)

func (*RPC) GetBlockReceipts

func (r *RPC) GetBlockReceipts(ctx context.Context, block types.BlockNumber) ([]*types.TransactionReceipt, error)

func (*RPC) GetBlockTransactionCountByHash

func (r *RPC) GetBlockTransactionCountByHash(ctx context.Context, hash types.Hash) (uint64, error)

func (*RPC) GetBlockTransactionCountByNumber

func (r *RPC) GetBlockTransactionCountByNumber(ctx context.Context, number types.BlockNumber) (uint64, error)

func (*RPC) GetCode

func (r *RPC) GetCode(ctx context.Context, account types.Address, block types.BlockNumber) ([]byte, error)

func (*RPC) GetFilterChanges

func (r *RPC) GetFilterChanges(ctx context.Context, id *big.Int) ([]types.Log, error)

func (*RPC) GetFilterLogs

func (r *RPC) GetFilterLogs(ctx context.Context, id *big.Int) ([]types.Log, error)

func (*RPC) GetLogs

func (r *RPC) GetLogs(ctx context.Context, query *types.FilterLogsQuery) ([]types.Log, error)

func (*RPC) GetStorageAt

func (r *RPC) GetStorageAt(ctx context.Context, account types.Address, key types.Hash, block types.BlockNumber) (*types.Hash, error)

func (*RPC) GetTransactionByBlockHashAndIndex

func (r *RPC) GetTransactionByBlockHashAndIndex(ctx context.Context, hash types.Hash, index uint64) (*types.OnChainTransaction, error)

func (*RPC) GetTransactionByBlockNumberAndIndex

func (r *RPC) GetTransactionByBlockNumberAndIndex(ctx context.Context, number types.BlockNumber, index uint64) (*types.OnChainTransaction, error)

func (*RPC) GetTransactionByHash

func (r *RPC) GetTransactionByHash(ctx context.Context, hash types.Hash) (*types.OnChainTransaction, error)

func (*RPC) GetTransactionCount

func (r *RPC) GetTransactionCount(ctx context.Context, account types.Address, block types.BlockNumber) (uint64, error)

func (*RPC) GetTransactionReceipt

func (r *RPC) GetTransactionReceipt(ctx context.Context, hash types.Hash) (*types.TransactionReceipt, error)

func (*RPC) GetUncleByBlockHashAndIndex

func (r *RPC) GetUncleByBlockHashAndIndex(ctx context.Context, hash types.Hash, index uint64) (*types.Block, error)

func (*RPC) GetUncleByBlockNumberAndIndex

func (r *RPC) GetUncleByBlockNumberAndIndex(ctx context.Context, number types.BlockNumber, index uint64) (*types.Block, error)

func (*RPC) GetUncleCountByBlockHash

func (r *RPC) GetUncleCountByBlockHash(ctx context.Context, hash types.Hash) (uint64, error)

func (*RPC) GetUncleCountByBlockNumber

func (r *RPC) GetUncleCountByBlockNumber(ctx context.Context, number types.BlockNumber) (uint64, error)

func (*RPC) Listening

func (r *RPC) Listening(ctx context.Context) (bool, error)

func (*RPC) MaxPriorityFeePerGas

func (r *RPC) MaxPriorityFeePerGas(ctx context.Context) (*big.Int, error)

func (*RPC) MockReset

func (r *RPC) MockReset(t *testing.T)

func (*RPC) NetworkID

func (r *RPC) NetworkID(ctx context.Context) (uint64, error)

func (*RPC) NewBlockFilter

func (r *RPC) NewBlockFilter(ctx context.Context) (*big.Int, error)

func (*RPC) NewFilter

func (r *RPC) NewFilter(ctx context.Context, query *types.FilterLogsQuery) (*big.Int, error)

func (*RPC) NewPendingTransactionFilter

func (r *RPC) NewPendingTransactionFilter(ctx context.Context) (*big.Int, error)

func (*RPC) PeerCount

func (r *RPC) PeerCount(ctx context.Context) (uint64, error)

func (*RPC) ProtocolVersion

func (r *RPC) ProtocolVersion(ctx context.Context) (uint64, error)

func (*RPC) SendRawTransaction

func (r *RPC) SendRawTransaction(ctx context.Context, data []byte) (*types.Hash, error)

func (*RPC) SendTransaction

func (r *RPC) SendTransaction(ctx context.Context, tx *types.Transaction) (*types.Hash, *types.Transaction, error)

func (*RPC) Sign

func (r *RPC) Sign(ctx context.Context, account types.Address, data []byte) (*types.Signature, error)

func (*RPC) SignTransaction

func (r *RPC) SignTransaction(ctx context.Context, tx *types.Transaction) ([]byte, *types.Transaction, error)

func (*RPC) SubscribeLogs

func (r *RPC) SubscribeLogs(ctx context.Context, query *types.FilterLogsQuery) (<-chan types.Log, error)

func (*RPC) SubscribeNewHeads

func (r *RPC) SubscribeNewHeads(ctx context.Context) (<-chan types.Block, error)

func (*RPC) SubscribeNewPendingTransactions

func (r *RPC) SubscribeNewPendingTransactions(ctx context.Context) (<-chan types.Hash, error)

func (*RPC) Syncing

func (r *RPC) Syncing(ctx context.Context) (*types.SyncStatus, error)

func (*RPC) UninstallFilter

func (r *RPC) UninstallFilter(ctx context.Context, id *big.Int) (bool, error)

type Recoverer

type Recoverer struct {
	sync.RWMutex

	RecoverHashFn        func(hash types.Hash, sig types.Signature) (*types.Address, error)
	RecoverMessageFn     func(data []byte, sig types.Signature) (*types.Address, error)
	RecoverTransactionFn func(tx *types.Transaction) (*types.Address, error)
}

func NewRecoverer

func NewRecoverer(t *testing.T) *Recoverer

func (*Recoverer) MockReset

func (r *Recoverer) MockReset(t *testing.T)

func (*Recoverer) RecoverHash

func (r *Recoverer) RecoverHash(hash types.Hash, sig types.Signature) (*types.Address, error)

func (*Recoverer) RecoverMessage

func (r *Recoverer) RecoverMessage(data []byte, sig types.Signature) (*types.Address, error)

func (*Recoverer) RecoverTransaction

func (r *Recoverer) RecoverTransaction(tx *types.Transaction) (*types.Address, error)

Jump to

Keyboard shortcuts

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