account

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2020 License: MIT Imports: 21 Imported by: 1

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 NewLedgerAccount

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

func NewRopstenAccountFromKeystore

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

func NewRopstenAccountFromPrivateKey

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

func NewRopstenAccountFromPrivateKeyFile

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

func NewRopstenLedgerAccount added in v0.2.0

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

func NewRopstenTrezorAccount

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

func NewTomoAccountFromKeystore

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

func NewTomoAccountFromPrivateKey

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

func NewTomoAccountFromPrivateKeyFile

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

func NewTomoLedgerAccount added in v0.2.0

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

func NewTomoTrezorAccount

func NewTomoTrezorAccount(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) DeployContract

func (self *Account) DeployContract(
	extraGas uint64, value float64, abiJson string, bytecode []byte,
	params ...interface{}) (tx *types.Transaction, broadcasted bool, caddr common.Address, errors error)

func (*Account) DeployContractWithNonceAndPrice

func (self *Account) DeployContractWithNonceAndPrice(
	nonce uint64, priceGwei float64, extraGas uint64,
	value float64, abiJson string, bytecode []byte,
	params ...interface{}) (tx *types.Transaction, broadcasted bool, caddr common.Address, 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) SetBroadcaster added in v0.2.4

func (self *Account) SetBroadcaster(b *broadcaster.Broadcaster)

func (*Account) SetERC20Allowance

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

func (*Account) SetReader added in v0.2.4

func (self *Account) SetReader(r *reader.EthReader)

func (*Account) SignTx added in v0.2.3

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

func (*Account) SignTxAndBroadcast

func (self *Account) SignTxAndBroadcast(tx *types.Transaction) (*types.Transaction, bool, 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 TomoKeySigner

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

func NewTomoKeySigner

func NewTomoKeySigner(key *ecdsa.PrivateKey) *TomoKeySigner

func (*TomoKeySigner) SignTx

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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