api

package
v0.2.0-beta Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2023 License: MIT Imports: 12 Imported by: 13

Documentation

Index

Constants

View Source
const (
	HostFilterModeAll     = "all"
	HostFilterModeAllowed = "allowed"
	HostFilterModeBlocked = "blocked"

	ContractArchivalReasonHostPruned = "hostpruned"
	ContractArchivalReasonRemoved    = "removed"
	ContractArchivalReasonRenewed    = "renewed"
)
View Source
const (
	SettingContractSet = "contractset"
	SettingGouging     = "gouging"
	SettingRedundancy  = "redundancy"
)

Variables

View Source
var (
	// ErrRequiresSyncSetRecently indicates that an account can't be set to sync
	// yet because it has been set too recently.
	ErrRequiresSyncSetRecently = errors.New("account had 'requiresSync' flag set recently")

	// ErrOBjectNotFound is returned if get is unable to retrieve an object from
	// the database.
	ErrObjectNotFound = errors.New("object not found")

	// ErrContractSetNotFound is returned when a contract can't be retrieved
	// from the database.
	ErrContractSetNotFound = errors.New("couldn't find contract set")

	// ErrSettingNotFound is returned if a requested setting is not present in the
	// database.
	ErrSettingNotFound = errors.New("setting not found")

	// DefaultRedundancySettings define the default redundancy settings the bus
	// is configured with on startup. These values can be adjusted using the
	// settings API.
	DefaultRedundancySettings = RedundancySettings{
		MinShards:   10,
		TotalShards: 30,
	}

	// DefaultGougingSettings define the default gouging settings the bus is
	// configured with on startup. These values can be adjusted using the
	// settings API.
	DefaultGougingSettings = GougingSettings{
		MinMaxCollateral:      types.Siacoins(10),
		MaxRPCPrice:           types.Siacoins(1).Div64(1000),
		MaxContractPrice:      types.Siacoins(15),
		MaxDownloadPrice:      types.Siacoins(3000),
		MaxUploadPrice:        types.Siacoins(3000),
		MaxStoragePrice:       types.Siacoins(1000).Div64(144 * 30),
		HostBlockHeightLeeway: 6,
	}
)

Functions

This section is empty.

Types

type Account

type Account struct {
	// ID identifies an account. It's a public key.
	ID rhpv3.Account `json:"id"`

	// HostKey describes the host the account was created with.
	HostKey types.PublicKey `json:"hostKey"`

	// Balance is the balance of the account.
	Balance *big.Int `json:"balance"`

	// Drift is the accumulated delta between the bus' tracked balance for
	// an account and the balance reported by a host.
	Drift *big.Int `json:"drift"`

	// RequiresSync indicates whether an account needs to be synced with the
	// host before it can be used again.
	RequiresSync bool `json:"requiresSync"`
}

type AccountHandlerPOST

type AccountHandlerPOST struct {
	HostKey types.PublicKey `json:"hostKey"`
}

AccountHandlerPOST is the request type for the /account/:id endpoint.

type AccountsAddBalanceRequest

type AccountsAddBalanceRequest struct {
	HostKey types.PublicKey `json:"hostKey"`
	Amount  *big.Int        `json:"amount"`
}

AccountsAddBalanceRequest is the request type for /accounts/:id/add endpoint.

type AccountsLockHandlerRequest

type AccountsLockHandlerRequest struct {
	HostKey   types.PublicKey `json:"hostKey"`
	Exclusive bool            `json:"exclusive"`
	Duration  ParamDuration   `json:"duration"`
}

type AccountsLockHandlerResponse

type AccountsLockHandlerResponse struct {
	Account Account `json:"account"`
	LockID  uint64  `json:"lockID"`
}

type AccountsRequiresSyncRequest

type AccountsRequiresSyncRequest struct {
	HostKey types.PublicKey `json:"hostKey"`
}

AccountsRequiresSyncRequest is the request type for /accounts/:id/requiressync endpoint.

type AccountsUnlockHandlerRequest

type AccountsUnlockHandlerRequest struct {
	LockID uint64 `json:"lockID"`
}

type AccountsUpdateBalanceRequest

type AccountsUpdateBalanceRequest struct {
	HostKey types.PublicKey `json:"hostKey"`
	Amount  *big.Int        `json:"amount"`
}

AccountsUpdateBalanceRequest is the request type for /accounts/:id/update endpoint.

type Action

type Action struct {
	Timestamp time.Time
	Type      string
	Action    interface {
		// contains filtered or unexported methods
	}
}

An Action is an autopilot operation.

type AddObjectRequest added in v1.0.3

type AddObjectRequest struct {
	Object        object.Object                            `json:"object"`
	UsedContracts map[types.PublicKey]types.FileContractID `json:"usedContracts"`
}

AddObjectRequest is the request type for the /object/*key endpoint.

type ArchiveContractsRequest

type ArchiveContractsRequest = map[types.FileContractID]string

ArchiveContractsRequest is the request type for the /contracts/archive endpoint.

type ArchivedContract

type ArchivedContract struct {
	ID        types.FileContractID `json:"id"`
	HostKey   types.PublicKey      `json:"hostKey"`
	RenewedTo types.FileContractID `json:"renewedTo"`
	Spending  ContractSpending     `json:"spending"`

	ProofHeight    uint64 `json:"proofHeight"`
	RevisionHeight uint64 `json:"revisionHeight"`
	RevisionNumber uint64 `json:"revisionNumber"`
	StartHeight    uint64 `json:"startHeight"`
	WindowStart    uint64 `json:"windowStart"`
	WindowEnd      uint64 `json:"windowEnd"`
}

An ArchivedContract contains all information about a contract with a host that has been moved to the archive either due to expiring or being renewed.

type AutopilotConfig

type AutopilotConfig struct {
	Wallet    WalletConfig    `json:"wallet"`
	Hosts     HostsConfig     `json:"hosts"`
	Contracts ContractsConfig `json:"contracts"`
}

AutopilotConfig contains all autopilot configuration parameters.

func DefaultAutopilotConfig

func DefaultAutopilotConfig() (c AutopilotConfig)

DefaultAutopilotConfig returns a configuration with sane default values.

type AutopilotStatusResponseGET

type AutopilotStatusResponseGET struct {
	CurrentPeriod uint64 `json:"currentPeriod"`
}

AutopilotStatusResponseGET is the response type for the /autopilot/status endpoint.

type ConsensusState

type ConsensusState struct {
	BlockHeight uint64
	Synced      bool
}

ConsensusState holds the current blockheight and whether we are synced or not.

type Contract

type Contract struct {
	ContractMetadata
	Revision types.FileContractRevision `json:"revision"`
}

A Contract wraps the contract metadata with the latest contract revision.

func (Contract) EndHeight

func (c Contract) EndHeight() uint64

EndHeight returns the height at which the host is no longer obligated to store contract data.

func (Contract) FileSize

func (c Contract) FileSize() uint64

FileSize returns the current Size of the contract.

func (Contract) HostKey

func (c Contract) HostKey() (pk types.PublicKey)

HostKey returns the public key of the host.

func (Contract) RemainingCollateral

func (c Contract) RemainingCollateral(s rhpv2.HostSettings) types.Currency

RemainingCollateral returns the remaining collateral in the contract.

func (Contract) RenterFunds

func (c Contract) RenterFunds() types.Currency

RenterFunds returns the funds remaining in the contract's Renter payout.

type ContractAcquireRequest

type ContractAcquireRequest struct {
	Duration ParamDuration `json:"duration"`
	Priority int           `json:"priority"`
}

ContractAcquireRequest is the request type for the /contract/acquire endpoint.

type ContractAcquireResponse

type ContractAcquireResponse struct {
	LockID uint64 `json:"lockID"`
}

ContractAcquireResponse is the response type for the /contract/:id/acquire endpoint.

type ContractMetadata

type ContractMetadata struct {
	ID         types.FileContractID `json:"id"`
	HostIP     string               `json:"hostIP"`
	HostKey    types.PublicKey      `json:"hostKey"`
	SiamuxAddr string               `json:"siamuxAddr"`

	ProofHeight    uint64 `json:"proofHeight"`
	RevisionHeight uint64 `json:"revisionHeight"`
	RevisionNumber uint64 `json:"revisionNumber"`
	StartHeight    uint64 `json:"startHeight"`
	WindowStart    uint64 `json:"windowStart"`
	WindowEnd      uint64 `json:"windowEnd"`

	RenewedFrom types.FileContractID `json:"renewedFrom"`
	Spending    ContractSpending     `json:"spending"`
	TotalCost   types.Currency       `json:"totalCost"`
}

ContractMetadata contains all metadata for a contract.

type ContractReleaseRequest

type ContractReleaseRequest struct {
	LockID uint64 `json:"lockID"`
}

ContractAcquireRequest is the request type for the /contract/:id/release endpoint.

type ContractSetSettings

type ContractSetSettings struct {
	Set string `json:"set"`
}

ContractSetSettings contains settings needed by the worker to figure out what contract set to use.

type ContractSpending

type ContractSpending struct {
	Uploads     types.Currency `json:"uploads"`
	Downloads   types.Currency `json:"downloads"`
	FundAccount types.Currency `json:"fundAccount"`
}

ContractSpending contains all spending details for a contract.

func (ContractSpending) Add

Add returns the sum of the current and given contract spending.

type ContractSpendingRecord

type ContractSpendingRecord struct {
	ContractSpending
	ContractID types.FileContractID `json:"contractID"`
}

type ContractsConfig

type ContractsConfig struct {
	Set         string         `json:"set"`
	Amount      uint64         `json:"amount"`
	Allowance   types.Currency `json:"allowance"`
	Period      uint64         `json:"period"`
	RenewWindow uint64         `json:"renewWindow"`
	Download    uint64         `json:"download"`
	Upload      uint64         `json:"upload"`
	Storage     uint64         `json:"storage"`
}

ContractsConfig contains all contracts configuration parameters.

type ContractsIDAddRequest

type ContractsIDAddRequest struct {
	Contract    rhpv2.ContractRevision `json:"contract"`
	StartHeight uint64                 `json:"startHeight"`
	TotalCost   types.Currency         `json:"totalCost"`
}

ContractsIDAddRequest is the request type for the /contract/:id endpoint.

type ContractsIDRenewedRequest

type ContractsIDRenewedRequest struct {
	Contract    rhpv2.ContractRevision `json:"contract"`
	RenewedFrom types.FileContractID   `json:"renewedFrom"`
	StartHeight uint64                 `json:"startHeight"`
	TotalCost   types.Currency         `json:"totalCost"`
}

ContractsIDRenewedRequest is the request type for the /contract/:id/renewed endpoint.

type ContractsResponse

type ContractsResponse struct {
	Contracts []Contract `json:"contracts"`
	Error     string     `json:"error,omitempty"`
}

ContractsResponse is the response type for the /rhp/contracts/active endpoint.

type DownloadParams

type DownloadParams struct {
	ContractSet string
	GougingParams
}

DownloadParams contains the metadata needed by a worker to download an object.

type GougingChecks

type GougingChecks struct {
	ContractErr error `json:"contractErr"`
	DownloadErr error `json:"downloadErr"`
	GougingErr  error `json:"gougingErr"`
	UploadErr   error `json:"uploadErr"`
}

func (GougingChecks) Errors

func (gc GougingChecks) Errors() (errs []error)

func (GougingChecks) Gouging

func (gc GougingChecks) Gouging() bool

type GougingParams

type GougingParams struct {
	ConsensusState     ConsensusState
	GougingSettings    GougingSettings
	RedundancySettings RedundancySettings
	TransactionFee     types.Currency
}

GougingParams contains the metadata needed by a worker to perform gouging checks.

type GougingSettings

type GougingSettings struct {
	// MinMaxCollateral is the minimum value for 'MaxCollateral' in the host's
	// price settings
	MinMaxCollateral types.Currency `json:"minMaxCollateral"`

	// MaxRPCPrice is the maximum allowed base price for RPCs
	MaxRPCPrice types.Currency `json:"maxRPCPrice"`

	// MaxContractPrice is the maximum allowed price to form a contract
	MaxContractPrice types.Currency `json:"maxContractPrice"`

	// MaxDownloadPrice is the maximum allowed price to download 1TiB of data
	MaxDownloadPrice types.Currency `json:"maxDownloadPrice"`

	// MaxUploadPrice is the maximum allowed price to upload 1TiB of data
	MaxUploadPrice types.Currency `json:"maxUploadPrice"`

	// MaxStoragePrice is the maximum allowed price to store 1 byte per block
	MaxStoragePrice types.Currency `json:"maxStoragePrice"`

	// HostBlockHeightLeeway is the amount of blocks of leeway given to the host
	// block height in the host's price table
	HostBlockHeightLeeway int `json:"hostBlockHeightLeeway"`
}

GougingSettings contain some price settings used in price gouging.

type HostGougingBreakdown

type HostGougingBreakdown struct {
	V2 GougingChecks `json:"v2"`
	V3 GougingChecks `json:"v3"`
}

func (HostGougingBreakdown) Gouging

func (hgb HostGougingBreakdown) Gouging() bool

func (HostGougingBreakdown) Reasons

func (hgb HostGougingBreakdown) Reasons() string

type HostHandlerGET

type HostHandlerGET struct {
	Host hostdb.Host `json:"host"`

	Gouging          bool                 `json:"gouging"`
	GougingBreakdown HostGougingBreakdown `json:"gougingBreakdown"`
	Score            float64              `json:"score"`
	ScoreBreakdown   HostScoreBreakdown   `json:"scoreBreakdown"`
	Usable           bool                 `json:"usable"`
	UnusableReasons  []string             `json:"unusableReasons"`
}

type HostScoreBreakdown

type HostScoreBreakdown struct {
	Age              float64 `json:"age"`
	Collateral       float64 `json:"collateral"`
	Interactions     float64 `json:"interactions"`
	StorageRemaining float64 `json:"storageRemaining"`
	Uptime           float64 `json:"uptime"`
	Version          float64 `json:"version"`
	Prices           float64 `json:"prices"`
}

func (HostScoreBreakdown) Score

func (sb HostScoreBreakdown) Score() float64

type HostsConfig

type HostsConfig struct {
	IgnoreRedundantIPs bool                        `json:"ignoreRedundantIPs"`
	MaxDowntimeHours   uint64                      `json:"maxDowntimeHours"`
	ScoreOverrides     map[types.PublicKey]float64 `json:"scoreOverrides"`
}

HostsConfig contains all hosts configuration parameters.

type HostsRemoveRequest

type HostsRemoveRequest struct {
	MaxDowntimeHours      ParamDurationHour `json:"maxDowntimeHours"`
	MinRecentScanFailures uint64            `json:"minRecentScanFailures"`
}

HostsRemoveRequest is the request type for the /hosts/remove endpoint.

type MigrationSlabsRequest

type MigrationSlabsRequest struct {
	ContractSet  string  `json:"contractSet"`
	HealthCutoff float64 `json:"healthCutoff"`
	Limit        int     `json:"limit"`
}

MigrationSlabsRequest is the request type for the /slabs/migration endpoint.

type ObjectsResponse

type ObjectsResponse struct {
	Entries []string       `json:"entries,omitempty"`
	Object  *object.Object `json:"object,omitempty"`
}

ObjectsResponse is the response type for the /objects endpoint.

type ObjectsStats

type ObjectsStats struct {
	NumObjects        uint64 `json:"numObjects"`        // number of objects
	TotalObjectsSize  uint64 `json:"totalObjectsSize"`  // size of all objects
	TotalSectorsSize  uint64 `json:"totalSectorsSize"`  // uploaded size of all objects
	TotalUploadedSize uint64 `json:"totalUploadedSize"` // uploaded size of all objects including redundant sectors
}

ObjectsStats is the response type for the /stats/objects endpoint.

type ParamCurrency

type ParamCurrency types.Currency

ParamCurrency aliases types.Currency and marshal them in hastings.

func (ParamCurrency) MarshalText

func (c ParamCurrency) MarshalText() ([]byte, error)

MarshalText implements encoding.TextMarshaler.

func (ParamCurrency) String

func (c ParamCurrency) String() string

String implements fmt.Stringer.

func (*ParamCurrency) UnmarshalText

func (c *ParamCurrency) UnmarshalText(b []byte) error

UnmarshalText implements encoding.TextUnmarshaler.

type ParamDuration

type ParamDuration time.Duration

A ParamDuration is the elapsed time between two instants. ParamDurations are encoded as an integer number of milliseconds.

func (ParamDuration) MarshalText

func (d ParamDuration) MarshalText() ([]byte, error)

MarshalText implements encoding.TextMarshaler.

func (ParamDuration) String

func (d ParamDuration) String() string

String implements fmt.Stringer.

func (*ParamDuration) UnmarshalText

func (d *ParamDuration) UnmarshalText(b []byte) error

UnmarshalText implements encoding.TextUnmarshaler.

type ParamDurationHour

type ParamDurationHour time.Duration

A ParamDurationHour aliases time.Duration to add marshaling functions that format the duration in hours.

func (ParamDurationHour) MarshalText

func (d ParamDurationHour) MarshalText() ([]byte, error)

MarshalText implements encoding.TextMarshaler.

func (ParamDurationHour) String

func (d ParamDurationHour) String() string

String implements fmt.Stringer.

func (*ParamDurationHour) UnmarshalText

func (d *ParamDurationHour) UnmarshalText(b []byte) error

UnmarshalText implements encoding.TextUnmarshaler.

type ParamString

type ParamString string

ParamString is a helper type since jape expects query params to implement the TextMarshaler interface.

func (ParamString) MarshalText

func (s ParamString) MarshalText() ([]byte, error)

MarshalText implements encoding.TextMarshaler.

func (ParamString) String

func (s ParamString) String() string

String implements fmt.Stringer.

func (*ParamString) UnmarshalText

func (s *ParamString) UnmarshalText(b []byte) error

UnmarshalText implements encoding.TextUnmarshaler.

type ParamTime

type ParamTime time.Time

ParamTime aliases time.Time to add marshaling functions that url escape and format a time in the RFC3339 format.

func (ParamTime) String

func (t ParamTime) String() string

String implements fmt.Stringer.

func (*ParamTime) UnmarshalText

func (t *ParamTime) UnmarshalText(b []byte) error

UnmarshalText implements encoding.TextUnmarshaler.

type RHPFormRequest

type RHPFormRequest struct {
	EndHeight      uint64          `json:"endHeight"`
	HostCollateral types.Currency  `json:"hostCollateral"`
	HostKey        types.PublicKey `json:"hostKey"`
	HostIP         string          `json:"hostIP"`
	RenterFunds    types.Currency  `json:"renterFunds"`
	RenterAddress  types.Address   `json:"renterAddress"`
}

RHPFormRequest is the request type for the /rhp/form endpoint.

type RHPFormResponse

type RHPFormResponse struct {
	ContractID     types.FileContractID   `json:"contractID"`
	Contract       rhpv2.ContractRevision `json:"contract"`
	TransactionSet []types.Transaction    `json:"transactionSet"`
}

RHPFormResponse is the response type for the /rhp/form endpoint.

type RHPFundRequest

type RHPFundRequest struct {
	ContractID types.FileContractID `json:"contractID"`
	HostKey    types.PublicKey      `json:"hostKey"`
	SiamuxAddr string               `json:"siamuxAddr"`
	Balance    types.Currency       `json:"balance"`
}

RHPFundRequest is the request type for the /rhp/fund endpoint.

type RHPPreparePaymentRequest

type RHPPreparePaymentRequest struct {
	Account    rhpv3.Account    `json:"account"`
	Amount     types.Currency   `json:"amount"`
	Expiry     uint64           `json:"expiry"`
	AccountKey types.PrivateKey `json:"accountKey"`
}

RHPPreparePaymentRequest is the request type for the /rhp/prepare/payment endpoint.

type RHPPriceTableRequest

type RHPPriceTableRequest struct {
	HostKey    types.PublicKey `json:"hostKey"`
	SiamuxAddr string          `json:"siamuxAddr"`
}

RHPPriceTableRequest is the request type for the /rhp/pricetable endpoint.

type RHPRegistryReadRequest

type RHPRegistryReadRequest struct {
	HostKey     types.PublicKey                    `json:"hostKey"`
	SiamuxAddr  string                             `json:"siamuxAddr"`
	RegistryKey rhpv3.RegistryKey                  `json:"registryKey"`
	Payment     rhpv3.PayByEphemeralAccountRequest `json:"payment"`
}

RHPRegistryReadRequest is the request type for the /rhp/registry/read endpoint.

type RHPRegistryUpdateRequest

type RHPRegistryUpdateRequest struct {
	HostKey       types.PublicKey     `json:"hostKey"`
	SiamuxAddr    string              `json:"siamuxAddr"`
	RegistryKey   rhpv3.RegistryKey   `json:"registryKey"`
	RegistryValue rhpv3.RegistryValue `json:"registryValue"`
}

RHPRegistryUpdateRequest is the request type for the /rhp/registry/update endpoint.

type RHPRenewRequest

type RHPRenewRequest struct {
	ContractID    types.FileContractID `json:"contractID"`
	EndHeight     uint64               `json:"endHeight"`
	HostKey       types.PublicKey      `json:"hostKey"`
	HostIP        string               `json:"hostIP"`
	NewCollateral types.Currency       `json:"newCollateral"`
	RenterAddress types.Address        `json:"renterAddress"`
	RenterFunds   types.Currency       `json:"renterFunds"`
}

RHPRenewRequest is the request type for the /rhp/renew endpoint.

type RHPRenewResponse

type RHPRenewResponse struct {
	Error          string                 `json:"error"`
	ContractID     types.FileContractID   `json:"contractID"`
	Contract       rhpv2.ContractRevision `json:"contract"`
	TransactionSet []types.Transaction    `json:"transactionSet"`
}

RHPRenewResponse is the response type for the /rhp/renew endpoint.

type RHPScanRequest

type RHPScanRequest struct {
	HostKey types.PublicKey `json:"hostKey"`
	HostIP  string          `json:"hostIP"`
	Timeout time.Duration   `json:"timeout"`
}

RHPScanRequest is the request type for the /rhp/scan endpoint.

type RHPScanResponse

type RHPScanResponse struct {
	Ping      ParamDuration      `json:"ping"`
	ScanError string             `json:"scanError,omitempty"`
	Settings  rhpv2.HostSettings `json:"settings,omitempty"`
}

RHPScanResponse is the response type for the /rhp/scan endpoint.

type RHPSyncRequest

type RHPSyncRequest struct {
	ContractID types.FileContractID `json:"contractID"`
	HostKey    types.PublicKey      `json:"hostKey"`
	SiamuxAddr string               `json:"siamuxAddr"`
}

RHPSyncRequest is the request type for the /rhp/sync endpoint.

type RedundancySettings

type RedundancySettings struct {
	MinShards   int `json:"minShards"`
	TotalShards int `json:"totalShards"`
}

RedundancySettings contain settings that dictate an object's redundancy.

func (RedundancySettings) Redundancy

func (rs RedundancySettings) Redundancy() float64

Redundancy returns the effective storage redundancy of the RedundancySettings.

func (RedundancySettings) Validate

func (rs RedundancySettings) Validate() error

Validate returns an error if the redundancy settings are not considered valid.

type SearchHostsRequest

type SearchHostsRequest struct {
	Offset          int               `json:"offset"`
	Limit           int               `json:"limit"`
	FilterMode      string            `json:"filterMode"`
	AddressContains string            `json:"addressContains"`
	KeyIn           []types.PublicKey `json:"keyIn"`
}

type SlabID

type SlabID uint

A SlabID uniquely identifies a slab.

func (*SlabID) LoadString

func (sid *SlabID) LoadString(s string) (err error)

LoadString is implemented for jape's DecodeParam.

func (SlabID) String

func (sid SlabID) String() string

String encodes the SlabID as a string.

type UpdateAllowlistRequest

type UpdateAllowlistRequest struct {
	Add    []types.PublicKey `json:"add"`
	Remove []types.PublicKey `json:"remove"`
	Clear  bool              `json:"clear"`
}

UpdateAllowlistRequest is the request type for /hosts/allowlist endpoint.

type UpdateBlocklistRequest

type UpdateBlocklistRequest struct {
	Add    []string `json:"add"`
	Remove []string `json:"remove"`
	Clear  bool     `json:"clear"`
}

UpdateBlocklistRequest is the request type for /hosts/blocklist endpoint.

type UpdateSlabRequest

type UpdateSlabRequest struct {
	Slab          object.Slab                              `json:"slab"`
	UsedContracts map[types.PublicKey]types.FileContractID `json:"usedContracts"`
}

UpdateSlabRequest is the request type for the /slab endpoint.

type UploadParams

type UploadParams struct {
	CurrentHeight uint64
	ContractSet   string
	GougingParams
}

UploadParams contains the metadata needed by a worker to upload an object.

type WalletConfig

type WalletConfig struct {
	DefragThreshold uint64 `json:"defragThreshold"`
}

WalletConfig contains all wallet configuration parameters.

type WalletFundRequest

type WalletFundRequest struct {
	Transaction types.Transaction `json:"transaction"`
	Amount      types.Currency    `json:"amount"`
}

WalletFundRequest is the request type for the /wallet/fund endpoint.

type WalletFundResponse

type WalletFundResponse struct {
	Transaction types.Transaction   `json:"transaction"`
	ToSign      []types.Hash256     `json:"toSign"`
	DependsOn   []types.Transaction `json:"dependsOn"`
}

WalletFundResponse is the response type for the /wallet/fund endpoint.

type WalletPrepareFormRequest

type WalletPrepareFormRequest struct {
	EndHeight      uint64             `json:"endHeight"`
	HostCollateral types.Currency     `json:"hostCollateral"`
	HostKey        types.PublicKey    `json:"hostKey"`
	HostSettings   rhpv2.HostSettings `json:"hostSettings"`
	RenterAddress  types.Address      `json:"renterAddress"`
	RenterFunds    types.Currency     `json:"renterFunds"`
	RenterKey      types.PrivateKey   `json:"renterKey"`
}

WalletPrepareFormRequest is the request type for the /wallet/prepare/form endpoint.

type WalletPrepareRenewRequest

type WalletPrepareRenewRequest struct {
	Contract      types.FileContractRevision `json:"contract"`
	EndHeight     uint64                     `json:"endHeight"`
	HostKey       types.PublicKey            `json:"hostKey"`
	HostSettings  rhpv2.HostSettings         `json:"hostSettings"`
	NewCollateral types.Currency             `json:"newCollateral"`
	RenterAddress types.Address              `json:"renterAddress"`
	RenterFunds   types.Currency             `json:"renterFunds"`
	RenterKey     types.PrivateKey           `json:"renterKey"`
}

WalletPrepareRenewRequest is the request type for the /wallet/prepare/renew endpoint.

type WalletPrepareRenewResponse

type WalletPrepareRenewResponse struct {
	TransactionSet []types.Transaction `json:"transactionSet"`
	FinalPayment   types.Currency      `json:"finalPayment"`
}

WalletPrepareRenewResponse is the response type for the /wallet/prepare/renew endpoint.

type WalletRedistributeRequest

type WalletRedistributeRequest struct {
	Amount  types.Currency `json:"amount"`
	Outputs int            `json:"outputs"`
}

WalletRedistributeRequest is the request type for the /wallet/redistribute endpoint.

type WalletSignRequest

type WalletSignRequest struct {
	Transaction   types.Transaction   `json:"transaction"`
	ToSign        []types.Hash256     `json:"toSign"`
	CoveredFields types.CoveredFields `json:"coveredFields"`
}

WalletSignRequest is the request type for the /wallet/sign endpoint.

Jump to

Keyboard shortcuts

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