api

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2018 License: MIT Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const (
	//MaxBlocksRequest is the maximum number of blocks a client can request.  10 is chosen
	MaxBlocksRequest = 10
)
View Source
const (
	//WriteTimeout max time the socket writer will wait
	WriteTimeout = 5 * time.Second
)

Variables

View Source
var Upgrader = websocket.Upgrader{
	ReadBufferSize:  1024,
	WriteBufferSize: 1024,
}

Upgrader upgrades HTTP connections to WS

Functions

func HttpGET

func HttpGET(url string) (resp *http.Response, err error)

HttpGET is a utility function for making http get requests to sia with a whitelisted user-agent. A non-2xx response does not return an error.

func HttpGETAuthenticated

func HttpGETAuthenticated(url string, password string) (resp *http.Response, err error)

HttpGETAuthenticated is a utility function for making authenticated http get requests to sia with a whitelisted user-agent and the supplied password. A non-2xx response does not return an error.

func HttpPOST

func HttpPOST(url string, data string) (resp *http.Response, err error)

HttpPOST is a utility function for making post requests to Hyperspace with a whitelisted user-agent. A non-2xx response does not return an error.

func HttpPOSTAuthenticated

func HttpPOSTAuthenticated(url string, data string, password string) (resp *http.Response, err error)

HttpPOSTAuthenticated is a utility function for making authenticated http post requests to sia with a whitelisted user-agent and the supplied password. A non-2xx response does not return an error.

func HttpPOSTJSON

func HttpPOSTJSON(url string, data string) (resp *http.Response, err error)

HttpPOSTJSON is a utility function for making json-encoded post requests to Hyperspace with a whitelisted user-agent. A non-2xx response does not return an error.

func RequirePassword

func RequirePassword(h httprouter.Handle, password string) httprouter.Handle

RequirePassword is middleware that requires a request to authenticate with a password using HTTP basic auth. Usernames are ignored. Empty passwords indicate no authentication is required.

func RequireUserAgent

func RequireUserAgent(h http.Handler, ua string) http.Handler

RequireUserAgent is middleware that requires all requests to set a UserAgent that contains the specified string.

func UnrecognizedCallHandler

func UnrecognizedCallHandler(w http.ResponseWriter, req *http.Request)

UnrecognizedCallHandler handles calls to unknown pages (404).

func WriteError

func WriteError(w http.ResponseWriter, err Error, code int)

WriteError an error to the API caller.

func WriteJSON

func WriteJSON(w http.ResponseWriter, obj interface{})

WriteJSON writes the object to the ResponseWriter. If the encoding fails, an error is written instead. The Content-Type of the response header is set accordingly.

func WriteSuccess

func WriteSuccess(w http.ResponseWriter)

WriteSuccess writes the HTTP header with status 204 No Content to the ResponseWriter. WriteSuccess should only be used to indicate that the requested action succeeded AND there is no data to return.

Types

type API

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

API encapsulates a collection of modules and implements a http.Handler to access their methods.

func New

New creates a new Sia API from the provided modules. The API will require authentication using HTTP basic auth for certain endpoints of the supplied password is not the empty string. Usernames are ignored for authentication.

func (*API) ProcessConsensusChange

func (api *API) ProcessConsensusChange(cc modules.ConsensusChange)

ProcessConsensusChange subscription allows the API to react in real time to consensus change events

func (*API) ReceiveUpdatedUnconfirmedTransactions

func (api *API) ReceiveUpdatedUnconfirmedTransactions(diff *modules.TransactionPoolDiff)

ReceiveUpdatedUnconfirmedTransactions subscription allows the API to react in real time to received pending transactions

func (*API) ServeHTTP

func (api *API) ServeHTTP(w http.ResponseWriter, r *http.Request)

api.ServeHTTP implements the http.Handler interface.

type ConsensusBlock

type ConsensusBlock struct {
	BlockID           types.BlockID     `json:"id"`
	BlockHeight       types.BlockHeight `json:"blockheight"`
	BlockHeader       types.BlockHeader `json:"blockheader"`
	Target            types.Target      `json:"target"`
	Difficulty        types.Currency    `json:"difficulty"`
	TotalCoins        types.Currency    `json:"totalcoins"`
	EstimatedHashrate types.Currency    `json:"estimatedhashrate"`

	MinerPayouts map[string]types.SiacoinOutput  `json:"minerpayouts"`
	Transactions map[string]ConsensusTransaction `json:"transactions"`
}

ConsensusBlock is the object returned by a GET request to /consensus/block.

type ConsensusBlocksGet

type ConsensusBlocksGet struct {
	ID           types.BlockID           `json:"id"`
	Height       types.BlockHeight       `json:"height"`
	ParentID     types.BlockID           `json:"parentid"`
	Nonce        types.BlockNonce        `json:"nonce"`
	Timestamp    types.Timestamp         `json:"timestamp"`
	MinerPayouts []types.SiacoinOutput   `json:"minerpayouts"`
	Transactions []ConsensusBlocksGetTxn `json:"transactions"`
}

ConsensusBlocksGet contains all fields of a types.Block and additional fields for ID and Height.

type ConsensusBlocksGetFileContract

type ConsensusBlocksGetFileContract struct {
	ID                 types.FileContractID              `json:"id"`
	FileSize           uint64                            `json:"filesize"`
	FileMerkleRoot     crypto.Hash                       `json:"filemerkleroot"`
	WindowStart        types.BlockHeight                 `json:"windowstart"`
	WindowEnd          types.BlockHeight                 `json:"windowend"`
	Payout             types.Currency                    `json:"payout"`
	ValidProofOutputs  []ConsensusBlocksGetSiacoinOutput `json:"validproofoutputs"`
	MissedProofOutputs []ConsensusBlocksGetSiacoinOutput `json:"missedproofoutputs"`
	UnlockHash         types.UnlockHash                  `json:"unlockhash"`
	RevisionNumber     uint64                            `json:"revisionnumber"`
}

ConsensusBlocksGetFileContract contains all fields of a types.FileContract and an additional ID field.

type ConsensusBlocksGetSiacoinOutput

type ConsensusBlocksGetSiacoinOutput struct {
	ID         types.SiacoinOutputID `json:"id"`
	Value      types.Currency        `json:"value"`
	UnlockHash types.UnlockHash      `json:"unlockhash"`
}

ConsensusBlocksGetSiacoinOutput contains all fields of a types.SiacoinOutput and an additional ID field.

type ConsensusBlocksGetTxn

type ConsensusBlocksGetTxn struct {
	ID                    types.TransactionID               `json:"id"`
	SiacoinInputs         []types.SiacoinInput              `json:"siacoininputs"`
	SiacoinOutputs        []ConsensusBlocksGetSiacoinOutput `json:"siacoinoutputs"`
	FileContracts         []ConsensusBlocksGetFileContract  `json:"filecontracts"`
	FileContractRevisions []types.FileContractRevision      `json:"filecontractrevisions"`
	StorageProofs         []types.StorageProof              `json:"storageproofs"`
	MinerFees             []types.Currency                  `json:"minerfees"`
	ArbitraryData         [][]byte                          `json:"arbitrarydata"`
	TransactionSignatures []types.TransactionSignature      `json:"transactionsignatures"`
}

ConsensusBlocksGetTxn contains all fields of a types.Transaction and an additional ID field.

type ConsensusFileContract

type ConsensusFileContract struct {
	FileSize           uint64                         `json:"filesize"`
	FileMerkleRoot     crypto.Hash                    `json:"filemerkleroot"`
	WindowStart        types.BlockHeight              `json:"windowstart"`
	WindowEnd          types.BlockHeight              `json:"windowend"`
	Payout             types.Currency                 `json:"payout"`
	ValidProofOutputs  map[string]types.SiacoinOutput `json:"validproofoutputs"`
	MissedProofOutputs map[string]types.SiacoinOutput `json:"missedproofoutputs"`
	UnlockHash         types.UnlockHash               `json:"unlockhash"`
	RevisionNumber     uint64                         `json:"revisionnumber"`
}

ConsensusFileContract contains information about a file contract

type ConsensusFileContractRevision

type ConsensusFileContractRevision struct {
	ParentID          types.FileContractID   `json:"parentid"`
	UnlockConditions  types.UnlockConditions `json:"unlockconditions"`
	NewRevisionNumber uint64                 `json:"newrevisionnumber"`

	NewFileSize           uint64                         `json:"newfilesize"`
	NewFileMerkleRoot     crypto.Hash                    `json:"newfilemerkleroot"`
	NewWindowStart        types.BlockHeight              `json:"newwindowstart"`
	NewWindowEnd          types.BlockHeight              `json:"newwindowend"`
	NewValidProofOutputs  map[string]types.SiacoinOutput `json:"newvalidproofoutputs"`
	NewMissedProofOutputs map[string]types.SiacoinOutput `json:"newmissedproofoutputs"`
	NewUnlockHash         types.UnlockHash               `json:"newunlockhash"`
}

ConsensusFileContractRevision contains information about a file contract revision

type ConsensusGET

type ConsensusGET struct {
	Synced       bool              `json:"synced"`
	Height       types.BlockHeight `json:"height"`
	CurrentBlock types.BlockID     `json:"currentblock"`
	Target       types.Target      `json:"target"`
	Difficulty   types.Currency    `json:"difficulty"`
}

ConsensusGET contains general information about the consensus set, with tags to support idiomatic json encodings.

type ConsensusHeadersGET

type ConsensusHeadersGET struct {
	BlockID types.BlockID `json:"blockid"`
}

ConsensusHeadersGET contains information from a blocks header.

type ConsensusTransaction

type ConsensusTransaction struct {
	SiacoinInputs         map[string]types.SiacoinInput            `json:"siacoininputs"`
	SiacoinOutputs        map[string]types.SiacoinOutput           `json:"siacoinoutputs"`
	FileContracts         map[string]ConsensusFileContract         `json:"filecontracts"`
	FileContractRevisions map[string]ConsensusFileContractRevision `json:"filecontractrevisions"`
	StorageProofs         map[string]types.StorageProof            `json:"storageproofs"`
	MinerFees             map[string]types.Currency                `json:"minerfees"`
	ArbitraryData         [][]byte                                 `json:"arbitrarydata"`
	TransactionSignatures map[string]types.TransactionSignature    `json:"transactionsignatures"`
}

ConsensusTransaction contains information about a transaction

type ContractInfoGET

type ContractInfoGET struct {
	Contracts []modules.StorageObligation `json:"contracts"`
}

ContractInfoGET contains the information that is returned after a GET request to /host/contracts - information for the host about stored obligations.

type DaemonUpdateGet

type DaemonUpdateGet struct {
	Available bool   `json:"available"`
	Version   string `json:"version"`
}

DaemonUpdateGet contains information about a potential available update for the daemon.

type DaemonVersionGet

type DaemonVersionGet struct {
	Version     string
	GitRevision string
	BuildTime   string
}

DaemonVersionGet contains information about the running daemon's version.

type DownloadInfo

type DownloadInfo struct {
	Destination     string `json:"destination"`     // The destination of the download.
	DestinationType string `json:"destinationtype"` // Can be "file", "memory buffer", or "http stream".
	Filesize        uint64 `json:"filesize"`        // DEPRECATED. Same as 'Length'.
	Length          uint64 `json:"length"`          // The length requested for the download.
	Offset          uint64 `json:"offset"`          // The offset within the siafile requested for the download.
	HyperspacePath  string `json:"hyperspacepath"`  // The hyperspacepath of the file used for the download.

	Completed            bool      `json:"completed"`            // Whether or not the download has completed.
	EndTime              time.Time `json:"endtime"`              // The time when the download fully completed.
	Error                string    `json:"error"`                // Will be the empty string unless there was an error.
	Received             uint64    `json:"received"`             // Amount of data confirmed and decoded.
	StartTime            time.Time `json:"starttime"`            // The time when the download was started.
	StartTimeUnix        int64     `json:"starttimeunix"`        // The time when the download was started in unix format.
	TotalDataTransferred uint64    `json:"totaldatatransferred"` // The total amount of data transferred, including negotiation, overdrive etc.
}

DownloadInfo contains all client-facing information of a file.

type Error

type Error struct {
	// Message describes the error in English. Typically it is set to
	// `err.Error()`. This field is required.
	Message string `json:"message"`
}

Error is a type that is encoded as JSON and returned in an API response in the event of an error. Only the Message field is required. More fields may be added to this struct in the future for better error reporting.

func (Error) Error

func (err Error) Error() string

Error implements the error interface for the Error type. It returns only the Message field.

type ExplorerBlock

type ExplorerBlock struct {
	MinerPayoutIDs []types.SiacoinOutputID `json:"minerpayoutids,omitempty"`
	Transactions   []ExplorerTransaction   `json:"transactions"`
	RawBlock       types.Block             `json:"rawblock,omitempty"`
	modules.BlockFacts
}

ExplorerBlock is a block with some extra information such as the id and height. This information is provided for programs that may not be complex enough to compute the ID on their own.

type ExplorerBlockGET

type ExplorerBlockGET struct {
	Blocks []ExplorerBlock `json:"blocks"`
}

ExplorerBlockGET is the object returned by a GET request to /explorer/pending.

type ExplorerConsensusChange

type ExplorerConsensusChange struct {
	AppliedBlocks  []ExplorerBlock `json:"applied_blocks"`
	RevertedBlocks []types.BlockID `json:"reverted_blocks"`
}

ExplorerConsensusChange is pushed to the websocket when a consensus change event occurs This allows subscribers to listen and react without having to poll the API

type ExplorerHashGET

type ExplorerHashGET struct {
	HashType     string                `json:"hashtype"`
	Block        *ExplorerBlock        `json:"block"`
	Blocks       []ExplorerBlock       `json:"blocks"`
	Transaction  *ExplorerTransaction  `json:"transaction"`
	Transactions []ExplorerTransaction `json:"transactions"`
}

ExplorerHashGET is the object returned as a response to a GET request to /explorer/hash. The HashType will indicate whether the hash corresponds to a block id, a transaction id, a siacoin output id, a file contract id. In the case of a block id, 'Block' will be filled out and all the rest of the fields will be blank. In the case of a transaction id, 'Transaction' will be filled out and all the rest of the fields will be blank. For everything else, 'Transactions' and 'Blocks' will/may be filled out and everything else will be blank.

type ExplorerPendingBlockGET

type ExplorerPendingBlockGET struct {
	PendingBlock PendingExplorerBlock `json:"block"`
}

ExplorerPendingBlockGET is the object returned by a GET request to /explorer/pending.

type ExplorerTransaction

type ExplorerTransaction struct {
	ID                                       types.TransactionID       `json:"id"`
	Height                                   types.BlockHeight         `json:"height"`
	Parent                                   types.BlockID             `json:"parent"`
	RawTransaction                           types.Transaction         `json:"rawtransaction"`
	SiacoinInputOutputs                      []types.SiacoinOutput     `json:"siacoininputoutputs"` // the outputs being spent
	SiacoinOutputIDs                         []types.SiacoinOutputID   `json:"siacoinoutputids"`
	FileContractIDs                          []types.FileContractID    `json:"filecontractids"`
	FileContractValidProofOutputIDs          [][]types.SiacoinOutputID `json:"filecontractvalidproofoutputids"`          // outer array is per-contract
	FileContractMissedProofOutputIDs         [][]types.SiacoinOutputID `json:"filecontractmissedproofoutputids"`         // outer array is per-contract
	FileContractRevisionValidProofOutputIDs  [][]types.SiacoinOutputID `json:"filecontractrevisionvalidproofoutputids"`  // outer array is per-revision
	FileContractRevisionMissedProofOutputIDs [][]types.SiacoinOutputID `json:"filecontractrevisionmissedproofoutputids"` // outer array is per-revision
	StorageProofOutputIDs                    [][]types.SiacoinOutputID `json:"storageproofoutputids"`                    // outer array is per-payout
	StorageProofOutputs                      [][]types.SiacoinOutput   `json:"storageproofoutputs"`                      // outer array is per-payout
}

ExplorerTransaction is a transcation with some extra information such as the parent block. This information is provided for programs that may not be complex enough to compute the extra information on their own.

type ExplorerUnconfirmedTransactionChange

type ExplorerUnconfirmedTransactionChange struct {
	AppliedTransactions  []ExplorerTransaction `json:"applied_txs"`
	RevertedTransactions []types.TransactionID `json:"reverted_txs"`
}

ExplorerUnconfirmedTransactionChange is pushed to the websocket when a transaction set update occurs This allows subscribers to listen and react without having to poll the API

type ExtendedHostDBEntry

type ExtendedHostDBEntry struct {
	modules.HostDBEntry
	PublicKeyString string                     `json:"publickeystring"`
	ScoreBreakdown  modules.HostScoreBreakdown `json:"scorebreakdown"`
}

ExtendedHostDBEntry is an extension to modules.HostDBEntry that includes the string representation of the public key, otherwise presented as two fields, a string and a base64 encoded byte slice.

type GatewayGET

type GatewayGET struct {
	NetAddress modules.NetAddress `json:"netaddress"`
	Peers      []modules.Peer     `json:"peers"`
}

GatewayGET contains the fields returned by a GET call to "/gateway".

type HostEstimateScoreGET

type HostEstimateScoreGET struct {
	EstimatedScore types.Currency `json:"estimatedscore"`
	ConversionRate float64        `json:"conversionrate"`
}

HostEstimateScoreGET contains the information that is returned from a /host/estimatescore call.

type HostGET

type HostGET struct {
	ExternalSettings     modules.HostExternalSettings     `json:"externalsettings"`
	FinancialMetrics     modules.HostFinancialMetrics     `json:"financialmetrics"`
	InternalSettings     modules.HostInternalSettings     `json:"internalsettings"`
	NetworkMetrics       modules.HostNetworkMetrics       `json:"networkmetrics"`
	ConnectabilityStatus modules.HostConnectabilityStatus `json:"connectabilitystatus"`
	WorkingStatus        modules.HostWorkingStatus        `json:"workingstatus"`
}

HostGET contains the information that is returned after a GET request to /host - a bunch of information about the status of the host.

type HostdbActiveGET

type HostdbActiveGET struct {
	Hosts []ExtendedHostDBEntry `json:"hosts"`
}

HostdbActiveGET lists active hosts on the network.

type HostdbAllGET

type HostdbAllGET struct {
	Hosts []ExtendedHostDBEntry `json:"hosts"`
}

HostdbAllGET lists all hosts that the renter is aware of.

type HostdbGet

type HostdbGet struct {
	InitialScanComplete bool `json:"initialscancomplete"`
}

HostdbGet holds information about the hostdb.

type HostdbHostsGET

type HostdbHostsGET struct {
	Entry          ExtendedHostDBEntry        `json:"entry"`
	ScoreBreakdown modules.HostScoreBreakdown `json:"scorebreakdown"`
}

HostdbHostsGET lists detailed statistics for a particular host, selected by pubkey.

type MinerGET

type MinerGET struct {
	BlocksMined      int  `json:"blocksmined"`
	CPUHashrate      int  `json:"cpuhashrate"`
	CPUMining        bool `json:"cpumining"`
	StaleBlocksMined int  `json:"staleblocksmined"`
}

MinerGET contains the information that is returned after a GET request to /miner.

type MiningPoolBlockClientInfo

type MiningPoolBlockClientInfo struct {
	ClientName       string  `json:"clientname"`
	ClientPercentage float64 `json:"clientpercentage"`
	ClientReward     string  `json:"clientreward"`
}

MiningPoolBlockClientInfo returns info about one of the pool's block's clients

type MiningPoolBlockInfo

type MiningPoolBlockInfo struct {
	BlockNumber uint64    `json:"blocknumber"`
	BlockHeight uint64    `json:"blockheight"`
	BlockReward string    `json:"blockreward"`
	BlockTime   time.Time `json:"blocktime"`
	BlockStatus string    `json:"blockstatus"`
}

MiningPoolBlockInfo returns info about one of the pool's blocks

type MiningPoolClientInfo

type MiningPoolClientInfo struct {
	ClientName  string           `json:"clientname"`
	BlocksMined uint64           `json:"blocksminer"`
	Balance     string           `json:"balance"`
	Workers     []PoolWorkerInfo `json:"workers"`
}

MiningPoolClientInfo returns the stats for a single client

type MiningPoolClientTransaction

type MiningPoolClientTransaction struct {
	BalanceChange string    `json:"balancechange"`
	TxTime        time.Time `json:"txtime"`
	Memo          string    `json:"memo"`
}

MiningPoolClientTransaction returns info for a single transaction

type MiningPoolClientsInfo

type MiningPoolClientsInfo struct {
	NumberOfClients uint64                 `json:"numberofclients"`
	NumberOfWorkers uint64                 `json:"numberofworkers"`
	Clients         []MiningPoolClientInfo `json:"clientinfo"`
}

MiningPoolClientsInfo returns the stats are return after a GET request to /pool/clients

type MiningPoolConfig

type MiningPoolConfig struct {
	NetworkPort    int              `json:"networkport"`
	DBConnection   string           `json:"dbconnection"`
	Name           string           `json:"name"`
	PoolID         uint64           `json:"poolid"`
	PoolWallet     types.UnlockHash `json:"poolwallet"`
	OperatorWallet types.UnlockHash `json:"operatorwallet"`
}

MiningPoolConfig contains the parameters you can set to config your pool

type MiningPoolGET

type MiningPoolGET struct {
	BlocksMined  int `json:"blocksmined"`
	PoolHashrate int `json:"poolhashrate"`
}

MiningPoolGET contains the stats that are returned after a GET request to /pool.

type PendingExplorerBlock

type PendingExplorerBlock struct {
	Transactions []ExplorerTransaction `json:"transactions"`
	modules.BlockFacts
}

PendingExplorerBlock is a block with the current facts and list of transactions. It doesn't have an ID yet since it's still in progress

type PoolWorkerInfo

type PoolWorkerInfo struct {
	WorkerName             string    `json:"workername"`
	LastShareTime          time.Time `json:"lastsharetime"`
	CurrentDifficulty      float64   `json:"currentdifficult"`
	CumulativeDifficulty   float64   `json:"cumulativedifficulty"`
	SharesThisBlock        uint64    `json:"sharesthisblock"`
	InvalidSharesThisBlock uint64    `json:"invalidsharesthisblock"`
	StaleSharesThisBlock   uint64    `json:"stalesharesthisblock"`
	BlocksFound            uint64    `json:"blocksfound"`
}

PoolWorkerInfo returns info about one of a client's workers

type RenterContract

type RenterContract struct {
	// Amount of contract funds that have been spent on downloads.
	DownloadSpending types.Currency `json:"downloadspending"`
	// Block height that the file contract ends on.
	EndHeight types.BlockHeight `json:"endheight"`
	// Fees paid in order to form the file contract.
	Fees types.Currency `json:"fees"`
	// Public key of the host the contract was formed with.
	HostPublicKey types.SiaPublicKey `json:"hostpublickey"`
	// ID of the file contract.
	ID types.FileContractID `json:"id"`
	// A signed transaction containing the most recent contract revision.
	LastTransaction types.Transaction `json:"lasttransaction"`
	// Address of the host the file contract was formed with.
	NetAddress modules.NetAddress `json:"netaddress"`
	// Remaining funds left for the renter to spend on uploads & downloads.
	RenterFunds types.Currency `json:"renterfunds"`
	// Size of the file contract, which is typically equal to the number of
	// bytes that have been uploaded to the host.
	Size uint64 `json:"size"`
	// Block height that the file contract began on.
	StartHeight types.BlockHeight `json:"startheight"`
	// Amount of contract funds that have been spent on storage.
	StorageSpending types.Currency `json:"storagespending"`
	// DEPRECATED: This is the exact same value as StorageSpending, but it has
	// incorrect capitalization. This was fixed in 1.3.2, but this field is kept
	// to preserve backwards compatibility on clients who depend on the
	// incorrect capitalization. This field will be removed in the future, so
	// clients should switch to the StorageSpending field (above) with the
	// correct lowercase name.
	StorageSpendingDeprecated types.Currency `json:"StorageSpending"`
	// Total cost to the wallet of forming the file contract.
	TotalCost types.Currency `json:"totalcost"`
	// Amount of contract funds that have been spent on uploads.
	UploadSpending types.Currency `json:"uploadspending"`
	// Signals if contract is good for uploading data
	GoodForUpload bool `json:"goodforupload"`
	// Signals if contract is good for a renewal
	GoodForRenew bool `json:"goodforrenew"`
}

RenterContract represents a contract formed by the renter.

type RenterContracts

type RenterContracts struct {
	Contracts         []RenterContract `json:"contracts"`
	ActiveContracts   []RenterContract `json:"activecontracts"`
	InactiveContracts []RenterContract `json:"inactivecontracts"`
	ExpiredContracts  []RenterContract `json:"expiredcontracts"`
}

RenterContracts contains the renter's contracts.

type RenterDownloadQueue

type RenterDownloadQueue struct {
	Downloads []DownloadInfo `json:"downloads"`
}

RenterDownloadQueue contains the renter's download queue.

type RenterFile

type RenterFile struct {
	File modules.FileInfo `json:"file"`
}

RenterFile lists the file queried.

type RenterFiles

type RenterFiles struct {
	Files []modules.FileInfo `json:"files"`
}

RenterFiles lists the files known to the renter.

type RenterGET

type RenterGET struct {
	Settings         modules.RenterSettings     `json:"settings"`
	FinancialMetrics modules.ContractorSpending `json:"financialmetrics"`
	CurrentPeriod    types.BlockHeight          `json:"currentperiod"`
}

RenterGET contains various renter metrics.

type RenterLoad

type RenterLoad struct {
	FilesAdded []string `json:"filesadded"`
}

RenterLoad lists files that were loaded into the renter.

type RenterPricesGET

type RenterPricesGET struct {
	modules.RenterPriceEstimation
}

RenterPricesGET lists the data that is returned when a GET call is made to /renter/prices.

type RenterShareASCII

type RenterShareASCII struct {
	ASCIIsia string `json:"asciisia"`
}

RenterShareASCII contains an ASCII-encoded .sia file.

type StorageGET

type StorageGET struct {
	Folders []modules.StorageFolderMetadata `json:"folders"`
}

StorageGET contains the information that is returned after a GET request to /host/storage - a bunch of information about the status of storage management on the host.

type StratumMinerGET

type StratumMinerGET struct {
	Hashrate    float64 `json:"hashrate"`
	Mining      bool    `json:"mining"`
	Submissions uint64  `json:"submissions"`
}

StratumMinerGET contains the information that is returned after a GET request to /stratumminer.

type Subscriber

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

Subscriber is an encapsulation of a single connection to the websocket hub

func (*Subscriber) SocketWriter

func (s *Subscriber) SocketWriter()

SocketWriter should be called in a goroutine. SocketWriter manages writing to the subscriber connection via channel buffers

type TpoolConfirmedGET

type TpoolConfirmedGET struct {
	Confirmed bool `json:"confirmed"`
}

TpoolConfirmedGET contains information about whether or not the transaction has been seen on the blockhain

type TpoolFeeGET

type TpoolFeeGET struct {
	Minimum types.Currency `json:"minimum"`
	Maximum types.Currency `json:"maximum"`
}

TpoolFeeGET contains the current estimated fee

type TpoolRawGET

type TpoolRawGET struct {
	ID          types.TransactionID `json:"id"`
	Parents     []byte              `json:"parents"`
	Transaction []byte              `json:"transaction"`
}

TpoolRawGET contains the requested transaction encoded to the raw format, along with the id of that transaction.

type WalletAddressGET

type WalletAddressGET struct {
	Address types.UnlockHash `json:"address"`
}

WalletAddressGET contains an address returned by a GET call to /wallet/address.

type WalletAddressPOST

type WalletAddressPOST struct {
	Address types.UnlockHash `json:"address"`
}

WalletAddressPOST contains an address returned by a POST call to /wallet/address.

type WalletAddressesGET

type WalletAddressesGET struct {
	Addresses []types.UnlockHash `json:"addresses"`
}

WalletAddressesGET contains the list of wallet addresses returned by a GET call to /wallet/addresses.

type WalletBuildTransactionGET

type WalletBuildTransactionGET struct {
	Transaction types.Transaction `json:"transaction"`
}

WalletBuildTransactionGET contains the transaction returned by a call to /wallet/build/transaction

type WalletGET

type WalletGET struct {
	Encrypted  bool              `json:"encrypted"`
	Height     types.BlockHeight `json:"height"`
	Rescanning bool              `json:"rescanning"`
	Unlocked   bool              `json:"unlocked"`

	ConfirmedSiacoinBalance     types.Currency `json:"confirmedspacecashbalance"`
	UnconfirmedOutgoingSiacoins types.Currency `json:"unconfirmedoutgoingspacecash"`
	UnconfirmedIncomingSiacoins types.Currency `json:"unconfirmedincomingspacecash"`

	SiacoinClaimBalance types.Currency `json:"siacoinclaimbalance"`

	DustThreshold types.Currency `json:"dustthreshold"`
}

WalletGET contains general information about the wallet.

type WalletInitPOST

type WalletInitPOST struct {
	PrimarySeed string `json:"primaryseed"`
}

WalletInitPOST contains the primary seed that gets generated during a POST call to /wallet/init.

type WalletSeedsGET

type WalletSeedsGET struct {
	PrimarySeed        string   `json:"primaryseed"`
	AddressesRemaining int      `json:"addressesremaining"`
	AllSeeds           []string `json:"allseeds"`
}

WalletSeedsGET contains the seeds used by the wallet.

type WalletSiacoinsPOST

type WalletSiacoinsPOST struct {
	TransactionIDs []types.TransactionID `json:"transactionids"`
}

WalletSiacoinsPOST contains the transaction sent in the POST call to /wallet/spacecash.

type WalletSignPOSTParams

type WalletSignPOSTParams struct {
	Transaction types.Transaction `json:"transaction"`
	ToSign      []crypto.Hash     `json:"tosign"`
}

WalletSignPOSTParams contains the unsigned transaction and a set of inputs to sign.

type WalletSignPOSTResp

type WalletSignPOSTResp struct {
	Transaction types.Transaction `json:"transaction"`
}

WalletSignPOSTResp contains the signed transaction.

type WalletSweepPOST

type WalletSweepPOST struct {
	Coins types.Currency `json:"coins"`
	Funds types.Currency `json:"funds"`
}

WalletSweepPOST contains the coins and funds returned by a call to /wallet/sweep.

type WalletTransactionGETid

type WalletTransactionGETid struct {
	Transaction modules.ProcessedTransaction `json:"transaction"`
}

WalletTransactionGETid contains the transaction returned by a call to /wallet/transaction/:id

type WalletTransactionsGET

type WalletTransactionsGET struct {
	ConfirmedTransactions   []modules.ProcessedTransaction `json:"confirmedtransactions"`
	UnconfirmedTransactions []modules.ProcessedTransaction `json:"unconfirmedtransactions"`
}

WalletTransactionsGET contains the specified set of confirmed and unconfirmed transactions.

type WalletTransactionsGETaddr

type WalletTransactionsGETaddr struct {
	ConfirmedTransactions   []modules.ProcessedTransaction `json:"confirmedtransactions"`
	UnconfirmedTransactions []modules.ProcessedTransaction `json:"unconfirmedtransactions"`
}

WalletTransactionsGETaddr contains the set of wallet transactions relevant to the input address provided in the call to /wallet/transaction/:addr

type WalletUnlockConditionsGET

type WalletUnlockConditionsGET struct {
	UnlockConditions types.UnlockConditions `json:"unlockconditions"`
}

WalletUnlockConditionsGET contains a set of unlock conditions.

type WalletUnlockConditionsPOSTParams

type WalletUnlockConditionsPOSTParams struct {
	UnlockConditions types.UnlockConditions `json:"unlockconditions"`
}

WalletUnlockConditionsPOSTParams contains a set of unlock conditions.

type WalletUnspentGET

type WalletUnspentGET struct {
	Outputs []modules.UnspentOutput `json:"outputs"`
}

WalletUnspentGET contains the unspent outputs tracked by the wallet. The MaturityHeight field of each output indicates the height of the block that the output appeared in.

type WalletVerifyAddressGET

type WalletVerifyAddressGET struct {
	Valid bool `json:"valid"`
}

WalletVerifyAddressGET contains a bool indicating if the address passed to /wallet/verify/address/:addr is a valid address.

type WalletWatchGET

type WalletWatchGET struct {
	Addresses []types.UnlockHash `json:"addresses"`
}

WalletWatchGET contains the set of addresses that the wallet is currently watching.

type WalletWatchPOST

type WalletWatchPOST struct {
	Addresses []types.UnlockHash `json:"addresses"`
	Remove    bool               `json:"remove"`
	Unused    bool               `json:"unused"`
}

WalletWatchPOST contains the set of addresses to add or remove from the watch set.

type WebsocketHub

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

WebsocketHub encapsulates the Sia websocket implementation

func (*WebsocketHub) StartWebsocketHub

func (h *WebsocketHub) StartWebsocketHub()

StartWebsocketHub should be started in a goroutine. This handles brodcasting to subscribers via chan

Directories

Path Synopsis
Package server provides a server that can wrap a node and serve an http api for interacting with the node.
Package server provides a server that can wrap a node and serve an http api for interacting with the node.

Jump to

Keyboard shortcuts

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