Documentation ¶
Overview ¶
Package xeth is the interface to all Ethereum functionality.
Index ¶
- Constants
- func DefaultGas() *big.Int
- type Block
- type Frontend
- type KeyVal
- type Object
- type PReceipt
- type Peer
- type Receipt
- type State
- type Transaction
- type Whisper
- func (self *Whisper) HasIdentity(key string) bool
- func (self *Whisper) Messages(id int) []WhisperMessage
- func (self *Whisper) NewIdentity() string
- func (self *Whisper) Post(payload string, to, from string, topics []string, priority, ttl uint32) error
- func (self *Whisper) Watch(to, from string, topics [][]string, fn func(WhisperMessage)) int
- type WhisperMessage
- type XEth
- func (self *XEth) Accounts() []string
- func (self *XEth) AllLogs(earliest, latest int64, skip, max int, address []string, topics [][]string) state.Logs
- func (self *XEth) AtStateNum(num int64) *XEth
- func (self *XEth) BalanceAt(addr string) string
- func (self *XEth) Block(v interface{}) *Block
- func (self *XEth) BlockByHash(strHash string) *Block
- func (self *XEth) BlockByNumber(num int64) *Block
- func (self *XEth) BlockFilterChanged(id int) []common.Hash
- func (self *XEth) Call(fromStr, toStr, valueStr, gasStr, gasPriceStr, dataStr string) (string, string, error)
- func (self *XEth) ClientVersion() string
- func (self *XEth) CodeAt(address string) string
- func (self *XEth) CodeAtBytes(address string) []byte
- func (self *XEth) Coinbase() string
- func (self *XEth) ConfirmTransaction(tx string) bool
- func (self *XEth) CurrentBlock() *types.Block
- func (self *XEth) DbGet(key []byte) ([]byte, error)
- func (self *XEth) DbPut(key, val []byte) bool
- func (self *XEth) DefaultGasPrice() *big.Int
- func (self *XEth) EachStorage(addr string) string
- func (self *XEth) EthBlockByHash(strHash string) *types.Block
- func (self *XEth) EthBlockByNumber(num int64) *types.Block
- func (self *XEth) EthTransactionByHash(hash string) (tx *types.Transaction, blhash common.Hash, blnum *big.Int, txi uint64)
- func (self *XEth) EthVersion() string
- func (self *XEth) FromAscii(str string) string
- func (self *XEth) FromNumber(str string) string
- func (self *XEth) GasLimit() *big.Int
- func (self *XEth) GetBlockReceipts(bhash common.Hash) types.Receipts
- func (self *XEth) GetFilterType(id int) byte
- func (self *XEth) GetTxReceipt(txhash common.Hash) *types.Receipt
- func (self *XEth) HashRate() int64
- func (self *XEth) IsContract(address string) bool
- func (self *XEth) IsListening() bool
- func (self *XEth) IsMining() bool
- func (self *XEth) LogFilterChanged(id int) state.Logs
- func (self *XEth) Logs(id int) state.Logs
- func (self *XEth) NetworkVersion() string
- func (self *XEth) NewBlockFilter() int
- func (self *XEth) NewLogFilter(earliest, latest int64, skip, max int, address []string, topics [][]string) int
- func (self *XEth) NewTransactionFilter() int
- func (p *XEth) NewWhisperFilter(to, from string, topics [][]string) int
- func (self *XEth) NumberToHuman(balance string) string
- func (self *XEth) PeerCount() int
- func (self *XEth) PushTx(encodedTx string) (string, error)
- func (self *XEth) RemoteMining() *miner.RemoteAgent
- func (self *XEth) SetMining(shouldmine bool, threads int) bool
- func (self *XEth) SetSolc(solcPath string) (*compiler.Solidity, error)
- func (self *XEth) Sign(fromStr, hashStr string, didUnlock bool) (string, error)
- func (self *XEth) Solc() (*compiler.Solidity, error)
- func (self *XEth) State() *State
- func (self *XEth) StorageAt(addr, storageAddr string) string
- func (self *XEth) ToAscii(str string) string
- func (self *XEth) Transact(fromStr, toStr, nonceStr, valueStr, gasStr, gasPriceStr, codeStr string) (string, error)
- func (self *XEth) TransactionFilterChanged(id int) []common.Hash
- func (self *XEth) TxCountAt(address string) int
- func (self *XEth) UninstallFilter(id int) bool
- func (p *XEth) UninstallWhisperFilter(id int) bool
- func (self *XEth) UpdateState() (wait chan *big.Int)
- func (self *XEth) Whisper() *Whisper
- func (self *XEth) WhisperMessages(id int) []WhisperMessage
- func (self *XEth) WhisperMessagesChanged(id int) []WhisperMessage
- func (self *XEth) WhisperVersion() string
- func (self *XEth) WithState(statedb *state.StateDB) *XEth
Constants ¶
const ( UnknownFilterTy = iota BlockFilterTy TransactionFilterTy LogFilterTy )
byte will be inferred
Variables ¶
This section is empty.
Functions ¶
func DefaultGas ¶
Types ¶
type Block ¶
type Block struct { Size string `json:"size"` Number int `json:"number"` Hash string `json:"hash"` Transactions *common.List `json:"transactions"` Uncles *common.List `json:"uncles"` Time *big.Int `json:"time"` Coinbase string `json:"coinbase"` Name string `json:"name"` GasLimit string `json:"gasLimit"` GasUsed string `json:"gasUsed"` PrevHash string `json:"prevHash"` Bloom string `json:"bloom"` Raw string `json:"raw"` // contains filtered or unexported fields }
Block interface exposed to QML
func (*Block) GetTransaction ¶
func (self *Block) GetTransaction(hash string) *Transaction
type Frontend ¶
type Frontend interface { // UnlockAccount is called when a transaction needs to be signed // but the key corresponding to the transaction's sender is // locked. // // It should unlock the account with the given address and return // true if unlocking succeeded. UnlockAccount(address []byte) bool // This is called for all transactions inititated through // Transact. It should prompt the user to confirm the transaction // and return true if the transaction was acknowledged. // // ConfirmTransaction is not used for Call transactions // because they cannot change any state. ConfirmTransaction(tx string) bool }
Frontend should be implemented by users of XEth. Its methods are called whenever XEth makes a decision that requires user input.
type Object ¶
type Object struct {
*state.StateObject
}
func NewObject ¶
func NewObject(state *state.StateObject) *Object
func (*Object) StorageString ¶
type PReceipt ¶
type PReceipt struct { CreatedContract bool `json:"createdContract"` Address string `json:"address"` Hash string `json:"hash"` Sender string `json:"sender"` }
func NewPReciept ¶
type Peer ¶
type Receipt ¶
type Receipt struct { CreatedContract bool `json:"createdContract"` Address string `json:"address"` Hash string `json:"hash"` Sender string `json:"sender"` }
func NewReciept ¶
type Transaction ¶
type Transaction struct { Value string `json:"value"` Gas string `json:"gas"` GasPrice string `json:"gasPrice"` Hash string `json:"hash"` Address string `json:"address"` Sender string `json:"sender"` RawData string `json:"rawData"` Data string `json:"data"` Contract bool `json:"isContract"` CreatesContract bool `json:"createsContract"` Confirmations int `json:"confirmations"` // contains filtered or unexported fields }
func NewTx ¶
func NewTx(tx *types.Transaction) *Transaction
func (*Transaction) ToString ¶
func (self *Transaction) ToString() string
type Whisper ¶
Whisper represents the API wrapper around the internal whisper implementation.
func NewWhisper ¶
NewWhisper wraps an internal whisper client into an external API version.
func (*Whisper) HasIdentity ¶
HasIdentity checks if the the whisper node is configured with the private key of the specified public pair.
func (*Whisper) Messages ¶
func (self *Whisper) Messages(id int) []WhisperMessage
Messages retrieves all the currently pooled messages matching a filter id.
func (*Whisper) NewIdentity ¶
NewIdentity generates a new cryptographic identity for the client, and injects it into the known identities for message decryption.
type WhisperMessage ¶
type WhisperMessage struct { Payload string `json:"payload"` To string `json:"to"` From string `json:"from"` Sent int64 `json:"sent"` TTL int64 `json:"ttl"` Hash string `json:"hash"` // contains filtered or unexported fields }
WhisperMessage is the external API representation of a whisper.Message.
func NewWhisperMessage ¶
func NewWhisperMessage(message *whisper.Message) WhisperMessage
NewWhisperMessage converts an internal message into an API version.
type XEth ¶
type XEth struct {
// contains filtered or unexported fields
}
func New ¶
New creates an XEth that uses the given frontend. If a nil Frontend is provided, a default frontend which confirms all transactions will be used.
func (*XEth) AtStateNum ¶
func (*XEth) BlockByHash ¶
func (*XEth) BlockByNumber ¶
func (*XEth) ClientVersion ¶
func (*XEth) CodeAtBytes ¶
func (*XEth) ConfirmTransaction ¶
func (*XEth) CurrentBlock ¶
func (*XEth) DefaultGasPrice ¶
func (*XEth) EachStorage ¶
func (*XEth) EthTransactionByHash ¶
func (*XEth) EthVersion ¶
func (*XEth) FromNumber ¶
func (*XEth) GetBlockReceipts ¶
func (*XEth) GetFilterType ¶
func (*XEth) IsContract ¶
func (*XEth) IsListening ¶
func (*XEth) NetworkVersion ¶
func (*XEth) NewBlockFilter ¶
func (*XEth) NewLogFilter ¶
func (*XEth) NewTransactionFilter ¶
func (*XEth) NewWhisperFilter ¶
NewWhisperFilter creates and registers a new message filter to watch for inbound whisper messages. All parameters at this point are assumed to be HEX encoded.
func (*XEth) NumberToHuman ¶
func (*XEth) RemoteMining ¶
func (self *XEth) RemoteMining() *miner.RemoteAgent
func (*XEth) TransactionFilterChanged ¶
func (*XEth) UninstallFilter ¶
func (*XEth) UninstallWhisperFilter ¶
UninstallWhisperFilter disables and removes an existing filter.
func (*XEth) UpdateState ¶
subscribes to new head block events and waits until blockchain height is greater n at any time given the current head, waits for the next chain event sets the state to the current head loop is async and quit by closing the channel used in tests and JS console debug module to control advancing private chain manually Note: this is not threadsafe, only called in JS single process and tests
func (*XEth) WhisperMessages ¶
func (self *XEth) WhisperMessages(id int) []WhisperMessage
WhisperMessages retrieves all the known messages that match a specific filter.
func (*XEth) WhisperMessagesChanged ¶
func (self *XEth) WhisperMessagesChanged(id int) []WhisperMessage
WhisperMessagesChanged retrieves all the new messages matched by a filter since the last retrieval