rhp

package
v1.2.0-hsc Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RPCAccountBalance

func RPCAccountBalance(ctx context.Context, t *rhpv3.Transport, payment rhpv3.PaymentMethod, account rhpv3.Account, settingsID rhpv3.SettingsID) (bal types.Currency, err error)

RPCAccountBalance fetches the balance of an ephemeral account.

func RPCAppendSector

func RPCAppendSector(ctx context.Context, t *rhpv3.Transport, renterKey types.PrivateKey, pt rhpv3.HostPriceTable, rev *types.FileContractRevision, payment rhpv3.PaymentMethod, sector *[rhpv2.SectorSize]byte) (sectorRoot types.Hash256, cost types.Currency, err error)

RPCAppendSector calls the ExecuteProgram RPC with an AppendSector instruction.

func RPCFormContract

func RPCFormContract(ctx context.Context, t *rhpv2.Transport, rsk types.PrivateKey, txnSet []types.Transaction) (_ rhpv2.ContractRevision, _ []types.Transaction, err error)

RPCFormContract forms a contract with the host.

func RPCFundAccount

func RPCFundAccount(ctx context.Context, t *rhpv3.Transport, payment rhpv3.PaymentMethod, account rhpv3.Account, settingsID rhpv3.SettingsID) (err error)

RPCFundAccount funds an ephemeral account.

func RPCLatestRevision

func RPCLatestRevision(ctx context.Context, t *rhpv3.Transport, contractID types.FileContractID) (types.FileContractRevision, error)

RPCLatestRevision fetches the latest revision from the host.

func RPCPriceTable

func RPCPriceTable(ctx context.Context, t *rhpv3.Transport, paymentFunc PriceTablePaymentFunc) (pt rhpv3.HostPriceTable, err error)

RPCPriceTable negotiates a price table with the host.

func RPCReadSector

func RPCReadSector(ctx context.Context, t *rhpv3.Transport, w io.Writer, pt rhpv3.HostPriceTable, payment rhpv3.PaymentMethod, offset, length uint32, merkleRoot types.Hash256) (cost, refund types.Currency, err error)

RPCReadSector calls the ExecuteProgram RPC with a ReadSector instruction.

func RPCSettings

func RPCSettings(ctx context.Context, t *rhpv2.Transport) (settings rhpv2.HostSettings, err error)

RPCSettings returns the host's reported settings.

func ReadSectorCost

func ReadSectorCost(pt rhpv3.HostPriceTable, length uint64) (types.Currency, error)

ReadSectorCost returns an overestimate for the cost of reading a sector from a host.

func UploadSectorCost

func UploadSectorCost(pt rhpv3.HostPriceTable, windowEnd uint64) (cost, collateral, storage types.Currency, _ error)

UploadSectorCost returns an overestimate for the cost of uploading a sector to a host.

func WithTransportV2

func WithTransportV2(ctx context.Context, hostIP string, hostKey types.PublicKey, fn func(*rhpv2.Transport) error) (err error)

WithTransportV2 creates a transport and calls an RHP2 RPC.

func WithTransportV3

func WithTransportV3(ctx context.Context, siamuxAddr string, hostKey types.PublicKey, fn func(*rhpv3.Transport) error) (err error)

WithTransportV3 creates a transport and calls an RHP3 RPC.

Types

type PriceTablePaymentFunc

type PriceTablePaymentFunc func(pt rhpv3.HostPriceTable) (rhpv3.PaymentMethod, error)

PriceTablePaymentFunc is a function that can be passed in to RPCPriceTable. It is called after the price table is received from the host and supposed to create a payment for that table and return it. It can also be used to perform gouging checks before paying for the table.

Jump to

Keyboard shortcuts

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