ethutils

package module
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2020 License: MIT Imports: 14 Imported by: 1

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 BuildContractCreationTx

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

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 HexToHash

func HexToHash(hex string) common.Hash

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

func StringToBig

func StringToBig(input string) *big.Int

func StringToFloat

func StringToFloat(input string, decimal int64) float64

Types

type InternalTx

type InternalTx struct {
	From  string `json:"from"`
	To    string `json:"to"`
	Value string `json:"value"`
}

type Transaction

type Transaction struct {
	*types.Transaction
	Extra TxExtraInfo `json:"extra"`
}

func (*Transaction) MarshalJSON

func (tx *Transaction) MarshalJSON() ([]byte, error)

func (*Transaction) UnmarshalJSON

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

type TxExtraInfo

type TxExtraInfo struct {
	BlockNumber *string         `json:"blockNumber,omitempty"`
	BlockHash   *common.Hash    `json:"blockHash,omitempty"`
	From        *common.Address `json:"from,omitempty"`
}

type TxInfo

type TxInfo struct {
	Status      string
	Tx          *Transaction
	InternalTxs []InternalTx
	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