Documentation
¶
Overview ¶
Package payment implements a payment API that can used with the generic session and channel APIs to open, use and close payment channels.
Index ¶
- func GetBalInfo(ch perun.ChannelAPI) perun.BalInfo
- func RespondPayChProposal(pctx context.Context, s perun.SessionAPI, proposalID string, accept bool) error
- func RespondPayChUpdate(pctx context.Context, ch perun.ChannelAPI, updateID string, accept bool) error
- func SendPayChUpdate(pctx context.Context, ch perun.ChannelAPI, payee, amount string) error
- func SubPayChCloses(s perun.SessionAPI, notifier PayChCloseNotifier) error
- func SubPayChProposals(s perun.SessionAPI, notifier PayChProposalNotifier) error
- func SubPayChUpdates(ch perun.ChannelAPI, notifier PayChUpdateNotifier) error
- func UnsubPayChCloses(s perun.SessionAPI) error
- func UnsubPayChProposals(s perun.SessionAPI) error
- func UnsubPayChUpdates(ch perun.ChannelAPI) error
- type PayChCloseNotif
- type PayChCloseNotifier
- type PayChInfo
- type PayChProposalNotif
- type PayChProposalNotifier
- type PayChUpdateNotif
- type PayChUpdateNotifier
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetBalInfo ¶
func GetBalInfo(ch perun.ChannelAPI) perun.BalInfo
GetBalInfo returns the balance information for this channel.
func RespondPayChProposal ¶
func RespondPayChProposal(pctx context.Context, s perun.SessionAPI, proposalID string, accept bool) error
RespondPayChProposal sends the response to a payment channel proposal notification.
func RespondPayChUpdate ¶
func RespondPayChUpdate(pctx context.Context, ch perun.ChannelAPI, updateID string, accept bool) error
RespondPayChUpdate sends a response for a channel update notification.
func SendPayChUpdate ¶
SendPayChUpdate send the given amount to the payee. Payee should be one of the channel participants. Use "self" to request payments.
func SubPayChCloses ¶
func SubPayChCloses(s perun.SessionAPI, notifier PayChCloseNotifier) error
SubPayChCloses sets up a subscription for payment channel closes.
func SubPayChProposals ¶
func SubPayChProposals(s perun.SessionAPI, notifier PayChProposalNotifier) error
SubPayChProposals sets up a subscription for payment channel proposals.
func SubPayChUpdates ¶
func SubPayChUpdates(ch perun.ChannelAPI, notifier PayChUpdateNotifier) error
SubPayChUpdates sets up a subscription for updates on this channel.
func UnsubPayChCloses ¶
func UnsubPayChCloses(s perun.SessionAPI) error
UnsubPayChCloses deletes the existing subscription for payment channel closes.
func UnsubPayChProposals ¶
func UnsubPayChProposals(s perun.SessionAPI) error
UnsubPayChProposals deletes the existing subscription for payment channel proposals.
func UnsubPayChUpdates ¶
func UnsubPayChUpdates(ch perun.ChannelAPI) error
UnsubPayChUpdates deletes the existing subscription for updates on this channel.
Types ¶
type PayChCloseNotif ¶
PayChCloseNotif represents the channel close notification data for payment app.
type PayChCloseNotifier ¶
type PayChCloseNotifier func(PayChCloseNotif)
PayChCloseNotifier represents the channel close notification function for payment app.
type PayChInfo ¶
PayChInfo represents the interpretation of channelInfo for payment app.
func ClosePayCh ¶
ClosePayCh closes the payment channel.
func GetPayChs ¶
func GetPayChs(s perun.SessionAPI) []PayChInfo
GetPayChs returns a list of payment channel info for all the channels in this session.
type PayChProposalNotif ¶
type PayChProposalNotif struct {
ProposalID string
Currency string
OpeningBals perun.BalInfo
ChallengeDurSecs uint64
Expiry int64
}
PayChProposalNotif represents the channel update notification data for payment app.
type PayChProposalNotifier ¶
type PayChProposalNotifier func(PayChProposalNotif)
PayChProposalNotifier represents the channel update notification function for payment app.
type PayChUpdateNotif ¶
type PayChUpdateNotif struct {
UpdateID string
ProposedBals perun.BalInfo
Version string
Final bool
Currency string
Parts []string
Expiry int64
}
PayChUpdateNotif represents the channel update notification data for payment app.
type PayChUpdateNotifier ¶
type PayChUpdateNotifier func(PayChUpdateNotif)
PayChUpdateNotifier represents the channel update notification function for payment app.