query

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2023 License: Apache-2.0, MIT Imports: 13 Imported by: 0

Documentation

Index

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

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 ConstructLedgerInfoFromChannel

func ConstructLedgerInfoFromChannel(c *channel.Channel, myAddress types.Address) (LedgerChannelInfo, error)

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

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 ConstructPaymentInfo(c *channel.Channel, paid, remaining *big.Int) (PaymentChannelInfo, error)

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

Jump to

Keyboard shortcuts

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