lightning

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FeeReserve

func FeeReserve(amountMsat uint64, internal bool) uint64

Types

type Client

type Client interface {
	InvoiceStatus(paymentHash string) (Payment, error)         // InvoiceStatus should return Payment information for a payment hash
	Pay(paymentRequest string) (Invoicer, error)               // Pay should pay the payment request.
	CreateInvoice(amount int64, memo string) (Invoicer, error) // CreateInvoice should create an invoice for given amount and memo
}

Client should be able to perform lightning services

type Configuration

type Configuration struct {
	Lightning struct {
		Enabled bool          `json:"enabled" yaml:"enabled"`
		Lnbits  *LnbitsConfig `json:"lnbits" yaml:"lnbits"`
	} `json:"lightning" json:"lightning"`
}

Configuration for lnbits

var Config Configuration

type Invoicer added in v0.1.7

type Invoicer interface {
	cashuLog.Loggable
	fmt.Stringer      // toJson
	SetHash(h string) // set the payment hash
	GetHash() string  // get the payment hash

	SetPaid(i bool) // SetPaid to true, if lightning invoice was paid

	SetIssued(i bool) // SetIssued to true, if lightning invoice was paid
	IsIssued() bool   // IsIssued returns true, if lightning invoice is paid

	SetAmount(a int64) // SetAmount of the lightning invoice
	GetAmount() int64  // GetAmount of the lightning invoice

	GetPaymentRequest() string // GetPaymentRequest should return the payment request (probably bech encoded)
	SetPaymentRequest(string)  // SetPaymentRequest

	SetTimeCreated(t time.Time)
	SetTimePaid(t time.Time)
}

Invoicer should create a lightning invoice somewhere.

type LnbitsConfig

type LnbitsConfig struct {
	LightningFeePercent    float64 `json:"lightning_fee_percent" yaml:"lightning_fee_percent"`
	LightningReserveFeeMin float64 `json:"lightning_reserve_fee_min" yaml:"lightning_reserve_fee_min"`
	AdminKey               string  `yaml:"admin_key"`
	Url                    string  `yaml:"url"`
}

type Payment

type Payment interface {
	IsPaid() bool        // IsPaid must return true, if payment is fulfilled
	GetPreimage() string // GetPreimage must return the preimage of the payment

}

Payment should give information about the payment status

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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