Documentation ¶
Index ¶
- func AddressFromHex(hex string) (string, error)
- func AddressFromPrivateKey(key *ecdsa.PrivateKey) string
- func PrivateKeyFromFile(file string) (string, *ecdsa.PrivateKey, error)
- func PrivateKeyFromHex(hex string) (string, *ecdsa.PrivateKey, error)
- func PrivateKeyFromKeystore(file string, password string) (string, *ecdsa.PrivateKey, error)
- func RandomPrivateKey(seed string) (string, *ecdsa.PrivateKey)
- func RandomPrivateKeyFile(seed string, dir string) (string, *ecdsa.PrivateKey, error)
- func SeedToPrivateKey(seed string) (string, *ecdsa.PrivateKey)
- func SeedToPrivateKeyFile(seed string, dir string) (filepath string, privkey *ecdsa.PrivateKey, err error)
- type Account
- func NewAccountFromKeystore(file string, password string) (*Account, error)
- func NewAccountFromPrivateKey(hex string) (*Account, error)
- func NewAccountFromPrivateKeyFile(file string) (*Account, error)
- func NewRopstenAccountFromKeystore(file string, password string) (*Account, error)
- func NewRopstenAccountFromPrivateKeyFile(file string) (*Account, error)
- func NewRopstenTrezorAccount(path string, address string) (*Account, error)
- func NewTrezorAccount(path string, address string) (*Account, error)
- func (self *Account) Address() string
- func (self *Account) CallContract(extraGas uint64, value float64, caddr string, function string, ...) (tx *types.Transaction, broadcasted bool, errors error)
- func (self *Account) CallContractWithNonceAndPrice(nonce uint64, priceGwei float64, extraGas uint64, value float64, caddr string, ...) (tx *types.Transaction, broadcasted bool, errors error)
- func (self *Account) CallContractWithPrice(priceGwei float64, extraGas uint64, value float64, caddr string, ...) (tx *types.Transaction, broadcasted bool, errors error)
- func (self *Account) CallERC20Contract(extraGas uint64, value float64, caddr string, function string, ...) (tx *types.Transaction, broadcasted bool, errors error)
- func (self *Account) CallERC20ContractWithNonceAndPrice(nonce uint64, priceGwei float64, extraGas uint64, value float64, caddr string, ...) (tx *types.Transaction, broadcasted bool, errors error)
- func (self *Account) CallERC20ContractWithPrice(priceGwei float64, extraGas uint64, value float64, caddr string, ...) (tx *types.Transaction, broadcasted bool, errors error)
- func (self *Account) ERC20Balance(tokenAddr string) (*big.Int, error)
- func (self *Account) ETHBalance() (*big.Int, error)
- func (self *Account) GetMinedNonce() (uint64, error)
- func (self *Account) GetPendingNonce() (uint64, error)
- func (self *Account) ListOfPendingNonces() ([]uint64, error)
- func (self *Account) PackData(caddr string, function string, params ...interface{}) ([]byte, error)
- func (self *Account) PackERC20Data(function string, params ...interface{}) ([]byte, error)
- func (self *Account) SendAllERC20(tokenAddr string, to string) (tx *types.Transaction, broadcasted bool, errors error)
- func (self *Account) SendAllETH(to string) (tx *types.Transaction, broadcasted bool, errors error)
- func (self *Account) SendAllETHWithPrice(priceGwei float64, to string) (tx *types.Transaction, broadcasted bool, errors error)
- func (self *Account) SendERC20(tokenAddr string, tokenAmount float64, to string) (tx *types.Transaction, broadcasted bool, errors error)
- func (self *Account) SendETH(ethAmount float64, to string) (tx *types.Transaction, broadcasted bool, errors error)
- func (self *Account) SendETHToMultipleAddresses(amounts []float64, addresses []string) (txs []*types.Transaction, broadcasteds []bool, errors []error)
- func (self *Account) SendETHToMultipleAddressesWithPrice(priceGwei float64, amounts []float64, addresses []string) (txs []*types.Transaction, broadcasteds []bool, errors []error)
- func (self *Account) SendETHWithNonceAndPrice(nonce uint64, priceGwei float64, ethAmount *big.Int, to string) (tx *types.Transaction, broadcasted bool, errors error)
- func (self *Account) SetERC20Allowance(tokenAddr string, spender string, tokenAmount float64) (tx *types.Transaction, broadcasted bool, errors error)
- type KeySigner
- type Signer
- type TrezorSigner
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddressFromHex ¶
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 RandomPrivateKey ¶
func RandomPrivateKey(seed string) (string, *ecdsa.PrivateKey)
func RandomPrivateKeyFile ¶
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 NewRopstenTrezorAccount ¶
func (*Account) CallContract ¶
func (*Account) CallContractWithNonceAndPrice ¶
func (*Account) CallContractWithPrice ¶
func (*Account) CallERC20Contract ¶
func (*Account) CallERC20ContractWithNonceAndPrice ¶
func (*Account) CallERC20ContractWithPrice ¶
func (*Account) ERC20Balance ¶
func (*Account) GetMinedNonce ¶
func (*Account) GetPendingNonce ¶
func (*Account) ListOfPendingNonces ¶
func (*Account) PackERC20Data ¶
func (*Account) SendAllERC20 ¶
func (*Account) SendAllETH ¶
func (*Account) SendAllETHWithPrice ¶
func (*Account) SendETHToMultipleAddresses ¶
func (*Account) SendETHToMultipleAddressesWithPrice ¶
func (*Account) SendETHWithNonceAndPrice ¶
func (*Account) SetERC20Allowance ¶
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)
Click to show internal directories.
Click to hide internal directories.