Documentation ¶
Overview ¶
Package etherutils provides utilities for working with Ethereum
Index ¶
- func AccountSigner(chainID *big.Int, wallet *accounts.Wallet, account *accounts.Account, ...) (signerfn bind.SignerFn)
- func KeySigner(chainID *big.Int, key *ecdsa.PrivateKey) (signerfn bind.SignerFn)
- func StringToWei(input string) (*big.Int, error)
- func UnitToMultiplier(unit string) (result *big.Int, err error)
- func WeiToString(input *big.Int, standard bool) string
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AccountSigner ¶
func AccountSigner(chainID *big.Int, wallet *accounts.Wallet, account *accounts.Account, passphrase string) (signerfn bind.SignerFn)
AccountSigner generates a signer using an account
func StringToWei ¶
StringToWei turns a string in to number of Wei. The string can be a simple number of Wei, e.g. "1000000000000000" or it can be a number followed by a unit, e.g. "10 ether". Unit names are case-insensitive, and can be either given names (e.g. "finney") or metric names (e.g. "mlliether"). Note that this function expects use of the period as the decimal separator.
func UnitToMultiplier ¶
UnitToMultiplier takes the name of an Ethereum unit and returns a multiplier
from Wei
Example ¶
multiplier, err := UnitToMultiplier("ether") if err != nil { return } fmt.Println(multiplier.Text(10))
Output: 1000000000000000000
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.