Documentation ¶
Index ¶
- func DefaultGasFactor(i uint64) uint64
- type Client
- func (c *Client) Call(method string, out interface{}, params ...interface{}) error
- func (c *Client) Close() error
- func (c *Client) Eth() *Eth
- func (c *Client) Net() *Net
- func (c *Client) Subscribe(method string, param interface{}, callback func(b []byte)) (func() error, error)
- func (c *Client) SubscribeLogs(callback func(log *web3.Log), addresses []web3.Address, ...) (func() error, error)
- func (c *Client) SubscribeNewHeads(callback func(b *web3.Block)) (func() error, error)
- func (c *Client) SubscribePendingTx(watchAddr web3.Address, callback func(tx *web3.Transaction)) (func() error, error)
- func (c *Client) SubscriptionEnabled() bool
- func (c *Client) Web3() *Web3
- type Eth
- func (e *Eth) Accounts() ([]web3.Address, error)
- func (e *Eth) BlockNumber() (uint64, error)
- func (e *Eth) Call(msg *web3.CallMsg, block web3.BlockNumber) (string, error)
- func (e *Eth) ChainID() (*big.Int, error)
- func (e *Eth) EstimateGas(msg *web3.CallMsg) (uint64, error)
- func (e *Eth) EstimateGasContract(bin []byte) (uint64, error)
- func (e *Eth) GasPrice() (uint64, error)
- func (e *Eth) GetBalance(addr web3.Address, blockNumber web3.BlockNumber) (*big.Int, error)
- func (e *Eth) GetBlockByHash(hash web3.Hash, full bool) (*web3.Block, error)
- func (e *Eth) GetBlockByNumber(i web3.BlockNumber, full bool) (*web3.Block, error)
- func (e *Eth) GetCode(addr web3.Address) (string, error)
- func (e *Eth) GetFilterChanges(id string) ([]*web3.Log, error)
- func (e *Eth) GetFilterChangesBlock(id string) ([]web3.Hash, error)
- func (e *Eth) GetLogs(filter *web3.LogFilter) ([]*web3.Log, error)
- func (e *Eth) GetNonce(addr web3.Address, blockNumber web3.BlockNumber) (uint64, error)
- func (ec *Eth) GetStorage(account web3.Address, key web3.Hash, blockNumber web3.BlockNumber) (web3.Hash, error)
- func (e *Eth) GetTransactionByBlockHashAndIndex(blockHash web3.Hash, index uint64) (*web3.Transaction, error)
- func (e *Eth) GetTransactionByBlockNumberAndIndex(blockNumber web3.BlockNumber, index uint64) (*web3.Transaction, error)
- func (e *Eth) GetTransactionByHash(hash web3.Hash) (*web3.Transaction, error)
- func (e *Eth) GetTransactionReceipt(hash web3.Hash) (*web3.Receipt, error)
- func (e *Eth) NewBlockFilter() (string, error)
- func (e *Eth) NewFilter(filter *web3.LogFilter) (string, error)
- func (e *Eth) SendRawTransaction(data []byte) (web3.Hash, error)
- func (e *Eth) SendTransaction(txn *web3.Transaction) (web3.Hash, error)
- func (e *Eth) UninstallFilter(id string) (bool, error)
- type Net
- type Web3
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultGasFactor ¶
Types ¶
type Client ¶
type Client struct { GasLimitFactor func(gasLimit uint64) uint64 // contains filtered or unexported fields }
Client is the jsonrpc client
func (*Client) Subscribe ¶
func (c *Client) Subscribe(method string, param interface{}, callback func(b []byte)) (func() error, error)
Subscribe starts a new subscription
func (*Client) SubscribeLogs ¶ added in v0.1.2
func (c *Client) SubscribeLogs(callback func(log *web3.Log), addresses []web3.Address, topics ...[][]web3.Hash) (func() error, error)
Emits logs which are part of newly added blocks that match specified filter criteria.
When a chain reorganization occurs, logs which are part of blocks on the old chain will be emitted again with the property removed set to true. Further, logs which are part of the blocks on the new chain are emitted, meaning that it is possible to see logs for the same transaction multiple times in the case of a reorganization.
Parameters is an object with the following fields: adddress (optional): either a string representing an address or an array of such strings.Only logs created from one of these addresses will be emitted. topics: an array of topic specifiers. Each topic specifier is either null, a string representing a topic, or an array of strings.Each position in the array which is not null restricts the emitted logs to only those who have one of the given topics in that position. Some examples of topic specifications: []: Any topics allowed. [A]: A in first position (and anything after). [null, B]: Anything in first position and B in second position (and anything after). [A, B]: A in first position and B in second position (and anything after). [[A, B], [A, B]]: (A or B) in first position and (A or B) in second position (and anything after).
func (*Client) SubscribeNewHeads ¶ added in v0.1.2
Emits an event any time a new header is added to the chain, including during a chain reorganization. When a chain reorganization occurs, this subscription will emit an event containing all new headers for the new chain. In particular, this means that you may see multiple headers emitted with the same height, and when this happens the later header should be taken as the correct one after a reorganization.
func (*Client) SubscribePendingTx ¶ added in v0.1.2
func (*Client) SubscriptionEnabled ¶
SubscriptionEnabled returns true if the subscription endpoints are enabled
type Eth ¶
type Eth struct {
// contains filtered or unexported fields
}
Eth is the eth namespace
func (*Eth) BlockNumber ¶
BlockNumber returns the number of most recent block.
func (*Eth) Call ¶
Call executes a new message call immediately without creating a transaction on the block chain.
func (*Eth) EstimateGas ¶
EstimateGas generates and returns an estimate of how much gas is necessary to allow the transaction to complete.
func (*Eth) EstimateGasContract ¶
EstimateGasContract estimates the gas to deploy a contract
func (*Eth) GetBalance ¶
GetBalance returns the balance of the account of given address.
func (*Eth) GetBlockByHash ¶
GetBlockByHash returns information about a block by hash.
func (*Eth) GetBlockByNumber ¶
GetBlockByNumber returns information about a block by block number.
func (*Eth) GetFilterChanges ¶
GetFilterChanges returns the filter changes for log filters
func (*Eth) GetFilterChangesBlock ¶
GetFilterChangesBlock returns the filter changes for block filters
func (*Eth) GetStorage ¶
func (ec *Eth) GetStorage(account web3.Address, key web3.Hash, blockNumber web3.BlockNumber) (web3.Hash, error)
StorageAt returns the value of key in the contract storage of the given account.
func (*Eth) GetTransactionByBlockHashAndIndex ¶ added in v0.1.2
func (e *Eth) GetTransactionByBlockHashAndIndex(blockHash web3.Hash, index uint64) (*web3.Transaction, error)
GetTransactionByBlockHashAndIndex returns the transaction for the given block hash and index.
func (*Eth) GetTransactionByBlockNumberAndIndex ¶ added in v0.1.2
func (e *Eth) GetTransactionByBlockNumberAndIndex(blockNumber web3.BlockNumber, index uint64) (*web3.Transaction, error)
GetTransactionByBlockNumberAndIndex returns the transaction for the given block number and index.
func (*Eth) GetTransactionByHash ¶
GetTransactionByHash returns a transaction by his hash
func (*Eth) GetTransactionReceipt ¶
GetTransactionReceipt returns the receipt of a transaction by transaction hash.
func (*Eth) NewBlockFilter ¶
NewBlockFilter creates a new block filter
func (*Eth) SendRawTransaction ¶
SendRawTransaction sends a signed transaction in rlp format.
func (*Eth) SendTransaction ¶
SendTransaction creates new message call transaction or a contract creation.
type Net ¶
type Net struct {
// contains filtered or unexported fields
}
Net is the net namespace
func (*Net) Listening ¶
Listening returns true if client is actively listening for network connections
type Web3 ¶
type Web3 struct {
// contains filtered or unexported fields
}
Web3 is the web3 namespace
func (*Web3) ClientVersion ¶
ClientVersion returns the current client version