Documentation ¶
Index ¶
- func LoadJWTHexFile(file string) ([]byte, error)
- func MockPayloadID(params engine.ExecutableData, beaconRoot *common.Hash) (engine.PayloadID, error)
- func NewFuzzer(seed int64) *fuzz.Fuzzer
- func WithMockSelfDelegation(pubkey crypto.PubKey, ether int64) func(*engineMock)
- func WithPortalRegister(network netconf.Network) func(*engineMock)
- func WithRandomErr(ctx context.Context, _ *testing.T) context.Context
- type Client
- type EngineClient
- type HeadType
- type Wrapper
- func (w Wrapper) Address() string
- func (w Wrapper) BalanceAt(ctx context.Context, account common.Address, blockNumber *big.Int) (*big.Int, error)
- func (w Wrapper) BlockByHash(ctx context.Context, hash common.Hash) (*types.Block, error)
- func (w Wrapper) BlockByNumber(ctx context.Context, number *big.Int) (*types.Block, error)
- func (w Wrapper) BlockNumber(ctx context.Context) (uint64, error)
- func (w Wrapper) CallContract(ctx context.Context, call ethereum.CallMsg, blockNumber *big.Int) ([]byte, error)
- func (w Wrapper) ChainID(ctx context.Context) (*big.Int, error)
- func (w Wrapper) Close()
- func (w Wrapper) CodeAt(ctx context.Context, account common.Address, blockNumber *big.Int) ([]byte, error)
- func (w Wrapper) EstimateGas(ctx context.Context, call ethereum.CallMsg) (uint64, error)
- func (w Wrapper) EtherBalanceAt(ctx context.Context, addr common.Address) (float64, error)
- func (w Wrapper) FilterLogs(ctx context.Context, q ethereum.FilterQuery) ([]types.Log, error)
- func (w Wrapper) HeaderByHash(ctx context.Context, hash common.Hash) (*types.Header, error)
- func (w Wrapper) HeaderByNumber(ctx context.Context, number *big.Int) (*types.Header, error)
- func (w Wrapper) HeaderByType(ctx context.Context, typ HeadType) (*types.Header, error)
- func (w Wrapper) NonceAt(ctx context.Context, account common.Address, blockNumber *big.Int) (uint64, error)
- func (w Wrapper) PeerCount(ctx context.Context) (uint64, error)
- func (w Wrapper) PendingBalanceAt(ctx context.Context, account common.Address) (*big.Int, error)
- func (w Wrapper) PendingCodeAt(ctx context.Context, account common.Address) ([]byte, error)
- func (w Wrapper) PendingNonceAt(ctx context.Context, account common.Address) (uint64, error)
- func (w Wrapper) PendingStorageAt(ctx context.Context, account common.Address, key common.Hash) ([]byte, error)
- func (w Wrapper) PendingTransactionCount(ctx context.Context) (uint, error)
- func (w Wrapper) SendTransaction(ctx context.Context, tx *types.Transaction) error
- func (w Wrapper) SetHead(ctx context.Context, height uint64) error
- func (w Wrapper) StorageAt(ctx context.Context, account common.Address, key common.Hash, ...) ([]byte, error)
- func (w Wrapper) SubscribeFilterLogs(ctx context.Context, q ethereum.FilterQuery, ch chan<- types.Log) (ethereum.Subscription, error)
- func (w Wrapper) SubscribeNewHead(ctx context.Context, ch chan<- *types.Header) (ethereum.Subscription, error)
- func (w Wrapper) SuggestGasPrice(ctx context.Context) (*big.Int, error)
- func (w Wrapper) SuggestGasTipCap(ctx context.Context) (*big.Int, error)
- func (w Wrapper) SyncProgress(ctx context.Context) (*ethereum.SyncProgress, error)
- func (w Wrapper) TransactionByHash(ctx context.Context, txHash common.Hash) (*types.Transaction, bool, error)
- func (w Wrapper) TransactionCount(ctx context.Context, blockHash common.Hash) (uint, error)
- func (w Wrapper) TransactionInBlock(ctx context.Context, blockHash common.Hash, index uint) (*types.Transaction, error)
- func (w Wrapper) TransactionReceipt(ctx context.Context, txHash common.Hash) (*types.Receipt, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LoadJWTHexFile ¶
LoadJWTHexFile loads a hex encoded JWT secret from the provided file.
func MockPayloadID ¶
MockPayloadID returns a deterministic payload id for the given payload.
func NewFuzzer ¶
NewFuzzer returns a new fuzzer for valid ethereum types. If seed is zero, it uses current nano time as the seed.
func WithMockSelfDelegation ¶
WithMockSelfDelegation returns an option to add a self-delegation Delegate event to the mock.
func WithPortalRegister ¶
Types ¶
type Client ¶
type Client interface { ethereum.BlockNumberReader ethereum.ChainIDReader ethereum.ChainReader ethereum.ChainStateReader ethereum.ChainSyncReader ethereum.ContractCaller ethereum.GasEstimator ethereum.GasPricer ethereum.GasPricer1559 ethereum.LogFilterer ethereum.PendingStateReader ethereum.TransactionReader ethereum.TransactionSender HeaderByType(ctx context.Context, typ HeadType) (*types.Header, error) EtherBalanceAt(ctx context.Context, addr common.Address) (float64, error) PeerCount(ctx context.Context) (uint64, error) SetHead(ctx context.Context, height uint64) error Address() string Close() }
Client defines all ethereum interfaces used in omni.
type EngineClient ¶
type EngineClient interface { Client // NewPayloadV2 creates an Eth1 block, inserts it in the chain, and returns the status of the chain. NewPayloadV2(ctx context.Context, params engine.ExecutableData) (engine.PayloadStatusV1, error) // NewPayloadV3 creates an Eth1 block, inserts it in the chain, and returns the status of the chain. NewPayloadV3(ctx context.Context, params engine.ExecutableData, versionedHashes []common.Hash, beaconRoot *common.Hash) (engine.PayloadStatusV1, error) // ForkchoiceUpdatedV2 has several responsibilities: // - It sets the chain the head. // - And/or it sets the chain's finalized block hash. // - And/or it starts assembling (async) a block with the payload attributes. ForkchoiceUpdatedV2(ctx context.Context, update engine.ForkchoiceStateV1, payloadAttributes *engine.PayloadAttributes) (engine.ForkChoiceResponse, error) // ForkchoiceUpdatedV3 is equivalent to V2 with the addition of parent beacon block root in the payload attributes. ForkchoiceUpdatedV3(ctx context.Context, update engine.ForkchoiceStateV1, payloadAttributes *engine.PayloadAttributes) (engine.ForkChoiceResponse, error) // GetPayloadV2 returns a cached payload by id. GetPayloadV2(ctx context.Context, payloadID engine.PayloadID) (*engine.ExecutionPayloadEnvelope, error) // GetPayloadV3 returns a cached payload by id. GetPayloadV3(ctx context.Context, payloadID engine.PayloadID) (*engine.ExecutionPayloadEnvelope, error) }
EngineClient defines the Engine API authenticated JSON-RPC endpoints. It extends the normal Client interface with the Engine API.
func NewAuthClient ¶
NewAuthClient returns a new authenticated JSON-RPc engineClient.
func NewEngineMock ¶
func NewEngineMock(opts ...func(mock *engineMock)) (EngineClient, error)
NewEngineMock returns a new mock engine API client.
Note only some methods are implemented, it will panic if you call an unimplemented method.
type Wrapper ¶
type Wrapper struct {
// contains filtered or unexported fields
}
Wrapper wraps an ethclient.Client adding metrics and wrapped errors.
func Dial ¶
Dial connects a client to the given URL.
Note if the URL is http(s), it doesn't return an error if it cannot connect to the URL. It will retry connecting on every call to a wrapped method. It will only return an error if the url is invalid.
func (Wrapper) BlockByHash ¶
func (Wrapper) BlockByNumber ¶
func (Wrapper) CallContract ¶
func (Wrapper) EstimateGas ¶
func (Wrapper) EtherBalanceAt ¶
EtherBalanceAt returns the current balance in ether of the provided account. Note this converts big.Int to float64 so IS NOT accurate. Only use if accuracy is not required, i.e., for display/metrics purposes.
func (Wrapper) FilterLogs ¶
func (Wrapper) HeaderByHash ¶
func (Wrapper) HeaderByNumber ¶
func (Wrapper) HeaderByType ¶
HeaderByType returns the block header for the given head type.
func (Wrapper) PeerCount ¶
PeerCount returns the number of p2p peers as reported by the net_peerCount method.
func (Wrapper) PendingBalanceAt ¶
func (Wrapper) PendingCodeAt ¶
func (Wrapper) PendingNonceAt ¶
func (Wrapper) PendingStorageAt ¶
func (Wrapper) PendingTransactionCount ¶
func (Wrapper) SendTransaction ¶
func (Wrapper) SetHead ¶
SetHead sets the current head of the local chain by block number. Note, this is a destructive action and may severely damage your chain. Use with extreme caution.
func (Wrapper) SubscribeFilterLogs ¶
func (Wrapper) SubscribeNewHead ¶
func (Wrapper) SuggestGasPrice ¶
func (Wrapper) SuggestGasTipCap ¶
func (Wrapper) SyncProgress ¶
func (Wrapper) TransactionByHash ¶
func (Wrapper) TransactionCount ¶
func (Wrapper) TransactionInBlock ¶
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Command genwrap provides a code generator for ethclient.Client wrapper that adds prometheus metrics and error wrapping.
|
Command genwrap provides a code generator for ethclient.Client wrapper that adds prometheus metrics and error wrapping. |
Package mock is a generated GoMock package.
|
Package mock is a generated GoMock package. |