api

package
v0.4.6-beta Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2015 License: MIT Imports: 23 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
}

ActiveHosts is the struct that pads the response to the hostdb module call "ActiveHosts". The padding is used so that the return value can have an explicit name, which makes adding or removing fields easier in the future.

type ConsensusBlockGET

type ConsensusBlockGET struct {
	Block types.Block `json:"block"`
}

ConsensusBlockGET contains a block.

type ConsensusGET added in v1.0.0

type ConsensusGET struct {
	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 DownloadInfo

type DownloadInfo struct {
	StartTime   time.Time
	Filesize    uint64
	Received    uint64
	Destination string
	Nickname    string
}

DownloadInfo is a helper struct for the downloadqueue API call.

type FileInfo

type FileInfo struct {
	Available      bool
	UploadProgress float32
	Nickname       string
	Filesize       uint64
	TimeRemaining  types.BlockHeight
}

FileInfo is a helper struct for the files API call.

type GatewayInfo

type GatewayInfo struct {
	Address modules.NetAddress
	Peers   []modules.NetAddress
}

type MinerStatus

type MinerStatus struct {
	CPUMining        bool
	CPUHashrate      int // hashes per second
	BlocksMined      int
	StaleBlocksMined int
}

MinerStatus contains all of the fields returned when querying the miner's status.

type RenterFilesLoadResponse

type RenterFilesLoadResponse struct {
	FilesAdded []string
}

LoadedFiles lists files that were loaded into the renter.

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) ProcessConsensusChange

func (srv *Server) ProcessConsensusChange(cc modules.ConsensusChange)

ProcessConsensusChange gets called by the consensus set every time there is a change to the blockchain.

func (*Server) Serve

func (srv *Server) Serve() error

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

type SiaConstants

type SiaConstants struct {
	BlockSizeLimit        uint64
	BlockFrequency        types.BlockHeight
	TargetWindow          types.BlockHeight
	MedianTimestampWindow uint64
	FutureThreshold       types.Timestamp
	SiafundCount          types.Currency
	SiafundPortion        *big.Rat

	InitialCoinbase uint64
	MinimumCoinbase uint64

	MaturityDelay types.BlockHeight

	GenesisTimestamp         types.Timestamp
	GenesisSiafundUnlockHash types.UnlockHash
	GenesisClaimUnlockHash   types.UnlockHash

	RootTarget types.Target
	RootDepth  types.Target

	MaxAdjustmentUp   *big.Rat
	MaxAdjustmentDown *big.Rat

	SiacoinPrecision types.Currency
}

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

type UpdateInfo

type UpdateInfo struct {
	Available bool
	Version   string
}

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 []modules.WalletAddress `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"`
}

WalletSeedGet 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