account

package
v0.0.0-...-0c526e4 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2020 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddressFromHex

func AddressFromHex(hex string) (string, error)

func AddressFromPrivateKey

func AddressFromPrivateKey(key *ecdsa.PrivateKey) string

func PrivateKeyFromFile

func PrivateKeyFromFile(file string) (string, *ecdsa.PrivateKey, error)

func PrivateKeyFromHex

func PrivateKeyFromHex(hex string) (string, *ecdsa.PrivateKey, error)

works with both 0x prefix form and naked form

func PrivateKeyFromKeystore

func PrivateKeyFromKeystore(file string, password string) (string, *ecdsa.PrivateKey, error)

func RandomPrivateKey

func RandomPrivateKey(seed string) (string, *ecdsa.PrivateKey)

func RandomPrivateKeyFile

func RandomPrivateKeyFile(seed string, dir string) (string, *ecdsa.PrivateKey, error)

func SeedToPrivateKey

func SeedToPrivateKey(seed string) (string, *ecdsa.PrivateKey)

func SeedToPrivateKeyFile

func SeedToPrivateKeyFile(seed string, dir string) (filepath string, privkey *ecdsa.PrivateKey, err error)

Generate a private key from a seed using keccak256 and store the private key in hex format to a file with generated address as its name. The file is saved to current working directory if `dir` is "", otherwise it will be saved to `dir`.

Types

type Account

type Account struct {
	// contains filtered or unexported fields
}

func NewAccountFromKeystore

func NewAccountFromKeystore(file string, password string) (*Account, error)

func NewAccountFromPrivateKey

func NewAccountFromPrivateKey(hex string) (*Account, error)

func NewAccountFromPrivateKeyFile

func NewAccountFromPrivateKeyFile(file string) (*Account, error)

func NewRopstenAccountFromKeystore

func NewRopstenAccountFromKeystore(file string, password string) (*Account, error)

func NewRopstenAccountFromPrivateKeyFile

func NewRopstenAccountFromPrivateKeyFile(file string) (*Account, error)

func NewRopstenTrezorAccount

func NewRopstenTrezorAccount(path string, address string) (*Account, error)

func NewTrezorAccount

func NewTrezorAccount(path string, address string) (*Account, error)

func (*Account) Address

func (self *Account) Address() string

func (*Account) CallContract

func (self *Account) CallContract(
	extraGas uint64,
	value float64, caddr string, function string,
	params ...interface{}) (tx *types.Transaction, broadcasted bool, errors error)

func (*Account) CallContractWithNonceAndPrice

func (self *Account) CallContractWithNonceAndPrice(
	nonce uint64, priceGwei float64, extraGas uint64,
	value float64, caddr string, function string,
	params ...interface{}) (tx *types.Transaction, broadcasted bool, errors error)

func (*Account) CallContractWithPrice

func (self *Account) CallContractWithPrice(
	priceGwei float64, extraGas uint64, value float64, caddr string, function string,
	params ...interface{}) (tx *types.Transaction, broadcasted bool, errors error)

func (*Account) CallERC20Contract

func (self *Account) CallERC20Contract(
	extraGas uint64,
	value float64, caddr string, function string,
	params ...interface{}) (tx *types.Transaction, broadcasted bool, errors error)

func (*Account) CallERC20ContractWithNonceAndPrice

func (self *Account) CallERC20ContractWithNonceAndPrice(
	nonce uint64, priceGwei float64, extraGas uint64,
	value float64, caddr string, function string,
	params ...interface{}) (tx *types.Transaction, broadcasted bool, errors error)

func (*Account) CallERC20ContractWithPrice

func (self *Account) CallERC20ContractWithPrice(
	priceGwei float64, extraGas uint64, value float64, caddr string, function string,
	params ...interface{}) (tx *types.Transaction, broadcasted bool, errors error)

func (*Account) ERC20Balance

func (self *Account) ERC20Balance(tokenAddr string) (*big.Int, error)

func (*Account) ETHBalance

func (self *Account) ETHBalance() (*big.Int, error)

func (*Account) GetMinedNonce

func (self *Account) GetMinedNonce() (uint64, error)

func (*Account) GetPendingNonce

func (self *Account) GetPendingNonce() (uint64, error)

func (*Account) ListOfPendingNonces

func (self *Account) ListOfPendingNonces() ([]uint64, error)

func (*Account) PackData

func (self *Account) PackData(caddr string, function string, params ...interface{}) ([]byte, error)

func (*Account) PackERC20Data

func (self *Account) PackERC20Data(function string, params ...interface{}) ([]byte, error)

func (*Account) SendAllERC20

func (self *Account) SendAllERC20(tokenAddr string, to string) (tx *types.Transaction, broadcasted bool, errors error)

func (*Account) SendAllETH

func (self *Account) SendAllETH(to string) (tx *types.Transaction, broadcasted bool, errors error)

func (*Account) SendAllETHWithPrice

func (self *Account) SendAllETHWithPrice(priceGwei float64, to string) (tx *types.Transaction, broadcasted bool, errors error)

func (*Account) SendERC20

func (self *Account) SendERC20(tokenAddr string, tokenAmount float64, to string) (tx *types.Transaction, broadcasted bool, errors error)

func (*Account) SendETH

func (self *Account) SendETH(ethAmount float64, to string) (tx *types.Transaction, broadcasted bool, errors error)

func (*Account) SendETHToMultipleAddresses

func (self *Account) SendETHToMultipleAddresses(amounts []float64, addresses []string) (txs []*types.Transaction, broadcasteds []bool, errors []error)

func (*Account) SendETHToMultipleAddressesWithPrice

func (self *Account) SendETHToMultipleAddressesWithPrice(priceGwei float64, amounts []float64, addresses []string) (txs []*types.Transaction, broadcasteds []bool, errors []error)

func (*Account) SendETHWithNonceAndPrice

func (self *Account) SendETHWithNonceAndPrice(nonce uint64, priceGwei float64, ethAmount *big.Int, to string) (tx *types.Transaction, broadcasted bool, errors error)

func (*Account) SetERC20Allowance

func (self *Account) SetERC20Allowance(tokenAddr string, spender string, tokenAmount float64) (tx *types.Transaction, broadcasted bool, errors error)

type KeySigner

type KeySigner struct {
	// contains filtered or unexported fields
}

func NewKeySigner

func NewKeySigner(key *ecdsa.PrivateKey) *KeySigner

func (*KeySigner) SignTx

func (self *KeySigner) SignTx(tx *types.Transaction) (*types.Transaction, error)

type Signer

type Signer interface {
	SignTx(tx *types.Transaction) (*types.Transaction, error)
}

type TrezorSigner

type TrezorSigner struct {
	// contains filtered or unexported fields
}

func NewRopstenTrezorSigner

func NewRopstenTrezorSigner(path string, address string) (*TrezorSigner, error)

func NewTrezorSigner

func NewTrezorSigner(path string, address string) (*TrezorSigner, error)

func (*TrezorSigner) ConnectAndMonitorTrezor

func (self *TrezorSigner) ConnectAndMonitorTrezor() error

func (*TrezorSigner) GetWallet

func (self *TrezorSigner) GetWallet() accounts.Wallet

func (*TrezorSigner) SignTx

func (self *TrezorSigner) SignTx(tx *types.Transaction) (*types.Transaction, error)

Jump to

Keyboard shortcuts

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