lightning

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2024 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	InvoiceExpiryMins         = 10
	FeePercent        float64 = 0.01
)
View Source
const (
	FakePreimage = "0000000000000000"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	ConnectionStatus() error
	CreateInvoice(amount uint64) (Invoice, error)
	InvoiceStatus(hash string) (Invoice, error)
	SendPayment(ctx context.Context, request string, amount uint64) (PaymentStatus, error)
	OutgoingPaymentStatus(ctx context.Context, hash string) (PaymentStatus, error)
	FeeReserve(amount uint64) uint64
}

Client interface to interact with a Lightning backend

type FakeBackend added in v0.3.0

type FakeBackend struct {
	// contains filtered or unexported fields
}

func (*FakeBackend) ConnectionStatus added in v0.3.0

func (fb *FakeBackend) ConnectionStatus() error

func (*FakeBackend) CreateInvoice added in v0.3.0

func (fb *FakeBackend) CreateInvoice(amount uint64) (Invoice, error)

func (*FakeBackend) FeeReserve added in v0.3.0

func (fb *FakeBackend) FeeReserve(amount uint64) uint64

func (*FakeBackend) InvoiceStatus added in v0.3.0

func (fb *FakeBackend) InvoiceStatus(hash string) (Invoice, error)

func (*FakeBackend) OutgoingPaymentStatus added in v0.3.0

func (fb *FakeBackend) OutgoingPaymentStatus(ctx context.Context, hash string) (PaymentStatus, error)

func (*FakeBackend) SendPayment added in v0.3.0

func (fb *FakeBackend) SendPayment(ctx context.Context, request string, amount uint64) (PaymentStatus, error)

type Invoice

type Invoice struct {
	PaymentRequest string
	PaymentHash    string
	Preimage       string
	Settled        bool
	Amount         uint64
	Expiry         uint64
}

type LndClient

type LndClient struct {
	// contains filtered or unexported fields
}

func SetupLndClient added in v0.2.0

func SetupLndClient(config LndConfig) (*LndClient, error)

func (*LndClient) ConnectionStatus added in v0.3.0

func (lnd *LndClient) ConnectionStatus() error

func (*LndClient) CreateInvoice

func (lnd *LndClient) CreateInvoice(amount uint64) (Invoice, error)

func (*LndClient) FeeReserve

func (lnd *LndClient) FeeReserve(amount uint64) uint64

func (*LndClient) InvoiceStatus added in v0.2.0

func (lnd *LndClient) InvoiceStatus(hash string) (Invoice, error)

func (*LndClient) OutgoingPaymentStatus added in v0.3.0

func (lnd *LndClient) OutgoingPaymentStatus(ctx context.Context, hash string) (PaymentStatus, error)

func (*LndClient) SendPayment

func (lnd *LndClient) SendPayment(ctx context.Context, request string, amount uint64) (PaymentStatus, error)

type LndConfig added in v0.2.0

type LndConfig struct {
	GRPCHost string
	Cert     credentials.TransportCredentials
	Macaroon macaroons.MacaroonCredential
}

type PaymentStatus added in v0.3.0

type PaymentStatus struct {
	Preimage             string
	PaymentStatus        State
	PaymentFailureReason string
}

type State added in v0.3.0

type State int
const (
	Succeeded State = iota
	Failed
	Pending
)

Jump to

Keyboard shortcuts

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