rhp

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChainManager

type ChainManager interface {
	TipState() consensus.State
}

A ChainManager is used to get the current consensus state

type Session

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

A Session is an RHP2 session with a host

func NewSession

func NewSession(ctx context.Context, hostKey types.PublicKey, hostAddr string, cm ChainManager, tp TPool, w Wallet) (*Session, error)

NewSession creates a new RHP2 session with a host. It is not safe for concurrent use.

func (*Session) Close

func (s *Session) Close() error

Close closes the underlying connection.

func (*Session) FormContract

func (s *Session) FormContract(hostAddr types.Address, renterKey types.PrivateKey, renterPayout, hostCollateral types.Currency, expirationHeight uint64) (rhp2.ContractRevision, []types.Transaction, error)

FormContract forms a new contract with the host.

func (*Session) ScanSettings

func (s *Session) ScanSettings() (settings rhp2.HostSettings, err error)

ScanSettings scans the host's settings and returns them.

type TPool

type TPool interface {
	RecommendedFee() types.Currency
}

A TPool manages transactions

type Wallet

type Wallet interface {
	Address() types.Address
	FundTransaction(txn *types.Transaction, amount types.Currency) ([]types.Hash256, func(), error)
	SignTransaction(cs consensus.State, txn *types.Transaction, toSign []types.Hash256, cf types.CoveredFields) error
}

A Wallet funds and signs transactions

Jump to

Keyboard shortcuts

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