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 NewLedgerAccount(path string, address string) (*Account, error)
- func NewRopstenAccountFromKeystore(file string, password string) (*Account, error)
- func NewRopstenAccountFromPrivateKey(hex string) (*Account, error)
- func NewRopstenAccountFromPrivateKeyFile(file string) (*Account, error)
- func NewRopstenLedgerAccount(path string, address string) (*Account, error)
- func NewRopstenTrezorAccount(path string, address string) (*Account, error)
- func NewTomoAccountFromKeystore(file string, password string) (*Account, error)
- func NewTomoAccountFromPrivateKey(hex string) (*Account, error)
- func NewTomoAccountFromPrivateKeyFile(file string) (*Account, error)
- func NewTomoLedgerAccount(path string, address string) (*Account, error)
- func NewTomoTrezorAccount(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) DeployContract(extraGas uint64, value float64, abiJson string, bytecode []byte, ...) (tx *types.Transaction, broadcasted bool, caddr common.Address, errors error)
- func (self *Account) DeployContractWithNonceAndPrice(nonce uint64, priceGwei float64, extraGas uint64, value float64, ...) (tx *types.Transaction, broadcasted bool, caddr common.Address, 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) SetBroadcaster(b *broadcaster.Broadcaster)
- func (self *Account) SetERC20Allowance(tokenAddr string, spender string, tokenAmount float64) (tx *types.Transaction, broadcasted bool, errors error)
- func (self *Account) SetReader(r *reader.EthReader)
- func (self *Account) SignTx(tx *types.Transaction) (*types.Transaction, error)
- func (self *Account) SignTxAndBroadcast(tx *types.Transaction) (*types.Transaction, bool, error)
- type KeySigner
- type Signer
- type TomoKeySigner
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 NewRopstenLedgerAccount ¶ added in v0.2.0
func NewRopstenTrezorAccount ¶
func NewTomoLedgerAccount ¶ added in v0.2.0
func NewTomoTrezorAccount ¶
func (*Account) CallContract ¶
func (*Account) CallContractWithNonceAndPrice ¶
func (*Account) CallContractWithPrice ¶
func (*Account) CallERC20Contract ¶
func (*Account) CallERC20ContractWithNonceAndPrice ¶
func (*Account) CallERC20ContractWithPrice ¶
func (*Account) DeployContract ¶
func (*Account) DeployContractWithNonceAndPrice ¶
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) SetBroadcaster ¶ added in v0.2.4
func (self *Account) SetBroadcaster(b *broadcaster.Broadcaster)
func (*Account) SetERC20Allowance ¶
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)
Source Files ¶
Click to show internal directories.
Click to hide internal directories.