Documentation ¶
Index ¶
- func GetVirtualFundObjective(id types.Destination, store store.Store) (*virtualfund.Objective, bool)
- func GetVoucherBalance(id types.Destination, vm *payments.VoucherManager) (paid, remaining *big.Int, err error)
- type ChannelStatus
- type LedgerChannelBalance
- type LedgerChannelInfo
- func ConstructLedgerInfoFromChannel(c *channel.Channel, myAddress types.Address) (LedgerChannelInfo, error)
- func ConstructLedgerInfoFromConsensus(con *consensus_channel.ConsensusChannel, myAddress types.Address) (LedgerChannelInfo, error)
- func GetAllLedgerChannels(store store.Store, consensusAppDefinition types.Address) ([]LedgerChannelInfo, error)
- func GetLedgerChannelInfo(id types.Destination, store store.Store) (LedgerChannelInfo, error)
- type PaymentChannelBalance
- type PaymentChannelInfo
- func ConstructPaymentInfo(c *channel.Channel, paid, remaining *big.Int) (PaymentChannelInfo, error)
- func GetPaymentChannelInfo(id types.Destination, store store.Store, vm *payments.VoucherManager) (PaymentChannelInfo, error)
- func GetPaymentChannelsByLedger(ledgerId types.Destination, s store.Store, vm *payments.VoucherManager) ([]PaymentChannelInfo, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetVirtualFundObjective ¶
func GetVirtualFundObjective(id types.Destination, store store.Store) (*virtualfund.Objective, bool)
GetVirtualFundObjective returns the virtual fund objective for the given channel if it exists.
func GetVoucherBalance ¶
func GetVoucherBalance(id types.Destination, vm *payments.VoucherManager) (paid, remaining *big.Int, err error)
GetVoucherBalance returns the amount paid and remaining for a given channel based on vouchers received. If not vouchers are received for the channel, it returns 0 for paid and remaining.
Types ¶
type ChannelStatus ¶
type ChannelStatus string
const ( Proposed ChannelStatus = "Proposed" Open ChannelStatus = "Open" Closing ChannelStatus = "Closing" Complete ChannelStatus = "Complete" )
TODO: Think through statuses
type LedgerChannelBalance ¶
type LedgerChannelBalance struct { AssetAddress types.Address Me types.Address Them types.Address MyBalance *hexutil.Big TheirBalance *hexutil.Big }
LedgerChannelBalance contains the balance of a ledger channel
func (LedgerChannelBalance) Equal ¶
func (lcb LedgerChannelBalance) Equal(other LedgerChannelBalance) bool
Equal returns true if the other LedgerChannelBalance is equal to this one
type LedgerChannelInfo ¶
type LedgerChannelInfo struct { ID types.Destination Status ChannelStatus Balance LedgerChannelBalance }
LedgerChannelInfo contains balance and status info about a ledger channel
func ConstructLedgerInfoFromConsensus ¶
func ConstructLedgerInfoFromConsensus(con *consensus_channel.ConsensusChannel, myAddress types.Address) (LedgerChannelInfo, error)
func GetAllLedgerChannels ¶
func GetAllLedgerChannels(store store.Store, consensusAppDefinition types.Address) ([]LedgerChannelInfo, error)
GetAllLedgerChannels returns a `LedgerChannelInfo` for each ledger channel in the store.
func GetLedgerChannelInfo ¶
func GetLedgerChannelInfo(id types.Destination, store store.Store) (LedgerChannelInfo, error)
GetLedgerChannelInfo returns the LedgerChannelInfo for the given channel It does this by querying the provided store
func (LedgerChannelInfo) Equal ¶
func (li LedgerChannelInfo) Equal(other LedgerChannelInfo) bool
Equal returns true if the other LedgerChannelInfo is equal to this one
type PaymentChannelBalance ¶
type PaymentChannelBalance struct { AssetAddress types.Address Payee types.Address Payer types.Address PaidSoFar *hexutil.Big RemainingFunds *hexutil.Big }
PaymentChannelBalance contains the balance of a uni-directional payment channel
func (PaymentChannelBalance) Equal ¶
func (pcb PaymentChannelBalance) Equal(other PaymentChannelBalance) bool
Equal returns true if the other PaymentChannelBalance is equal to this one
type PaymentChannelInfo ¶
type PaymentChannelInfo struct { ID types.Destination Status ChannelStatus Balance PaymentChannelBalance }
PaymentChannelInfo contains balance and status info about a payment channel
func ConstructPaymentInfo ¶
func GetPaymentChannelInfo ¶
func GetPaymentChannelInfo(id types.Destination, store store.Store, vm *payments.VoucherManager) (PaymentChannelInfo, error)
GetPaymentChannelInfo returns the PaymentChannelInfo for the given channel It does this by querying the provided store and voucher manager
func GetPaymentChannelsByLedger ¶
func GetPaymentChannelsByLedger(ledgerId types.Destination, s store.Store, vm *payments.VoucherManager) ([]PaymentChannelInfo, error)
GetPaymentChannelsByLedger returns a `PaymentChannelInfo` for each active payment channel funded by the given ledger channel.
func (PaymentChannelInfo) Equal ¶
func (pci PaymentChannelInfo) Equal(other PaymentChannelInfo) bool
Equal returns true if the other PaymentChannelInfo is equal to this one