connection

package
v0.0.0-...-1845101 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2024 License: GPL-3.0 Imports: 25 Imported by: 0

Documentation

Overview

Copyright 2024 Stafi Protocol SPDX-License-Identifier: LGPL-3.0-only

Index

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) ChainID

func (c *CachedConnection) ChainID() (*big.Int, 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) (*Connection, error)

NewConnection returns an uninitialized connection, must call Connection.Connect() before using.

func (*Connection) CallOpts

func (c *Connection) CallOpts(blocknumber *big.Int) *bind.CallOpts

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

func (c *Connection) SafeEstimateFee(ctx context.Context) (*big.Int, *big.Int, error)

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) BalanceAt

func (c *Eth1Client) BalanceAt(ctx context.Context, account common.Address, blockNumber *big.Int) (balance *big.Int, err error)

func (*Eth1Client) BlockByNumber

func (c *Eth1Client) BlockByNumber(ctx context.Context, number *big.Int) (block *types.Block, err error)

func (*Eth1Client) BlockNumber

func (c *Eth1Client) BlockNumber(ctx context.Context) (number uint64, err error)

func (*Eth1Client) CallContract

func (c *Eth1Client) CallContract(ctx context.Context, call ethereum.CallMsg, blockNumber *big.Int) (bytes []byte, err error)

func (*Eth1Client) ChainID

func (c *Eth1Client) ChainID(ctx context.Context) (id *big.Int, err error)

func (*Eth1Client) CodeAt

func (c *Eth1Client) CodeAt(ctx context.Context, contract common.Address, blockNumber *big.Int) (bytes []byte, err error)

func (*Eth1Client) EstimateGas

func (c *Eth1Client) EstimateGas(ctx context.Context, call ethereum.CallMsg) (gas uint64, err error)

func (*Eth1Client) FilterLogs

func (c *Eth1Client) FilterLogs(ctx context.Context, query ethereum.FilterQuery) (logs []types.Log, err error)

func (*Eth1Client) HeaderByNumber

func (c *Eth1Client) HeaderByNumber(ctx context.Context, number *big.Int) (header *types.Header, err error)

func (*Eth1Client) NonceAt

func (c *Eth1Client) NonceAt(ctx context.Context, account common.Address, blockNumber *big.Int) (nonce uint64, err error)

func (*Eth1Client) PendingCodeAt

func (c *Eth1Client) PendingCodeAt(ctx context.Context, account common.Address) (bytes []byte, err error)

func (*Eth1Client) PendingNonceAt

func (c *Eth1Client) PendingNonceAt(ctx context.Context, account common.Address) (nonce uint64, err error)

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 (c *Eth1Client) SuggestGasPrice(ctx context.Context) (price *big.Int, err error)

func (*Eth1Client) SuggestGasTipCap

func (c *Eth1Client) SuggestGasTipCap(ctx context.Context) (cap *big.Int, err error)

func (*Eth1Client) WaitTxOkCommon

func (c *Eth1Client) WaitTxOkCommon(txHash common.Hash) (blockNumber uint64, err error)

type MultiCall

type MultiCall struct {
	*multicall.Call
	BlockNumber uint64
	Err         error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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