utils

package
v1.10.1 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2023 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	STATUS_FAIL    = 1
	STATUS_SUCCESS = 0
)
View Source
const (
	Wei    = "wei"
	Kwei   = "kwei"
	Mwei   = "mwei"
	Gwei   = "gwei"
	Szabo  = "szabo"
	Finney = "finney"
	Ether  = "ether"
	Kether = "kether"
	Mether = "mether"
	Gether = "gether"
	Tether = "tether"
)

Variables

View Source
var ErrInvalidUnit = fmt.Errorf("invalid unit")

ErrInvalidUnit is returned when the given unit is not supported.

Functions

func AddPercents

func AddPercents(gasLimitUnits uint64, percents int) *big.Int

func CheckEthHashStatus

func CheckEthHashStatus(hash string, client *ethclient.Client) int

CheckEthHashStatus - checking the status of ETH transaction possible values 0 (fail) or 1 (success)

func ConfirmEthereumTransaction

func ConfirmEthereumTransaction(hash string, times int, duration time.Duration, client *ethclient.Client) (int, error)

func Convert

func Convert(input decimal.Decimal, inputUnit string, outputUnit string) (decimal.Decimal, error)

Convert converts the given amount from the given unit to the given unit.

func CreateHDWallet

func CreateHDWallet() (*accounts.Account, string, error)

func FromWei

func FromWei(amount decimal.Decimal, unit string) (decimal.Decimal, error)

FromWei converts the given amount from Wei to the given unit.

func NewSignedTransaction

func NewSignedTransaction(pack []byte, from, to string, value *big.Int, privateKey *ecdsa.PrivateKey, client *ethclient.Client) (*bind.TransactOpts, error)

func ToWei

func ToWei(amount decimal.Decimal, unit string) (decimal.Decimal, error)

ToWei converts the given amount to Wei.

Types

This section is empty.

Jump to

Keyboard shortcuts

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