eth

package
v1.18.4 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2025 License: GPL-3.0, GPL-3.0 Imports: 14 Imported by: 14

Documentation

Index

Constants

View Source
const (
	WeiPerEth  float64 = 1e18
	WeiPerGwei float64 = 1e9
)

Conversion factors

View Source
const (
	Erc20AbiString string = `` /* 1089-byte string literal not displayed */

)

Variables

This section is empty.

Functions

func EstimateSendTransactionGas

func EstimateSendTransactionGas(client rocketpool.ExecutionClient, toAddress common.Address, data []byte, useSafeGasLimit bool, opts *bind.TransactOpts) (rocketpool.GasInfo, error)

Estimate the gas of SendTransaction

func EthToWei

func EthToWei(eth float64) *big.Int

Convert eth to wei

func EthToWeiWithDecimals

func EthToWeiWithDecimals(amountRaw float64, decimals uint8) *big.Int

Converts float amount to big.Int considering a token's decimals

func FilterContractLogs

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

func GetLogs

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

func GweiToWei(gwei float64) *big.Int

Convert gigawei to wei

func SendTransaction

func SendTransaction(client rocketpool.ExecutionClient, toAddress common.Address, chainID *big.Int, data []byte, useSafeGasLimit bool, opts *bind.TransactOpts) (common.Hash, error)

Send a transaction to an address useSafeGasLimit will amplify the estimated gas limit to by 50% for safety (no effect if the gas limit in opts is already set).

func WeiToEth

func WeiToEth(wei *big.Int) float64

Convert wei to eth

func WeiToEthWithDecimals

func WeiToEthWithDecimals(amount *big.Int, decimals uint8) float64

Converts big.Int to float64 considering a token's decimals

func WeiToGwei

func WeiToGwei(wei *big.Int) float64

Convert wei to gigawei

Types

type Erc20Contract

type Erc20Contract struct {
	Name     string
	Symbol   string
	Decimals uint8
	// contains filtered or unexported fields
}

func NewErc20Contract

func NewErc20Contract(address common.Address, client rocketpool.ExecutionClient, opts *bind.CallOpts) (*Erc20Contract, error)

Creates a contract wrapper for the ERC20 at the given address

func (*Erc20Contract) BalanceOf

func (c *Erc20Contract) BalanceOf(address common.Address, opts *bind.CallOpts) (*big.Int, error)

Get the token balance for an address

func (*Erc20Contract) EstimateTransferGas

func (c *Erc20Contract) EstimateTransferGas(to common.Address, amount *big.Int, opts *bind.TransactOpts) (rocketpool.GasInfo, error)

Estimate the gas for transferring an ERC20 to another address

func (*Erc20Contract) GetDecimals

func (c *Erc20Contract) GetDecimals(opts *bind.CallOpts) (uint8, error)

Get the token decimals

func (*Erc20Contract) GetName

func (c *Erc20Contract) GetName(opts *bind.CallOpts) (string, error)

Get the token name

func (*Erc20Contract) GetSymbol

func (c *Erc20Contract) GetSymbol(opts *bind.CallOpts) (string, error)

Get the token symbol

func (*Erc20Contract) Transfer

func (c *Erc20Contract) Transfer(to common.Address, amount *big.Int, opts *bind.TransactOpts) (*types.Transaction, error)

Transfer an ERC20 to another address

type FilterQuery

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

Jump to

Keyboard shortcuts

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