Documentation ¶
Index ¶
- Variables
- type Client
- func (c *Client) Account() *accounts.Account
- func (c *Client) BalanceAt(addr common.Address) (*big.Int, error)
- func (c *Client) Call(fn func(*ethclient.Client) error) error
- func (c *Client) CallAuth(gasLimit uint64, ...) (*types.Transaction, error)
- func (c *Client) CurrentBlock() (*big.Int, error)
- func (c *Client) Deploy(name string, ...) (ContractData, error)
- func (c *Client) GetReceipt(tx *types.Transaction) (*types.Receipt, error)
- func (c *Client) WaitReceipt(tx *types.Transaction) (*types.Receipt, error)
- type ContractData
Constants ¶
This section is empty.
Variables ¶
var ( ErrAccountNil = fmt.Errorf("Authorized calls can't be made when the account is nil") // ErrReceiptStatusFailed when receiving a failed transaction ErrReceiptStatusFailed = fmt.Errorf("receipt status is failed") // ErrReceiptNotRecieved when unable to retrieve a transaction ErrReceiptNotReceived = fmt.Errorf("receipt not available") )
Functions ¶
This section is empty.
Types ¶
type Client ¶
Client is an ethereum client to call Smart Contract methods.
func NewClient ¶
func NewClient(client *ethclient.Client, account *accounts.Account, ks *ethkeystore.KeyStore) *Client
NewClient creates a Client instance. The account is not mandatory (it can be nil). If the account is nil, CallAuth will fail with ErrAccountNil.
func (*Client) CallAuth ¶
func (c *Client) CallAuth(gasLimit uint64, fn func(*ethclient.Client, *bind.TransactOpts) (*types.Transaction, error)) (*types.Transaction, error)
CallAuth performs a Smart Contract method call that requires authorization. This call requires a valid account with Ether that can be spend during the call.
func (*Client) CurrentBlock ¶ added in v0.0.8
CurrentBlock returns the current block number in the blockchain
func (*Client) Deploy ¶ added in v0.0.8
func (c *Client) Deploy(name string, fn func(c *ethclient.Client, auth *bind.TransactOpts) (common.Address, *types.Transaction, interface{}, error)) (ContractData, error)
Deploy a smart contract. `name` is used to log deployment information. fn is a wrapper to the deploy function generated by abigen. In case of error, the returned `ContractData` may have some parameters filled depending on the kind of error that ocurred. successfull.
func (*Client) GetReceipt ¶ added in v0.0.8
GetReceipt will check if a transaction is confirmed and return immediately, waiting at most 1 second and returning error if the transaction is still pending.
func (*Client) WaitReceipt ¶
WaitReceipt will block until a transaction is confirmed. Internally it polls the state every 200 milliseconds.