Documentation ¶
Overview ¶
Package channel implements the main components of Perun channels.
Index ¶
- Constants
- Variables
- func BigToLittleEndianBytes(big *big.Int) []byte
- func BoolToBytes(b bool) []byte
- func CalcID(params *pchannel.Params) (pchannel.ID, error)
- func EvaluateFundedEvents(events []FundedEvent, funderAddr wallet.Address, ...) (bool, error)
- func MakeAdjReq(req pchannel.AdjudicatorReq) (icperun.AdjRequest, error)
- func MakeAlloc(bals pchannel.Balances) []icperun.Amount
- func MakeFundingReq(req *pchannel.FundingReq) (chanconn.Funding, error)
- func MakeParts(addrs []pwallet.Address) ([][]byte, error)
- func Uint64ToBytes(i uint64) []byte
- func WrapError(err error, msg string) error
- type Adjudicator
- func (a *Adjudicator) GetAcc() *wallet.Account
- func (a *Adjudicator) MakeWithdrawalReq(req pchannel.AdjudicatorReq) (icperun.WithdrawalRequest, error)
- func (a *Adjudicator) Progress(ctx context.Context, req pchannel.ProgressReq) error
- func (a *Adjudicator) Register(ctx context.Context, req pchannel.AdjudicatorReq, ...) error
- func (a *Adjudicator) Subscribe(ctx context.Context, cid pchannel.ID) (pchannel.AdjudicatorSubscription, error)
- func (a *Adjudicator) Withdraw(ctx context.Context, req pchannel.AdjudicatorReq, smap pchannel.StateMap) error
- type DepositReq
- type Depositor
- type Event
- type FundedEvent
- type Funder
- type FundingEventSub
Constants ¶
View Source
const DefaultMaxIters = 15
View Source
const DefaultPollInterval = 3 * time.Second
View Source
const DisputeSuccess = "successful initialization of a dispute"
View Source
const ResponseErrorConcludingChannel = "error concluding the channel"
View Source
const WithdrawalSuccessResponse = "successful withdrawal"
Variables ¶
View Source
var ( ErrNotFundedInTime = errors.New("funding not in time") ErrFundingReqIncompatible = errors.New("incompatible funding request") ErrFailWithdrawal = errors.New("withdrawal failed") ErrFailDispute = errors.New("error disputing") ErrFailConclude = errors.New("error concluding") ErrFinalizedNotConcludable = errors.New("channel finalized but not concludable") ErrConcludedDifferentVersion = errors.New("channel was concluded with a different version") ErrAdjudicatorReqIncompatible = errors.New("adjudicator request was not compatible") ErrReqVersionTooLow = errors.New("request version too low") )
View Source
var Asset = &asset{}
Asset is the unique asset that is supported by the chain.
View Source
var Backend backend
Backend is the channel backend. Is a singleton since there is only one backend.
Functions ¶
func BigToLittleEndianBytes ¶
func BoolToBytes ¶
func EvaluateFundedEvents ¶
func MakeAdjReq ¶
func MakeAdjReq(req pchannel.AdjudicatorReq) (icperun.AdjRequest, error)
func MakeFundingReq ¶
func MakeFundingReq(req *pchannel.FundingReq) (chanconn.Funding, error)
func Uint64ToBytes ¶
Types ¶
type Adjudicator ¶
type Adjudicator struct {
// contains filtered or unexported fields
}
func NewAdjudicator ¶
func NewAdjudicator(acc wallet.Account, c *chanconn.Connector) *Adjudicator
NewAdjudicator returns a new Adjudicator.
func (*Adjudicator) GetAcc ¶
func (a *Adjudicator) GetAcc() *wallet.Account
func (*Adjudicator) MakeWithdrawalReq ¶
func (a *Adjudicator) MakeWithdrawalReq(req pchannel.AdjudicatorReq) (icperun.WithdrawalRequest, error)
func (*Adjudicator) Progress ¶
func (a *Adjudicator) Progress(ctx context.Context, req pchannel.ProgressReq) error
Progress returns nil because app channels are currently not supported.
func (*Adjudicator) Register ¶
func (a *Adjudicator) Register(ctx context.Context, req pchannel.AdjudicatorReq, states []pchannel.SignedState) error
Register registers and disputes a channel.
func (*Adjudicator) Subscribe ¶
func (a *Adjudicator) Subscribe(ctx context.Context, cid pchannel.ID) (pchannel.AdjudicatorSubscription, error)
func (*Adjudicator) Withdraw ¶
func (a *Adjudicator) Withdraw(ctx context.Context, req pchannel.AdjudicatorReq, smap pchannel.StateMap) error
type DepositReq ¶
type DepositReq struct { Balance pchannel.Bal Fee pchannel.Bal Account wallet.Account Funding chanconn.Funding }
func NewDepositReq ¶
func NewDepositReqFromPerun ¶
func NewDepositReqFromPerun(req *pchannel.FundingReq, acc pwallet.Account) (*DepositReq, error)
type Depositor ¶
func NewDepositor ¶
NewDepositor returns a new Depositor.
func (*Depositor) TransferToPerun ¶
func (d *Depositor) TransferToPerun(req *DepositReq) (chanconn.BlockNum, error)
type FundedEvent ¶
func SortEvents ¶
func SortEvents(eventString string) ([]FundedEvent, error)
type FundingEventSub ¶
type FundingEventSub struct {
// contains filtered or unexported fields
}
func NewFundingEventSub ¶
func NewFundingEventSub(addr wallet.Address, starttime uint64, req pchannel.FundingReq, conn *chanconn.Connector) (*FundingEventSub, error)
func (*FundingEventSub) QueryEvents ¶
func (f *FundingEventSub) QueryEvents() (string, error)
func (*FundingEventSub) QueryFundingState ¶
func (f *FundingEventSub) QueryFundingState(ctx context.Context) error
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package connector provides the functionality to invoke and query Perun canister methods and handles the responses.
|
Package connector provides the functionality to invoke and query Perun canister methods and handles the responses. |
icperun
Package icperun contains functions to communicate to the Perun canister
|
Package icperun contains functions to communicate to the Perun canister |
Click to show internal directories.
Click to hide internal directories.