Documentation
¶
Index ¶
- Variables
- type Client
- func (c *Client) ConsensusBlocksHeightGet(height uint64) (cbg api.ConsensusBlocksGet, err error)
- func (c *Client) ConsensusBlocksIDGet(id types.BlockID) (cbg api.ConsensusBlocksGet, err error)
- func (c *Client) ConsensusGet() (cg api.ConsensusGET, err error)
- func (c *Client) DaemonAlertsGet() (dag api.DaemonAlertsGet, err error)
- func (c *Client) DaemonStopGet() (err error)
- func (c *Client) DaemonVersionGet() (dvg api.DaemonVersionGet, err error)
- func (c *Client) GatewayAppendBlocklistPost(addresses []string) (err error)
- func (c *Client) GatewayBlocklistGet() (gbg api.GatewayBlocklistGET, err error)
- func (c *Client) GatewayConnectPost(address modules.NetAddress) (err error)
- func (c *Client) GatewayDisconnectPost(address modules.NetAddress) (err error)
- func (c *Client) GatewayGet() (gwg api.GatewayGET, err error)
- func (c *Client) GatewayRemoveBlocklistPost(addresses []string) (err error)
- func (c *Client) GatewaySetBlocklistPost(addresses []string) (err error)
- func (c *Client) HostDbActiveGet() (hdag api.HostdbActiveGET, err error)
- func (c *Client) HostDbAllGet() (hdag api.HostdbAllGET, err error)
- func (c *Client) HostDbFilterModeGet() (hdfmg api.HostdbFilterModeGET, err error)
- func (c *Client) HostDbFilterModePost(fm modules.FilterMode, hosts []types.PublicKey, netAddresses []string) (err error)
- func (c *Client) HostDbGet() (hdg api.HostdbGet, err error)
- func (c *Client) HostDbHostsGet(pk types.PublicKey) (hhg api.HostdbHostsGET, err error)
- func (c *Client) ManagerAveragesGet(currency string) (ha api.HostAverages, err error)
- func (c *Client) ManagerBalanceGet(key string) (ub modules.UserBalance, err error)
- func (c *Client) ManagerContractsGet(key string) (rc api.RenterContracts, err error)
- func (c *Client) ManagerPreferencesGet() (ep api.EmailPreferences, err error)
- func (c *Client) ManagerPreferencesPost(ep api.EmailPreferences) error
- func (c *Client) ManagerPricesGet() (prices modules.Pricing, err error)
- func (c *Client) ManagerPricesPost(prices modules.Pricing) error
- func (c *Client) ManagerRateGet(currency string) (er api.ExchangeRate, err error)
- func (c *Client) ManagerRenterGet(key string) (r modules.Renter, err error)
- func (c *Client) ManagerRentersGet() (rg api.RentersGET, err error)
- func (c *Client) NewRequest(method, resource string, body io.Reader) (*http.Request, error)
- func (c *Client) PortalCreditsGet() (credits modules.CreditData, err error)
- func (c *Client) PortalCreditsPost(credits modules.CreditData) (err error)
- func (c *Client) TransactionPoolFeeGet() (tfg api.TpoolFeeGET, err error)
- func (c *Client) TransactionPoolRawPost(txn types.Transaction, parents []types.Transaction) (err error)
- func (c *Client) TransactionPoolTransactionsGet() (tptg api.TpoolTxnsGET, err error)
- func (c *Client) WalletAddressGet() (wag api.WalletAddressGET, err error)
- func (c *Client) WalletAddressesGet() (wag api.WalletAddressesGET, err error)
- func (c *Client) WalletChangePasswordPost(currentPassword, newPassword string) (err error)
- func (c *Client) WalletChangePasswordWithSeedPost(seed modules.Seed, newPassword string) (err error)
- func (c *Client) WalletGet() (wg api.WalletGET, err error)
- func (c *Client) WalletInitPost(password string, force bool) (wip api.WalletInitPOST, err error)
- func (c *Client) WalletInitSeedPost(seed, password string, force bool) (err error)
- func (c *Client) WalletLastAddressesGet(count uint64) (wag api.WalletAddressesGET, err error)
- func (c *Client) WalletLockPost() (err error)
- func (c *Client) WalletSeedPost(seed, password string) (err error)
- func (c *Client) WalletSeedsGet() (wsg api.WalletSeedsGET, err error)
- func (c *Client) WalletSiacoinsMultiPost(outputs []types.SiacoinOutput) (wsp api.WalletSiacoinsPOST, err error)
- func (c *Client) WalletSiacoinsPost(amount types.Currency, destination types.Address, feeIncluded bool) (wsp api.WalletSiacoinsPOST, err error)
- func (c *Client) WalletSignPost(txn types.Transaction, toSign []types.Hash256) (wspr api.WalletSignPOSTResp, err error)
- func (c *Client) WalletSweepPost(seed string) (wsp api.WalletSweepPOST, err error)
- func (c *Client) WalletTransactionGet(id types.TransactionID) (wtg api.WalletTransactionGETid, err error)
- func (c *Client) WalletTransactionsGet(startHeight uint64, endHeight uint64) (wtg api.WalletTransactionsGET, err error)
- func (c *Client) WalletUnlockConditionsGet(addr types.Address) (wucg api.WalletUnlockConditionsGET, err error)
- func (c *Client) WalletUnlockPost(password string) (err error)
- func (c *Client) WalletUnspentGet() (wug api.WalletUnspentGET, err error)
- func (c *Client) WalletVerifyPasswordGet(password string) (wvpg api.WalletVerifyPasswordGET, err error)
- func (c *Client) WalletVerifyPasswordSeedGet(seed modules.Seed) (wvpg api.WalletVerifyPasswordGET, err error)
- func (c *Client) WalletWatchAddPost(addrs []types.Address, unused bool) error
- func (c *Client) WalletWatchGet() (wwg api.WalletWatchGET, err error)
- func (c *Client) WalletWatchRemovePost(addrs []types.Address, unused bool) error
- type Options
Constants ¶
This section is empty.
Variables ¶
var ( // ErrPeerExists indicates that two peers are already connected. The string // of this error needs to be updated if the string of errPeerExists in the // gateway package is changed. ErrPeerExists = errors.New("already connected to this peer") )
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
Options
}
A Client makes requests to the satd HTTP API.
func New ¶
New creates a new Client using the provided address. The password will be set using SATD_API_PASSWORD environment variable and the user agent will be set to "Sat-Agent". Both can be changed manually by the caller after the client is returned.
func (*Client) ConsensusBlocksHeightGet ¶
func (c *Client) ConsensusBlocksHeightGet(height uint64) (cbg api.ConsensusBlocksGet, err error)
ConsensusBlocksHeightGet requests the /consensus/blocks api resource.
func (*Client) ConsensusBlocksIDGet ¶
ConsensusBlocksIDGet requests the /consensus/blocks api resource.
func (*Client) ConsensusGet ¶
func (c *Client) ConsensusGet() (cg api.ConsensusGET, err error)
ConsensusGet requests the /consensus api resource.
func (*Client) DaemonAlertsGet ¶
func (c *Client) DaemonAlertsGet() (dag api.DaemonAlertsGet, err error)
DaemonAlertsGet requests the /daemon/alerts resource.
func (*Client) DaemonStopGet ¶
DaemonStopGet stops the daemon using the /daemon/stop endpoint.
func (*Client) DaemonVersionGet ¶
func (c *Client) DaemonVersionGet() (dvg api.DaemonVersionGet, err error)
DaemonVersionGet requests the /daemon/version resource.
func (*Client) GatewayAppendBlocklistPost ¶
GatewayAppendBlocklistPost uses the /gateway/blocklist endpoint to append addresses to the Gateway's blocklist.
func (*Client) GatewayBlocklistGet ¶
func (c *Client) GatewayBlocklistGet() (gbg api.GatewayBlocklistGET, err error)
GatewayBlocklistGet uses the /gateway/blocklist endpoint to request the Gateway's blocklist.
func (*Client) GatewayConnectPost ¶
func (c *Client) GatewayConnectPost(address modules.NetAddress) (err error)
GatewayConnectPost uses the /gateway/connect/:address endpoint to connect to the gateway at address.
func (*Client) GatewayDisconnectPost ¶
func (c *Client) GatewayDisconnectPost(address modules.NetAddress) (err error)
GatewayDisconnectPost uses the /gateway/disconnect/:address endpoint to disconnect the gateway from a peer.
func (*Client) GatewayGet ¶
func (c *Client) GatewayGet() (gwg api.GatewayGET, err error)
GatewayGet requests the /gateway api resource.
func (*Client) GatewayRemoveBlocklistPost ¶
GatewayRemoveBlocklistPost uses the /gateway/blocklist endpoint to remove addresses from the Gateway's blocklist.
func (*Client) GatewaySetBlocklistPost ¶
GatewaySetBlocklistPost uses the /gateway/blocklist endpoint to set the Gateway's blocklist.
func (*Client) HostDbActiveGet ¶
func (c *Client) HostDbActiveGet() (hdag api.HostdbActiveGET, err error)
HostDbActiveGet requests the /hostdb/active endpoint's resources.
func (*Client) HostDbAllGet ¶
func (c *Client) HostDbAllGet() (hdag api.HostdbAllGET, err error)
HostDbAllGet requests the /hostdb/all endpoint's resources.
func (*Client) HostDbFilterModeGet ¶
func (c *Client) HostDbFilterModeGet() (hdfmg api.HostdbFilterModeGET, err error)
HostDbFilterModeGet requests the /hostdb/filtermode GET endpoint.
func (*Client) HostDbFilterModePost ¶
func (c *Client) HostDbFilterModePost(fm modules.FilterMode, hosts []types.PublicKey, netAddresses []string) (err error)
HostDbFilterModePost requests the /hostdb/filtermode POST endpoint.
func (*Client) HostDbHostsGet ¶
HostDbHostsGet request the /hostdb/hosts/:pubkey endpoint's resources.
func (*Client) ManagerAveragesGet ¶
func (c *Client) ManagerAveragesGet(currency string) (ha api.HostAverages, err error)
ManagerAveragesGet requests the /manager/averages resource.
func (*Client) ManagerBalanceGet ¶
func (c *Client) ManagerBalanceGet(key string) (ub modules.UserBalance, err error)
ManagerBalanceGet requests the /manager/balance resource.
func (*Client) ManagerContractsGet ¶
func (c *Client) ManagerContractsGet(key string) (rc api.RenterContracts, err error)
ManagerContractsGet requests the /manager/contracts resource.
func (*Client) ManagerPreferencesGet ¶
func (c *Client) ManagerPreferencesGet() (ep api.EmailPreferences, err error)
ManagerPreferencesGet requests the /manager/preferences resource.
func (*Client) ManagerPreferencesPost ¶
func (c *Client) ManagerPreferencesPost(ep api.EmailPreferences) error
ManagerPreferencesPost uses the /manager/preferences resource to change the email preferences.
func (*Client) ManagerPricesGet ¶ added in v0.6.0
ManagerPricesGet requests the /manager/prices resource.
func (*Client) ManagerPricesPost ¶ added in v0.6.0
ManagerPricesPost uses the /manager/prices resource to change the current prices.
func (*Client) ManagerRateGet ¶
func (c *Client) ManagerRateGet(currency string) (er api.ExchangeRate, err error)
ManagerRateGet requests the /manager/rate resource.
func (*Client) ManagerRenterGet ¶
ManagerRenterGet requests the /manager/renter resource.
func (*Client) ManagerRentersGet ¶
func (c *Client) ManagerRentersGet() (rg api.RentersGET, err error)
ManagerRentersGet requests the /manager/renters resource.
func (*Client) NewRequest ¶
NewRequest constructs a request to the satd HTTP API, setting the correct User-Agent and Basic Auth. The resource path must begin with /.
func (*Client) PortalCreditsGet ¶
func (c *Client) PortalCreditsGet() (credits modules.CreditData, err error)
PortalCreditsGet requests the /portal/credits resource.
func (*Client) PortalCreditsPost ¶
func (c *Client) PortalCreditsPost(credits modules.CreditData) (err error)
PortalCreditsPost requests the /portal/credits resource.
func (*Client) TransactionPoolFeeGet ¶
func (c *Client) TransactionPoolFeeGet() (tfg api.TpoolFeeGET, err error)
TransactionPoolFeeGet uses the /tpool/fee endpoint to get a fee estimation.
func (*Client) TransactionPoolRawPost ¶
func (c *Client) TransactionPoolRawPost(txn types.Transaction, parents []types.Transaction) (err error)
TransactionPoolRawPost uses the /tpool/raw endpoint to send a raw transaction to the transaction pool.
func (*Client) TransactionPoolTransactionsGet ¶
func (c *Client) TransactionPoolTransactionsGet() (tptg api.TpoolTxnsGET, err error)
TransactionPoolTransactionsGet uses the /tpool/transactions endpoint to get the transactions of the tpool.
func (*Client) WalletAddressGet ¶
func (c *Client) WalletAddressGet() (wag api.WalletAddressGET, err error)
WalletAddressGet requests a new address from the /wallet/address endpoint.
func (*Client) WalletAddressesGet ¶
func (c *Client) WalletAddressesGet() (wag api.WalletAddressesGET, err error)
WalletAddressesGet requests the wallets known addresses from the /wallet/addresses endpoint.
func (*Client) WalletChangePasswordPost ¶
WalletChangePasswordPost uses the /wallet/changepassword endpoint to change the wallet's password.
func (*Client) WalletChangePasswordWithSeedPost ¶
func (c *Client) WalletChangePasswordWithSeedPost(seed modules.Seed, newPassword string) (err error)
WalletChangePasswordWithSeedPost uses the /wallet/changepassword endpoint to change the password used to encrypt the wallet.
func (*Client) WalletInitPost ¶
WalletInitPost uses the /wallet/init endpoint to initialize and encrypt a wallet.
func (*Client) WalletInitSeedPost ¶
WalletInitSeedPost uses the /wallet/init/seed endpoint to initialize and encrypt a wallet using a given seed.
func (*Client) WalletLastAddressesGet ¶
func (c *Client) WalletLastAddressesGet(count uint64) (wag api.WalletAddressesGET, err error)
WalletLastAddressesGet returns the count last addresses generated by the wallet in reverse order. That means the last generated address will be the first one in the slice.
func (*Client) WalletLockPost ¶
WalletLockPost uses the /wallet/lock endpoint to lock the wallet.
func (*Client) WalletSeedPost ¶
WalletSeedPost uses the /wallet/seed endpoint to add a seed to the wallet's list of seeds.
func (*Client) WalletSeedsGet ¶
func (c *Client) WalletSeedsGet() (wsg api.WalletSeedsGET, err error)
WalletSeedsGet uses the /wallet/seeds endpoint to return the wallet's current seeds.
func (*Client) WalletSiacoinsMultiPost ¶
func (c *Client) WalletSiacoinsMultiPost(outputs []types.SiacoinOutput) (wsp api.WalletSiacoinsPOST, err error)
WalletSiacoinsMultiPost uses the /wallet/siacoin api endpoint to send money to multiple addresses at once.
func (*Client) WalletSiacoinsPost ¶
func (c *Client) WalletSiacoinsPost(amount types.Currency, destination types.Address, feeIncluded bool) (wsp api.WalletSiacoinsPOST, err error)
WalletSiacoinsPost uses the /wallet/siacoins api endpoint to send money to a single address.
func (*Client) WalletSignPost ¶
func (c *Client) WalletSignPost(txn types.Transaction, toSign []types.Hash256) (wspr api.WalletSignPOSTResp, err error)
WalletSignPost uses the /wallet/sign api endpoint to sign a transaction.
func (*Client) WalletSweepPost ¶
func (c *Client) WalletSweepPost(seed string) (wsp api.WalletSweepPOST, err error)
WalletSweepPost uses the /wallet/sweep/seed endpoint to sweep a seed into the current wallet.
func (*Client) WalletTransactionGet ¶
func (c *Client) WalletTransactionGet(id types.TransactionID) (wtg api.WalletTransactionGETid, err error)
WalletTransactionGet requests the /wallet/transaction/:id api resource for a certain TransactionID.
func (*Client) WalletTransactionsGet ¶
func (c *Client) WalletTransactionsGet(startHeight uint64, endHeight uint64) (wtg api.WalletTransactionsGET, err error)
WalletTransactionsGet requests the/wallet/transactions api resource for a certain startheight and endheight.
func (*Client) WalletUnlockConditionsGet ¶
func (c *Client) WalletUnlockConditionsGet(addr types.Address) (wucg api.WalletUnlockConditionsGET, err error)
WalletUnlockConditionsGet requests the /wallet/unlockconditions endpoint and returns the UnlockConditions of addr.
func (*Client) WalletUnlockPost ¶
WalletUnlockPost uses the /wallet/unlock endpoint to unlock the wallet with a given encryption key. Per default this key is the seed.
func (*Client) WalletUnspentGet ¶
func (c *Client) WalletUnspentGet() (wug api.WalletUnspentGET, err error)
WalletUnspentGet requests the /wallet/unspent endpoint and returns all of the unspent outputs related to the wallet.
func (*Client) WalletVerifyPasswordGet ¶
func (c *Client) WalletVerifyPasswordGet(password string) (wvpg api.WalletVerifyPasswordGET, err error)
WalletVerifyPasswordGet uses the /wallet/verifypassword endpoint to check the wallet's password.
func (*Client) WalletVerifyPasswordSeedGet ¶
func (c *Client) WalletVerifyPasswordSeedGet(seed modules.Seed) (wvpg api.WalletVerifyPasswordGET, err error)
WalletVerifyPasswordSeedGet takes a seed and generates a seed string to submit to the /wallet/verifypassword endpoint.
func (*Client) WalletWatchAddPost ¶
WalletWatchAddPost uses the /wallet/watch endpoint to add a set of addresses to the watch set. The unused flag should be set to true if the addresses have never appeared in the blockchain.
func (*Client) WalletWatchGet ¶
func (c *Client) WalletWatchGet() (wwg api.WalletWatchGET, err error)
WalletWatchGet requests the /wallet/watch endpoint and returns the set of currently watched addresses.
func (*Client) WalletWatchRemovePost ¶
WalletWatchRemovePost uses the /wallet/watch endpoint to remove a set of addresses from the watch set. The unused flag should be set to true if the addresses have never appeared in the blockchain.
type Options ¶
type Options struct { // Address is the API address of the satd server. Address string // Password must match the password of the satd server. Password string // UserAgent must match the User-Agent required by the satd server. If not // set, it defaults to "Sat-Agent". UserAgent string // CheckRedirect is an optional handler to be called if the request // receives a redirect status code. // For more see https://golang.org/pkg/net/http/#Client CheckRedirect func(req *http.Request, via []*http.Request) error }
Options defines the options that are available when creating a client.
func DefaultOptions ¶
DefaultOptions returns the default options for a client. This includes setting the default satd user agent to "Sat-Agent" and setting the password using SATD_API_PASSWORD environment variable.