Documentation ¶
Overview ¶
Package client manages connections and interactions with the EVM chain
Index ¶
- func EtherToWei(eth *big.Float) *big.Int
- func PrivateKeyString(privateKey *ecdsa.PrivateKey) string
- func PrivateKeyToAddress(privateKey *ecdsa.PrivateKey) (common.Address, error)
- func WeiToEther(wei *big.Int) *big.Float
- func WeiToGwei(wei *big.Int) *big.Float
- type Wallet
- func (w *Wallet) Balance() (*big.Int, error)
- func (w *Wallet) BalanceAt(address common.Address) (*big.Int, error)
- func (w *Wallet) BlockByNumber(blockNumber *big.Int) (*types.Block, error)
- func (w *Wallet) ConfirmTx(confirmedChan chan struct{}, errChan chan error, ...)
- func (w *Wallet) ConfirmTxWait(ctx context.Context, transaction *types.Transaction) error
- func (w *Wallet) SendTransaction(timeBeforeResending time.Duration, reSendTipMultiplier *big.Float, ...)
- func (w *Wallet) SubscribeNewBlocks(ctx context.Context, ch chan<- *types.Header) (ethereum.Subscription, error)
- func (w *Wallet) TransactionOpts() (*bind.TransactOpts, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func PrivateKeyString ¶
func PrivateKeyString(privateKey *ecdsa.PrivateKey) string
PrivateKeyString easy converter of a private key to its hex format
func PrivateKeyToAddress ¶
func PrivateKeyToAddress(privateKey *ecdsa.PrivateKey) (common.Address, error)
PrivateKeyToAddress is a handy converter for an ecdsa private key to a usable eth address
Types ¶
type Wallet ¶
client wraps the standard Ethereum client
func NewWallet ¶
func NewWallet(privateKey *ecdsa.PrivateKey, wsURL string) (*Wallet, error)
NewWallet produces a new wallet to manage transactions on the specified chain
func (*Wallet) BlockByNumber ¶ added in v0.0.2
BlockByNumber wraps ether block by number. Input nil for latest block
func (*Wallet) ConfirmTx ¶ added in v0.0.2
func (w *Wallet) ConfirmTx( confirmedChan chan struct{}, errChan chan error, transaction *types.Transaction, )
ConfirmTx attempts to confirm a tx on chain, sending a struct on the confirmed chan when it does
func (*Wallet) ConfirmTxWait ¶ added in v0.0.2
ConfirmTxWait confirms the transaction, waiting until the tx confirms until it returns
func (*Wallet) SendTransaction ¶
func (w *Wallet) SendTransaction( timeBeforeResending time.Duration, reSendTipMultiplier *big.Float, toAddress common.Address, additionalTip *big.Int, amount *big.Float, )
SendTransaction sends an eth transaction, and confirms it gets on chain. timeBeforeResending determines how long to wait for the transaction to be confirmed before attempting a re-send reSendTipMultiplier multiplies the gas tip when replacing the old transaction
func (*Wallet) SubscribeNewBlocks ¶
func (w *Wallet) SubscribeNewBlocks(ctx context.Context, ch chan<- *types.Header) (ethereum.Subscription, error)
SubscribeNewBlocks wraps SubscribeNewHead
func (*Wallet) TransactionOpts ¶ added in v0.0.2
func (w *Wallet) TransactionOpts() (*bind.TransactOpts, error)
TransactionOpts for deploying contracts. Warning: increases nonce