lightning

package
v0.87.0 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package lightning package seeks to provide an interoperable interface for interacting with different lightning clients (e.g. lnd, c-lightning, eclair, etc) see: https://github.com/moneysocket/py-moneysocket/tree/main/moneysocket/lightning

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Lightning

type Lightning interface {
	// RegisterPaidRecvCb registers a PaidCallback for when an invoice is paid
	RegisterPaidRecvCb(callback PaidCallback)
	// GetInvoice retrieves a bolt11 invoice for a given msatAmount
	GetInvoice(msatAmount int) (paymentRequest string, err error)
	// PayInvoice pays a bolt11 invoice
	PayInvoice(bolt11 string) (preimage []byte, msatAmount int, err error)
	// RecvPaid receives a payment
	RecvPaid(preimage string, msats int)
}

Lightning is an implementable interface for interacting with different lightning clients.

type Lnd

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

Lnd is the Lightning interface for lnd.

func NewLnd

func NewLnd(config *config.Config) (lnd *Lnd, err error)

NewLnd generates a new lnd client from a given config TODO use streaming for invoices.

func (*Lnd) GetInvoice

func (l *Lnd) GetInvoice(msatAmount int) (paymentRequest string, err error)

GetInvoice gets an invoice (paymentRequest) fora given amount msatAmount.

func (*Lnd) PayInvoice

func (l *Lnd) PayInvoice(bolt11 string) (preimage []byte, msatAmount int, err error)

PayInvoice sends a payment for a bolt-11 invoice.

func (*Lnd) RecvPaid

func (l *Lnd) RecvPaid(preimage string, msats int)

RecvPaid receives an invoice payment.

func (*Lnd) RegisterPaidRecvCb

func (l *Lnd) RegisterPaidRecvCb(callback PaidCallback)

RegisterPaidRecvCb registers the callback.

type PaidCallback

type PaidCallback func(preimage string, msats int)

PaidCallback is a function for when ln image is paid.

Jump to

Keyboard shortcuts

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