paych

package
v1.34.0 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2025 License: Apache-2.0, MIT Imports: 9 Imported by: 10

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrPaymentChannelDisabled = xerrors.New("payment channel manager is disabled (EnablePaymentChannelManager is set to false)")

ErrPaymentChannelDisabled is returned when payment channel operations are attempted but the payment channel manager is disabled in the configuration.

Functions

This section is empty.

Types

type DisabledPaych added in v1.34.0

type DisabledPaych struct{}

DisabledPaych is a stub implementation of the PaychAPI interface that returns errors for all methods. It is used when the payment channel manager is disabled (e.g., when EnablePaymentChannelManager is set to false in the configuration).

func (*DisabledPaych) PaychAllocateLane added in v1.34.0

func (a *DisabledPaych) PaychAllocateLane(ctx context.Context, ch address.Address) (uint64, error)

func (*DisabledPaych) PaychAvailableFunds added in v1.34.0

func (a *DisabledPaych) PaychAvailableFunds(ctx context.Context, ch address.Address) (*api.ChannelAvailableFunds, error)

func (*DisabledPaych) PaychAvailableFundsByFromTo added in v1.34.0

func (a *DisabledPaych) PaychAvailableFundsByFromTo(ctx context.Context, from, to address.Address) (*api.ChannelAvailableFunds, error)

func (*DisabledPaych) PaychCollect added in v1.34.0

func (a *DisabledPaych) PaychCollect(ctx context.Context, addr address.Address) (cid.Cid, error)

func (*DisabledPaych) PaychFund added in v1.34.0

func (a *DisabledPaych) PaychFund(ctx context.Context, from, to address.Address, amt types.BigInt) (*api.ChannelInfo, error)

func (*DisabledPaych) PaychGet added in v1.34.0

func (a *DisabledPaych) PaychGet(ctx context.Context, from, to address.Address, amt types.BigInt, opts api.PaychGetOpts) (*api.ChannelInfo, error)

func (*DisabledPaych) PaychGetWaitReady added in v1.34.0

func (a *DisabledPaych) PaychGetWaitReady(ctx context.Context, sentinel cid.Cid) (address.Address, error)

func (*DisabledPaych) PaychList added in v1.34.0

func (a *DisabledPaych) PaychList(ctx context.Context) ([]address.Address, error)

func (*DisabledPaych) PaychNewPayment added in v1.34.0

func (a *DisabledPaych) PaychNewPayment(ctx context.Context, from, to address.Address, vouchers []api.VoucherSpec) (*api.PaymentInfo, error)

func (*DisabledPaych) PaychSettle added in v1.34.0

func (a *DisabledPaych) PaychSettle(ctx context.Context, addr address.Address) (cid.Cid, error)

func (*DisabledPaych) PaychStatus added in v1.34.0

func (a *DisabledPaych) PaychStatus(ctx context.Context, pch address.Address) (*api.PaychStatus, error)

func (*DisabledPaych) PaychVoucherAdd added in v1.34.0

func (a *DisabledPaych) PaychVoucherAdd(ctx context.Context, ch address.Address, sv *paychtypes.SignedVoucher, proof []byte, minDelta types.BigInt) (types.BigInt, error)

func (*DisabledPaych) PaychVoucherCheckSpendable added in v1.34.0

func (a *DisabledPaych) PaychVoucherCheckSpendable(ctx context.Context, ch address.Address, sv *paychtypes.SignedVoucher, secret []byte, proof []byte) (bool, error)

func (*DisabledPaych) PaychVoucherCheckValid added in v1.34.0

func (a *DisabledPaych) PaychVoucherCheckValid(ctx context.Context, ch address.Address, sv *paychtypes.SignedVoucher) error

func (*DisabledPaych) PaychVoucherCreate added in v1.34.0

func (a *DisabledPaych) PaychVoucherCreate(ctx context.Context, pch address.Address, amt types.BigInt, lane uint64) (*api.VoucherCreateResult, error)

func (*DisabledPaych) PaychVoucherList added in v1.34.0

func (a *DisabledPaych) PaychVoucherList(ctx context.Context, pch address.Address) ([]*paychtypes.SignedVoucher, error)

func (*DisabledPaych) PaychVoucherSubmit added in v1.34.0

func (a *DisabledPaych) PaychVoucherSubmit(ctx context.Context, ch address.Address, sv *paychtypes.SignedVoucher, secret []byte, proof []byte) (cid.Cid, error)

type PaychAPI

type PaychAPI interface {
	PaychGet(ctx context.Context, from, to address.Address, amt types.BigInt, opts api.PaychGetOpts) (*api.ChannelInfo, error)
	PaychFund(ctx context.Context, from, to address.Address, amt types.BigInt) (*api.ChannelInfo, error)
	PaychAvailableFunds(ctx context.Context, ch address.Address) (*api.ChannelAvailableFunds, error)
	PaychAvailableFundsByFromTo(ctx context.Context, from, to address.Address) (*api.ChannelAvailableFunds, error)
	PaychGetWaitReady(ctx context.Context, sentinel cid.Cid) (address.Address, error)
	PaychAllocateLane(ctx context.Context, ch address.Address) (uint64, error)
	PaychNewPayment(ctx context.Context, from, to address.Address, vouchers []api.VoucherSpec) (*api.PaymentInfo, error)
	PaychList(ctx context.Context) ([]address.Address, error)
	PaychStatus(ctx context.Context, pch address.Address) (*api.PaychStatus, error)
	PaychSettle(ctx context.Context, addr address.Address) (cid.Cid, error)
	PaychCollect(ctx context.Context, addr address.Address) (cid.Cid, error)
	PaychVoucherCheckValid(ctx context.Context, ch address.Address, sv *paychtypes.SignedVoucher) error
	PaychVoucherCheckSpendable(ctx context.Context, ch address.Address, sv *paychtypes.SignedVoucher, secret []byte, proof []byte) (bool, error)
	PaychVoucherAdd(ctx context.Context, ch address.Address, sv *paychtypes.SignedVoucher, proof []byte, minDelta types.BigInt) (types.BigInt, error)
	PaychVoucherCreate(ctx context.Context, pch address.Address, amt types.BigInt, lane uint64) (*api.VoucherCreateResult, error)
	PaychVoucherList(ctx context.Context, pch address.Address) ([]*paychtypes.SignedVoucher, error)
	PaychVoucherSubmit(ctx context.Context, ch address.Address, sv *paychtypes.SignedVoucher, secret []byte, proof []byte) (cid.Cid, error)
}

PaychAPI is the external interface that Lotus provides for interacting with payment channels.

type PaychImpl added in v1.34.0

type PaychImpl struct {
	fx.In

	PaychMgr *paychmgr.Manager
}

PaychImpl is the implementation of the PaychAPI interface that uses the paychmgr.Manager to manage payment channels. It is designed to be used with dependency injection via fx. It provides methods for creating, funding, and managing payment channels, as well as handling vouchers and their associated operations.

func (*PaychImpl) PaychAllocateLane added in v1.34.0

func (a *PaychImpl) PaychAllocateLane(ctx context.Context, ch address.Address) (uint64, error)

func (*PaychImpl) PaychAvailableFunds added in v1.34.0

func (a *PaychImpl) PaychAvailableFunds(ctx context.Context, ch address.Address) (*api.ChannelAvailableFunds, error)

func (*PaychImpl) PaychAvailableFundsByFromTo added in v1.34.0

func (a *PaychImpl) PaychAvailableFundsByFromTo(ctx context.Context, from, to address.Address) (*api.ChannelAvailableFunds, error)

func (*PaychImpl) PaychCollect added in v1.34.0

func (a *PaychImpl) PaychCollect(ctx context.Context, addr address.Address) (cid.Cid, error)

func (*PaychImpl) PaychFund added in v1.34.0

func (a *PaychImpl) PaychFund(ctx context.Context, from, to address.Address, amt types.BigInt) (*api.ChannelInfo, error)

func (*PaychImpl) PaychGet added in v1.34.0

func (a *PaychImpl) PaychGet(ctx context.Context, from, to address.Address, amt types.BigInt, opts api.PaychGetOpts) (*api.ChannelInfo, error)

func (*PaychImpl) PaychGetWaitReady added in v1.34.0

func (a *PaychImpl) PaychGetWaitReady(ctx context.Context, sentinel cid.Cid) (address.Address, error)

func (*PaychImpl) PaychList added in v1.34.0

func (a *PaychImpl) PaychList(ctx context.Context) ([]address.Address, error)

func (*PaychImpl) PaychNewPayment added in v1.34.0

func (a *PaychImpl) PaychNewPayment(ctx context.Context, from, to address.Address, vouchers []api.VoucherSpec) (*api.PaymentInfo, error)

func (*PaychImpl) PaychSettle added in v1.34.0

func (a *PaychImpl) PaychSettle(ctx context.Context, addr address.Address) (cid.Cid, error)

func (*PaychImpl) PaychStatus added in v1.34.0

func (a *PaychImpl) PaychStatus(ctx context.Context, pch address.Address) (*api.PaychStatus, error)

func (*PaychImpl) PaychVoucherAdd added in v1.34.0

func (a *PaychImpl) PaychVoucherAdd(ctx context.Context, ch address.Address, sv *paychtypes.SignedVoucher, proof []byte, minDelta types.BigInt) (types.BigInt, error)

func (*PaychImpl) PaychVoucherCheckSpendable added in v1.34.0

func (a *PaychImpl) PaychVoucherCheckSpendable(ctx context.Context, ch address.Address, sv *paychtypes.SignedVoucher, secret []byte, proof []byte) (bool, error)

func (*PaychImpl) PaychVoucherCheckValid added in v1.34.0

func (a *PaychImpl) PaychVoucherCheckValid(ctx context.Context, ch address.Address, sv *paychtypes.SignedVoucher) error

func (*PaychImpl) PaychVoucherCreate added in v1.34.0

func (a *PaychImpl) PaychVoucherCreate(ctx context.Context, pch address.Address, amt types.BigInt, lane uint64) (*api.VoucherCreateResult, error)

PaychVoucherCreate creates a new signed voucher on the given payment channel with the given lane and amount. The value passed in is exactly the value that will be used to create the voucher, so if previous vouchers exist, the actual additional value of this voucher will only be the difference between the two. If there are insufficient funds in the channel to create the voucher, returns a nil voucher and the shortfall.

func (*PaychImpl) PaychVoucherList added in v1.34.0

func (a *PaychImpl) PaychVoucherList(ctx context.Context, pch address.Address) ([]*paychtypes.SignedVoucher, error)

func (*PaychImpl) PaychVoucherSubmit added in v1.34.0

func (a *PaychImpl) PaychVoucherSubmit(ctx context.Context, ch address.Address, sv *paychtypes.SignedVoucher, secret []byte, proof []byte) (cid.Cid, error)

Jump to

Keyboard shortcuts

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