account

package
v0.8.4 Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2022 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 NewBSCAccountFromKeystore added in v0.7.3

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

func NewBSCAccountFromPrivateKey added in v0.7.3

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

func NewBSCAccountFromPrivateKeyFile added in v0.7.3

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

func NewBSCLedgerAccount added in v0.7.3

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

func NewBSCTestnetAccountFromKeystore added in v0.7.3

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

func NewBSCTestnetAccountFromPrivateKey added in v0.7.3

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

func NewBSCTestnetAccountFromPrivateKeyFile added in v0.7.3

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

func NewBSCTestnetLedgerAccount added in v0.7.3

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

func NewBSCTestnetTrezorAccount added in v0.7.3

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

func NewBSCTrezorAccount added in v0.7.3

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

func NewKeystoreAccountGeneric added in v0.7.5

func NewKeystoreAccountGeneric(file string, password string, reader *reader.EthReader, broadcaster *broadcaster.Broadcaster, chainID int64) (*Account, error)

func NewKovanAccountFromKeystore added in v0.5.0

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

func NewKovanAccountFromPrivateKey added in v0.5.0

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

func NewKovanAccountFromPrivateKeyFile added in v0.5.0

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

func NewKovanLedgerAccount added in v0.5.0

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

func NewKovanTrezorAccount added in v0.5.0

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

func NewLedgerAccount

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

func NewLedgerAccountGeneric added in v0.7.5

func NewLedgerAccountGeneric(path string, address string, reader *reader.EthReader, broadcaster *broadcaster.Broadcaster, chainID int64) (*Account, error)

func NewRinkebyAccountFromKeystore added in v0.5.0

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

func NewRinkebyAccountFromPrivateKey added in v0.5.0

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

func NewRinkebyAccountFromPrivateKeyFile added in v0.5.0

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

func NewRinkebyLedgerAccount added in v0.5.0

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

func NewRinkebyTrezorAccount added in v0.5.0

func NewRinkebyTrezorAccount(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 NewTrezorAccountGeneric added in v0.7.5

func NewTrezorAccountGeneric(path string, address string, reader *reader.EthReader, broadcaster *broadcaster.Broadcaster, chainID int64) (*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) CallContractWithABI added in v0.6.0

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

func (*Account) CallContractWithABINonceAndPrice added in v0.6.0

func (self *Account) CallContractWithABINonceAndPrice(
	a *abi.ABI, nonce uint64, priceGwei float64, 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) PackDataWithABI added in v0.6.0

func (self *Account) PackDataWithABI(a *abi.ABI, 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, gasLimit 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, chainID int64) *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