uethereum

package
v0.0.0-...-c7da4f4 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2025 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	GweiPerETH = big.NewInt(1000000000)                               // 1 ETH = 1,000,000,000 Gwei
	WeiPerETH  = new(big.Int).Mul(GweiPerETH, big.NewInt(1000000000)) // 1 ETH = 1,000,000,000,000,000,000 Wei
)

Functions

func CreateWalletAccount

func CreateWalletAccount() (privateKeyHex, address string, err error)

Types

type ParsedLog

type ParsedLog struct {
	Topics []string // log topics // hex string
	Data   string   // log data // hex string
}

type ParsedTx

type ParsedTx struct {
	Block          *big.Int     // block height
	Timestamp      int64        // block timestamp // milliseconds
	TxHash         string       // transaction hash
	From           string       // from address
	To             string       // to address // wallet or contract address
	Value          *big.Int     // transaction value
	Fee            *big.Int     // transaction fee // = gas price * gas used
	GasLimit       uint64       // transaction gas limit
	GasUsed        uint64       // transaction gas used
	GasPrice       *big.Int     // transaction gas price // static or dynamic // dynamic: min((base fee + max priority fee), max fee)
	BaseFee        *big.Int     // transaction base fee
	MaxPriorityFee *big.Int     // transaction max priority fee
	MaxFee         *big.Int     // transaction max fee
	InputData      string       // transaction input data // hex string
	Logs           []*ParsedLog // transaction logs
	Nonce          uint64
	TxType         uint8 // transaction type // https://ethereum.org/developers/docs/transactions/#typed-transaction-envelope
}

type TxParser

type TxParser struct {
	// contains filtered or unexported fields
}

func NewTxParser

func NewTxParser(endpoint string) (*TxParser, error)

func (*TxParser) ParseBlock

func (tp *TxParser) ParseBlock(ctx context.Context, blockNumber *big.Int) ([]*ParsedTx, error)

type WalletClient

type WalletClient struct {
	// contains filtered or unexported fields
}

func NewWalletClient

func NewWalletClient(endpoint, privateKeyHex string) (*WalletClient, error)

func (*WalletClient) EstimateGasTransferERC20Token

func (wc *WalletClient) EstimateGasTransferERC20Token(ctx context.Context, tokenContract, to string, amount *big.Int) (gas uint64, err error)

func (*WalletClient) EstimateGasTransferETH

func (wc *WalletClient) EstimateGasTransferETH(ctx context.Context, to string, amount *big.Int) (gas uint64, err error)

func (*WalletClient) GetERC20TokenBalance

func (wc *WalletClient) GetERC20TokenBalance(ctx context.Context, tokenContract string) (balance *big.Int, err error)

func (*WalletClient) GetERC20TokenBalanceByAddress

func (wc *WalletClient) GetERC20TokenBalanceByAddress(ctx context.Context, tokenContract, address string) (balance *big.Int, err error)

func (*WalletClient) GetETHBalance

func (wc *WalletClient) GetETHBalance(ctx context.Context) (balance *big.Int, err error)

func (*WalletClient) GetETHBalanceByAddress

func (wc *WalletClient) GetETHBalanceByAddress(ctx context.Context, address string) (balance *big.Int, err error)

func (*WalletClient) SuggestGasPrice

func (wc *WalletClient) SuggestGasPrice(ctx context.Context) (gasPrice *big.Int, err error)

func (*WalletClient) TransferERC20Token

func (wc *WalletClient) TransferERC20Token(ctx context.Context, tokenContract, to string, amount *big.Int, gasLimit uint64, gasPrice *big.Int) (txHash string, err error)

func (*WalletClient) TransferETH

func (wc *WalletClient) TransferETH(ctx context.Context, to string, amount *big.Int, gasLimit uint64, gasPrice *big.Int) (txHash string, err error)

Jump to

Keyboard shortcuts

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