Skip to content

eth

go
import "github.com/rocket-pool/rocketpool-go/utils/eth"

Index

Constants

Conversion factors

go
const (
    WeiPerEth  float64 = 1e18
    WeiPerGwei float64 = 1e9
)

func EstimateSendTransactionGas

go
func EstimateSendTransactionGas(client *ethclient.Client, toAddress common.Address, opts *bind.TransactOpts) (rocketpool.GasInfo, error)

Estimate the gas of SendTransaction

func EthToWei

go
func EthToWei(eth float64) *big.Int

Convert eth to wei

func FilterContractLogs

go
func FilterContractLogs(rp *rocketpool.RocketPool, contractName string, q FilterQuery, intervalSize *big.Int) ([]types.Log, error)

func GetLogs

go
func GetLogs(rp *rocketpool.RocketPool, addressFilter []common.Address, topicFilter [][]common.Hash, intervalSize, fromBlock, toBlock *big.Int, blockHash *common.Hash) ([]types.Log, error)

Gets the logs for a particular log request, breaking the calls into batches if necessary

func GweiToWei

go
func GweiToWei(gwei float64) *big.Int

Convert gigawei to wei

func SendTransaction

go
func SendTransaction(client *ethclient.Client, toAddress common.Address, opts *bind.TransactOpts) (common.Hash, error)

Send a transaction to an address

func WeiToEth

go
func WeiToEth(wei *big.Int) float64

Convert wei to eth

func WeiToGwei

go
func WeiToGwei(wei *big.Int) float64

Convert wei to gigawei

type FilterQuery

go
type FilterQuery struct {
    BlockHash *common.Hash
    FromBlock *big.Int
    ToBlock   *big.Int
    Topics    [][]common.Hash
}