Documentation ¶
Index ¶
- func NewServer(cm ChainManager, s Syncer, tp TransactionPool) http.Handler
- type ChainManager
- type Client
- func (c *Client) ConsensusTip() (resp ConsensusTipResponse, err error)
- func (c *Client) SyncerConnect(addr string) (err error)
- func (c *Client) SyncerPeers() (resp []SyncerPeerResponse, err error)
- func (c *Client) TxpoolBroadcast(txn types.Transaction, dependsOn []types.Transaction) (err error)
- func (c *Client) TxpoolTransactions() (resp []types.Transaction, err error)
- type ConsensusTipResponse
- type Syncer
- type SyncerConnectRequest
- type SyncerPeerResponse
- type TransactionPool
- type TxpoolBroadcastRequest
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewServer ¶
func NewServer(cm ChainManager, s Syncer, tp TransactionPool) http.Handler
NewServer returns an HTTP handler that serves the explored API.
Types ¶
type ChainManager ¶
A ChainManager manages blockchain state.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
A Client provides methods for interacting with a explored API server.
func NewClient ¶
NewClient returns a client that communicates with a explored server listening on the specified address.
func (*Client) ConsensusTip ¶
func (c *Client) ConsensusTip() (resp ConsensusTipResponse, err error)
ConsensusTip reports information about the current consensus state.
func (*Client) SyncerConnect ¶
SyncerConnect adds the address as a peer of the syncer.
func (*Client) SyncerPeers ¶
func (c *Client) SyncerPeers() (resp []SyncerPeerResponse, err error)
SyncerPeers returns the current peers of the syncer.
func (*Client) TxpoolBroadcast ¶
func (c *Client) TxpoolBroadcast(txn types.Transaction, dependsOn []types.Transaction) (err error)
TxpoolBroadcast broadcasts a transaction to the network.
func (*Client) TxpoolTransactions ¶
func (c *Client) TxpoolTransactions() (resp []types.Transaction, err error)
TxpoolTransactions returns all transactions in the transaction pool.
type ConsensusTipResponse ¶
type ConsensusTipResponse struct { Index types.ChainIndex TotalWork types.Work Difficulty types.Work OakWork types.Work OakTime time.Duration SiafundPool types.Currency FoundationAddress types.Address }
ConsensusTipResponse contains information about the current consensus state.
type Syncer ¶
type Syncer interface { Addr() string Peers() []string Connect(addr string) error BroadcastTransaction(txn types.Transaction, dependsOn []types.Transaction) }
A Syncer can connect to other peers and synchronize the blockchain.
type SyncerConnectRequest ¶
type SyncerConnectRequest struct {
NetAddress string `json:"netAddress"`
}
A SyncerConnectRequest requests that the syncer connect to a peer.
type SyncerPeerResponse ¶
type SyncerPeerResponse struct {
NetAddress string `json:"netAddress"`
}
A SyncerPeerResponse is a unique peer that is being used by the syncer.
type TransactionPool ¶
type TransactionPool interface { Transactions() []types.Transaction AddTransaction(txn types.Transaction) error }
A TransactionPool can validate and relay unconfirmed transactions.
type TxpoolBroadcastRequest ¶
type TxpoolBroadcastRequest struct { DependsOn []types.Transaction `json:"dependsOn"` Transaction types.Transaction `json:"transaction"` }
TxpoolBroadcastRequest is the request for the /txpool/broadcast endpoint. It contains the transaction to broadcast and the transactions that it depends on.