Documentation
¶
Index ¶
- Variables
- type Eth
- type EthAPI
- func (eth *EthAPI) Accounts() (addrs []common.Address, err error)
- func (eth *EthAPI) BlockNumber() (result *big.Int, err error)
- func (eth *EthAPI) Call(tx *common.TransactionRequest, quantity string) ([]byte, error)
- func (eth *EthAPI) Coinbase() (addr common.Address, err error)
- func (eth *EthAPI) EstimateGas(tx *common.TransactionRequest, quantity string) (result *big.Int, err error)
- func (eth *EthAPI) GasPrice() (result *big.Int, err error)
- func (eth *EthAPI) GetBalance(address common.Address, quantity string) (result *big.Int, err error)
- func (eth *EthAPI) GetBlockByHash(hash common.Hash, full bool) (*common.Block, error)
- func (eth *EthAPI) GetBlockByNumber(quantity string, full bool) (*common.Block, error)
- func (eth *EthAPI) GetBlockTransactionCountByHash(hash common.Hash) (result *big.Int, err error)
- func (eth *EthAPI) GetBlockTransactionCountByNumber(quantity string) (result *big.Int, err error)
- func (eth *EthAPI) GetCode(address common.Address, quantity string) ([]byte, error)
- func (eth *EthAPI) GetCompilers() (result []string, err error)
- func (eth *EthAPI) GetFilterChanges(filter Filter) (result []interface{}, err error)
- func (eth *EthAPI) GetFilterLogs(filter Filter) (result []interface{}, err error)
- func (eth *EthAPI) GetLogs(filter Filter) (result []interface{}, err error)
- func (eth *EthAPI) GetStorageAt(address common.Address, position uint64, quantity string) (uint64, error)
- func (eth *EthAPI) GetTransactionByBlockHashAndIndex(hash common.Hash, index uint64) (*common.Transaction, error)
- func (eth *EthAPI) GetTransactionByBlockNumberAndIndex(quantity string, index uint64) (*common.Transaction, error)
- func (eth *EthAPI) GetTransactionByHash(hash common.Hash) (*common.Transaction, error)
- func (eth *EthAPI) GetTransactionCount(address common.Address, quantity string) (result *big.Int, err error)
- func (eth *EthAPI) GetTransactionReceipt(hash common.Hash) (*common.TransactionReceipt, error)
- func (eth *EthAPI) GetUncleByBlockHashAndIndex(hash common.Hash, index uint64) (*common.Block, error)
- func (eth *EthAPI) GetUncleByBlockNumberAndIndex(quantity string, index uint64) (*common.Block, error)
- func (eth *EthAPI) GetUncleCountByBlockHash(hash common.Hash) (result *big.Int, err error)
- func (eth *EthAPI) GetUncleCountByBlockNumber(quantity string) (result *big.Int, err error)
- func (eth *EthAPI) GetWork() (header, seed, boundary common.Hash, err error)
- func (eth *EthAPI) HashRate() (uint64, error)
- func (eth *EthAPI) Mining() (bool, error)
- func (eth *EthAPI) NewBlockFilter() (Filter, error)
- func (eth *EthAPI) NewFilter(option *FilterOption) (Filter, error)
- func (eth *EthAPI) NewPendingTransactionFilter() (Filter, error)
- func (eth *EthAPI) ProtocolVersion() (string, error)
- func (eth *EthAPI) ReceiveCrossRawTransactionReq(tx []byte) (common.Hash, error)
- func (eth *EthAPI) SendCrossRawTransaction(tx []byte, url string) (common.Hash, error)
- func (eth *EthAPI) SendRawTransaction(tx []byte) (hash common.Hash, err error)
- func (eth *EthAPI) SendTransaction(tx *common.TransactionRequest) (hash common.Hash, err error)
- func (eth *EthAPI) Sign(address common.Address, data []byte) ([]byte, error)
- func (eth *EthAPI) SubmitWork(nonce uint64, header, mixDigest common.Hash) (bool, error)
- func (eth *EthAPI) Syncing() (common.SyncStatus, error)
- func (eth *EthAPI) UninstallFilter(filter Filter) (bool, error)
- type Filter
- type FilterOption
- type FilterType
- type Net
- type NetAPI
- type WatchChannel
- type Web3
- func (web3 *Web3) CurrentProvider() provider.Provider
- func (web3 *Web3) FromASCII(textString string, padding int) string
- func (web3 *Web3) FromDecimal(value interface{}) string
- func (web3 *Web3) FromWei(number string, unit string) string
- func (web3 *Web3) IsAddress(address string) bool
- func (web3 *Web3) IsConnected() bool
- func (web3 *Web3) Reset(keepSyncing bool)
- func (web3 *Web3) SetProvider(provider provider.Provider)
- func (web3 *Web3) Sha3(data string, options interface{}) string
- func (web3 *Web3) ToASCII(hexString string) string
- func (web3 *Web3) ToBigNumber(value interface{}) (result *big.Rat)
- func (web3 *Web3) ToDecimal(value interface{}) string
- func (web3 *Web3) ToHex(value interface{}) string
- func (web3 *Web3) ToWei(number interface{}, unit string) string
Constants ¶
This section is empty.
Variables ¶
var (
ErrChannelClosed = errors.New("Channel is closed")
)
Functions ¶
This section is empty.
Types ¶
type Eth ¶
type Eth interface { ProtocolVersion() (string, error) Syncing() (common.SyncStatus, error) Coinbase() (common.Address, error) Mining() (bool, error) HashRate() (uint64, error) GasPrice() (*big.Int, error) Accounts() ([]common.Address, error) BlockNumber() (*big.Int, error) GetBalance(address common.Address, quantity string) (*big.Int, error) GetStorageAt(address common.Address, position uint64, quantity string) (uint64, error) GetTransactionCount(address common.Address, quantity string) (*big.Int, error) GetBlockTransactionCountByHash(hash common.Hash) (*big.Int, error) GetBlockTransactionCountByNumber(quantity string) (*big.Int, error) GetUncleCountByBlockHash(hash common.Hash) (*big.Int, error) GetUncleCountByBlockNumber(quantity string) (*big.Int, error) GetCode(address common.Address, quantity string) ([]byte, error) Sign(address common.Address, data []byte) ([]byte, error) SendTransaction(tx *common.TransactionRequest) (common.Hash, error) SendRawTransaction(tx []byte) (common.Hash, error) SendCrossRawTransaction(tx []byte, url string) (common.Hash, error) ReceiveCrossRawTransactionReq(tx []byte) (common.Hash, error) Call(tx *common.TransactionRequest, quantity string) ([]byte, error) EstimateGas(tx *common.TransactionRequest, quantity string) (*big.Int, error) GetBlockByHash(hash common.Hash, full bool) (*common.Block, error) GetBlockByNumber(quantity string, full bool) (*common.Block, error) GetTransactionByHash(hash common.Hash) (*common.Transaction, error) GetTransactionByBlockHashAndIndex(hash common.Hash, index uint64) (*common.Transaction, error) GetTransactionByBlockNumberAndIndex(quantity string, index uint64) (*common.Transaction, error) GetTransactionReceipt(hash common.Hash) (*common.TransactionReceipt, error) GetUncleByBlockHashAndIndex(hash common.Hash, index uint64) (*common.Block, error) GetUncleByBlockNumberAndIndex(quantity string, index uint64) (*common.Block, error) GetCompilers() ([]string, error) // GompileLLL // CompileSolidity // CompileSerpent NewFilter(option *FilterOption) (Filter, error) NewBlockFilter() (Filter, error) NewPendingTransactionFilter() (Filter, error) UninstallFilter(filter Filter) (bool, error) GetFilterChanges(filter Filter) ([]interface{}, error) GetFilterLogs(filter Filter) ([]interface{}, error) GetLogs(filter Filter) ([]interface{}, error) GetWork() (common.Hash, common.Hash, common.Hash, error) SubmitWork(nonce uint64, header common.Hash, mixDigest common.Hash) (bool, error) }
Eth ...
type EthAPI ¶
type EthAPI struct {
// contains filtered or unexported fields
}
EthAPI ...
func (*EthAPI) BlockNumber ¶
BlockNumber returns the number of most recent block.
func (*EthAPI) Call ¶
Call executes a new message call immediately without creating a transaction on the block chain.
func (*EthAPI) EstimateGas ¶
func (eth *EthAPI) EstimateGas(tx *common.TransactionRequest, quantity string) (result *big.Int, err error)
EstimateGas makes a call or transaction, which won't be added to the blockchain and returns the used gas, which can be used for estimating the used gas.
func (*EthAPI) GetBalance ¶
GetBalance returns the balance of the account of given address.
func (*EthAPI) GetBlockByHash ¶
GetBlockByHash returns information about a block by hash.
func (*EthAPI) GetBlockByNumber ¶
GetBlockByNumber returns information about a block by block number.
func (*EthAPI) GetBlockTransactionCountByHash ¶
GetBlockTransactionCountByHash returns the number of transactions in a block from a block matching the given block hash.
func (*EthAPI) GetBlockTransactionCountByNumber ¶
GetBlockTransactionCountByNumber returns the number of transactions in a block from a block matching the given block number.
func (*EthAPI) GetCompilers ¶
GetCompilers returns a list of available compilers in the client.
func (*EthAPI) GetFilterChanges ¶
GetFilterChanges polling method for a filter, which returns an array of logs which occurred since last poll.
func (*EthAPI) GetFilterLogs ¶
GetFilterLogs returns an array of all logs matching filter with given id.
func (*EthAPI) GetStorageAt ¶
func (eth *EthAPI) GetStorageAt(address common.Address, position uint64, quantity string) (uint64, error)
GetStorageAt returns the value from a storage position at a given address.
func (*EthAPI) GetTransactionByBlockHashAndIndex ¶
func (eth *EthAPI) GetTransactionByBlockHashAndIndex(hash common.Hash, index uint64) (*common.Transaction, error)
GetTransactionByBlockHashAndIndex returns information about a transaction by block hash and transaction index position.
func (*EthAPI) GetTransactionByBlockNumberAndIndex ¶
func (eth *EthAPI) GetTransactionByBlockNumberAndIndex(quantity string, index uint64) (*common.Transaction, error)
GetTransactionByBlockNumberAndIndex returns information about a transaction by block number and transaction index position.
func (*EthAPI) GetTransactionByHash ¶
GetTransactionByHash returns the information about a transaction requested by transaction hash.
func (*EthAPI) GetTransactionCount ¶
func (eth *EthAPI) GetTransactionCount(address common.Address, quantity string) (result *big.Int, err error)
GetTransactionCount returns the number of transactions sent from an address.
func (*EthAPI) GetTransactionReceipt ¶
GetTransactionReceipt Returns the receipt of a transaction by transaction hash.
func (*EthAPI) GetUncleByBlockHashAndIndex ¶
func (eth *EthAPI) GetUncleByBlockHashAndIndex(hash common.Hash, index uint64) (*common.Block, error)
GetUncleByBlockHashAndIndex returns information about a uncle of a block by hash and uncle index position.
func (*EthAPI) GetUncleByBlockNumberAndIndex ¶
func (eth *EthAPI) GetUncleByBlockNumberAndIndex(quantity string, index uint64) (*common.Block, error)
GetUncleByBlockNumberAndIndex returns information about a uncle of a block by number and uncle index position.
func (*EthAPI) GetUncleCountByBlockHash ¶
GetUncleCountByBlockHash returns the number of uncles in a block from a block matching the given block hash.
func (*EthAPI) GetUncleCountByBlockNumber ¶
GetUncleCountByBlockNumber returns the number of uncles in a block from a block matching the given block number.
func (*EthAPI) GetWork ¶
GetWork returns the hash of the current block, the seedHash, and the boundary condition to be met ("target").
func (*EthAPI) HashRate ¶
HashRate returns the number of hashes per second that the node is mining with.
func (*EthAPI) NewBlockFilter ¶
NewBlockFilter creates a filter in the node, to notify when a new block arrives. To check if the state has changed, call eth_getFilterChanges.
func (*EthAPI) NewFilter ¶
func (eth *EthAPI) NewFilter(option *FilterOption) (Filter, error)
NewFilter creates a filter object, based on filter options, to notify when the state changes (logs). To check if the state has changed, call eth_getFilterChanges.
func (*EthAPI) NewPendingTransactionFilter ¶
NewPendingTransactionFilter creates a filter in the node, to notify when new pending transactions arrive. To check if the state has changed, call eth_getFilterChanges.
func (*EthAPI) ProtocolVersion ¶
ProtocolVersion returns the current ethereum protocol version.
func (*EthAPI) ReceiveCrossRawTransactionReq ¶ added in v1.1.0
ReceiveCrossRawTransaction creates new message call transaction or a contract creation for signed transactions. Must call sendCrossRawTransaction before this
func (*EthAPI) SendCrossRawTransaction ¶ added in v1.1.0
SendCrossRawTransaction creates new message call transaction or a contract creation for signed transactions.
func (*EthAPI) SendRawTransaction ¶
SendRawTransaction creates new message call transaction or a contract creation for signed transactions.
func (*EthAPI) SendTransaction ¶
SendTransaction creates new message call transaction or a contract creation, if the data field contains code.
func (*EthAPI) SubmitWork ¶
SubmitWork is used for submitting a proof-of-work solution.
func (*EthAPI) Syncing ¶
func (eth *EthAPI) Syncing() (common.SyncStatus, error)
Syncing returns true with an object with data about the sync status or false with nil.
func (*EthAPI) UninstallFilter ¶
UninstallFilter uninstalls a filter with given id. Should always be called when watch is no longer needed. Additonally Filters timeout when they aren't requested with eth_getFilterChanges for a period of time.
type FilterOption ¶
type FilterOption struct { FromBlock string `json:"fromBlock,omitempty"` ToBlock string `json:"toBlock,omitempty"` Address interface{} `json:"address,omitempty"` Topics common.Topics `json:"topics,omitempty"` }
FilterOption ...
func (*FilterOption) String ¶
func (opt *FilterOption) String() string
type FilterType ¶
type FilterType int
const ( TypeNormal FilterType = iota TypeBlockFilter TypeTransactionFilter )
type Net ¶
type Net interface { Version() (string, error) PeerCount() (uint64, error) Listening() (bool, error) }
Net ...
type NetAPI ¶
type NetAPI struct {
// contains filtered or unexported fields
}
NetAPI ...
func (*NetAPI) Listening ¶
Listening returns true if client is actively listening for network connections.
type WatchChannel ¶
type WatchChannel interface { Next() (interface{}, error) Close() }
WatchChannel ...
type Web3 ¶
Web3 Standard interface See https://github.com/ethereum/wiki/wiki/JavaScript-API#web3js-api-reference
func (*Web3) CurrentProvider ¶
CurrentProvider returns the current provider.
func (*Web3) FromDecimal ¶
FromDecimal converts value to it"s hex representation.
func (*Web3) FromWei ¶
FromWei takes a number of wei and converts it to any other ether unit.
Possible units are:
SI Short SI Full Effigy Other
- kwei femtoether babbage - mwei picoether lovelace - gwei nanoether shannon nano - -- microether szabo micro - -- microether szabo micro - -- milliether finney milli - ether -- -- - kether -- grand - mether - gether - tether
func (*Web3) IsConnected ¶
IsConnected checks if a connection to a node exists.
func (*Web3) Reset ¶
Reset state of web3. Resets everything except manager. Uninstalls all filters. Stops polling. If keepSyncing is true, it will uninstall all filters, but will keep the web3.eth.IsSyncing() polls.
func (*Web3) SetProvider ¶
SetProvider sets provider.
func (*Web3) ToBigNumber ¶
ToBigNumber takes an input and transforms it into an *big.Rat.
func (*Web3) ToWei ¶
ToWei takes a number of a unit and converts it to wei.
Possible units are:
SI Short SI Full Effigy Other
- kwei femtoether babbage - mwei picoether lovelace - gwei nanoether shannon nano - -- microether szabo micro - -- microether szabo micro - -- milliether finney milli - ether -- -- - kether -- grand - mether - gether - tether