etherutils

package module
v0.0.0-...-139c2bc Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2018 License: Apache-2.0 Imports: 11 Imported by: 12

README

This package contains a number of command-line utilities and libraries useful when working with Ethereum and Go.

ens

ens is a command-line utility that allows users to manage resolvers and addreses for ENS names.

To build ens from source run go build from the cmd/ens subdirectory.

Sample usage

Obtain the resolver for a name

ens resolver myname.eth

Set the resolver for a name

ens resolver set myname.eth --passphrase="my secret passphrase"

Obtain the address for a name

ens address myname.eth

Set the address for a name

ens address set myname.eth --passphrase="my secret passphrase" --address=0x90f8bf6a479f320ead074411a4b0e7944ea8c9c1

Further details about ens usage can be obtained with ens help

Documentation

Overview

Package etherutils provides utilities for working with Ethereum

Index

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 KeySigner

func KeySigner(chainID *big.Int, key *ecdsa.PrivateKey) (signerfn bind.SignerFn)

KeySigner generates a signer using a private key

func StringToWei

func StringToWei(input string) (*big.Int, error)

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

func UnitToMultiplier(unit string) (result *big.Int, err error)

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

func WeiToString

func WeiToString(input *big.Int, standard bool) string

WeiToString turns a number of Wei in to a string. If the 'standard' argument is true then this will display the value in either (KMG)Wei or Ether only

Types

This section is empty.

Jump to

Keyboard shortcuts

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