swap

package
v2.4.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2019 License: GPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewSwap

func NewSwap(localProfile *LocalProfile, remoteProfile *RemoteProfile, backend chequebook.Backend, proto swap.Protocol) (swapInstance *swap.Swap, err error)

NewSwap constructor, parameters * global chequebook, assume deployed service and * the balance is at buffer. swap.Add(n) called in netstore n > 0 called when sending chunks = receiving retrieve requests

OR sending cheques.

n < 0 called when receiving chunks = receiving delivery responses

OR receiving cheques.

Types

type LocalProfile

type LocalProfile struct {
	*swap.Params
	*PayProfile
}

LocalProfile combines a PayProfile with *swap.Params

func NewDefaultSwapParams

func NewDefaultSwapParams() *LocalProfile

NewDefaultSwapParams create params with default values

func (*LocalProfile) Chequebook

func (lp *LocalProfile) Chequebook() *chequebook.Chequebook

Chequebook get's chequebook from the localProfile

func (*LocalProfile) Init

func (lp *LocalProfile) Init(contract common.Address, prvkey *ecdsa.PrivateKey)

Init this can only finally be set after all config options (file, cmd line, env vars) have been evaluated

func (*LocalProfile) PrivateKey

func (lp *LocalProfile) PrivateKey() *ecdsa.PrivateKey

PrivateKey accessor

func (*LocalProfile) SetChequebook

func (lp *LocalProfile) SetChequebook(ctx context.Context, backend chequebook.Backend, path string) error

SetChequebook wraps the chequebook initialiser and sets up autoDeposit to cover spending.

func (*LocalProfile) SetKey

func (lp *LocalProfile) SetKey(prvkey *ecdsa.PrivateKey)

SetKey set's private and public key on localProfile

type PayProfile

type PayProfile struct {
	PublicKey   string         // check against signature of promise
	Contract    common.Address // address of chequebook contract
	Beneficiary common.Address // recipient address for swarm sales revenue
	// contains filtered or unexported fields
}

PayProfile is a container for relevant chequebook and beneficiary options

type RemoteProfile

type RemoteProfile struct {
	*swap.Profile
	*PayProfile
}

RemoteProfile combines a PayProfile with *swap.Profile

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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