eth

package
v0.0.0-...-f1d979d Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2018 License: GPL-3.0 Imports: 15 Imported by: 12

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ContractLogFilterer

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

ContractLogFilterer extends FilterLogs method of bind.BoundContract struct to allow filter multiple events

func NewContractLogFilterer

func NewContractLogFilterer(address common.Address, abi abi.ABI, filterer bind.ContractFilterer) *ContractLogFilterer

NewContractLogFilterer creates a instance of ContractLogFilterer.

func (*ContractLogFilterer) FilterLogs

func (c *ContractLogFilterer) FilterLogs(opts *bind.FilterOpts, names []string, query ...[]interface{}) (chan types.Log, event.Subscription, error)

FilterLogs filters contract logs for past blocks, returning the necessary channels to construct a strongly typed bound iterator on top of them.

type Eth

type Eth struct {
	Backend           backend.Backend
	LogFun            log.Fun
	SuggestedGasPrice *big.Int
}

Eth simplifies some operations with the Ethereum network

func New

func New(b backend.Backend, lf log.Fun) *Eth

New creates new instance of Eth

func (*Eth) Log

func (e *Eth) Log(msg string, ctx ...interface{})

Log writes message to the log with the context data

func (*Eth) NewHandleNonceBackend

func (e *Eth) NewHandleNonceBackend(handleAddresses []common.Address) *Eth

NewHandleNonceBackend returns new instance of Eth which internally handles nonce of the given addresses. It still calls PendingNonceAt of inner backend, but returns PendingNonceAt as a maximum of pending nonce in block-chain and internally stored nonce. It increments nonce for the given addresses after each successfully sent transaction (transaction may eventually fail in block-cain). Implementation is not thread-safe and should be used within one goroutine because otherwise invocations of PendingNonceAt and SendTransaction should be done atomically to have sequence of nonce without gaps (so that nonce would be equal to number of transactions sent).

func (*Eth) NewSession

func (e *Eth) NewSession(key *ecdsa.PrivateKey) *Session

NewSession creates an instance of Session

func (*Eth) UpdateSuggestedGasPrice

func (e *Eth) UpdateSuggestedGasPrice(ctx context.Context) error

UpdateSuggestedGasPrice initializes suggested gas price from backend

func (*Eth) WaitForTxReceipt

func (e *Eth) WaitForTxReceipt(ctx context.Context, txHash common.Hash) (tr *types.Receipt, err error)

WaitForTxReceipt waits until the transaction is successfully mined. It returns error if receipt status is not equal to `types.ReceiptStatusSuccessful`.

type Session

type Session struct {
	*Eth
	TransactOpts bind.TransactOpts
}

Session provides holds basic pre-configured parameters like backend, authorization, logging

func (*Session) IsEnoughFunds

func (s *Session) IsEnoughFunds(ctx context.Context, gasLimit int64) (enough bool, minBalance *big.Int, err error)

IsEnoughFunds retrieves current account balance and checks if it's enough funds given gas limit. SetGasPrice needs to be called with non-nil parameter before calling this method.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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