ethutils

package module
v0.0.0-...-0c526e4 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2020 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BigToFloat

func BigToFloat(b *big.Int, decimal int64) float64

BigToFloat converts a big int to float according to its number of decimal digits Example: - BigToFloat(1100, 3) = 1.1 - BigToFloat(1100, 2) = 11 - BigToFloat(1100, 5) = 0.11

func BuildExactSendETHTx

func BuildExactSendETHTx(nonce uint64, to string, ethAmount *big.Int, priceGwei float64) (tx *types.Transaction)

func BuildExactTx

func BuildExactTx(nonce uint64, to string, ethAmount *big.Int, gasLimit uint64, priceGwei float64, data []byte) (tx *types.Transaction)

func BuildSendETHTx

func BuildSendETHTx(nonce uint64, to string, ethAmount float64, priceGwei float64) (tx *types.Transaction)

func BuildTx

func BuildTx(nonce uint64, to string, ethAmount float64, gasLimit uint64, priceGwei float64, data []byte) (tx *types.Transaction)

func EthToWei

func EthToWei(n float64) *big.Int

EthToWei converts Gwei as a float to Wei as a big int

func FloatToBigInt

func FloatToBigInt(amount float64, decimal int64) *big.Int

FloatToBigInt converts a float to a big int with specific decimal Example: - FloatToBigInt(1, 4) = 10000 - FloatToBigInt(1.234, 4) = 12340

func FloatToInt

func FloatToInt(amount float64) int64

func GetERC20ABI

func GetERC20ABI() (*abi.ABI, error)

func GweiToWei

func GweiToWei(n float64) *big.Int

GweiToWei converts Gwei as a float to Wei as a big int

func HexToAddress

func HexToAddress(hex string) common.Address

func HexToAddresses

func HexToAddresses(hexes []string) []common.Address

func HexToBig

func HexToBig(hex string) *big.Int

func PackERC20Data

func PackERC20Data(function string, params ...interface{}) ([]byte, error)

func RawTxToHash

func RawTxToHash(data string) string

RawTxToHash returns valid hex data of a transaction to transaction hash

Types

type Transaction

type Transaction struct {
	*types.Transaction
	Extra txExtraInfo
}

func (*Transaction) UnmarshalJSON

func (tx *Transaction) UnmarshalJSON(msg []byte) error

type TxInfo

type TxInfo struct {
	Status  string
	Tx      *Transaction
	Receipt *types.Receipt
}

func (*TxInfo) GasCost

func (self *TxInfo) GasCost() *big.Int

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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