Documentation ¶
Overview ¶
Copyright 2024 Stafi Protocol SPDX-License-Identifier: LGPL-3.0-only
Index ¶
- Variables
- type CachedConnection
- func (c *CachedConnection) BeaconHead() (beacon.BeaconHead, error)
- func (c *CachedConnection) ChainID() (*big.Int, error)
- func (c *CachedConnection) Eth1LatestBlock() (uint64, error)
- func (c *CachedConnection) Eth2Config() (beacon.Eth2Config, error)
- func (c *CachedConnection) GetValidatorStatus(ctx context.Context, pubkey types.ValidatorPubkey, ...) (validatorStatus beacon.ValidatorStatus, err error)
- func (c *CachedConnection) Start() error
- func (c *CachedConnection) Stop()
- type Connection
- func (c *Connection) CallOpts(blocknumber *big.Int) *bind.CallOpts
- func (c *Connection) CallOptsOn(targetBlockNumber uint64) *bind.CallOpts
- func (c *Connection) Eth1Client() ContractBackend
- func (c *Connection) Eth1LatestBlock() (uint64, error)
- func (c *Connection) GetBeaconBlock(blockId uint64) (block beacon.BeaconBlock, exist bool, err error)
- func (c *Connection) GetBeaconHead() (head beacon.BeaconHead, err error)
- func (c *Connection) GetEth2Config() (cfg beacon.Eth2Config, err error)
- func (c *Connection) GetValidatorStatus(ctx context.Context, pubkey types.ValidatorPubkey, ...) (validatorStatus beacon.ValidatorStatus, err error)
- func (c *Connection) GetValidatorStatuses(ctx context.Context, pubkeys []types.ValidatorPubkey, ...) (validatorStatus map[types.ValidatorPubkey]beacon.ValidatorStatus, err error)
- func (c *Connection) Keypair() *secp256k1.Keypair
- func (c *Connection) LockAndUpdateTxOpts() error
- func (c *Connection) MultiCaller() *multicall.Caller
- func (c *Connection) SafeEstimateFee(ctx context.Context) (*big.Int, *big.Int, error)
- func (c *Connection) SubmitLatestCallJob(call *multicall.Call) (gomicrobee.JobResult[*MultiCall], error)
- func (c *Connection) TxOpts() *bind.TransactOpts
- func (c *Connection) UnlockTxOpts()
- type ContractBackend
- type Eth1Client
- func (c *Eth1Client) BalanceAt(ctx context.Context, account common.Address, blockNumber *big.Int) (balance *big.Int, err error)
- func (c *Eth1Client) BlockByNumber(ctx context.Context, number *big.Int) (block *types.Block, err error)
- func (c *Eth1Client) BlockNumber(ctx context.Context) (number uint64, err error)
- func (c *Eth1Client) CallContract(ctx context.Context, call ethereum.CallMsg, blockNumber *big.Int) (bytes []byte, err error)
- func (c *Eth1Client) ChainID(ctx context.Context) (id *big.Int, err error)
- func (c *Eth1Client) CodeAt(ctx context.Context, contract common.Address, blockNumber *big.Int) (bytes []byte, err error)
- func (c *Eth1Client) EstimateGas(ctx context.Context, call ethereum.CallMsg) (gas uint64, err error)
- func (c *Eth1Client) FilterLogs(ctx context.Context, query ethereum.FilterQuery) (logs []types.Log, err error)
- func (c *Eth1Client) HeaderByNumber(ctx context.Context, number *big.Int) (header *types.Header, err error)
- func (c *Eth1Client) NonceAt(ctx context.Context, account common.Address, blockNumber *big.Int) (nonce uint64, err error)
- func (c *Eth1Client) PendingCodeAt(ctx context.Context, account common.Address) (bytes []byte, err error)
- func (c *Eth1Client) PendingNonceAt(ctx context.Context, account common.Address) (nonce uint64, err error)
- func (c *Eth1Client) SendTransaction(ctx context.Context, tx *types.Transaction) (err error)
- func (c *Eth1Client) SubscribeFilterLogs(ctx context.Context, query ethereum.FilterQuery, ch chan<- types.Log) (sub ethereum.Subscription, err error)
- func (c *Eth1Client) SuggestGasPrice(ctx context.Context) (price *big.Int, err error)
- func (c *Eth1Client) SuggestGasTipCap(ctx context.Context) (cap *big.Int, err error)
- func (c *Eth1Client) WaitTxOkCommon(txHash common.Hash) (blockNumber uint64, err error)
- type GasPriceError
- type MultiCall
Constants ¶
This section is empty.
Variables ¶
View Source
var Gwei10 = big.NewInt(10e9)
View Source
var Gwei20 = big.NewInt(20e9)
View Source
var Gwei5 = big.NewInt(5e9)
Functions ¶
This section is empty.
Types ¶
type CachedConnection ¶
type CachedConnection struct { *Connection // contains filtered or unexported fields }
func NewCachedConnection ¶
func NewCachedConnection(conn *Connection) (*CachedConnection, error)
func (*CachedConnection) BeaconHead ¶
func (c *CachedConnection) BeaconHead() (beacon.BeaconHead, error)
func (*CachedConnection) Eth1LatestBlock ¶
func (c *CachedConnection) Eth1LatestBlock() (uint64, error)
func (*CachedConnection) Eth2Config ¶
func (c *CachedConnection) Eth2Config() (beacon.Eth2Config, error)
func (*CachedConnection) GetValidatorStatus ¶
func (c *CachedConnection) GetValidatorStatus(ctx context.Context, pubkey types.ValidatorPubkey, opts *beacon.ValidatorStatusOptions) (validatorStatus beacon.ValidatorStatus, err error)
func (*CachedConnection) Start ¶
func (c *CachedConnection) Start() error
func (*CachedConnection) Stop ¶
func (c *CachedConnection) Stop()
type Connection ¶
type Connection struct {
// contains filtered or unexported fields
}
func NewConnection ¶
func NewConnection(endpoints []config.Endpoint, kp *secp256k1.Keypair, gasLimit, maxGasPrice *big.Int, gasPriceMultiplier *big.Float) (*Connection, error)
NewConnection returns an uninitialized connection, must call Connection.Connect() before using.
func (*Connection) CallOptsOn ¶
func (c *Connection) CallOptsOn(targetBlockNumber uint64) *bind.CallOpts
func (*Connection) Eth1Client ¶
func (c *Connection) Eth1Client() ContractBackend
func (*Connection) Eth1LatestBlock ¶
func (c *Connection) Eth1LatestBlock() (uint64, error)
LatestBlock returns the latest block from the current chain
func (*Connection) GetBeaconBlock ¶
func (c *Connection) GetBeaconBlock(blockId uint64) (block beacon.BeaconBlock, exist bool, err error)
func (*Connection) GetBeaconHead ¶
func (c *Connection) GetBeaconHead() (head beacon.BeaconHead, err error)
func (*Connection) GetEth2Config ¶
func (c *Connection) GetEth2Config() (cfg beacon.Eth2Config, err error)
func (*Connection) GetValidatorStatus ¶
func (c *Connection) GetValidatorStatus(ctx context.Context, pubkey types.ValidatorPubkey, opts *beacon.ValidatorStatusOptions) (validatorStatus beacon.ValidatorStatus, err error)
func (*Connection) GetValidatorStatuses ¶
func (c *Connection) GetValidatorStatuses(ctx context.Context, pubkeys []types.ValidatorPubkey, opts *beacon.ValidatorStatusOptions) (validatorStatus map[types.ValidatorPubkey]beacon.ValidatorStatus, err error)
func (*Connection) Keypair ¶
func (c *Connection) Keypair() *secp256k1.Keypair
func (*Connection) LockAndUpdateTxOpts ¶
func (c *Connection) LockAndUpdateTxOpts() error
LockAndUpdateOpts acquires a lock on the opts before updating the nonce and gas price.
func (*Connection) MultiCaller ¶
func (c *Connection) MultiCaller() *multicall.Caller
func (*Connection) SafeEstimateFee ¶
return suggest gastipcap gasfeecap
func (*Connection) SubmitLatestCallJob ¶
func (c *Connection) SubmitLatestCallJob(call *multicall.Call) (gomicrobee.JobResult[*MultiCall], error)
func (*Connection) TxOpts ¶
func (c *Connection) TxOpts() *bind.TransactOpts
func (*Connection) UnlockTxOpts ¶
func (c *Connection) UnlockTxOpts()
type ContractBackend ¶
type ContractBackend interface { bind.ContractBackend NonceAt(ctx context.Context, account common.Address, blockNumber *big.Int) (uint64, error) BlockNumber(ctx context.Context) (uint64, error) ChainID(ctx context.Context) (*big.Int, error) BlockByNumber(ctx context.Context, number *big.Int) (*types.Block, error) BalanceAt(ctx context.Context, account common.Address, blockNumber *big.Int) (*big.Int, error) WaitTxOkCommon(txHash common.Hash) (blockNumber uint64, err error) }
type Eth1Client ¶
type Eth1Client struct {
// contains filtered or unexported fields
}
func NewEth1Client ¶
func NewEth1Client(endpoints []string) (*Eth1Client, error)
func (*Eth1Client) BlockByNumber ¶
func (*Eth1Client) BlockNumber ¶
func (c *Eth1Client) BlockNumber(ctx context.Context) (number uint64, err error)
func (*Eth1Client) CallContract ¶
func (*Eth1Client) EstimateGas ¶
func (*Eth1Client) FilterLogs ¶
func (c *Eth1Client) FilterLogs(ctx context.Context, query ethereum.FilterQuery) (logs []types.Log, err error)
func (*Eth1Client) HeaderByNumber ¶
func (*Eth1Client) PendingCodeAt ¶
func (*Eth1Client) PendingNonceAt ¶
func (*Eth1Client) SendTransaction ¶
func (c *Eth1Client) SendTransaction(ctx context.Context, tx *types.Transaction) (err error)
func (*Eth1Client) SubscribeFilterLogs ¶
func (c *Eth1Client) SubscribeFilterLogs(ctx context.Context, query ethereum.FilterQuery, ch chan<- types.Log) (sub ethereum.Subscription, err error)
func (*Eth1Client) SuggestGasPrice ¶
func (*Eth1Client) SuggestGasTipCap ¶
func (*Eth1Client) WaitTxOkCommon ¶
func (c *Eth1Client) WaitTxOkCommon(txHash common.Hash) (blockNumber uint64, err error)
type GasPriceError ¶
func (*GasPriceError) Error ¶
func (e *GasPriceError) Error() string
Click to show internal directories.
Click to hide internal directories.