Documentation ¶
Index ¶
- func CalcGasCost(gasLimit uint64, gasPrice *big.Int) *big.Int
- func EstimateGasLimit(client *ethclient.Client, toAddress *common.Address, data []byte) uint64
- func GenerateMnemonic() string
- func GetBytesFromFile(file string) []byte
- func IsContract(client *ethclient.Client, address string) bool
- func IsValidEthAddress(address string) bool
- func SigRSV(isig interface{}) ([32]byte, [32]byte, uint8)
- func SuggestGasPrice(client *ethclient.Client) *big.Int
- func ToDecimal(ivalue interface{}, decimals int) decimal.Decimal
- func ToWei(iamount interface{}, decimals int) *big.Int
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CalcGasCost ¶
CalcGasCost calculate gas cost given gas limit (units) and gas price (wei) example gasLimit := uint64(21000) gasPrice := new(big.Int) gasPrice.SetString("2000000000", 10) gasCost := util.CalcGasCost(gasLimit, gasPrice) fmt.Println(gasCost) // 42000000000000
func EstimateGasLimit ¶
func GetBytesFromFile ¶
func IsContract ¶
Checks if address is valid, and also checks if it is a smart contract or account.
func IsValidEthAddress ¶
func SigRSV ¶
SigRSV signatures R S V returned as arrays sig := "0x789a80053e4927d0a898db8e065e948f5cf086e32f9ccaa54c1908e22ac430c62621578113ddbb62d509bf6049b8fb544ab06d36f916685a2eb8e57ffadde02301" r, s, v := util.SigRSV(sig) fmt.Println(hexutil.Encode(r[:])[2:]) // 789a80053e4927d0a898db8e065e948f5cf086e32f9ccaa54c1908e22ac430c6 fmt.Println(hexutil.Encode(s[:])[2:]) // 2621578113ddbb62d509bf6049b8fb544ab06d36f916685a2eb8e57ffadde023 fmt.Println(v) // 28
Types ¶
This section is empty.