api

package
v0.5.2-beta Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2016 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HttpGET added in v1.0.0

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

func HttpPOST added in v1.0.0

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

HttpPOST is a utility function for making post requests to sia with a whitelisted user-agent

Types

type ActiveHosts

type ActiveHosts struct {
	Hosts []modules.HostSettings `json:"hosts"`
}

ActiveHosts lists active hosts on the network.

type ConsensusGET added in v1.0.0

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

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

type DaemonVersion added in v1.0.0

type DaemonVersion struct {
	Version string `json:"version"`
}

type ExplorerBlock added in v1.0.0

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

	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 added in v1.0.0

type ExplorerBlockGET struct {
	Block ExplorerBlock `json:"block"`
}

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

type ExplorerGET added in v1.0.0

type ExplorerGET struct {
	modules.BlockFacts
}

ExplorerGET is the object returned as a response to a GET request to /explorer.

type ExplorerHashGET added in v1.0.0

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, or a siafund output 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 ExplorerTransaction added in v1.0.0

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
	SiafundInputOutputs                      []types.SiafundOutput     `json:"siafundinputoutputs"`                      // the outputs being spent
	SiafundOutputIDs                         []types.SiafundOutputID   `json:"siafundoutputids"`
	SiaClaimOutputIDs                        []types.SiacoinOutputID   `json:"siafundclaimoutputids"`
}

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 GatewayInfo

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

type HostGET added in v1.0.0

type HostGET struct {
	Collateral   types.Currency     `json:"collateral"`
	NetAddress   modules.NetAddress `json:"netaddress"`
	MaxDuration  types.BlockHeight  `json:"maxduration"`
	MinDuration  types.BlockHeight  `json:"minduration"`
	Price        types.Currency     `json:"price"`
	TotalStorage int64              `json:"totalstorage"`
	UnlockHash   types.UnlockHash   `json:"unlockhash"`
	WindowSize   types.BlockHeight  `json:"windowsize"`

	AcceptingContracts bool           `json:"acceptingcontracts"`
	NumContracts       uint64         `json:"numcontracts"`
	LostRevenue        types.Currency `json:"lostrevenue"`
	Revenue            types.Currency `json:"revenue"`
	StorageRemaining   int64          `json:"storageremaining"`
	AnticipatedRevenue types.Currency `json:"anticipatedrevenue"`

	RPCErrorCalls        uint64 `json:"rpcerrorcalls"`
	RPCUnrecognizedCalls uint64 `json:"rpcunrecognizedcalls"`
	RPCDownloadCalls     uint64 `json:"rpcdownloadcalls"`
	RPCRenewCalls        uint64 `json:"rpcrenewcalls"`
	RPCReviseCalls       uint64 `json:"rpcrevisecalls"`
	RPCSettingsCalls     uint64 `json:"rpcsettingscalls"`
	RPCUploadCalls       uint64 `json:"rpcuploadcalls"`
}

HostGET contains the information that is returned after a GET request to /host.

type MinerGET added in v1.0.0

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 RenterDownloadQueue added in v1.0.0

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

DownloadQueue contains the renter's download queue.

type RenterFiles added in v1.0.0

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

RenterFiles lists the files known to the renter.

type RenterLoad added in v1.0.0

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

RenterLoad lists files that were loaded into the renter.

type RenterShareASCII added in v1.0.0

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

RenterShareASCII contains an ASCII-encoded .sia file.

type Server

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

A Server is essentially a collection of modules and an API server to talk to them all.

func NewServer

NewServer creates a new API server from the provided modules.

func (*Server) Close added in v1.0.0

func (srv *Server) Close() error

Close closes the Server's listener, causing the HTTP server to shut down.

func (*Server) Serve

func (srv *Server) Serve() error

Serve listens for and handles API calls. It is a blocking function.

type SiaConstants

type SiaConstants struct {
	GenesisTimestamp      types.Timestamp   `json:"genesistimestamp"`
	BlockSizeLimit        uint64            `json:"blocksizelimit"`
	BlockFrequency        types.BlockHeight `json:"blockfrequency"`
	TargetWindow          types.BlockHeight `json:"targetwindow"`
	MedianTimestampWindow uint64            `json:"mediantimestampwindow"`
	FutureThreshold       types.Timestamp   `json:"futurethreshold"`
	SiafundCount          types.Currency    `json:"siafundcount"`
	SiafundPortion        *big.Rat          `json:"siafundportion"`
	MaturityDelay         types.BlockHeight `json:"maturitydelay"`

	InitialCoinbase uint64 `json:"initialcoinbase"`
	MinimumCoinbase uint64 `json:"minimumcoinbase"`

	RootTarget types.Target `json:"roottarget"`
	RootDepth  types.Target `json:"rootdepth"`

	MaxAdjustmentUp   *big.Rat `json:"maxadjustmentup"`
	MaxAdjustmentDown *big.Rat `json:"maxadjustmentdown"`

	SiacoinPrecision types.Currency `json:"siacoinprecision"`
}

SiaConstants is a struct listing all of the constants in use.

type TransactionPoolGET added in v1.0.0

type TransactionPoolGET struct {
	Transactions []types.Transaction `json:"transactions"`
}

type WalletAddressGET added in v1.0.0

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

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

type WalletAddressesGET added in v1.0.0

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

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

type WalletEncryptPOST

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

WalletEncryptPOST contains the primary seed that gets generated during a POST call to /wallet/encrypt.

COMPATv0.4.0

type WalletGET added in v1.0.0

type WalletGET struct {
	Encrypted bool `json:"encrypted"`
	Unlocked  bool `json:"unlocked"`

	ConfirmedSiacoinBalance     types.Currency `json:"confirmedsiacoinbalance"`
	UnconfirmedOutgoingSiacoins types.Currency `json:"unconfirmedoutgoingsiacoins"`
	UnconfirmedIncomingSiacoins types.Currency `json:"unconfirmedincomingsiacoins"`

	SiafundBalance      types.Currency `json:"siafundbalance"`
	SiacoinClaimBalance types.Currency `json:"siacoinclaimbalance"`
}

WalletGET contains general information about the wallet.

type WalletInitPOST added in v1.0.0

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

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

type WalletSeedsGET added in v1.0.0

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 added in v1.0.0

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

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

type WalletSiafundsPOST added in v1.0.0

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

WalletSiafundsPOST contains the transaction sent in the POST call to /wallet/siafunds.

type WalletTransactionGETid added in v1.0.0

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

WalletTransactionGETid contains the transaction returned by a call to /wallet/transaction/$(id)

type WalletTransactionsGET added in v1.0.0

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 added in v1.0.0

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)

Jump to

Keyboard shortcuts

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