api

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 18, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewServer

func NewServer(cm *chain.Manager, cmZen *chain.Manager, s *syncer.Syncer, sZen *syncer.Syncer, w *walletutil.Wallet, hdb *hostdb.HostDB) http.Handler

NewServer returns an HTTP handler that serves the hsd API.

Types

type Balance

type Balance struct {
	Siacoins         types.Currency `json:"siacoins"`
	ImmatureSiacoins types.Currency `json:"immatureSiacoins"`
}

Balance combines mature and immature values.

type Client

type Client struct {
	// contains filtered or unexported fields
}

A Client provides methods for interacting with a hsd API server.

func NewClient

func NewClient(addr, password string) *Client

NewClient returns a client that communicates with a hsd server listening on the specified address.

func (*Client) Address

func (c *Client) Address(network string) (resp types.Address, err error)

Address returns the address controlled by the wallet.

func (*Client) Balance

func (c *Client) Balance(network string) (resp WalletBalanceResponse, err error)

Balance returns the wallet balance.

func (*Client) ConsensusNetwork

func (c *Client) ConsensusNetwork(network string) (resp *consensus.Network, err error)

ConsensusNetwork returns the node's network metadata.

func (*Client) ConsensusTip

func (c *Client) ConsensusTip(network string) (resp ConsensusTipResponse, err error)

ConsensusTip returns the current tip index.

func (*Client) ConsensusTipState

func (c *Client) ConsensusTipState(network string) (resp consensus.State, err error)

ConsensusTipState returns the current tip state.

func (*Client) FinalizeUpdates

func (c *Client) FinalizeUpdates(id hostdb.UpdateID) error

FinalizeUpdates confirms the receipt of the HostDB updates.

func (*Client) NodeStatus

func (c *Client) NodeStatus() (resp NodeStatusResponse, err error)

NodeStatus returns the status of the node.

func (*Client) Outputs

func (c *Client) Outputs(network string) (sc []types.SiacoinElement, sf []types.SiafundElement, err error)

Outputs returns the set of unspent outputs controlled by the wallet.

func (*Client) PoolTransactions

func (c *Client) PoolTransactions(network string) (resp []wallet.PoolTransaction, err error)

PoolTransactions returns all txpool transactions relevant to the wallet.

func (*Client) SyncerPeers

func (c *Client) SyncerPeers(network string) (resp []GatewayPeer, err error)

SyncerPeers returns the current peers of the syncer.

func (*Client) TxpoolFee

func (c *Client) TxpoolFee(network string) (resp types.Currency, err error)

TxpoolFee returns the recommended fee (per weight unit) to ensure a high probability of inclusion in the next block.

func (*Client) TxpoolTransactions

func (c *Client) TxpoolTransactions(network string) (txns []types.Transaction, v2txns []types.V2Transaction, err error)

TxpoolTransactions returns all transactions in the transaction pool.

func (*Client) Updates

func (c *Client) Updates() (resp hostdb.HostUpdates, err error)

Updates returns a list of most recent HostDB updates.

type ConsensusTipResponse

type ConsensusTipResponse struct {
	Network string        `json:"network"`
	Height  uint64        `json:"height"`
	BlockID types.BlockID `json:"id"`
	Synced  bool          `json:"synced"`
}

ConsensusTipResponse is the response type for /consensus/tip.

type GatewayPeer

type GatewayPeer struct {
	Addr    string `json:"addr"`
	Inbound bool   `json:"inbound"`
	Version string `json:"version"`
}

A GatewayPeer is a currently-connected peer.

type NodeStatusResponse

type NodeStatusResponse struct {
	Version    string  `json:"version"`
	Height     uint64  `json:"heightMainnet"`
	HeightZen  uint64  `json:"heightZen"`
	Balance    Balance `json:"balanceMainnet"`
	BalanceZen Balance `json:"balanceZen"`
}

NodeStatusResponse is the response type for /node/status.

type TxpoolTransactionsResponse

type TxpoolTransactionsResponse struct {
	Transactions   []types.Transaction   `json:"transactions"`
	V2Transactions []types.V2Transaction `json:"v2transactions"`
}

TxpoolTransactionsResponse is the response type for /txpool/transactions.

type WalletBalanceResponse

type WalletBalanceResponse struct {
	Network          string         `json:"network"`
	Siacoins         types.Currency `json:"siacoins"`
	ImmatureSiacoins types.Currency `json:"immatureSiacoins"`
	Siafunds         uint64         `json:"siafunds"`
}

WalletBalanceResponse is the response type for /wallet/balance.

type WalletOutputsResponse

type WalletOutputsResponse struct {
	Network        string                 `json:"network"`
	SiacoinOutputs []types.SiacoinElement `json:"siacoinOutputs"`
	SiafundOutputs []types.SiafundElement `json:"siafundOutputs"`
}

WalletOutputsResponse is the response type for /wallet/outputs.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL